From: Greg Kroah-Hartman Date: Fri, 24 Jun 2016 02:51:10 +0000 (-0700) Subject: 4.6-stable patches X-Git-Tag: v3.14.73~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=49cbbf7dc83f06f36c5d772e7224bda8a5e4addf;p=thirdparty%2Fkernel%2Fstable-queue.git 4.6-stable patches added patches: gpio-make-sure-gpiod_to_irq-returns-negative-on-null-desc.patch --- diff --git a/queue-4.6/gpio-make-sure-gpiod_to_irq-returns-negative-on-null-desc.patch b/queue-4.6/gpio-make-sure-gpiod_to_irq-returns-negative-on-null-desc.patch new file mode 100644 index 00000000000..fda5a006618 --- /dev/null +++ b/queue-4.6/gpio-make-sure-gpiod_to_irq-returns-negative-on-null-desc.patch @@ -0,0 +1,46 @@ +From 79bb71bd1d93197ce227fa167b450b633f30a52b Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Wed, 15 Jun 2016 22:57:38 +0200 +Subject: gpio: make sure gpiod_to_irq() returns negative on NULL desc + +From: Linus Walleij + +commit 79bb71bd1d93197ce227fa167b450b633f30a52b upstream. + +commit 54d77198fdfbc4f0fe11b4252c1d9c97d51a3264 +("gpio: bail out silently on NULL descriptors") +doesn't work for gpiod_to_irq(): drivers assume that NULL +descriptors will give negative IRQ numbers in return. + +It has been pointed out that returning 0 is NO_IRQ and that +drivers should be amended to treat this as an error, but that +is for the longer term: now let us repair the semantics. + +Cc: Maxime Ripard +Reported-by: Hans de Goede +Tested-by: Hans de Goede +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpio/gpiolib.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -2006,7 +2006,14 @@ int gpiod_to_irq(const struct gpio_desc + struct gpio_chip *chip; + int offset; + +- VALIDATE_DESC(desc); ++ /* ++ * Cannot VALIDATE_DESC() here as gpiod_to_irq() consumer semantics ++ * requires this function to not return zero on an invalid descriptor ++ * but rather a negative error number. ++ */ ++ if (!desc || !desc->gdev || !desc->gdev->chip) ++ return -EINVAL; ++ + chip = desc->gdev->chip; + offset = gpio_chip_hwgpio(desc); + return chip->to_irq ? chip->to_irq(chip, offset) : -ENXIO; diff --git a/queue-4.6/series b/queue-4.6/series index 86203f93d8a..aa7f1ac97e2 100644 --- a/queue-4.6/series +++ b/queue-4.6/series @@ -85,3 +85,4 @@ netfilter-ip6_tables-simplify-translate_compat_table-args.patch netfilter-x_tables-xt_compat_match_from_user-doesn-t-need-a-retval.patch netfilter-x_tables-do-compat-validation-via-translate_table.patch netfilter-x_tables-introduce-and-use-xt_copy_counters_from_user.patch +gpio-make-sure-gpiod_to_irq-returns-negative-on-null-desc.patch