public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fsi: Fix device refcount leak in i2cr_scom_probe
@ 2025-11-07  3:21 Ma Ke
  2025-11-07  8:50 ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Ma Ke @ 2025-11-07  3:21 UTC (permalink / raw)
  To: eajames, ninad, joel; +Cc: linux-fsi, linux-kernel, akpm, Ma Ke, stable

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


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

* Re: [PATCH] fsi: Fix device refcount leak in i2cr_scom_probe
  2025-11-07  3:21 [PATCH] fsi: Fix device refcount leak in i2cr_scom_probe Ma Ke
@ 2025-11-07  8:50 ` Markus Elfring
  2025-11-08  1:25   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2025-11-07  8:50 UTC (permalink / raw)
  To: make24, linux-fsi
  Cc: stable, LKML, Andrew Morton, Eddie James, Joel Stanley,
	Ninad Palsule

> 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

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

* Re: [PATCH] fsi: Fix device refcount leak in i2cr_scom_probe
  2025-11-07  8:50 ` Markus Elfring
@ 2025-11-08  1:25   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2025-11-08  1:25 UTC (permalink / raw)
  To: Markus Elfring
  Cc: make24, linux-fsi, stable, LKML, Andrew Morton, Eddie James,
	Joel Stanley, Ninad Palsule

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

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

end of thread, other threads:[~2025-11-08  1:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-07  3:21 [PATCH] fsi: Fix device refcount leak in i2cr_scom_probe Ma Ke
2025-11-07  8:50 ` Markus Elfring
2025-11-08  1:25   ` Greg KH

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