lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 8 Aug 2013 23:06:10 +0200 (CEST)
From:	Guennadi Liakhovetski <g.liakhovetski@....de>
To:	Christian Daudt <csd@...adcom.com>
cc:	Chris Ball <cjb@...top.org>, Shawn Guo <shawn.guo@...aro.org>,
	linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mmc: change mmc_gpio_get_cd to call non-sleep gpio

On Thu, 8 Aug 2013, Christian Daudt wrote:

> Given that mmc_gpio_get_cd can be called in softirq
> context (by sdhci_tasklet_card -> sdhci_card_event ->
> sdhci_do_get_cd -> mmc_gpio_get_cd ), it is necessary
> for it to use gpio_get_value instead of
> gpio_get_value_cansleep
> Note that at present sdhci_card_event gets called both
> from mmc_gpio_cd_irqt and sdhci_tasklet_card, and from
> both it gets called immediately while the actual cd
> processing is debounced to 200ms later. I think that
> the better solution might be to move the sdhci_card_event
> callback into mmc_rescan and remove it from its 2
> present locations. That way the cd related callbacks
> are aligned with the actual cd detection code. I can
> submit a follow-up patch with these mods if that sounds
> like a better way to solve this.
> 
> Signed-off-by: Christian Daudt <csd@...adcom.com>

I don't think this is a right approach. It will Oops if the card-detect 
GPIO is provided by, e.g. an I2C GPIO controller. Instead the driver 
should be fixed to only call this function from a sleeping context.

Thanks
Guennadi

> 
> diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c
> index 3242351..897b298 100644
> --- a/drivers/mmc/core/slot-gpio.c
> +++ b/drivers/mmc/core/slot-gpio.c
> @@ -87,7 +87,7 @@ int mmc_gpio_get_cd(struct mmc_host *host)
>  	if (!ctx || !gpio_is_valid(ctx->cd_gpio))
>  		return -ENOSYS;
>  
> -	return !gpio_get_value_cansleep(ctx->cd_gpio) ^
> +	return !gpio_get_value(ctx->cd_gpio) ^
>  		!!(host->caps2 & MMC_CAP2_CD_ACTIVE_HIGH);
>  }
>  EXPORT_SYMBOL(mmc_gpio_get_cd);
> -- 
> 1.7.10.4
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ