3c59x: Fix deadlock in vortex_error()
This fixes a bug introduced in commit
de84727214
"3c59x: Use fine-grained locks for MII and windowed register access".
vortex_interrupt() holds vp->window_lock over multiple register
accesses to reduce locking overhead. However it also needs to call
vortex_error() sometimes, and that uses the regular functions for
access to windowed registers, which will try to acquire window_lock
again.
Therefore, drop window_lock around the call to vortex_error() and set
the window afterward reacquiring the lock. Since vortex_error() may
call vortex_rx(), which *does* require its caller to hold window_lock,
lift that call up into vortex_interrupt(). This also removes the
potential for calling vortex_rx() on a later-generation NIC.
Reported-and-tested-by: Jens Schüßler <jgs@trash.net> [in Debian's 2.6.32]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1ee89bd0fe
commit
89b12faba4
@ -1994,10 +1994,9 @@ vortex_error(struct net_device *dev, int status)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status & RxEarly) { /* Rx early is unused. */
|
if (status & RxEarly) /* Rx early is unused. */
|
||||||
vortex_rx(dev);
|
|
||||||
iowrite16(AckIntr | RxEarly, ioaddr + EL3_CMD);
|
iowrite16(AckIntr | RxEarly, ioaddr + EL3_CMD);
|
||||||
}
|
|
||||||
if (status & StatsFull) { /* Empty statistics. */
|
if (status & StatsFull) { /* Empty statistics. */
|
||||||
static int DoneDidThat;
|
static int DoneDidThat;
|
||||||
if (vortex_debug > 4)
|
if (vortex_debug > 4)
|
||||||
@ -2298,7 +2297,12 @@ vortex_interrupt(int irq, void *dev_id)
|
|||||||
if (status & (HostError | RxEarly | StatsFull | TxComplete | IntReq)) {
|
if (status & (HostError | RxEarly | StatsFull | TxComplete | IntReq)) {
|
||||||
if (status == 0xffff)
|
if (status == 0xffff)
|
||||||
break;
|
break;
|
||||||
|
if (status & RxEarly)
|
||||||
|
vortex_rx(dev);
|
||||||
|
spin_unlock(&vp->window_lock);
|
||||||
vortex_error(dev, status);
|
vortex_error(dev, status);
|
||||||
|
spin_lock(&vp->window_lock);
|
||||||
|
window_set(vp, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (--work_done < 0) {
|
if (--work_done < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user