net: fix __neigh_event_send()

commit 7fee226ad2 (net: add a noref bit on skb dst) missed one spot
where an skb is enqueued, with a possibly not refcounted dst entry.

__neigh_event_send() inserts skb into arp_queue, so we must make sure
dst entry is refcounted, or dst entry can be freed by garbage collector
after caller exits from rcu protected section.

Reported-by: Ingo Molnar <mingo@elte.hu>
Tested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Eric Dumazet 2010-05-27 16:09:39 -07:00 committed by David S. Miller
parent a02c37891a
commit a47311380e

View file

@ -934,6 +934,7 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
kfree_skb(buff); kfree_skb(buff);
NEIGH_CACHE_STAT_INC(neigh->tbl, unres_discards); NEIGH_CACHE_STAT_INC(neigh->tbl, unres_discards);
} }
skb_dst_force(skb);
__skb_queue_tail(&neigh->arp_queue, skb); __skb_queue_tail(&neigh->arp_queue, skb);
} }
rc = 1; rc = 1;