From owner-svn-src-all@FreeBSD.ORG Sun Mar 4 17:08:44 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6857A1065670; Sun, 4 Mar 2012 17:08:44 +0000 (UTC) (envelope-from brucec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 53C938FC12; Sun, 4 Mar 2012 17:08:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q24H8iIT044603; Sun, 4 Mar 2012 17:08:44 GMT (envelope-from brucec@svn.freebsd.org) Received: (from brucec@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q24H8iAR044601; Sun, 4 Mar 2012 17:08:44 GMT (envelope-from brucec@svn.freebsd.org) Message-Id: <201203041708.q24H8iAR044601@svn.freebsd.org> From: Bruce Cran Date: Sun, 4 Mar 2012 17:08:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232509 - head/sys/compat/ndis X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Mar 2012 17:08:44 -0000 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 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);