Commit ac1cccb
Bluetooth: MGMT: Fix dangling pointer on mgmt_add_adv_patterns_monitor_complete
commit 5f5fa4cd35f707344f65ce9e225b6528691dbbaa upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 2074dfffad76981ca451cb7fc98703d04ac562fe)
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>1 parent 0016e1c commit ac1cccb
1 file changed
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5332 | 5332 | | |
5333 | 5333 | | |
5334 | 5334 | | |
5335 | | - | |
| 5335 | + | |
5336 | 5336 | | |
5337 | 5337 | | |
5338 | 5338 | | |
| |||
0 commit comments