summaryrefslogtreecommitdiffstats
path: root/net/lapb
diff options
context:
space:
mode:
authorJeremy Sowden <jeremy@azazel.net>2019-06-16 16:54:37 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-06-22 08:16:14 +0200
commitf0662be07d10b3df2e3c16f4ccf623647df02389 (patch)
tree5d59bde33dfee246e2cc37e1e02ec9525bb3cf58 /net/lapb
parent3cc4e63c97081b1017a589adc3c814da23dbc69b (diff)
downloadlinux-stable-f0662be07d10b3df2e3c16f4ccf623647df02389.tar.gz
linux-stable-f0662be07d10b3df2e3c16f4ccf623647df02389.tar.bz2
linux-stable-f0662be07d10b3df2e3c16f4ccf623647df02389.zip
lapb: fixed leak of control-blocks.
[ Upstream commit 6be8e297f9bcea666ea85ac7a6cd9d52d6deaf92 ] lapb_register calls lapb_create_cb, which initializes the control- block's ref-count to one, and __lapb_insert_cb, which increments it when adding the new block to the list of blocks. lapb_unregister calls __lapb_remove_cb, which decrements the ref-count when removing control-block from the list of blocks, and calls lapb_put itself to decrement the ref-count before returning. However, lapb_unregister also calls __lapb_devtostruct to look up the right control-block for the given net_device, and __lapb_devtostruct also bumps the ref-count, which means that when lapb_unregister returns the ref-count is still 1 and the control-block is leaked. Call lapb_put after __lapb_devtostruct to fix leak. Reported-by: syzbot+afb980676c836b4a0afa@syzkaller.appspotmail.com Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/lapb')
-rw-r--r--net/lapb/lapb_iface.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/lapb/lapb_iface.c b/net/lapb/lapb_iface.c
index e15314e3b464..299de0c0508e 100644
--- a/net/lapb/lapb_iface.c
+++ b/net/lapb/lapb_iface.c
@@ -182,6 +182,7 @@ int lapb_unregister(struct net_device *dev)
lapb = __lapb_devtostruct(dev);
if (!lapb)
goto out;
+ lapb_put(lapb);
lapb_stop_t1timer(lapb);
lapb_stop_t2timer(lapb);