mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-11 09:50:12 +00:00
Close a race I introduced in the spinlock_* changes. We need to finish
disabling interrupts before updating the saved pil in the thread. If we save the value first then it can be clobbered if an interrupt comes in and the interrupt handler tries to acquire a spin lock. Submitted by: marius
This commit is contained in:
parent
e897c4d6fb
commit
5d971d4895
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145085
@ -236,11 +236,13 @@ void
|
||||
spinlock_enter(void)
|
||||
{
|
||||
struct thread *td;
|
||||
register_t pil;
|
||||
|
||||
td = curthread;
|
||||
if (td->td_md.md_spinlock_count == 0) {
|
||||
td->td_md.md_saved_pil = rdpr(pil);
|
||||
pil = rdpr(pil);
|
||||
wrpr(pil, 0, 14);
|
||||
td->td_md.md_saved_pil = pil;
|
||||
}
|
||||
td->td_md.md_spinlock_count++;
|
||||
critical_enter();
|
||||
|
Loading…
Reference in New Issue
Block a user