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

Commit e104411b authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

[XFRM]: Always release dst_entry on error in xfrm_lookup

parent cf0b450c
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -92,10 +92,7 @@ static inline struct rtable *route_reverse(struct sk_buff *skb,
	fl.fl_ip_sport = tcph->dest;
	fl.fl_ip_dport = tcph->source;

	if (xfrm_lookup((struct dst_entry **)&rt, &fl, NULL, 0)) {
		dst_release(&rt->u.dst);
		rt = NULL;
	}
	xfrm_lookup((struct dst_entry **)&rt, &fl, NULL, 0);

	return rt;
}
+1 −3
Original line number Diff line number Diff line
@@ -175,10 +175,8 @@ int ip6_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
	if (final_p)
		ipv6_addr_copy(&fl.fl6_dst, final_p);

	if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0) {
		dst_release(dst);
	if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
		goto out;
	}

	/* source address lookup done in ip6_dst_lookup */

+2 −3
Original line number Diff line number Diff line
@@ -374,7 +374,7 @@ void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info,
	if (err)
		goto out;
	if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
		goto out_dst_release;
		goto out;

	if (ipv6_addr_is_multicast(&fl.fl6_dst))
		hlimit = np->mcast_hops;
@@ -469,7 +469,7 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
	if (err)
		goto out;
	if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
		goto out_dst_release;
		goto out;

	if (ipv6_addr_is_multicast(&fl.fl6_dst))
		hlimit = np->mcast_hops;
@@ -505,7 +505,6 @@ static void icmpv6_echo_reply(struct sk_buff *skb)
out_put: 
	if (likely(idev != NULL))
		in6_dev_put(idev);
out_dst_release:
	dst_release(dst);
out: 
	icmpv6_xmit_unlock();
+4 −12
Original line number Diff line number Diff line
@@ -447,10 +447,8 @@ static void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
		return;

	err = xfrm_lookup(&dst, &fl, NULL, 0);
	if (err < 0) {
		dst_release(dst);
	if (err < 0)
		return;
	}

	if (inc_opt) {
		if (dev->addr_len)
@@ -539,10 +537,8 @@ void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
		return;

	err = xfrm_lookup(&dst, &fl, NULL, 0);
	if (err < 0) {
		dst_release(dst);
	if (err < 0)
		return;
	}

	len = sizeof(struct icmp6hdr) + sizeof(struct in6_addr);
	send_llinfo = dev->addr_len && !ipv6_addr_any(saddr);
@@ -616,10 +612,8 @@ void ndisc_send_rs(struct net_device *dev, struct in6_addr *saddr,
		return;

	err = xfrm_lookup(&dst, &fl, NULL, 0);
	if (err < 0) {
		dst_release(dst);
	if (err < 0)
		return;
	}

	len = sizeof(struct icmp6hdr);
	if (dev->addr_len)
@@ -1353,10 +1347,8 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
		return;

	err = xfrm_lookup(&dst, &fl, NULL, 0);
	if (err) {
		dst_release(dst);
	if (err)
		return;
	}

	rt = (struct rt6_info *) dst;

+1 −4
Original line number Diff line number Diff line
@@ -100,11 +100,8 @@ static void send_reset(struct sk_buff *oldskb)
	dst = ip6_route_output(NULL, &fl);
	if (dst == NULL)
		return;
	if (dst->error ||
	    xfrm_lookup(&dst, &fl, NULL, 0)) {
		dst_release(dst);
	if (dst->error || xfrm_lookup(&dst, &fl, NULL, 0))
		return;
	}

	hh_len = (dst->dev->hard_header_len + 15)&~15;
	nskb = alloc_skb(hh_len + 15 + dst->header_len + sizeof(struct ipv6hdr)
Loading