Message ID | 1441301670-6498-1-git-send-email-tony@atomide.com |
---|---|
State | New |
Headers | show |
On Thu, Sep 3, 2015 at 7:34 PM, Tony Lindgren <tony@atomide.com> wrote: > If the gpio driver is confused about the numbers for gpio-ranges, > pinctrl_ready_for_gpio_range() may get called with invalid GPIO > causing a NULL pointer exception. Let's instead provide a warning > that allows fixing the problem and return with error. > > Signed-off-by: Tony Lindgren <tony@atomide.com> Patch applied for fixes. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -349,6 +349,9 @@ static bool pinctrl_ready_for_gpio_range(unsigned gpio) struct pinctrl_gpio_range *range = NULL; struct gpio_chip *chip = gpio_to_chip(gpio); + if (WARN(!chip, "no gpio_chip for gpio%i?", gpio)) + return false; + mutex_lock(&pinctrldev_list_mutex); /* Loop over the pin controllers */
If the gpio driver is confused about the numbers for gpio-ranges, pinctrl_ready_for_gpio_range() may get called with invalid GPIO causing a NULL pointer exception. Let's instead provide a warning that allows fixing the problem and return with error. Signed-off-by: Tony Lindgren <tony@atomide.com> --- drivers/pinctrl/core.c | 3 +++ 1 file changed, 3 insertions(+)