OSDN Git Service

bpf: Fix bad unlock balance on freeze_mutex
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 26 May 2023 10:13:56 +0000 (12:13 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 26 May 2023 10:16:12 +0000 (12:16 +0200)
commit4266f41feaeee2521749ce2cfb52eafd4e2947c5
tree93e49d931c5c4355463771d46cc181f643e1dd0b
parent4aadd2920b81b3d7e5c8ac63c7d5d673f3c8aaeb
bpf: Fix bad unlock balance on freeze_mutex

Commit c4c84f6fb2c4 ("bpf: drop unnecessary bpf_capable() check in
BPF_MAP_FREEZE command") moved the permissions check outside of the
freeze_mutex in the map_freeze() handler. The error paths still jumps
to the err_put which tries to unlock the freeze_mutex even though it
was not locked in the first place. Fix it.

Fixes: c4c84f6fb2c4 ("bpf: drop unnecessary bpf_capable() check in BPF_MAP_FREEZE command")
Reported-by: syzbot+8982e75c2878b9ffeac5@syzkaller.appspotmail.com
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/syscall.c