diff options
author | Alexei Starovoitov <ast@kernel.org> | 2020-09-24 04:10:38 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-09-24 04:14:11 +0200 |
commit | f00f2f7fe86036a586e26bd55ad86310477199a3 (patch) | |
tree | 73e17be3699a1e48974666a0a018e178f2097ef4 | |
parent | Merge branch 'net-dsa-bcm_sf2-Additional-DT-changes' (diff) | |
download | linux-f00f2f7fe86036a586e26bd55ad86310477199a3.tar.xz linux-f00f2f7fe86036a586e26bd55ad86310477199a3.zip |
Revert "bpf: Fix potential call bpf_link_free() in atomic context"
This reverts commit 31f23a6a181c81543b10a1a9056b0e6c7ef1c747.
This change made many selftests/bpf flaky: flow_dissector, sk_lookup, sk_assign and others.
There was no issue in the code.
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to '')
-rw-r--r-- | kernel/bpf/syscall.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 34268491d2de..2740df19f55e 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -2345,8 +2345,12 @@ void bpf_link_put(struct bpf_link *link) if (!atomic64_dec_and_test(&link->refcnt)) return; - INIT_WORK(&link->work, bpf_link_put_deferred); - schedule_work(&link->work); + if (in_atomic()) { + INIT_WORK(&link->work, bpf_link_put_deferred); + schedule_work(&link->work); + } else { + bpf_link_free(link); + } } static int bpf_link_release(struct inode *inode, struct file *filp) |