* [PATCH v2] gpiolib: cdev: Fix resource leaks on errors in lineinfo_changed_notify()
@ 2026-01-20 3:08 Tzung-Bi Shih
2026-01-20 8:53 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Tzung-Bi Shih @ 2026-01-20 3:08 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij
Cc: linux-gpio, linux-kernel, tzungbi, stable
On error handling paths, lineinfo_changed_notify() doesn't free the
allocated resources which results leaks. Fix it.
Cc: stable@vger.kernel.org
Fixes: d4cd0902c156 ("gpio: cdev: make sure the cdev fd is still active before emitting events")
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
---
v2:
- Drop the label "err_put_fp" and fput() in the error path directly.
- Add "cdev" prefix in title.
v1: https://lore.kernel.org/all/20260116081036.352286-5-tzungbi@kernel.org/
drivers/gpio/gpiolib-cdev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index 550795987da0..b886f4474e5a 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -2549,6 +2549,7 @@ static int lineinfo_changed_notify(struct notifier_block *nb,
ctx = kzalloc(sizeof(*ctx), GFP_ATOMIC);
if (!ctx) {
pr_err("Failed to allocate memory for line info notification\n");
+ fput(fp);
return NOTIFY_DONE;
}
--
2.52.0.457.g6b5491de43-goog
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] gpiolib: cdev: Fix resource leaks on errors in lineinfo_changed_notify()
2026-01-20 3:08 [PATCH v2] gpiolib: cdev: Fix resource leaks on errors in lineinfo_changed_notify() Tzung-Bi Shih
@ 2026-01-20 8:53 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2026-01-20 8:53 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, Tzung-Bi Shih
Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, stable
On Tue, 20 Jan 2026 03:08:56 +0000, Tzung-Bi Shih wrote:
> On error handling paths, lineinfo_changed_notify() doesn't free the
> allocated resources which results leaks. Fix it.
>
>
Applied, thanks!
[1/1] gpiolib: cdev: Fix resource leaks on errors in lineinfo_changed_notify()
commit: 70b3c280533167749a8f740acaa8ef720f78f984
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-01-20 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-20 3:08 [PATCH v2] gpiolib: cdev: Fix resource leaks on errors in lineinfo_changed_notify() Tzung-Bi Shih
2026-01-20 8:53 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®