netrom: fix a memory leak in nr_rx_frame()
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 27 Jun 2019 21:30:58 +0000 (14:30 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2019 07:33:34 +0000 (09:33 +0200)
commitcab2e3d65ff697ddadce30d4f2ee75c5eff2f327
tree8336cfa0a304a6fdb51b915496fd7feb29bed40f
parentbca7b798f56bb303b94672a8f2a71b7916aa363b
netrom: fix a memory leak in nr_rx_frame()

[ Upstream commit c8c8218ec5af5d2598381883acbefbf604e56b5e ]

When the skb is associated with a new sock, just assigning
it to skb->sk is not sufficient, we have to set its destructor
to free the sock properly too.

Reported-by: syzbot+d6636a36d3c34bd88938@syzkaller.appspotmail.com
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netrom/af_netrom.c