All of lore.kernel.org
 help / color / mirror / Atom feed
* [bpf-next] bpf: fix error check in bpf_tcp_gen_syncookie
@ 2019-08-27 23:46 Petar Penkov
  2019-08-28 19:15 ` Song Liu
  2019-08-30 23:23 ` Daniel Borkmann
  0 siblings, 2 replies; 3+ messages in thread
From: Petar Penkov @ 2019-08-27 23:46 UTC (permalink / raw)
  To: netdev, bpf; +Cc: davem, ast, daniel, Petar Penkov, Stanislav Fomichev

From: Petar Penkov <ppenkov@google.com>

If a SYN cookie is not issued by tcp_v#_gen_syncookie, then the return
value will be exactly 0, rather than <= 0. Let's change the check to
reflect that, especially since mss is an unsigned value and cannot be
negative.

Fixes: 70d66244317e ("bpf: add bpf_tcp_gen_syncookie helper")
Reported-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Petar Penkov <ppenkov@google.com>
---
 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 0c1059cdad3d..17bc9af8f156 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -5903,7 +5903,7 @@ BPF_CALL_5(bpf_tcp_gen_syncookie, struct sock *, sk, void *, iph, u32, iph_len,
 	default:
 		return -EPROTONOSUPPORT;
 	}
-	if (mss <= 0)
+	if (mss == 0)
 		return -ENOENT;
 
 	return cookie | ((u64)mss << 32);
-- 
2.23.0.187.g17f5b7556c-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [bpf-next] bpf: fix error check in bpf_tcp_gen_syncookie
  2019-08-27 23:46 [bpf-next] bpf: fix error check in bpf_tcp_gen_syncookie Petar Penkov
@ 2019-08-28 19:15 ` Song Liu
  2019-08-30 23:23 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2019-08-28 19:15 UTC (permalink / raw)
  To: Petar Penkov
  Cc: Networking, bpf, David S . Miller, Alexei Starovoitov,
	Daniel Borkmann, Petar Penkov, Stanislav Fomichev

On Tue, Aug 27, 2019 at 4:46 PM Petar Penkov <ppenkov.kernel@gmail.com> wrote:
>
> From: Petar Penkov <ppenkov@google.com>
>
> If a SYN cookie is not issued by tcp_v#_gen_syncookie, then the return
> value will be exactly 0, rather than <= 0. Let's change the check to
> reflect that, especially since mss is an unsigned value and cannot be
> negative.
>
> Fixes: 70d66244317e ("bpf: add bpf_tcp_gen_syncookie helper")
> Reported-by: Stanislav Fomichev <sdf@google.com>
> Signed-off-by: Petar Penkov <ppenkov@google.com>

Acked-by: Song Liu <songliubraving@fb.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [bpf-next] bpf: fix error check in bpf_tcp_gen_syncookie
  2019-08-27 23:46 [bpf-next] bpf: fix error check in bpf_tcp_gen_syncookie Petar Penkov
  2019-08-28 19:15 ` Song Liu
@ 2019-08-30 23:23 ` Daniel Borkmann
  1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2019-08-30 23:23 UTC (permalink / raw)
  To: Petar Penkov, netdev, bpf; +Cc: davem, ast, Petar Penkov, Stanislav Fomichev

On 8/28/19 1:46 AM, Petar Penkov wrote:
> From: Petar Penkov <ppenkov@google.com>
> 
> If a SYN cookie is not issued by tcp_v#_gen_syncookie, then the return
> value will be exactly 0, rather than <= 0. Let's change the check to
> reflect that, especially since mss is an unsigned value and cannot be
> negative.
> 
> Fixes: 70d66244317e ("bpf: add bpf_tcp_gen_syncookie helper")
> Reported-by: Stanislav Fomichev <sdf@google.com>
> Signed-off-by: Petar Penkov <ppenkov@google.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-08-30 23:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-27 23:46 [bpf-next] bpf: fix error check in bpf_tcp_gen_syncookie Petar Penkov
2019-08-28 19:15 ` Song Liu
2019-08-30 23:23 ` Daniel Borkmann

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.