plic: Fix lock/unlock mismatch in plic__irq_trig()
PATCH 1/1 plic: Fix lock/unlock mismatch in plic__irq_trig()
plic__irq_trig() may call mutex_unlock(&s->irq_lock) without having acquired the lock first. In some condition, the function jumps to the done label and s->irq_lock is unlocked without lock first.
Signed-off-by jk.hong <[email protected]>
--- riscv/plic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
riscv/plic.c +1 -2
@@ -217,7 +217,7 @@ static void plic__irq_trig(struct kvm *kvm, int irq, int level, bool edge)return ;if (irq <=0 || s->num_irq <= (u32 )irq) - goto done; +return ;mutex_lock (&s->irq_lock);
@@ -261,7 +261,6 @@ static void plic__irq_trig(struct kvm *kvm, int irq, int level, bool edge)break ; } -done:mutex_unlock (&s->irq_lock); }
Signature · 1 line
2.48.1
Will Deacon
AppliedQuoted 4 lines · jk.hong
plic__irq_trig()may callmutex_unlock(&s->irq_lock)without having acquired the lock first. In some condition, the function jumps to the done label ands->irq_lockis unlocked without lock first.
Applied to kvmtool (master), thanks!
[1/1] plic: Fix lock/unlock mismatch in plic__irq_trig()
https://git.kernel.org/will/kvmtool/c/5a1233d80dec
Cheers,
Signature · 5 lines
Will https://fixes.arm64.dev https://next.arm64.dev https://will.arm64.dev