Author: kevlo
Date: Fri May 11 07:12:18 2012
New Revision: 235262
URL: http://svn.freebsd.org/changeset/base/235262

Log:
  Make sure we don't dereference a null pointer

Modified:
  head/sys/dev/re/if_re.c

Modified: head/sys/dev/re/if_re.c
==============================================================================
--- head/sys/dev/re/if_re.c     Fri May 11 04:18:39 2012        (r235261)
+++ head/sys/dev/re/if_re.c     Fri May 11 07:12:18 2012        (r235262)
@@ -1753,8 +1753,12 @@ re_detach(device_t dev)
                bus_teardown_intr(dev, sc->rl_irq[0], sc->rl_intrhand[0]);
                sc->rl_intrhand[0] = NULL;
        }
-       if (ifp != NULL)
+       if (ifp != NULL) {
+#ifdef DEV_NETMAP
+               netmap_detach(ifp);
+#endif /* DEV_NETMAP */
                if_free(ifp);
+       }
        if ((sc->rl_flags & (RL_FLAG_MSI | RL_FLAG_MSIX)) == 0)
                rid = 0;
        else
@@ -1843,9 +1847,6 @@ re_detach(device_t dev)
                bus_dma_tag_destroy(sc->rl_ldata.rl_stag);
        }
 
-#ifdef DEV_NETMAP
-       netmap_detach(ifp);
-#endif /* DEV_NETMAP */
        if (sc->rl_parent_tag)
                bus_dma_tag_destroy(sc->rl_parent_tag);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to