Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad65a2f0 authored by Wei Wang's avatar Wei Wang Committed by David S. Miller
Browse files

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: default avatarWei Wang <weiwan@google.com>
Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9514528d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5576,7 +5576,7 @@ static void __ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)
				ip6_del_rt(rt);
		}
		if (ifp->rt) {
			dst_hold(&ifp->rt->dst);
			if (dst_hold_safe(&ifp->rt->dst))
				ip6_del_rt(ifp->rt);
		}
		rt_genid_bump_ipv6(net);
+2 −2
Original line number Diff line number Diff line
@@ -1366,7 +1366,7 @@ static void ip6_link_failure(struct sk_buff *skb)
	rt = (struct rt6_info *) skb_dst(skb);
	if (rt) {
		if (rt->rt6i_flags & RTF_CACHE) {
			dst_hold(&rt->dst);
			if (dst_hold_safe(&rt->dst))
				ip6_del_rt(rt);
		} else if (rt->rt6i_node && (rt->rt6i_flags & RTF_DEFAULT)) {
			rt->rt6i_node->fn_sernum = -1;