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

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

STALE2004d

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

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

From: Zheng Yongjun <hidden>
Date: 2021-02-04 07:43:00

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 d0c32a8fcc4a..ad63a6c77edd 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -2444,7 +2444,7 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
 		encap = kmemdup(nla_data(attrs[XFRMA_ENCAP]),
 				sizeof(*encap), GFP_KERNEL);
 		if (!encap)
-			return 0;
+			return -ENOMEM;
 	}
 
 	err = xfrm_migrate(&pi->sel, pi->dir, type, m, n, kmp, net, encap);
-- 
2.22.0

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

From: Steffen Klassert <steffen.klassert@secunet.com>
Date: 2021-02-06 07:13:24

On Thu, Feb 04, 2021 at 03:42:54PM +0800, Zheng Yongjun wrote:
When kalloc or kmemdup failed, should return ENOMEM rather than ENOBUF.

Signed-off-by: Zheng Yongjun <redacted>
Applied to ipsec-next, thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help