Skip to content

Commit

Permalink
net: dev_pick_tx() fix
Browse files Browse the repository at this point in the history
When dev_pick_tx() caches tx queue_index on a socket, we must check
socket dst_entry matches skb one, or risk a crash later, as reported by
Denys Fedorysychenko, if old packets are in flight during a route
change, involving devices with different number of queues.

Bug introduced by commit a4ee3ce
(net: Use sk_tx_queue_mapping for connected sockets)

Reported-by: Denys Fedorysychenko <nuclearcat@nuclearcat.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Eric Dumazet authored and davem330 committed Apr 15, 2010
1 parent 4eaa0e3 commit 8728c54
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/core/dev.c
Expand Up @@ -1989,8 +1989,12 @@ static struct netdev_queue *dev_pick_tx(struct net_device *dev,
if (dev->real_num_tx_queues > 1)
queue_index = skb_tx_hash(dev, skb);

if (sk && sk->sk_dst_cache)
sk_tx_queue_set(sk, queue_index);
if (sk) {
struct dst_entry *dst = rcu_dereference(sk->sk_dst_cache);

if (dst && skb_dst(skb) == dst)
sk_tx_queue_set(sk, queue_index);
}
}
}

Expand Down

0 comments on commit 8728c54

Please sign in to comment.