[PATCH] bpf: fix return in bpf_skb_adjust_net

Subsystems: bpf [general] (safe dynamic programs and tools), bpf [networking] (tcx & tc bpf, sock_addr), networking [general], the rest

STALE3344d

3 messages, 3 authors, 2017-07-13 · open the first message on its own page

[PATCH] bpf: fix return in bpf_skb_adjust_net

From: Kefeng Wang <hidden>
Date: 2017-07-13 06:29:54

The bpf_skb_adjust_net() ignores the return value of bpf_skb_net_shrink/grow,
and always return 0, fix it by return 'ret'.

Signed-off-by: Kefeng Wang <redacted>
---
 net/core/filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index c7f7370..f44fc22 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -2248,7 +2248,7 @@ static int bpf_skb_adjust_net(struct sk_buff *skb, s32 len_diff)
 		       bpf_skb_net_grow(skb, len_diff_abs);
 
 	bpf_compute_data_end(skb);
-	return 0;
+	return ret;
 }
 
 BPF_CALL_4(bpf_skb_adjust_room, struct sk_buff *, skb, s32, len_diff,
-- 
1.8.3.1

Re: [PATCH] bpf: fix return in bpf_skb_adjust_net

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2017-07-13 09:21:05

On 07/13/2017 08:27 AM, Kefeng Wang wrote:
The bpf_skb_adjust_net() ignores the return value of bpf_skb_net_shrink/grow,
and always return 0, fix it by return 'ret'.

Signed-off-by: Kefeng Wang <redacted>
Sigh, yep of course. Thanks!

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

Re: [PATCH] bpf: fix return in bpf_skb_adjust_net

From: David Miller <davem@davemloft.net>
Date: 2017-07-13 16:19:42

From: Kefeng Wang <redacted>
Date: Thu, 13 Jul 2017 14:27:58 +0800
The bpf_skb_adjust_net() ignores the return value of bpf_skb_net_shrink/grow,
and always return 0, fix it by return 'ret'.

Signed-off-by: Kefeng Wang <redacted>
Applied, 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