summaryrefslogtreecommitdiffstats
path: root/net/ipv6/addrconf.c
diff options
context:
space:
mode:
authorWei Wang <weiwan@google.com>2017-06-17 19:42:35 +0200
committerDavid S. Miller <davem@davemloft.net>2017-06-18 04:54:00 +0200
commitad65a2f05695aced349e308193c6e2a6b1d87112 (patch)
treebc94ee3f9f25c990ffd1c8367a9c081289648c27 /net/ipv6/addrconf.c
parentipv6: call dst_dev_put() properly (diff)
downloadlinux-ad65a2f05695aced349e308193c6e2a6b1d87112.tar.xz
linux-ad65a2f05695aced349e308193c6e2a6b1d87112.zip
ipv6: call dst_hold_safe() properly
Similar as ipv4, ipv6 path also needs to call dst_hold_safe() when necessary to avoid double free issue on the dst. Signed-off-by: Wei Wang <weiwan@google.com> Acked-by: Martin KaFai Lau <kafai@fb.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/addrconf.c')
-rw-r--r--net/ipv6/addrconf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 0aa36b093013..2a6397714d70 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -5576,8 +5576,8 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
ip6_del_rt(rt);
}
if (ifp->rt) {
- dst_hold(&ifp->rt->dst);
- ip6_del_rt(ifp->rt);
+ if (dst_hold_safe(&ifp->rt->dst))
+ ip6_del_rt(ifp->rt);
}
rt_genid_bump_ipv6(net);
break;