Author: dexuan
Date: Tue Jul 17 21:05:08 2018
New Revision: 336426
URL: https://svnweb.freebsd.org/changeset/base/336426

Log:
  hyperv/hn: Fix panic in hypervisor code upon device detach event
  
  Submitted by: hselasky
  Reviewed by:  dexuan
  MFC after:    3 days
  Differential Revision:        https://reviews.freebsd.org/D16139

Modified:
  head/sys/dev/hyperv/netvsc/if_hn.c

Modified: head/sys/dev/hyperv/netvsc/if_hn.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/if_hn.c  Tue Jul 17 20:26:17 2018        
(r336425)
+++ head/sys/dev/hyperv/netvsc/if_hn.c  Tue Jul 17 21:05:08 2018        
(r336426)
@@ -1161,6 +1161,13 @@ hn_ismyvf(const struct hn_softc *sc, const struct ifne
            strcmp(ifp->if_dname, "vlan") == 0)
                return (false);
 
+       /*
+        * During detach events ifp->if_addr might be NULL.
+        * Make sure the bcmp() below doesn't panic on that:
+        */
+       if (ifp->if_addr == NULL || hn_ifp->if_addr == NULL)
+               return (false);
+
        if (bcmp(IF_LLADDR(ifp), IF_LLADDR(hn_ifp), ETHER_ADDR_LEN) != 0)
                return (false);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to