Linux RTC
 help / color / mirror / Atom feed
* [PATCH] rtc: isl12026: Fix EEPROM dummy client leak on probe failure
@ 2026-11-25  9:10 Yige Jiang
  2026-11-25  9:12 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Yige Jiang @ 2026-11-25  9:10 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: Yige Jiang, linux-rtc, linux-kernel, stable

isl12026_probe() registers a dummy i2c client for the EEPROM at 0x57
with i2c_new_dummy_device(), but only isl12026_remove() unregisters it.
If devm_rtc_allocate_device(), devm_rtc_nvmem_register() or
devm_rtc_register_device() fails, probe returns with the dummy client
still registered. Every later probe attempt then fails with -EBUSY in
i2c_new_dummy_device(), because 0x57 is still taken by the leaked
client.

Use devm_i2c_new_dummy_device() and drop isl12026_remove(). The dummy
client is now unregistered on probe failure, and on unbind it is
unregistered after the devm-managed RTC and nvmem devices that use it.

Fixes: 4731a43169b7 ("rtc: isl12026: new driver.")
Cc: stable@vger.kernel.org
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Based on linux-next next-20261109 (630059a5a632).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_RTC_DRV_ISL12026=m, CONFIG_RTC_NVMEM=y, CONFIG_COMPILE_TEST=y (object only; no new warnings).
Runtime-tested in QEMU (arm64 virt, KASAN) with this driver on a test I2C adapter module: with fault injection failing probe after the EEPROM client exists, the next probe fails with -EBUSY on 0x57 before the patch and binds after it; unbind/rebind and module reload are clean. No hardware test.
AI assistance was used for analysis and patch preparation.
Needs a probe error after the dummy client is created (allocation failure, or an nvmem or RTC registration error); no in-tree DT uses isil,isl12026.

 drivers/rtc/rtc-isl12026.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-isl12026.c b/drivers/rtc/rtc-isl12026.c
index 2aa3694c4de7..cb12a6366fc3 100644
--- a/drivers/rtc/rtc-isl12026.c
+++ b/drivers/rtc/rtc-isl12026.c
@@ -453,7 +453,8 @@ static int isl12026_probe(struct i2c_client *client)
 
 	isl12026_force_power_modes(client);
 
-	priv->nvm_client = i2c_new_dummy_device(client->adapter, ISL12026_EEPROM_ADDR);
+	priv->nvm_client = devm_i2c_new_dummy_device(&client->dev, client->adapter,
+						     ISL12026_EEPROM_ADDR);
 	if (IS_ERR(priv->nvm_client))
 		return PTR_ERR(priv->nvm_client);
 
@@ -471,13 +472,6 @@ static int isl12026_probe(struct i2c_client *client)
 	return devm_rtc_register_device(priv->rtc);
 }
 
-static void isl12026_remove(struct i2c_client *client)
-{
-	struct isl12026 *priv = i2c_get_clientdata(client);
-
-	i2c_unregister_device(priv->nvm_client);
-}
-
 static const struct of_device_id isl12026_dt_match[] = {
 	{ .compatible = "isil,isl12026" },
 	{ }
@@ -496,7 +490,6 @@ static struct i2c_driver isl12026_driver = {
 		.of_match_table = isl12026_dt_match,
 	},
 	.probe		= isl12026_probe,
-	.remove		= isl12026_remove,
 	.id_table	= isl12026_id,
 };
 

base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtc: isl12026: Fix EEPROM dummy client leak on probe failure
  2026-11-25  9:10 [PATCH] rtc: isl12026: Fix EEPROM dummy client leak on probe failure Yige Jiang
@ 2026-11-25  9:12 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-25  9:12 UTC (permalink / raw)
  To: Yige Jiang; +Cc: linux-rtc, Alexandre Belloni

> isl12026_probe() registers a dummy i2c client for the EEPROM at 0x57
> with i2c_new_dummy_device(), but only isl12026_remove() unregisters it.
> If devm_rtc_allocate_device(), devm_rtc_nvmem_register() or
> devm_rtc_register_device() fails, probe returns with the dummy client
> still registered. Every later probe attempt then fails with -EBUSY in
> i2c_new_dummy_device(), because 0x57 is still taken by the leaked
> client.
> 
> Use devm_i2c_new_dummy_device() and drop isl12026_remove(). The dummy
> client is now unregistered on probe failure, and on unbind it is
> unregistered after the devm-managed RTC and nvmem devices that use it.
> 
> Fixes: 4731a43169b7 ("rtc: isl12026: new driver.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yige Jiang <yigejiang86@gmail.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/rc-b1-20261110-vc-22-300211a8c5a0@gmail.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-25  9:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-25  9:10 [PATCH] rtc: isl12026: Fix EEPROM dummy client leak on probe failure Yige Jiang
2026-11-25  9:12 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox