: Fix dev->qdisc race for NETDEV_TX_LOCKED case
Subsystems (3)
When transmit fails with NETDEV_TX_LOCKED the skb is requeued to dev->qdisc again. The dev->qdisc pointer is protected by the queue lock which needs to be dropped when attempting to transmit and acquired again before requeing. The problem is that qdisc_restart() fetches the dev->qdisc pointer once and stores it in the `q' variable which is invalidated when dropping the queue_lock, therefore the variable needs to be refreshed before requeueing.
net/sched/sch_generic.c +1 -0
@@ -139,6 +139,7 @@ static inline int qdisc_restart(struct n }if (ret ==NETDEV_TX_LOCKED && nolock) {spin_lock (&dev->queue_lock); + q = dev->qdisc; goto collision; } }
Quoted 10 lines · Thomas Graf
When transmit fails with
NETDEV_TX_LOCKEDthe skb is requeued todev->qdiscagain. Thedev->qdiscpointer is protected by the queue lock which needs to be dropped when attempting to transmit and acquired again before requeing. The problem is thatqdisc_restart()fetches thedev->qdiscpointer once and stores it in the `q' variable which is invalidated when dropping thequeue_lock, therefore the variable needs to be refreshed before requeueing.Signed-off-by Thomas Graf <[email protected]>
I agree, good catch Thomas.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txtFrom: Herbert Xu <[email protected]>
Date: Thu, 10 May 2007 21:55:17 +1000
Quoted 10 lines
Quoted 9 lines · Thomas Graf
When transmit fails with
NETDEV_TX_LOCKEDthe skb is requeued todev->qdiscagain. Thedev->qdiscpointer is protected by the queue lock which needs to be dropped when attempting to transmit and acquired again before requeing. The problem is thatqdisc_restart()fetches thedev->qdiscpointer once and stores it in the `q' variable which is invalidated when dropping thequeue_lock, therefore the variable needs to be refreshed before requeueing.
Quoted 3 lines
Quoted 1 line
Signed-off-by Thomas Graf <[email protected]>I agree, good catch Thomas.
Applied to my tree and I'll push it off to Linus tomorrow unless someone finds a problem with it by then.
Thanks.
Quoted 3 lines · David Miller
Applied to my tree and I'll push it off to Linus tomorrow unless someone finds a problem with it by then.
BTW, guess how this bug was introduced? By the lockless patch, surprise surprise :)
The sooner we are rid of it the better.
Cheers,
Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt