Skip to content

Commit 51e4a96

Browse files
Muchun Songkernel-patches-bot
Muchun Song
authored andcommitted
The in_atomic macro cannot always detect atomic context. In particular,
it cannot know about held spinlocks in non-preemptible kernels. Although, there is no user call bpf_link_put() with holding spinlock now. Be the safe side, we can avoid this in the feature. Signed-off-by: Muchun Song <[email protected]> --- kernel/bpf/syscall.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
1 parent 1a714c0 commit 51e4a96

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

kernel/bpf/syscall.c

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

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-
}
2348+
INIT_WORK(&link->work, bpf_link_put_deferred);
2349+
schedule_work(&link->work);
23542350
}
23552351

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

0 commit comments

Comments
 (0)