gpio: fix error path in lineevent_create
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Mon, 16 Apr 2018 11:17:53 +0000 (13:17 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 26 Apr 2018 22:43:03 +0000 (00:43 +0200)
If gpiod_request() fails the cleanup must not call gpiod_free().

Cc: stable@vger.kernel.org
Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c

index d07771797707b5c2bd7fa6daef0c551999fec97b..d8ccb500872fa2eacd26a91c473ee02a131cea18 100644 (file)
@@ -903,7 +903,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;