[patch] bug in 3c509 driver

From: Tigran Aivazian (tigran@ocston.org)
Date: Sun Jan 09 2000 - 10:21:04 EST


Hi Linus,

Here is a simple bug (and a fix). The 3c509 driver initializes the
spinlock dev->priv->lock in the open routine instead of the probe routine.
This way, if you load a driver but do not up the interface you will get an
oops while doing cat /proc/net/dev or just running ifconfig (because
el3_stats() tries to lock the spinlock).

The patch is against 2.3.39-pre1, I have not checked if it has been fixed
in pre2 already (hope not).

Regards,
Tigran.

--- 3c509.c.0 Sun Jan 9 23:16:56 2000
+++ 3c509.c Sun Jan 9 23:20:37 2000
@@ -374,6 +374,7 @@
         
         ((struct el3_private *)dev->priv)->mca_slot = mca_slot;
         ((struct el3_private *)dev->priv)->next_dev = el3_root_dev;
+ ((struct el3_private *)dev->priv)->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
         el3_root_dev = dev;
 
         if (el3_debug > 0)
@@ -433,9 +434,6 @@
         outw(TxReset, ioaddr + EL3_CMD);
         outw(RxReset, ioaddr + EL3_CMD);
         outw(SetStatusEnb | 0x00, ioaddr + EL3_CMD);
-
- /* Set the spinlock before grabbing IRQ! */
- ((struct el3_private *)dev->priv)->lock = (spinlock_t) SPIN_LOCK_UNLOCKED;
 
         if (request_irq(dev->irq, &el3_interrupt, 0, dev->name, dev)) {
                 return -EAGAIN;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:14 EST