Disable interrupts first and then set spinlock_count to 1.

Otherwise interrupt can be generated just after setting spinlock_count
and before disabling interrupts.

Sponsored by:	DARPA, AFRL
This commit is contained in:
Ruslan Bukin 2019-05-07 14:32:17 +00:00
parent 75cf8837a9
commit bf03b1f1f9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347226

View File

@ -457,11 +457,13 @@ void
spinlock_enter(void)
{
struct thread *td;
register_t reg;
td = curthread;
if (td->td_md.md_spinlock_count == 0) {
reg = intr_disable();
td->td_md.md_spinlock_count = 1;
td->td_md.md_saved_sstatus_ie = intr_disable();
td->td_md.md_saved_sstatus_ie = reg;
} else
td->td_md.md_spinlock_count++;
critical_enter();