]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
driver core: platform: use generic driver_override infrastructure
authorDanilo Krummrich <dakr@kernel.org>
Tue, 3 Mar 2026 11:53:21 +0000 (12:53 +0100)
committerDanilo Krummrich <dakr@kernel.org>
Tue, 17 Mar 2026 19:30:57 +0000 (20:30 +0100)
commit2b38efc05bf7a8568ec74bfffea0f5cfa62bc01d
tree64913e7184ba0cd8ebc40838934425f92c0bfaab
parentc5f60e3f07b6609562d21efda878e83ce8860728
driver core: platform: 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]

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: 3d713e0e382e ("driver core: platform: add device binding path 'driver_override'")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patch.msgid.link/20260303115720.48783-5-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
drivers/base/platform.c
drivers/bus/simple-pm-bus.c
drivers/clk/imx/clk-scu.c
drivers/slimbus/qcom-ngd-ctrl.c
include/linux/platform_device.h
sound/soc/samsung/i2s.c