fsi: Fix device refcount leak in i2cr_scom_probe
Subsystems (2)
PATCH 1/1 fsi: Fix device refcount leak in i2cr_scom_probe
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.
--- drivers/fsi/i2cr-scom.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/fsi/i2cr-scom.c +8 -2
@@ -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; }
Signature · 1 line
2.17.1
Quoted 1 line
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
Greg KH
maintainerQuoted 10 lines · Markus Elfring
Quoted 1 line
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#n94Would 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