diff mbox series

gpio: fix error path in lineevent_create

Message ID 20180416111753.4714-1-u.kleine-koenig@pengutronix.de
State New
Headers show
Series gpio: fix error path in lineevent_create | expand

Commit Message

Uwe Kleine-König April 16, 2018, 11:17 a.m. UTC
If gpiod_request() fails the cleanup must not call gpiod_free().

Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/gpio/gpiolib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij April 26, 2018, 10:43 p.m. UTC | #1
On Mon, Apr 16, 2018 at 1:17 PM, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:

> If gpiod_request() fails the cleanup must not call gpiod_free().
>
> Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Patch applied for fixes, tagged for stable, nice catch!

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 43aeb07343ec..ce9b238fc531 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -902,7 +902,7 @@  static int lineevent_create(struct gpio_device *gdev, void __user *ip)
 	desc = &gdev->descs[offset];
 	ret = gpiod_request(desc, le->label);
 	if (ret)
-		goto out_free_desc;
+		goto out_free_label;
 	le->desc = desc;
 	le->eflags = eflags;