From: WANG Cong <xiyou.wangcong@gmail.com>
Date: Thu, 25 Sep 2014 00:07:53 +0000 (-0700)
Subject: neigh: check error pointer instead of NULL for ipv4_neigh_lookup()
X-Git-Tag: v3.17~14^2~11
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2c1a4311b61072afe2309d4152a7993e92caa41c;p=users%2Fjedix%2Flinux-maple.git

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 <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 173e7ea54c70..cbadb942c332 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -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 {