[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190827234622.76209-1-ppenkov.kernel@gmail.com>
Date: Tue, 27 Aug 2019 16:46:22 -0700
From: Petar Penkov <ppenkov.kernel@...il.com>
To: netdev@...r.kernel.org, bpf@...r.kernel.org
Cc: davem@...emloft.net, ast@...nel.org, daniel@...earbox.net,
Petar Penkov <ppenkov@...gle.com>,
Stanislav Fomichev <sdf@...gle.com>
Subject: [bpf-next] bpf: fix error check in bpf_tcp_gen_syncookie
From: Petar Penkov <ppenkov@...gle.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@...gle.com>
Signed-off-by: Petar Penkov <ppenkov@...gle.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
Powered by blists - more mailing lists