[3.13.y-ckt stable] Patch "gpio: fix sleep-while-atomic in gpiochip_remove" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Thu Feb 19 00:29:06 UTC 2015


This is a note to let you know that I have just added a patch titled

    gpio: fix sleep-while-atomic in gpiochip_remove

to the linux-3.13.y-queue branch of the 3.13.y-ckt extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.13.y-queue

This patch is scheduled to be released in version 3.13.11-ckt16.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.13.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From 81166283ff743b469fd87f691d3ac6a5cb739ad0 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan at kernel.org>
Date: Mon, 12 Jan 2015 17:12:28 +0100
Subject: gpio: fix sleep-while-atomic in gpiochip_remove

commit 6798acaa0138d8b12f1c54402ebcb66fea3deb03 upstream.

Move direct and indirect calls to gpiochip_remove_pin_ranges outside of
spin lock as they can end up taking a mutex in pinctrl_remove_gpio_range.

Note that the pin ranges are already added outside of the lock.

Fixes: 9ef0d6f7628b ("gpiolib: call pin removal in chip removal function")
Fixes: f23f1516b675 ("gpiolib: provide provision to register pin ranges")
Signed-off-by: Johan Hovold <johan at kernel.org>
Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/gpio/gpiolib.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 3ef348f..f86386c 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1256,12 +1256,11 @@ int gpiochip_remove(struct gpio_chip *chip)
 	int		status = 0;
 	unsigned	id;

-	spin_lock_irqsave(&gpio_lock, flags);
-
 	gpiochip_remove_pin_ranges(chip);
 	of_gpiochip_remove(chip);
 	acpi_gpiochip_remove(chip);

+	spin_lock_irqsave(&gpio_lock, flags);
 	for (id = 0; id < chip->ngpio; id++) {
 		if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) {
 			status = -EBUSY;
--
1.9.1





More information about the kernel-team mailing list