projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b0d93b4
)
bpf: Omit superfluous address family check in __bpf_skc_lookup
author
Tobias Klauser
<tklauser@distanz.ch>
Thu, 30 Jun 2022 08:26:18 +0000
(10:26 +0200)
committer
Daniel Borkmann
<daniel@iogearbox.net>
Tue, 5 Jul 2022 09:51:30 +0000
(11:51 +0200)
family is only set to either AF_INET or AF_INET6 based on len. In all
other cases we return early. Thus the check against AF_UNSPEC can be
omitted.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link:
https://lore.kernel.org/bpf/20220630082618.15649-1-tklauser@distanz.ch
net/core/filter.c
patch
|
blob
|
history
diff --git
a/net/core/filter.c
b/net/core/filter.c
index c6941ab0eb52d7d98a1cdb0591acb1d9e12d8795..4fae919843592a16e51d92cf1bd1491df012bdd4 100644
(file)
--- a/
net/core/filter.c
+++ b/
net/core/filter.c
@@
-6516,8
+6516,8
@@
__bpf_skc_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,
u64 flags)
{
struct sock *sk = NULL;
- u8 family = AF_UNSPEC;
struct net *net;
+ u8 family;
int sdif;
if (len == sizeof(tuple->ipv4))
@@
-6527,8
+6527,7
@@
__bpf_skc_lookup(struct sk_buff *skb, struct bpf_sock_tuple *tuple, u32 len,
else
return NULL;
- if (unlikely(family == AF_UNSPEC || flags ||
- !((s32)netns_id < 0 || netns_id <= S32_MAX)))
+ if (unlikely(flags || !((s32)netns_id < 0 || netns_id <= S32_MAX)))
goto out;
if (family == AF_INET)