drivers/fsi/i2cr-scom.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
This patch fixes a device reference count leak in the i2cr_scom driver
by adding proper put_device() calls in both error paths and the remove
function.
Found by code review.
Cc: stable@vger.kernel.org
Fixes: c0b34bed0bbf ("fsi: Add I2C Responder SCOM driver")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
---
drivers/fsi/i2cr-scom.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/fsi/i2cr-scom.c b/drivers/fsi/i2cr-scom.c
index cb7e02213032..11506d321d7e 100644
--- a/drivers/fsi/i2cr-scom.c
+++ b/drivers/fsi/i2cr-scom.c
@@ -104,14 +104,20 @@ static int i2cr_scom_probe(struct device *dev)
ret = fsi_get_new_minor(fsi_dev, fsi_dev_scom, &scom->dev.devt, &didx);
if (ret)
- return ret;
+ goto err_put_device;
dev_set_name(&scom->dev, "scom%d", didx);
cdev_init(&scom->cdev, &i2cr_scom_fops);
ret = cdev_device_add(&scom->cdev, &scom->dev);
if (ret)
- fsi_free_minor(scom->dev.devt);
+ goto err_free_minor;
+
+ return ret;
+err_free_minor:
+ fsi_free_minor(scom->dev.devt);
+err_put_device:
+ put_device(&scom->dev);
return ret;
}
--
2.17.1
> This patch fixes a device reference count leak … Would a corresponding imperative wording become helpful for an improved change description? https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.18-rc4#n94 Would a summary phrase like “Fix reference count leak in i2cr_scom_probe()” be nicer? Regards, Markus
On Fri, Nov 07, 2025 at 09:50:43AM +0100, Markus Elfring wrote: > > This patch fixes a device reference count leak … > > Would a corresponding imperative wording become helpful for an improved change description? > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.18-rc4#n94 > > Would a summary phrase like “Fix reference count leak in i2cr_scom_probe()” be nicer? > > Regards, > Markus > Hi, This is the semi-friendly patch-bot of Greg Kroah-Hartman. Markus, you seem to have sent a nonsensical or otherwise pointless review comment to a patch submission on a Linux kernel developer mailing list. I strongly suggest that you not do this anymore. Please do not bother developers who are actively working to produce patches and features with comments that, in the end, are a waste of time. Patch submitter, please ignore Markus's suggestion; you do not need to follow it at all. The person/bot/AI that sent it is being ignored by almost all Linux kernel maintainers for having a persistent pattern of behavior of producing distracting and pointless commentary, and inability to adapt to feedback. Please feel free to also ignore emails from them. thanks, greg k-h's patch email bot
© 2016 - 2025 Red Hat, Inc.