]> bbs.cooldavid.org Git - net-next-2.6.git/commit
3c59x: Fix deadlock in vortex_error()
authorBen Hutchings <ben@decadent.org.uk>
Tue, 7 Sep 2010 01:28:56 +0000 (18:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Sep 2010 20:57:22 +0000 (13:57 -0700)
commit89b12faba4f3441c9457c5278851e8a93ffd008d
treefa7af4864a3200a7abcadea2a04886515249d326
parent1ee89bd0fe72e381c8e4ef887d53c19c8adc6c93
3c59x: Fix deadlock in vortex_error()

This fixes a bug introduced in commit
de847272149365363a6043a963a6f42fb91566e2
"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>
drivers/net/3c59x.c