]> git.baikalelectronics.ru Git - kernel.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)
commitd4e9c04577ba83873a03a766b9ba7d9302641b46
treeff753de5fbb156b1990dc83782a195d8ec5cc081
parent2817e68c887d3df7f1c00501662454dee25eaf06
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: bf69d233638b ("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