svn commit: r285624 - stable/9/sys/compat/ndis
Christian Brueffer
brueffer at FreeBSD.org
Thu Jul 16 09:08:37 UTC 2015
Author: brueffer
Date: Thu Jul 16 09:08:36 2015
New Revision: 285624
URL: https://svnweb.freebsd.org/changeset/base/285624
Log:
MFC: r232509 by brucec
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:
stable/9/sys/compat/ndis/subr_hal.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/compat/ndis/subr_hal.c
==============================================================================
--- stable/9/sys/compat/ndis/subr_hal.c Thu Jul 16 08:03:23 2015 (r285623)
+++ stable/9/sys/compat/ndis/subr_hal.c Thu Jul 16 09:08:36 2015 (r285624)
@@ -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-stable-9
mailing list