]> git.karo-electronics.de Git - karo-tx-linux.git/commit
gpio: fix gpio-chip list corruption
authorJohan Hovold <johan@kernel.org>
Mon, 12 Jan 2015 16:12:25 +0000 (17:12 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 14 Jan 2015 13:24:29 +0000 (14:24 +0100)
commit225fce83cb72e1bffb712a33ce47c210c770f8ab
treeff753de5fbb156b1990dc83782a195d8ec5cc081
parent5539b3c938d64a60cb1fc442ac3ce9263d52de0c
gpio: fix gpio-chip list corruption

Fix potential corruption of gpio-chip list due to failure to remove the
chip from the list before returning in gpiochip_add error path.

The chip could be long gone when the global list is next traversed,
something which could lead to a null-pointer dereference. In the best
case (chip not deallocated) we are just leaking the gpio range.

Fixes: 14e85c0e69d5 ("gpio: remove gpio_descs global array")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib.c