]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
Bluetooth: MGMT: fix crash in set_mesh_sync and set_mesh_complete
authorPauli Virtanen <pav@iki.fi>
Fri, 3 Oct 2025 19:07:32 +0000 (22:07 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Fri, 24 Oct 2025 14:21:37 +0000 (10:21 -0400)
commite8785404de06a69d89dcdd1e9a0b6ea42dc6d327
treeba216fecce4869a6ae0d8c9d23268b53733393ec
parent0d92808024b4e9868cef68d16f121d509843e80e
Bluetooth: MGMT: fix crash in set_mesh_sync and set_mesh_complete

There is a BUG: KASAN: stack-out-of-bounds in set_mesh_sync due to
memcpy from badly declared on-stack flexible array.

Another crash is in set_mesh_complete() due to double list_del via
mgmt_pending_valid + mgmt_pending_remove.

Use DEFINE_FLEX to declare the flexible array right, and don't memcpy
outside bounds.

As mgmt_pending_valid removes the cmd from list, use mgmt_pending_free,
and also report status on error.

Fixes: 302a1f674c00d ("Bluetooth: MGMT: Fix possible UAFs")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
include/net/bluetooth/mgmt.h
net/bluetooth/mgmt.c