svn commit: r299590 - head/sys/dev/bxe

Scott Long scottl at FreeBSD.org
Fri May 13 05:57:23 UTC 2016


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) &&


More information about the svn-src-head mailing list