]> git.hungrycats.org Git - linux/commitdiff
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)
committerJiri Slaby <jslaby@suse.cz>
Mon, 28 Nov 2016 21:22:39 +0000 (22:22 +0100)
commit 2c1a4311b61072afe2309d4152a7993e92caa41c upstream.

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>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
net/ipv4/route.c

index 2d709773dc6c2cdaa3052c810c2438e7f17f0dfc..f1631aec4206ff9bd3b65b8db922d6bac6af2767 100644 (file)
@@ -765,7 +765,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 {