diff options
author | Colin Ian King <colin.king@canonical.com> | 2017-10-10 19:01:16 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-10 19:54:17 +0200 |
commit | b2427e671766c51379bc882fdf809d905c6f9619 (patch) | |
tree | 498341271f337447255fc04dac899aa98056f936 /net/ipv6 | |
parent | Add a driver for Renesas uPD60620 and uPD60620A PHYs (diff) | |
download | linux-b2427e671766c51379bc882fdf809d905c6f9619.tar.xz linux-b2427e671766c51379bc882fdf809d905c6f9619.zip |
ipv6: fix dereference of rt6_ex before null check error
Currently rt6_ex is being dereferenced before it is null checked
hence there is a possible null dereference bug. Fix this by only
dereferencing rt6_ex after it has been null checked.
Detected by CoverityScan, CID#1457749 ("Dereference before null check")
Fixes: 81eb8447daae ("ipv6: take care of rt6_stats")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/route.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 13b0d6d1cc30..c1c44f484286 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -1142,10 +1142,12 @@ static DEFINE_SPINLOCK(rt6_exception_lock); static void rt6_remove_exception(struct rt6_exception_bucket *bucket, struct rt6_exception *rt6_ex) { - struct net *net = dev_net(rt6_ex->rt6i->dst.dev); + struct net *net; if (!bucket || !rt6_ex) return; + + net = dev_net(rt6_ex->rt6i->dst.dev); rt6_ex->rt6i->rt6i_node = NULL; hlist_del_rcu(&rt6_ex->hlist); rt6_release(rt6_ex->rt6i); |