commit: 0e9f480bb553d39ee06ccd45639ba7a5446a7b81
From: Guennadi Liakhovetski <[email protected]>
Date: Tue, 24 Apr 2012 17:56:29 +0200
Subject: mmc: cd-gpio: protect against NULL context in mmc_cd_gpio_free()

Do not oops, even if mmc_cd_gpio_free() is mistakenly called on a driver
cleanup path, even though a previous call to mmc_cd_gpio_request() failed.

Signed-off-by: Guennadi Liakhovetski <[email protected]>
[stable@: please apply to 3.3-stable]
Cc: stable <[email protected]>
Signed-off-by: Chris Ball <[email protected]>
---
 drivers/mmc/core/cd-gpio.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/cd-gpio.c b/drivers/mmc/core/cd-gpio.c
index 2c14be7..f13e38d 100644
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -73,6 +73,9 @@ void mmc_cd_gpio_free(struct mmc_host *host)
 {
        struct mmc_cd_gpio *cd = host->hotplug.handler_priv;
 
+       if (!cd)
+               return;
+
        free_irq(host->hotplug.irq, host);
        gpio_free(cd->gpio);
        kfree(cd);
-- 
1.7.3.4
--
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