diff options
| author | Danilo Krummrich <dakr@kernel.org> | 2026-03-24 01:59:15 +0100 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-03-24 15:00:08 +0000 |
| commit | cc34d77dd48708d810c12bfd6f5bf03304f6c824 (patch) | |
| tree | f3511411719a703f54f30f6765333ec81be849a4 /include/mtd/git@git.tavy.me:linux.git | |
| parent | 63542bb402b7013171c9f621c28b609eda4dbf1f (diff) | |
spi: 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]
Also note that we do not enable the driver_override feature of struct
bus_type, as SPI - in contrast to most other buses - passes "" to
sysfs_emit() when the driver_override pointer is NULL. Thus, printing
"\n" instead of "(null)\n".
Link: https://lore.kernel.org/driver-core/DGRGTIRHA62X.3RY09D9SOK77P@kernel.org/ [1]
Reported-by: Gui-Dong Han <hanguidong02@gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=220789
Fixes: 5039563e7c25 ("spi: Add driver_override SPI device attribute")
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patch.msgid.link/20260324005919.2408620-12-dakr@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/mtd/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
