gpiolib: Free the last requested descriptor
authorRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Thu, 13 Sep 2018 13:37:04 +0000 (15:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Oct 2018 06:53:23 +0000 (08:53 +0200)
commite88ca677f3251af14d2f492f42de2359c1d405a8
tree83555d6cf5c8d3a848a2be807a4bee9778b099d9
parentd49c7bb74ac6a2c651ab7fccc989800cb889ef03
gpiolib: Free the last requested descriptor

commit 19a4fbffc94e41abaa2a623a25ce2641d69eccf0 upstream.

The current code only frees N-1 gpios if an error occurs during
gpiod_set_transitory, gpiod_direction_output or gpiod_direction_input.
Leading to gpios that cannot be used by userspace nor other drivers.

Cc: Timur Tabi <timur@codeaurora.org>
Cc: stable@vger.kernel.org
Fixes: ab3dbcf78f60f46d ("gpioib: do not free unrequested descriptors)
Reported-by: Jan Lorenzen <jl@newtec.dk>
Reported-by: Jim Paris <jim@jtan.com>
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpio/gpiolib.c