Skip to content

Commit d24f7c7

Browse files
strssndktndavem330
authored andcommitted
bpf: bpf_lock on kallsysms doesn't need to be irqsave
Hannes rightfully spotted that the bpf_lock doesn't need to be irqsave variant. We never perform any such updates where this would be necessary (neither right now nor in future), therefore relax this further. Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 728a853 commit d24f7c7

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

kernel/bpf/core.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -394,27 +394,23 @@ static bool bpf_prog_kallsyms_verify_off(const struct bpf_prog *fp)
394394

395395
void bpf_prog_kallsyms_add(struct bpf_prog *fp)
396396
{
397-
unsigned long flags;
398-
399397
if (!bpf_prog_kallsyms_candidate(fp) ||
400398
!capable(CAP_SYS_ADMIN))
401399
return;
402400

403-
spin_lock_irqsave(&bpf_lock, flags);
401+
spin_lock_bh(&bpf_lock);
404402
bpf_prog_ksym_node_add(fp->aux);
405-
spin_unlock_irqrestore(&bpf_lock, flags);
403+
spin_unlock_bh(&bpf_lock);
406404
}
407405

408406
void bpf_prog_kallsyms_del(struct bpf_prog *fp)
409407
{
410-
unsigned long flags;
411-
412408
if (!bpf_prog_kallsyms_candidate(fp))
413409
return;
414410

415-
spin_lock_irqsave(&bpf_lock, flags);
411+
spin_lock_bh(&bpf_lock);
416412
bpf_prog_ksym_node_del(fp->aux);
417-
spin_unlock_irqrestore(&bpf_lock, flags);
413+
spin_unlock_bh(&bpf_lock);
418414
}
419415

420416
static struct bpf_prog *bpf_prog_kallsyms_find(unsigned long addr)

0 commit comments

Comments
 (0)