Skip to content

Commit 494bfc0

Browse files
committed
Bluetooth: MGMT: Fix dangling pointer on mgmt_add_adv_patterns_monitor_complete
jira VULN-182134 cve CVE-2026-31511 commit-author Luiz Augusto von Dentz <luiz.von.dentz@intel.com> commit 5f5fa4c This fixes the condition checking so mgmt_pending_valid is executed whenever status != -ECANCELED otherwise calling mgmt_pending_free(cmd) would kfree(cmd) without unlinking it from the list first, leaving a dangling pointer. Any subsequent list traversal (e.g., mgmt_pending_foreach during __mgmt_power_off, or another mgmt_pending_valid call) would dereference freed memory. Link: https://lore.kernel.org/linux-bluetooth/20260315132013.75ab40c5@kernel.org/T/#m1418f9c82eeff8510c1beaa21cf53af20db96c06 Fixes: 302a1f6 ("Bluetooth: MGMT: Fix possible UAFs") Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de> (cherry picked from commit 5f5fa4c) Signed-off-by: Marcin Wcisło <marcin.wcislo@conclusive.pl>
1 parent ed6d420 commit 494bfc0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/bluetooth/mgmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5343,7 +5343,7 @@ static void mgmt_add_adv_patterns_monitor_complete(struct hci_dev *hdev,
53435343
* hci_adv_monitors_clear is about to be called which will take care of
53445344
* freeing the adv_monitor instances.
53455345
*/
5346-
if (status == -ECANCELED && !mgmt_pending_valid(hdev, cmd))
5346+
if (status == -ECANCELED || !mgmt_pending_valid(hdev, cmd))
53475347
return;
53485348

53495349
monitor = cmd->user_data;

0 commit comments

Comments
 (0)