]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/lapb-fixed-leak-of-control-blocks.patch
Linux 4.19.54
[thirdparty/kernel/stable-queue.git] / queue-4.14 / lapb-fixed-leak-of-control-blocks.patch
1 From foo@baz Wed 19 Jun 2019 04:01:16 PM CEST
2 From: Jeremy Sowden <jeremy@azazel.net>
3 Date: Sun, 16 Jun 2019 16:54:37 +0100
4 Subject: lapb: fixed leak of control-blocks.
5
6 From: Jeremy Sowden <jeremy@azazel.net>
7
8 [ Upstream commit 6be8e297f9bcea666ea85ac7a6cd9d52d6deaf92 ]
9
10 lapb_register calls lapb_create_cb, which initializes the control-
11 block's ref-count to one, and __lapb_insert_cb, which increments it when
12 adding the new block to the list of blocks.
13
14 lapb_unregister calls __lapb_remove_cb, which decrements the ref-count
15 when removing control-block from the list of blocks, and calls lapb_put
16 itself to decrement the ref-count before returning.
17
18 However, lapb_unregister also calls __lapb_devtostruct to look up the
19 right control-block for the given net_device, and __lapb_devtostruct
20 also bumps the ref-count, which means that when lapb_unregister returns
21 the ref-count is still 1 and the control-block is leaked.
22
23 Call lapb_put after __lapb_devtostruct to fix leak.
24
25 Reported-by: syzbot+afb980676c836b4a0afa@syzkaller.appspotmail.com
26 Signed-off-by: Jeremy Sowden <jeremy@azazel.net>
27 Signed-off-by: David S. Miller <davem@davemloft.net>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 ---
30 net/lapb/lapb_iface.c | 1 +
31 1 file changed, 1 insertion(+)
32
33 --- a/net/lapb/lapb_iface.c
34 +++ b/net/lapb/lapb_iface.c
35 @@ -182,6 +182,7 @@ int lapb_unregister(struct net_device *d
36 lapb = __lapb_devtostruct(dev);
37 if (!lapb)
38 goto out;
39 + lapb_put(lapb);
40
41 lapb_stop_t1timer(lapb);
42 lapb_stop_t2timer(lapb);