]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bus: fsl-mc: fix use-after-free in driver_override_show()
authorGui-Dong Han <hanguidong02@gmail.com>
Tue, 2 Dec 2025 17:44:38 +0000 (01:44 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 16 Feb 2026 09:19:45 +0000 (10:19 +0100)
commit1d6bd6183e723a7b256ff34bbb5b498b5f4f2ec0
tree0ffd8bf8fa95eae0722115e0994b0af4213606bb
parentd14e991279831673729b0f2002905bf3741df55b
bus: fsl-mc: fix use-after-free in driver_override_show()

commit 148891e95014b5dc5878acefa57f1940c281c431 upstream.

The driver_override_show() function reads the driver_override string
without holding the device_lock. However, driver_override_store() uses
driver_set_override(), which modifies and frees the string while holding
the device_lock.

This can result in a concurrent use-after-free if the string is freed
by the store function while being read by the show function.

Fix this by holding the device_lock around the read operation.

Fixes: 1f86a00c1159 ("bus/fsl-mc: add support for 'driver_override' in the mc-bus")
Cc: stable@vger.kernel.org
Signed-off-by: Gui-Dong Han <hanguidong02@gmail.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20251202174438.12658-1-hanguidong02@gmail.com
Signed-off-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/bus/fsl-mc/fsl-mc-bus.c