Skip to content

Commit 1641434

Browse files
Tzung-Bi Shihgregkh
authored andcommitted
gpio: cdev: Fix resource leaks on errors in lineinfo_changed_notify()
commit 70b3c28 upstream. On error handling paths, lineinfo_changed_notify() doesn't free the allocated resources which results leaks. Fix it. Cc: stable@vger.kernel.org Fixes: d4cd090 ("gpio: cdev: make sure the cdev fd is still active before emitting events") Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org> Link: https://lore.kernel.org/r/20260120030857.2144847-1-tzungbi@kernel.org Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 919f27e commit 1641434

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/gpio/gpiolib-cdev.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2573,6 +2573,7 @@ static int lineinfo_changed_notify(struct notifier_block *nb,
25732573
ctx = kzalloc(sizeof(*ctx), GFP_ATOMIC);
25742574
if (!ctx) {
25752575
pr_err("Failed to allocate memory for line info notification\n");
2576+
fput(fp);
25762577
return NOTIFY_DONE;
25772578
}
25782579

0 commit comments

Comments
 (0)