1
0
Fork 0

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

commit 3d2557ab75 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: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: <stable@vger.kernel.org>
Fixes: 14c255d35b ("pinctrl: exynos: Add irq_chip instance for Exynos7 wakeup interrupts")
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5.4-rM2-2.2.x-imx-squashed
Nishka Dasgupta 2019-08-04 21:32:00 +05:30 committed by Greg Kroah-Hartman
parent 0298d6cf85
commit 4e8285d98c
1 changed files with 3 additions and 1 deletions

View File

@ -486,8 +486,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;
}