Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c72a9f1 authored by Nishka Dasgupta's avatar Nishka Dasgupta Committed by Greg Kroah-Hartman
Browse files

pinctrl: samsung: Add of_node_put() before return in error path



commit 3d2557ab75d4c568c79eefa2e550e0d80348a6bd upstream.

Each iteration of for_each_child_of_node puts the previous node, but in
the case of a return from the middle of the loop, there is no put, thus
causing a memory leak. Hence add an of_node_put before the return of
exynos_eint_wkup_init() error path.
Issue found with Coccinelle.

Signed-off-by: default avatarNishka Dasgupta <nishkadg.linux@gmail.com>
Cc: <stable@vger.kernel.org>
Fixes: 14c255d3 ("pinctrl: exynos: Add irq_chip instance for Exynos7 wakeup interrupts")
Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 935057b0
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -494,8 +494,10 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
		if (match) {
			irq_chip = kmemdup(match->data,
				sizeof(*irq_chip), GFP_KERNEL);
			if (!irq_chip)
			if (!irq_chip) {
				of_node_put(np);
				return -ENOMEM;
			}
			wkup_np = np;
			break;
		}