Fix race condition in KfRaiseIrql().

After getting the current irql, if the kthread gets preempted and
subsequently runs on a different CPU, the saved irql could be wrong.

Also, correct the panic string.

PR:		kern/165630
Submitted by:	Vladislav Movchan <vladislav.movchan at gmail.com>
This commit is contained in:
Rebecca Cran 2012-03-04 17:08:43 +00:00
parent 4a63252f49
commit 03225fac13
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=232509

View File

@ -392,16 +392,18 @@ KfRaiseIrql(uint8_t irql)
{
uint8_t oldirql;
sched_pin();
oldirql = KeGetCurrentIrql();
/* I am so going to hell for this. */
if (oldirql > irql)
panic("IRQL_NOT_LESS_THAN");
panic("IRQL_NOT_LESS_THAN_OR_EQUAL");
if (oldirql != DISPATCH_LEVEL) {
sched_pin();
if (oldirql != DISPATCH_LEVEL)
mtx_lock(&disp_lock[curthread->td_oncpu]);
}
else
sched_unpin();
/*printf("RAISE IRQL: %d %d\n", irql, oldirql);*/
return (oldirql);