Skip to content
Commit 7adf3246 authored by Stefano Brivio's avatar Stefano Brivio Committed by David S. Miller
Browse files

ipv6: route: Fix return value of ip6_neigh_lookup() on neigh_create() error



In ip6_neigh_lookup(), we must not return errors coming from
neigh_create(): if creation of a neighbour entry fails, the lookup should
return NULL, in the same way as it's done in __neigh_lookup().

Otherwise, callers legitimately checking for a non-NULL return value of
the lookup function might dereference an invalid pointer.

For instance, on neighbour table overflow, ndisc_router_discovery()
crashes ndisc_update() by passing ERR_PTR(-ENOBUFS) as 'neigh' argument.

Reported-by: default avatarJianlin Shi <jishi@redhat.com>
Fixes: f8a1b43b

 ("net/ipv6: Create a neigh_lookup for FIB entries")
Signed-off-by: default avatarStefano Brivio <sbrivio@redhat.com>
Reviewed-by: default avatarDavid Ahern <dsahern@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 202700e3
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment