neigh: check error pointer instead of NULL for ipv4_neigh_lookup()
authorWANG Cong <xiyou.wangcong@gmail.com>
Thu, 25 Sep 2014 00:07:53 +0000 (17:07 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Sep 2014 21:16:04 +0000 (17:16 -0400)
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>
net/ipv4/route.c

index 173e7ea54c7016d43e81a269571049ca4b55199d..cbadb942c3328d3585add8e791fcd2e3d2cb1d67 100644 (file)
@@ -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 {