]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
Bluetooth: mgmt: hold reference for hci_conn in mgmt_pending_cmds
authorPauli Virtanen <pav@iki.fi>
Fri, 10 Jul 2026 08:23:42 +0000 (11:23 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 13 Jul 2026 14:09:08 +0000 (10:09 -0400)
commitda55f570191d5d72f10c607a7043b947eb05ea46
tree0c737840d61e9dd6378999024f35458410ab2b72
parent16cd66443957e4ad42155c6fec401012f600c6f8
Bluetooth: mgmt: hold reference for hci_conn in mgmt_pending_cmds

Dereferencing RCU-protected pointers outside critical sections is
invalid and may lead to UAF.  Use of hci_conn in hci_sync callbacks also
needs to hold refcount to avoid UAF.

Take appropriate locks for hci_conn lookups, and take refcount for
hci_conn pointers stored in mgmt_pending_cmd so that the pointer stays
valid.

When accessing conn->state, ensure hdev->lock is held to avoid data
race.

Fixes: 7b445e220db9 ("Bluetooth: MGMT: Fix holding hci_conn reference while command is queued")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/mgmt.c