Skip to contentSkip to conversation

ipsec:Fix error handling in the function xfrm6_get_addr

PATCH Herbert Xu 1 participant 1 message Jul 31, 2015 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Herbert Xu

author
#1 lore raw
In reply to a message not in the archive
Quoted 6 lines · Nicholas Krause
net/ipv6/xfrm6_policy.c +0 -0
index ed0583c..f60c670 100644

net/ipv6/xfrm6_policy.c static int xfrm6_get_saddr(struct net *net, · line 67

Quoted 8 lines
net/ipv6/xfrm6_policy.c +3 -1
@@ -61,7 +61,9 @@ static int xfrm6_get_saddr(struct net *net,
 		return -EHOSTUNREACH;
 
 	dev = ip6_dst_idev(dst)->dev;
-	ipv6_dev_get_saddr(dev_net(dev), dev, &daddr->in6, 0, &saddr->in6);
+	if (ipv6_dev_get_saddr(dev_net(dev), dev, &daddr->in6, 0, &saddr->in6))
+		return -EADDRNOTAVAIL;
+
 	dst_release(dst);

You're leaking dst.

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt