From: Benedict Wong Date: Wed, 25 Jul 2018 20:45:29 +0000 (-0700) Subject: UPSTREAM: xfrm: Return detailed errors from xfrmi_newlink X-Git-Tag: MMI-RSBS31.Q1-48-36-26~119 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=25e08eab748718cdf427f1372179a888bc3a1276;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git UPSTREAM: xfrm: Return detailed errors from xfrmi_newlink Currently all failure modes of xfrm interface creation return EEXIST. This change improves the granularity of errnos provided by also returning ENODEV or EINVAL if failures happen in looking up the underlying interface, or a required parameter is not provided. This change has been tested against the Android Kernel Networking Tests, with additional xfrmi_newlink tests here: https://android-review.googlesource.com/c/kernel/tests/+/715755 Signed-off-by: Benedict Wong Signed-off-by: Steffen Klassert (cherry picked from commit 44e2b838c24d883dae8496dc7b6ddac7956ba53c) Bug: 113046120 Change-Id: Ic680bf1e4a828aaae01b289223d9396a551eefd2 --- diff --git a/net/xfrm/xfrm_interface.c b/net/xfrm/xfrm_interface.c index 31acc6f33d98..481d7307ab51 100644 --- a/net/xfrm/xfrm_interface.c +++ b/net/xfrm/xfrm_interface.c @@ -689,7 +689,10 @@ static int xfrmi_newlink(struct net *src_net, struct net_device *dev, nla_strlcpy(p->name, tb[IFLA_IFNAME], IFNAMSIZ); xi = xfrmi_locate(net, p, 1); - return PTR_ERR_OR_ZERO(xi); + if (IS_ERR(xi)) + return PTR_ERR(xi); + + return 0; } static void xfrmi_dellink(struct net_device *dev, struct list_head *head)