From owner-svn-src-head@FreeBSD.ORG Wed Nov 28 07:12:09 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 52A21970; Wed, 28 Nov 2012 07:12:09 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 388ED8FC08; Wed, 28 Nov 2012 07:12:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qAS7C9Q6064016; Wed, 28 Nov 2012 07:12:09 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qAS7C9Lr064014; Wed, 28 Nov 2012 07:12:09 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211280712.qAS7C9Lr064014@svn.freebsd.org> From: Adrian Chadd Date: Wed, 28 Nov 2012 07:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r243648 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Nov 2012 07:12:09 -0000 Author: adrian Date: Wed Nov 28 07:12:08 2012 New Revision: 243648 URL: http://svnweb.freebsd.org/changeset/base/243648 Log: Call if_free() with the correct vnet context if and only if ifp_vnet isn't NULL. If the attach fails prematurely and there's no if_vnet context, calling CURVNET_SET(ifp->if_vnet) is going to dereference a NULL pointer. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Wed Nov 28 06:55:34 2012 (r243647) +++ head/sys/dev/ath/if_ath.c Wed Nov 28 07:12:08 2012 (r243648) @@ -918,11 +918,16 @@ bad2: bad: if (ah) ath_hal_detach(ah); - if (ifp != NULL) { + + /* + * To work around scoping issues with CURVNET_SET/CURVNET_RESTORE.. + */ + if (ifp != NULL && ifp->if_vnet) { CURVNET_SET(ifp->if_vnet); if_free(ifp); CURVNET_RESTORE(); - } + } else if (ifp != NULL) + if_free(ifp); sc->sc_invalid = 1; return error; }