From: Guennadi Liakhovetski Date: Thu, 11 Nov 2010 16:32:25 +0000 (+0100) Subject: mmc: fix rmmod race for hosts using card-detection polling X-Git-Tag: v2.6.36.2~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7bfb0a0a1c85478e2c4c19ee1053f4bd674042f2;p=thirdparty%2Fkernel%2Fstable.git mmc: fix rmmod race for hosts using card-detection polling commit d9bcbf343ec63e1104b5276195888ee06b4d086f upstream. MMC hosts that poll for card detection by defining the MMC_CAP_NEEDS_POLL flag have a race on rmmod, where the delayed work is cancelled without waiting for completed polling. To prevent this a _sync version of the work cancellation has to be used. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Chris Ball Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 09eee6df0653c..9ca553b79f12a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1514,7 +1514,7 @@ void mmc_stop_host(struct mmc_host *host) if (host->caps & MMC_CAP_DISABLE) cancel_delayed_work(&host->disable); - cancel_delayed_work(&host->detect); + cancel_delayed_work_sync(&host->detect); mmc_flush_scheduled_work(); /* clear pm flags now and let card drivers set them as needed */