Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Mar 2012 17:08:44 +0000 (UTC)
From:      Bruce Cran <brucec@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r232509 - head/sys/compat/ndis
Message-ID:  <201203041708.q24H8iAR044601@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201203041708.q24H8iAR044601>