diff options
author | Nishka Dasgupta <nishkadg.linux@gmail.com> | 2019-07-06 19:04:22 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-28 08:27:21 +0200 |
commit | 594a0e0d11b86d84a67b683a4cbe0bed17fa00b0 (patch) | |
tree | a7b084689936041a611c5f3f8fcbc2fc52d61d10 /drivers/gpio | |
parent | 52da09f58290b7165a54798b6008bc1a803ed3c4 (diff) | |
download | linux-stable-594a0e0d11b86d84a67b683a4cbe0bed17fa00b0.tar.gz linux-stable-594a0e0d11b86d84a67b683a4cbe0bed17fa00b0.tar.bz2 linux-stable-594a0e0d11b86d84a67b683a4cbe0bed17fa00b0.zip |
gpiolib: of: fix a memory leak in of_gpio_flags_quirks()
commit 89fea04c85e85f21ef4937611055abce82330d48 upstream.
Each iteration of for_each_child_of_node puts the previous node, but in
the case of a break from the middle of the loop, there is no put, thus
causing a memory leak. Hence add an of_node_put before the break.
Issue found with Coccinelle.
Cc: <stable@vger.kernel.org>
Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com>
[Bartosz: tweaked the commit message]
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib-of.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index aec7bd86ae7e..c9325efc1783 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -154,6 +154,7 @@ static void of_gpio_flags_quirks(struct device_node *np, of_node_full_name(child)); *flags |= OF_GPIO_ACTIVE_LOW; } + of_node_put(child); break; } } |