Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Bluetooth: Fix memory leaks due to chan refcnt

When we queue delayed work we hold(chan) and delayed work
shall put(chan) after execution.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo@padovan.org>

authored by

Andrei Emeltchenko and committed by
Gustavo Padovan
8d7e1c7f 94324962

+3
+3
net/bluetooth/l2cap_core.c
··· 1309 1309 if (chan->retry_count >= chan->remote_max_tx) { 1310 1310 l2cap_send_disconn_req(chan->conn, chan, ECONNABORTED); 1311 1311 l2cap_chan_unlock(chan); 1312 + l2cap_chan_put(chan); 1312 1313 return; 1313 1314 } 1314 1315 ··· 1318 1317 1319 1318 l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); 1320 1319 l2cap_chan_unlock(chan); 1320 + l2cap_chan_put(chan); 1321 1321 } 1322 1322 1323 1323 static void l2cap_retrans_timeout(struct work_struct *work) ··· 1338 1336 l2cap_send_rr_or_rnr(chan, L2CAP_CTRL_POLL); 1339 1337 1340 1338 l2cap_chan_unlock(chan); 1339 + l2cap_chan_put(chan); 1341 1340 } 1342 1341 1343 1342 static void l2cap_drop_acked_frames(struct l2cap_chan *chan)