Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jul 2015 09:08:37 +0000 (UTC)
From:      Christian Brueffer <brueffer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r285624 - stable/9/sys/compat/ndis
Message-ID:  <201507160908.t6G98boT088348@repo.freebsd.org>

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



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