Skip to content

Commit f752a0b

Browse files
Zhengping Jiangkuba-moo
authored andcommitted
Bluetooth: L2CAP: Fix use-after-free
Fix potential use-after-free in l2cap_le_command_rej. Signed-off-by: Zhengping Jiang <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 8153b73 commit f752a0b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/bluetooth/l2cap_core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6374,9 +6374,14 @@ static inline int l2cap_le_command_rej(struct l2cap_conn *conn,
63746374
if (!chan)
63756375
goto done;
63766376

6377+
chan = l2cap_chan_hold_unless_zero(chan);
6378+
if (!chan)
6379+
goto done;
6380+
63776381
l2cap_chan_lock(chan);
63786382
l2cap_chan_del(chan, ECONNREFUSED);
63796383
l2cap_chan_unlock(chan);
6384+
l2cap_chan_put(chan);
63806385

63816386
done:
63826387
mutex_unlock(&conn->chan_lock);

0 commit comments

Comments
 (0)