Commit 70b3c280 authored by Tzung-Bi Shih's avatar Tzung-Bi Shih Committed by Bartosz Golaszewski
Browse files

gpio: cdev: Fix resource leaks on errors in lineinfo_changed_notify()



On error handling paths, lineinfo_changed_notify() doesn't free the
allocated resources which results leaks.  Fix it.

Cc: stable@vger.kernel.org
Fixes: d4cd0902 ("gpio: cdev: make sure the cdev fd is still active before emitting events")
Signed-off-by: default avatarTzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20260120030857.2144847-1-tzungbi@kernel.org


Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
parent faff6846
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
	}