]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: don't free unallocated ida on gpiochip_add_data_with_key() error path
authorVladimir Zapolskiy <vz@mleia.com>
Fri, 2 Nov 2018 13:39:43 +0000 (15:39 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Fri, 9 Nov 2018 10:16:57 +0000 (11:16 +0100)
commitc6a0812c803fe949c0f5c23d20ea1c107c3173c0
tree902dc93aede3e9b35673e404aba3c6bb43916e2a
parent5219766e6f663db6d2d22ec2e5dd9669a5ccbfe6
gpio: don't free unallocated ida on gpiochip_add_data_with_key() error path

The change corrects the error path in gpiochip_add_data_with_key()
by avoiding to call ida_simple_remove(), if ida_simple_get() returns
an error.

Note that ida_simple_remove()/ida_free() throws a BUG(), if id argument
is negative, it allows to easily check the correctness of the fix by
fuzzing the return value from ida_simple_get().

Fixes: 69f44c88a724 ("gpio: make the gpiochip a real device")
Cc: stable@vger.kernel.org # v4.6+
Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c