Re: NULL pointer dereference panic in stable (2.6.33.2), amd64

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Eric Dumazet
Date: Monday, April 12, 2010 - 12:18 am

Le lundi 12 avril 2010 à 08:01 +0200, Eric Dumazet a écrit :


Here the patch I cooked, this is a stable candidate, once tested and
acknowledged.

[PATCH] net: dev_pick_tx() fix

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 a4ee3ce3
(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>
---
diff --git a/net/core/dev.c b/net/core/dev.c
index 1c8a0ce..92584bf 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -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);
+			}
 		}
 	}
 


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
NULL pointer dereference panic in stable (2.6.33.2), amd64, Denys Fedorysychenko, (Sun Apr 11, 1:38 pm)
Re: NULL pointer dereference panic in stable (2.6.33.2), amd64, Denys Fedorysychenko, (Sun Apr 11, 4:04 pm)
Re: NULL pointer dereference panic in stable (2.6.33.2), amd64, Denys Fedorysychenko, (Sun Apr 11, 4:36 pm)
Re: NULL pointer dereference panic in stable (2.6.33.2), amd64, Eric Dumazet, (Mon Apr 12, 12:18 am)
Re: NULL pointer dereference panic in stable (2.6.33.2), amd64, Denys Fedorysychenko, (Mon Apr 12, 9:11 am)
Re: NULL pointer dereference panic in stable (2.6.33.2), amd64, Denys Fedorysychenko, (Thu Apr 15, 2:11 am)
[PATCH net-next-2.6] net: Introduce skb_orphan_try(), Eric Dumazet, (Fri Apr 16, 3:18 pm)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), Eric Dumazet, (Tue Apr 20, 11:08 pm)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), David Miller, (Wed Apr 21, 10:56 pm)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), Eric Dumazet, (Thu Apr 22, 12:10 am)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), David Miller, (Thu Apr 22, 12:16 am)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), Eric Dumazet, (Thu Apr 22, 12:24 am)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), David Miller, (Thu Apr 22, 12:26 am)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), Eric Dumazet, (Thu Apr 22, 12:33 am)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), David Miller, (Thu Apr 22, 12:41 am)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), Eric Dumazet, (Thu Apr 22, 12:47 am)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), David Miller, (Thu Apr 22, 12:54 am)
Re: [PATCH net-next-2.6] net: Introduce skb_orphan_try(), Eric Dumazet, (Thu Apr 22, 12:59 am)
Re: NULL pointer dereference panic in stable (2.6.33.2), amd64, Denys Fedorysychenko, (Thu Apr 29, 3:50 am)