gpio: use kzalloc to allocate gpio_device
The use of kmalloc() to allocate the gpio_device leaves the contained struct device object in an unknown state. Calling dev_set_name() on a struct device of unknown state can trigger the free() of an invalid pointer, as seen in the following backtrace (collected by Tony Lindgren): kfree kobject_set_name_vargs dev_set_name gpiochip_add_data omap_gpio_probe platform_drv_probe ... Reported-by: NGeert Uytterhoeven <geert+renesas@glider.be> Reported-by: NMichael Welling <mwelling@ieee.org> Reported-by: NTony Lindgren <tony@atomide.com> Tested-by: NMichael Welling <mwelling@ieee.org> Tested-by: NTony Lindgren <tony@atomide.com> Signed-off-by: NJosh Cartwright <joshc@ni.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
Showing
想要评论请 注册 或 登录