Skip to content

Commit f00f2f7

Browse files
author
Alexei Starovoitov
committed
Revert "bpf: Fix potential call bpf_link_free() in atomic context"
This reverts commit 31f23a6. 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 <[email protected]>
1 parent 3fc826f commit f00f2f7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

kernel/bpf/syscall.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,8 +2345,12 @@ void bpf_link_put(struct bpf_link *link)
23452345
if (!atomic64_dec_and_test(&link->refcnt))
23462346
return;
23472347

2348-
INIT_WORK(&link->work, bpf_link_put_deferred);
2349-
schedule_work(&link->work);
2348+
if (in_atomic()) {
2349+
INIT_WORK(&link->work, bpf_link_put_deferred);
2350+
schedule_work(&link->work);
2351+
} else {
2352+
bpf_link_free(link);
2353+
}
23502354
}
23512355

23522356
static int bpf_link_release(struct inode *inode, struct file *filp)

0 commit comments

Comments
 (0)