]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
pinctrl: samsung: Add of_node_put() before return in error path
authorNishka Dasgupta <nishkadg.linux@gmail.com>
Sun, 4 Aug 2019 16:02:00 +0000 (21:32 +0530)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:45 +0000 (14:22 -0300)
BugLink: https://bugs.launchpad.net/bugs/1857158
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: Nishka Dasgupta <nishkadg.linux@gmail.com>
Cc: <stable@vger.kernel.org>
Fixes: 14c255d35b25 ("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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/pinctrl/samsung/pinctrl-exynos.c

index c8d0de7ea16054d616a2aaaa493e6df1386fedd4..1c534d823fd792ec276691d5bc7d23d9c233f743 100644 (file)
@@ -467,8 +467,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;
                }