From owner-freebsd-bugs@FreeBSD.ORG Wed Dec 5 05:50:01 2007 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9928016A421 for ; Wed, 5 Dec 2007 05:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7549F13C455 for ; Wed, 5 Dec 2007 05:50:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id lB55o1Ag049129 for ; Wed, 5 Dec 2007 05:50:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id lB55o1CM049128; Wed, 5 Dec 2007 05:50:01 GMT (envelope-from gnats) Resent-Date: Wed, 5 Dec 2007 05:50:01 GMT Resent-Message-Id: <200712050550.lB55o1CM049128@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Weongyo Jeong Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A399A16A420 for ; Wed, 5 Dec 2007 05:46:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id 8F31F13C46E for ; Wed, 5 Dec 2007 05:46:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id lB55kDa5039075 for ; Wed, 5 Dec 2007 05:46:13 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id lB55kDwi039074; Wed, 5 Dec 2007 05:46:13 GMT (envelope-from nobody) Message-Id: <200712050546.lB55kDwi039074@www.freebsd.org> Date: Wed, 5 Dec 2007 05:46:13 GMT From: Weongyo Jeong To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/118439: [PATCH] if_ndis - fix a panic when ndis_attach() failed. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2007 05:50:01 -0000 >Number: 118439 >Category: kern >Synopsis: [PATCH] if_ndis - fix a panic when ndis_attach() failed. >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 05 05:50:01 UTC 2007 >Closed-Date: >Last-Modified: >Originator: Weongyo Jeong >Release: FreeBSD-CURRENT >Organization: CDNetworks >Environment: >Description: When ndis_attach() failed to initialize a device, it always call ndis_detach(). However, the problem is that it can try to call taskqueue_drain() or taskqueue_free() of sc->ndis_tq before taskqueue_create() function is called. sc->ndis_tq variable is only initialized when a driver module is for wireless NICs. This problem can drive the kernel to a panic. >How-To-Repeat: >Fix: Patch attached with submission follows: Index: if_ndis.c =================================================================== RCS file: /data/cvs/src/sys/dev/if_ndis/if_ndis.c,v retrieving revision 1.128 diff -u -r1.128 if_ndis.c --- if_ndis.c 4 Dec 2007 20:48:32 -0000 1.128 +++ if_ndis.c 5 Dec 2007 02:49:17 -0000 @@ -958,7 +958,8 @@ } else NDIS_UNLOCK(sc); - taskqueue_drain(sc->ndis_tq, &sc->ndis_scantask); + if (sc->ndis_80211) + taskqueue_drain(sc->ndis_tq, &sc->ndis_scantask); if (sc->ndis_tickitem != NULL) IoFreeWorkItem(sc->ndis_tickitem); @@ -1017,7 +1018,8 @@ if (sc->ndis_iftype == PCIBus) bus_dma_tag_destroy(sc->ndis_parent_tag); - taskqueue_free(sc->ndis_tq); + if (sc->ndis_80211) + taskqueue_free(sc->ndis_tq); return(0); } >Release-Note: >Audit-Trail: >Unformatted: