neigh: check error pointer instead of NULL for ipv4_neigh_lookup()
Subsystems (3)
PATCH 1/1 neigh: check error pointer instead of NULL for ipv4_neigh_lookup()
Fixes commit f187bc6efb7250afee0e2009b6106 ("ipv4: No need to set generic neighbour pointer")
Cc David S. Miller <[email protected]>
Signed-off-by Cong Wang <[email protected]>
--- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/route.c +1 -1
@@ -746,7 +746,7 @@ static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow } n =ipv4_neigh_lookup (&rt->dst,NULL , &new_gw); -if (n) { +if (!IS_ERR (n)) {if (!(n->nud_state &NUD_VALID )) {neigh_event_send (n,NULL ); }else {
Signature · 1 line
1.8.3.1
Quoted 12 lines · Cong Wang
Fixes commit f187bc6efb7250afee0e2009b6106 ("ipv4: No need to set generic neighbour pointer")Cc David S. Miller <[email protected]>Signed-off-by Cong Wang <[email protected]>--- net/ipv4/route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/ipv4/route.c +0
-0
net/ipv4/route.c static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow · line 751
Quoted 7 lines
net/ipv4/route.c +1
-1@@ -746,7 +746,7 @@ static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow } n =ipv4_neigh_lookup (&rt->dst,NULL , &new_gw); -if (n) { +if (!IS_ERR (n)) {if (!(n->nud_state &NUD_VALID )) {neigh_event_send (n,NULL );
assuming symptoms of this was a crash?
Could you share the stack trace to see how we got to this state ? Or was it spotted just by code inspection?
Thanks!
Quoted 1 line · Alexei Starovoitov
assuming symptoms of this was a crash?
No.
Quoted 1 line
Or was it spotted just by code inspection?
Yes.
From: Cong Wang <[email protected]>
Date: Wed, 24 Sep 2014 17:07:53 -0700
Quoted 3 lines
Fixes commit f187bc6efb7250afee0e2009b6106 ("ipv4: No need to set generic neighbour pointer")Cc David S. Miller <[email protected]>Signed-off-by Cong Wang <[email protected]>
Applied, thank you.