From: Greg Kroah-Hartman Date: Sun, 25 Jan 2015 14:14:08 +0000 (+0800) Subject: 3.14-stable patches X-Git-Tag: v3.10.66~26 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=574bc76c0c56748ec57f3f47010af61e9dc41218;p=thirdparty%2Fkernel%2Fstable-queue.git 3.14-stable patches added patches: gpio-fix-memory-and-reference-leaks-in-gpiochip_add-error-path.patch gpiolib-of-correct-error-handling-in-of_get_named_gpiod_flags.patch --- diff --git a/queue-3.14/gpio-fix-memory-and-reference-leaks-in-gpiochip_add-error-path.patch b/queue-3.14/gpio-fix-memory-and-reference-leaks-in-gpiochip_add-error-path.patch new file mode 100644 index 00000000000..aee5941e770 --- /dev/null +++ b/queue-3.14/gpio-fix-memory-and-reference-leaks-in-gpiochip_add-error-path.patch @@ -0,0 +1,55 @@ +From 5539b3c938d64a60cb1fc442ac3ce9263d52de0c Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 12 Jan 2015 17:12:24 +0100 +Subject: gpio: fix memory and reference leaks in gpiochip_add error path + +From: Johan Hovold + +commit 5539b3c938d64a60cb1fc442ac3ce9263d52de0c upstream. + +Memory allocated and references taken by of_gpiochip_add and +acpi_gpiochip_add were never released on errors in gpiochip_add (e.g. +failure to find free gpio range). + +Fixes: 391c970c0dd1 ("of/gpio: add default of_xlate function if device +has a node pointer") +Fixes: 664e3e5ac64c ("gpio / ACPI: register to ACPI events +automatically") + +Signed-off-by: Johan Hovold +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpio/gpiolib.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -1222,6 +1222,9 @@ int gpiochip_add(struct gpio_chip *chip) + + spin_unlock_irqrestore(&gpio_lock, flags); + ++ if (status) ++ goto fail; ++ + #ifdef CONFIG_PINCTRL + INIT_LIST_HEAD(&chip->pin_ranges); + #endif +@@ -1229,12 +1232,12 @@ int gpiochip_add(struct gpio_chip *chip) + of_gpiochip_add(chip); + acpi_gpiochip_add(chip); + +- if (status) +- goto fail; +- + status = gpiochip_export(chip); +- if (status) ++ if (status) { ++ acpi_gpiochip_remove(chip); ++ of_gpiochip_remove(chip); + goto fail; ++ } + + pr_debug("%s: registered GPIOs %d to %d on device: %s\n", __func__, + chip->base, chip->base + chip->ngpio - 1, diff --git a/queue-3.14/gpiolib-of-correct-error-handling-in-of_get_named_gpiod_flags.patch b/queue-3.14/gpiolib-of-correct-error-handling-in-of_get_named_gpiod_flags.patch new file mode 100644 index 00000000000..beaede7e4a7 --- /dev/null +++ b/queue-3.14/gpiolib-of-correct-error-handling-in-of_get_named_gpiod_flags.patch @@ -0,0 +1,43 @@ +From 7b8792bbdffdff3abda704f89c6a45ea97afdc62 Mon Sep 17 00:00:00 2001 +From: Hans Holmberg +Date: Fri, 9 Jan 2015 09:40:43 +0100 +Subject: gpiolib: of: Correct error handling in of_get_named_gpiod_flags + +From: Hans Holmberg + +commit 7b8792bbdffdff3abda704f89c6a45ea97afdc62 upstream. + +of_get_named_gpiod_flags fails with -EPROBE_DEFER in cases +where the gpio chip is available and the GPIO translation fails. + +This causes drivers to be re-probed erroneusly, and hides the +real problem(i.e. the GPIO number being out of range). + +Signed-off-by: Hans Holmberg +Reviewed-by: Alexandre Courbot +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpio/gpiolib-of.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/gpio/gpiolib-of.c ++++ b/drivers/gpio/gpiolib-of.c +@@ -44,8 +44,14 @@ static int of_gpiochip_find_and_xlate(st + return false; + + ret = gc->of_xlate(gc, &gg_data->gpiospec, gg_data->flags); +- if (ret < 0) +- return false; ++ if (ret < 0) { ++ /* We've found the gpio chip, but the translation failed. ++ * Return true to stop looking and return the translation ++ * error via out_gpio ++ */ ++ gg_data->out_gpio = ERR_PTR(ret); ++ return true; ++ } + + gg_data->out_gpio = gpio_to_desc(ret + gc->base); + return true; diff --git a/queue-3.14/series b/queue-3.14/series index 837aaad8bb2..7c7319483c7 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -53,3 +53,5 @@ vfio-pci-fix-the-check-on-pci-device-type-in.patch drivers-net-cpsw-fix-multicast-flush-in-dual-emac-mode.patch ftrace-jprobes-x86-fix-conflict-between-jprobes-and-function-graph-tracing.patch nfsv4.1-fix-client-id-trunking-on-linux.patch +gpiolib-of-correct-error-handling-in-of_get_named_gpiod_flags.patch +gpio-fix-memory-and-reference-leaks-in-gpiochip_add-error-path.patch