Netdev List
 help / color / mirror / Atom feed
* [PATCH] ipsec: Fix error handling in the function xfrm6_get_addr
@ 2016-04-05 14:23 Bastien Philbert
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien Philbert @ 2016-04-05 14:23 UTC (permalink / raw)
  To: herbert; +Cc: davem, kuznet, jmorris, yoshfuji, kaber, netdev, linux-kernel

This fixes the error handling in the function xfrm_get_addr by
checking if the call to ipv6_dev_get_saddr has failed and if
so return -EADDRNOTAVAIL to signal to the caller of xfrm6_get_addr
that the call has failed the error should be handled by the caller
while also freeing the dst_entry structure pointer in use by this

Signed-off-by: Bastien Philbert <bastienphilbert@gmail.com>
---
 net/ipv6/xfrm6_policy.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index c074771..759473e 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -64,7 +64,10 @@ static int xfrm6_get_saddr(struct net *net, int oif,
 		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)) {
+		dst_release(dst);
+		return -EADDRNOTAVAIL;
+	}
 	dst_release(dst);
 	return 0;
 }
-- 
2.5.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread
[parent not found: <1438273240-15493-1-git-send-email-xerofoify@gmail.com>]

end of thread, other threads:[~2016-04-05 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-05 14:23 [PATCH] ipsec: Fix error handling in the function xfrm6_get_addr Bastien Philbert
     [not found] <1438273240-15493-1-git-send-email-xerofoify@gmail.com>
2015-07-31  0:00 ` [PATCH] ipsec:Fix " Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox