[PATCH net-next] xfrm: Return the correct errno code

Subsystems: networking [general], networking [ipsec], the rest

STALE1892d

2 messages, 2 authors, 2021-06-04 · open the first message on its own page

[PATCH net-next] xfrm: Return the correct errno code

From: Zheng Yongjun <hidden>
Date: 2021-06-04 01:33:19

When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.

Signed-off-by: Zheng Yongjun <redacted>
---
 net/xfrm/xfrm_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index f0aecee4d539..4f9c86807bc4 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -3159,7 +3159,7 @@ static struct xfrm_policy *xfrm_compile_policy(struct sock *sk, int opt,
 
 	xp = xfrm_policy_alloc(net, GFP_ATOMIC);
 	if (xp == NULL) {
-		*dir = -ENOBUFS;
+		*dir = -ENOMEM;
 		return NULL;
 	}
 
-- 
2.25.1

Re: [PATCH net-next] xfrm: Return the correct errno code

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2021-06-04 01:34:59

On Fri, Jun 04, 2021 at 09:46:52AM +0800, Zheng Yongjun wrote:
quoted hunk
When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.

Signed-off-by: Zheng Yongjun <redacted>
---
 net/xfrm/xfrm_user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index f0aecee4d539..4f9c86807bc4 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -3159,7 +3159,7 @@ static struct xfrm_policy *xfrm_compile_policy(struct sock *sk, int opt,
 
 	xp = xfrm_policy_alloc(net, GFP_ATOMIC);
 	if (xp == NULL) {
-		*dir = -ENOBUFS;
+		*dir = -ENOMEM;
Nack.  ENOBUFS has a specific meaning in the network stack.
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help