[PATCH] i2c: owl: Fix potential adapter use-after-free on unbind
Guangshuo Li
liguangshuo at mail.sdu.edu.cn
Sat Nov 28 01:42:05 PST 2026
owl_i2c_probe() registers an adapter embedded in device-managed
private data. Unbinding the controller frees that data while the
adapter remains registered.
Use devm_i2c_add_adapter() to unregister the adapter before the
controller resources are released.
This issue was found by our static analysis tool under development.
Fixes: d211e62af466 ("i2c: Add Actions Semiconductor Owl family S900 I2C driver")
Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>
---
drivers/i2c/busses/i2c-owl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-owl.c b/drivers/i2c/busses/i2c-owl.c
index 1937a2467512..f122a60b24a6 100644
--- a/drivers/i2c/busses/i2c-owl.c
+++ b/drivers/i2c/busses/i2c-owl.c
@@ -495,7 +495,7 @@ static int owl_i2c_probe(struct platform_device *pdev)
return ret;
}
- return i2c_add_adapter(&i2c_dev->adap);
+ return devm_i2c_add_adapter(dev, &i2c_dev->adap);
}
static const struct of_device_id owl_i2c_of_match[] = {
base-commit: eeb63983deb23d68ddc47e5d1944a7d64acdaf22
--
2.43.0
More information about the linux-arm-kernel
mailing list