From 535ac52efadc5c5cdb0483ad55c306cfaff71d50 Mon Sep 17 00:00:00 2001 From: Robert Morris Date: Mon, 1 Jul 2019 14:15:18 -0400 Subject: [PATCH] oops, don't hold mycpu() result across intr_off() --- kernel/spinlock.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kernel/spinlock.c b/kernel/spinlock.c index 557a86c..5a44a46 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c @@ -87,13 +87,12 @@ holding(struct spinlock *lk) void push_off(void) { - struct cpu *c = mycpu(); int old = intr_get(); intr_off(); - if(c->noff == 0) - c->intena = old; - c->noff += 1; + if(mycpu()->noff == 0) + mycpu()->intena = old; + mycpu()->noff += 1; } void