svn commit: r232509 - head/sys/compat/ndis
Bruce Cran
brucec at FreeBSD.org
Sun Mar 4 17:08:44 UTC 2012
Author: brucec
Date: Sun Mar 4 17:08:43 2012
New Revision: 232509
URL: http://svn.freebsd.org/changeset/base/232509
Log:
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>
Modified:
head/sys/compat/ndis/subr_hal.c
Modified: head/sys/compat/ndis/subr_hal.c
==============================================================================
--- head/sys/compat/ndis/subr_hal.c Sun Mar 4 17:00:46 2012 (r232508)
+++ head/sys/compat/ndis/subr_hal.c Sun Mar 4 17:08:43 2012 (r232509)
@@ -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);
More information about the svn-src-all
mailing list