lkml.org 
[lkml]   [2012]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[ 84/94] mmc: cd-gpio: protect against NULL context in mmc_cd_gpio_free()
3.3-stable review patch.  If anyone has any objections, please let me know.

------------------
From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>

commit 0e9f480bb553d39ee06ccd45639ba7a5446a7b81 upstream.

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 <g.liakhovetski@gmx.de>
[stable@: please apply to 3.3-stable]
Signed-off-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
drivers/mmc/core/cd-gpio.c | 3 +++
1 file changed, 3 insertions(+)
--- a/drivers/mmc/core/cd-gpio.c
+++ b/drivers/mmc/core/cd-gpio.c
@@ -67,6 +67,9 @@ void mmc_cd_gpio_free(struct mmc_host *h
{
struct mmc_cd_gpio *cd = host->hotplug.handler_priv;

+ if (!cd)
+ return;
+
free_irq(host->hotplug.irq, host);
gpio_free(cd->gpio);
kfree(cd);



\
 
 \ /
  Last update: 2012-05-27 04:21    [from the cache]
©2003-2011 Jasper Spaans