Hi Linus, On Wed, Jan 05, 2011 at 12:44:32AM +0100, Linus Walleij wrote: > 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 <tardyp@xxxxxxxxx> > Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxxxxxx> > --- > 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 97e0624..ef4f7f8 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) > /* Thanks, pushed to mmc-next for .38. I'll add a stable tag. Looks like the potential for the divide-by-zero has always existed in the tree. -- Chris Ball <cjb@xxxxxxxxxx> <http://printf.net/> One Laptop Per Child -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html