]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bus: fsl-mc: use generic driver_override infrastructure
authorDanilo Krummrich <dakr@kernel.org>
Tue, 24 Mar 2026 00:59:06 +0000 (01:59 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Sat, 4 Apr 2026 18:41:25 +0000 (20:41 +0200)
commit6c8dfb0362732bf1e4829867a2a5239fedc592d0
tree129e9308ad28ef9affedb53eb5f590f46bd6092b
parent81d6f7c3a70b10ff757ee8b5f8114a190871cf1e
bus: fsl-mc: use generic driver_override infrastructure

When a driver is probed through __driver_attach(), the bus' match()
callback is called without the device lock held, thus accessing the
driver_override field without a lock, which can cause a UAF.

Fix this by using the driver-core driver_override infrastructure taking
care of proper locking internally.

Note that calling match() from __driver_attach() without the device lock
held is intentional. [1]

Tested-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Acked-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Acked-by: Christophe Leroy (CS GROUP) <chleroy@kernel.org>
Link: https://lore.kernel.org/driver-core/DGRGTIRHA62X.3RY09D9SOK77P@kernel.org/
Reported-by: Gui-Dong Han <hanguidong02@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220789
Fixes: 1f86a00c1159 ("bus/fsl-mc: add support for 'driver_override' in the mc-bus")
Link: https://patch.msgid.link/20260324005919.2408620-3-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/bus/fsl-mc/fsl-mc-bus.c
drivers/vfio/fsl-mc/vfio_fsl_mc.c
include/linux/fsl/mc.h