summaryrefslogtreecommitdiff
path: root/net/ipv4
diff options
context:
space:
mode:
authorStanislav Fomichev <sdf@google.com>2020-12-02 09:25:15 -0800
committerAlexei Starovoitov <ast@kernel.org>2020-12-02 13:25:11 -0800
commit427167c0b064ed898b848209add62b4322ec7840 (patch)
tree7708fccc1fae344093e5835ee142118a1a251c2b /net/ipv4
parenta999696c547f1a8ef2ddbb9b0e77abc3f6db4ff1 (diff)
bpf: Allow bpf_{s,g}etsockopt from cgroup bind{4,6} hooks
I have to now lock/unlock socket for the bind hook execution. That shouldn't cause any overhead because the socket is unbound and shouldn't receive any traffic. Signed-off-by: Stanislav Fomichev <sdf@google.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrey Ignatov <rdna@fb.com> Link: https://lore.kernel.org/bpf/20201202172516.3483656-3-sdf@google.com
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/af_inet.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index b7260c8cef2e..b94fa8eb831b 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -450,7 +450,7 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
/* BPF prog is run before any checks are done so that if the prog
* changes context in a wrong way it will be caught.
*/
- err = BPF_CGROUP_RUN_PROG_INET4_BIND(sk, uaddr);
+ err = BPF_CGROUP_RUN_PROG_INET4_BIND_LOCK(sk, uaddr);
if (err)
return err;