aoe: avoid using skb member after dev_queue_xmit
Subsystems (3)
PATCH 1/1 aoe: avoid using skb member after dev_queue_xmit
After calling dev_queue_xmit it is no longer safe to access the members of the skb.
--- drivers/block/aoe/aoenet.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/block/aoe/aoenet.c +3 -1
@@ -55,12 +55,14 @@ static int tx(void) __must_hold(&txlock) {struct sk_buff *skb; +struct net_device *ifp;while ((skb =skb_dequeue (&skbtxq))) {spin_unlock_irq (&txlock); + ifp = skb->dev;if (dev_queue_xmit (skb) =NET_XMIT_DROP &&net_ratelimit ())pr_warn ("aoe: packet could not be sent on %s. %s\n" , - skb->dev ? skb->dev->name :"netif" , + ifp ? ifp->name :"netif" ,"consider increasing tx_queue_len" );spin_lock_irq (&txlock); }
Signature · 1 line
1.7.1
Quoted 4 lines · On Wed, 24 Oct 2012 14:26:13 -0400 Ed Cashin <[email protected]> wrote:
After calling
dev_queue_xmitit is no longer safe to access the members of the skb.Reported-by Dan Carpenter <[email protected]>
hm, that was clever. How did Dan detect this bug?
Quoted 8 lines
drivers/block/aoe/aoenet.c +1
-0@@ -55,12 +55,14 @@ static int tx(void) __must_hold(&txlock) {struct sk_buff *skb; +struct net_device *ifp;
drivers/block/aoe/aoenet.c static int · line 68
Quoted 10 lines
drivers/block/aoe/aoenet.c +2
-1while ((skb =skb_dequeue (&skbtxq))) {spin_unlock_irq (&txlock); + ifp = skb->dev;if (dev_queue_xmit (skb) =NET_XMIT_DROP &&net_ratelimit ())pr_warn ("aoe: packet could not be sent on %s. %s\n" , - skb->dev ? skb->dev->name :"netif" , + ifp ? ifp->name :"netif" ,"consider increasing tx_queue_len" );spin_lock_irq (&txlock); }
Queued as a fix against the not-yet-upstream aoe-print-warning-regarding-a-common-reason-for-dropped-transmits.patch, thanks.
Quoted 9 lines · Andrew Morton
Quoted 4 lines · On Wed, 24 Oct 2012 14:26:13 -0400 Ed Cashin <[email protected]> wrote:
After calling
dev_queue_xmitit is no longer safe to access the members of the skb.Reported-by Dan Carpenter <[email protected]>hm, that was clever. How did Dan detect this bug?
It was a Smatch thing, but it wasn't enabled by default. I think I will enable it. This is the second bug use after dev_queue_xmit() in two years.
regards,
dan carpenter
Quoted 7 lines · Dan Carpenter
Quoted 6 lines · Andrew Morton
Quoted 3 lines · On Wed, 24 Oct 2012 14:26:13 -0400 Ed Cashin <[email protected]> wrote:
After calling
dev_queue_xmitit is no longer safe to access the members of the skb.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Reported-by Dan Carpenter <[email protected]>hm, that was clever. How did Dan detect this bug?
It was a Smatch thing, but it wasn't enabled by default. I think I will enable it. This is the second bug use after
dev_queue_xmit()in two years.
OK, no more procrastinating. I'm using smatch from today forward.
Signature · 2 lines
Ed Cashin [email protected]