This is a note to let you know that I've just added the patch titled

    gpio: fix memory leak and sleep-while-atomic

to the 3.18-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     gpio-fix-memory-leak-and-sleep-while-atomic.patch
and it can be found in the queue-3.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 00acc3dc248063f982cfacfbe5e78c0d6797ffef Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Mon, 12 Jan 2015 17:12:27 +0100
Subject: gpio: fix memory leak and sleep-while-atomic

From: Johan Hovold <[email protected]>

commit 00acc3dc248063f982cfacfbe5e78c0d6797ffef upstream.

Fix memory leak and sleep-while-atomic in gpiochip_remove.

The memory leak was introduced by afa82fab5e13 ("gpio / ACPI: Move event
handling registration to gpiolib irqchip helpers") that moved the
release of acpi interrupt resources to gpiochip_irqchip_remove, but by
then the resources are no longer accessible as the acpi_gpio_chip has
already been freed by acpi_gpiochip_remove.

Note that this also fixes a few potential sleep-while-atomics, which has
been around since 1425052097b5 ("gpio: add IRQ chip helpers in gpiolib")
when the call to gpiochip_irqchip_remove while holding a spinlock was
added (a couple of irq-domain paths can end up grabbing mutexes).

Fixes: afa82fab5e13 ("gpio / ACPI: Move event handling registration to
gpiolib irqchip helpers")
Fixes: 1425052097b5 ("gpio: add IRQ chip helpers in gpiolib")

Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/gpio/gpiolib.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -316,11 +316,12 @@ void gpiochip_remove(struct gpio_chip *c
        unsigned long   flags;
        unsigned        id;
 
+       gpiochip_irqchip_remove(chip);
+
        acpi_gpiochip_remove(chip);
 
        spin_lock_irqsave(&gpio_lock, flags);
 
-       gpiochip_irqchip_remove(chip);
        gpiochip_remove_pin_ranges(chip);
        of_gpiochip_remove(chip);
 


Patches currently in stable-queue which might be from [email protected] are

queue-3.18/gpio-fix-memory-and-reference-leaks-in-gpiochip_add-error-path.patch
queue-3.18/pinctrl-lantiq-remove-bogus-of_gpio_chip_add.patch
queue-3.18/gpio-sysfs-fix-gpio-device-attribute-leak.patch
queue-3.18/gpio-fix-memory-leak-and-sleep-while-atomic.patch
queue-3.18/gpio-sysfs-fix-gpio-chip-device-attribute-leak.patch
queue-3.18/gpio-fix-sleep-while-atomic-in-gpiochip_remove.patch
queue-3.18/leds-netxbig-fix-oops-at-probe-time.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to