Skip to content

Commit

Permalink
Bluetooth: Fix possible use after free in delete path
Browse files Browse the repository at this point in the history
We need to use the _sync() version for cancelling the info and security
timer in the L2CAP connection delete path. Otherwise the delayed work
handler might run after the connection object is freed.

Signed-off-by: Ulisses Furquim <ulisses@profusion.mobi>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Ulisses Furquim authored and Johan Hedberg committed Feb 15, 2012
1 parent 6de3275 commit 24d2b8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/bluetooth/l2cap_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,10 +1018,10 @@ static void l2cap_conn_del(struct hci_conn *hcon, int err)
hci_chan_del(conn->hchan);

if (conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_SENT)
__cancel_delayed_work(&conn->info_timer);
cancel_delayed_work_sync(&conn->info_timer);

if (test_and_clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->pend)) {
__cancel_delayed_work(&conn->security_timer);
cancel_delayed_work_sync(&conn->security_timer);
smp_chan_destroy(conn);
}

Expand Down

0 comments on commit 24d2b8c

Please sign in to comment.