From owner-svn-src-all@freebsd.org Fri May 13 05:57:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B314B38348; Fri, 13 May 2016 05:57:23 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EB88E1D99; Fri, 13 May 2016 05:57:22 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4D5vMK0015637; Fri, 13 May 2016 05:57:22 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4D5vMBZ015636; Fri, 13 May 2016 05:57:22 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <201605130557.u4D5vMBZ015636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Fri, 13 May 2016 05:57:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r299590 - head/sys/dev/bxe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 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: Fri, 13 May 2016 05:57:23 -0000 Author: scottl Date: Fri May 13 05:57:21 2016 New Revision: 299590 URL: https://svnweb.freebsd.org/changeset/base/299590 Log: Don't jam the softc in the device_probe routine. The softc isn't owned by the driver here, so it shouldn't be accessed, let alone written to. Remove the nearby debug line, it's the only thing that depended on the softc, and it depended on it in a way that couldn't work in this part of the code. This fixes some reports of use-after-free and system instability with DEBUG_MEMGUARD enabled. Submitted by: Matthew Macy MFC after: 3 days Modified: head/sys/dev/bxe/bxe.c Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Fri May 13 05:49:02 2016 (r299589) +++ head/sys/dev/bxe/bxe.c Fri May 13 05:57:21 2016 (r299590) @@ -2454,14 +2454,11 @@ bxe_sp_post(struct bxe_softc *sc, static int bxe_probe(device_t dev) { - struct bxe_softc *sc; struct bxe_device_type *t; char *descbuf; uint16_t did, sdid, svid, vid; /* Find our device structure */ - sc = device_get_softc(dev); - sc->dev = dev; t = bxe_devs; /* Get the data for the device to be probed. */ @@ -2470,10 +2467,6 @@ bxe_probe(device_t dev) svid = pci_get_subvendor(dev); sdid = pci_get_subdevice(dev); - BLOGD(sc, DBG_LOAD, - "%s(); VID = 0x%04X, DID = 0x%04X, SVID = 0x%04X, " - "SDID = 0x%04X\n", __FUNCTION__, vid, did, svid, sdid); - /* Look through the list of known devices for a match. */ while (t->bxe_name != NULL) { if ((vid == t->bxe_vid) && (did == t->bxe_did) &&