This patch doesn't apply to the .37 stable tree.
If someone wants it applied there, please email the backport
to [email protected]

thanks,

greg k-h

> commit: e9b86841b372de01ae865080118e29159d8b7c39
> From: Linus Walleij <[email protected]>
> Date: Wed, 5 Jan 2011 00:44:32 +0100
> Subject: [PATCH] mmc: fix division by zero in MMC core
> 
> The card is not always clocked and the clock frequency zero is perfectly
> legal, thus this code in mmc_set_data_timeout() may cause a division by
> zero. It will be triggered more often if you're using software clock
> gating but can be triggered under other conditions too.
> 
> Reported-by: Pierre Tardy <[email protected]>
> Signed-off-by: Linus Walleij <[email protected]>
> Reviewed-by: Chris Ball <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Chris Ball <[email protected]>
> ---
>  drivers/mmc/core/core.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 4b1d8fb..6625c05 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -299,8 +299,9 @@ void mmc_set_data_timeout(struct mmc_data *data, const 
> struct mmc_card *card)
>               unsigned int timeout_us, limit_us;
>  
>               timeout_us = data->timeout_ns / 1000;
> -             timeout_us += data->timeout_clks * 1000 /
> -                     (mmc_host_clk_rate(card->host) / 1000);
> +             if (mmc_host_clk_rate(card->host))
> +                     timeout_us += data->timeout_clks * 1000 /
> +                             (mmc_host_clk_rate(card->host) / 1000);
>  
>               if (data->flags & MMC_DATA_WRITE)
>                       /*
> 
> _______________________________________________
> stable mailing list
> [email protected]
> http://linux.kernel.org/mailman/listinfo/stable

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to