diff options
| author | Danilo Krummrich <dakr@kernel.org> | 2026-03-03 12:53:21 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-04-02 13:22:54 +0200 |
| commit | 7c02a9bd7d14a89065fcf672b86d8e1d1a41d3b1 (patch) | |
| tree | 74a06cce8ae98e715d2dfea067938400ccac5fae /drivers/clk | |
| parent | ad9465ca3444c70a164ff81caa457b46318c1a6d (diff) | |
| download | linux-7c02a9bd7d14a89065fcf672b86d8e1d1a41d3b1.tar.gz linux-7c02a9bd7d14a89065fcf672b86d8e1d1a41d3b1.tar.bz2 linux-7c02a9bd7d14a89065fcf672b86d8e1d1a41d3b1.zip | |
driver core: platform: use generic driver_override infrastructure
[ Upstream commit 2b38efc05bf7a8568ec74bfffea0f5cfa62bc01d ]
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/ [1]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/clk')
| -rw-r--r-- | drivers/clk/imx/clk-scu.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c index 34c9dc1fb20e..c03f7821824d 100644 --- a/drivers/clk/imx/clk-scu.c +++ b/drivers/clk/imx/clk-scu.c @@ -696,8 +696,7 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name, if (ret) goto put_device; - ret = driver_set_override(&pdev->dev, &pdev->driver_override, - "imx-scu-clk", strlen("imx-scu-clk")); + ret = device_set_driver_override(&pdev->dev, "imx-scu-clk"); if (ret) goto put_device; |
