Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Jul 2018 17:38:35 +0000 (UTC)
From:      Dexuan Cui <dexuan@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r336644 - stable/10/sys/dev/hyperv/netvsc
Message-ID:  <201807231738.w6NHcZdL019458@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dexuan
Date: Mon Jul 23 17:38:35 2018
New Revision: 336644
URL: https://svnweb.freebsd.org/changeset/base/336644

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

Modified:
  stable/10/sys/dev/hyperv/netvsc/if_hn.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c
==============================================================================
--- stable/10/sys/dev/hyperv/netvsc/if_hn.c	Mon Jul 23 17:35:20 2018	(r336643)
+++ stable/10/sys/dev/hyperv/netvsc/if_hn.c	Mon Jul 23 17:38:35 2018	(r336644)
@@ -1157,6 +1157,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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201807231738.w6NHcZdL019458>