Skip to content

Commit beb5b2f

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 33c7f47 commit beb5b2f

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
@@ -2335,12 +2335,8 @@ void bpf_link_put(struct bpf_link *link)
23352335
if (!atomic64_dec_and_test(&link->refcnt))
23362336
return;
23372337

2338-
if (in_atomic()) {
2339-
INIT_WORK(&link->work, bpf_link_put_deferred);
2340-
schedule_work(&link->work);
2341-
} else {
2342-
bpf_link_free(link);
2343-
}
2338+
INIT_WORK(&link->work, bpf_link_put_deferred);
2339+
schedule_work(&link->work);
23442340
}
23452341

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

0 commit comments

Comments
 (0)