Skip to content

Commit f0662be

Browse files
a3a3elgregkh
authored andcommitted
lapb: fixed leak of control-blocks.
[ Upstream commit 6be8e29 ] 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: [email protected] Signed-off-by: Jeremy Sowden <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3cc4e63 commit f0662be

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/lapb/lapb_iface.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ int lapb_unregister(struct net_device *dev)
182182
lapb = __lapb_devtostruct(dev);
183183
if (!lapb)
184184
goto out;
185+
lapb_put(lapb);
185186

186187
lapb_stop_t1timer(lapb);
187188
lapb_stop_t2timer(lapb);

0 commit comments

Comments
 (0)