Message ID | 20110605082016.5a26f61a.ken_kawasaki@spring.nifty.jp |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Ken Kawasaki <ken_kawasaki@spring.nifty.jp> Date: Sun, 5 Jun 2011 08:20:16 +0900 > > smc91c92_cs: > set smc->base to NULL before iounmap > to avoid writing to smc->base in smc_interrupt. > > Signed-off-by: Ken Kawasaki <ken_kawasaki@spring.nifty.jp> The device should be completely made quiet and all interrupts synchronized before unmapping chip registers. Using NULL checks is merely a workaround for the real problem, even though you take great pains to assign NULL before the iounmap() call. Perhaps putting the pcmcia_disable_device() call before the iounmap() will be sufficient to fix this bug. Or perhaps that, plus a call to synchronize_irq() or similar. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, I will re-test this problem. Thanks, Ken >> smc91c92_cs: >> set smc->base to NULL before iounmap >> to avoid writing to smc->base in smc_interrupt. >> >> Signed-off-by: Ken Kawasaki <ken_kawasaki@spring.nifty.jp> > >The device should be completely made quiet and all interrupts >synchronized before unmapping chip registers. Using NULL checks >is merely a workaround for the real problem, even though you take >great pains to assign NULL before the iounmap() call. > >Perhaps putting the pcmcia_disable_device() call before the iounmap() >will be sufficient to fix this bug. Or perhaps that, plus a call to >synchronize_irq() or similar. > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
--- linux-3.0-rc1/drivers/net/pcmcia/smc91c92_cs.c.orig 2011-06-04 19:38:07.000000000 +0900 +++ linux-3.0-rc1/drivers/net/pcmcia/smc91c92_cs.c 2011-06-05 07:59:51.000000000 +0900 @@ -315,6 +315,7 @@ static int smc91c92_probe(struct pcmcia_ smc = netdev_priv(dev); smc->p_dev = link; link->priv = dev; + smc->base = NULL; spin_lock_init(&smc->lock); @@ -954,11 +955,17 @@ config_failed: static void smc91c92_release(struct pcmcia_device *link) { + struct net_device *dev = link->priv; + struct smc_private *smc = netdev_priv(dev); + dev_dbg(&link->dev, "smc91c92_release\n"); - if (link->resource[2]->end) { - struct net_device *dev = link->priv; - struct smc_private *smc = netdev_priv(dev); - iounmap(smc->base); + + if (smc->base != NULL) { + u_char __iomem *tmp; + + tmp = smc->base; + smc->base = NULL; /* set NULL before iounmap */ + iounmap(tmp); } pcmcia_disable_device(link); } @@ -1444,7 +1451,7 @@ irq_done: mask_bits(0x00ff, ioaddr-0x10+OSITECH_RESET_ISR); set_bits(0x0300, ioaddr-0x10+OSITECH_RESET_ISR); } - if (smc->manfid == MANFID_MOTOROLA) { + if ((smc->base != NULL) && (smc->manfid == MANFID_MOTOROLA)) { u_char cor; cor = readb(smc->base + MOT_UART + CISREG_COR); writeb(cor & ~COR_IREQ_ENA, smc->base + MOT_UART + CISREG_COR);
smc91c92_cs: set smc->base to NULL before iounmap to avoid writing to smc->base in smc_interrupt. Signed-off-by: Ken Kawasaki <ken_kawasaki@spring.nifty.jp> --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html