From owner-svn-src-stable-11@freebsd.org Mon Jul 23 17:35:21 2018 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68FE21050CD0; Mon, 23 Jul 2018 17:35:21 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13B2086970; Mon, 23 Jul 2018 17:35:21 +0000 (UTC) (envelope-from dexuan@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4D841FA4F; Mon, 23 Jul 2018 17:35:20 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6NHZK4Z019158; Mon, 23 Jul 2018 17:35:20 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6NHZKZn019157; Mon, 23 Jul 2018 17:35:20 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201807231735.w6NHZKZn019157@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Mon, 23 Jul 2018 17:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r336643 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 X-SVN-Commit-Author: dexuan X-SVN-Commit-Paths: stable/11/sys/dev/hyperv/netvsc X-SVN-Commit-Revision: 336643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jul 2018 17:35:21 -0000 Author: dexuan Date: Mon Jul 23 17:35:20 2018 New Revision: 336643 URL: https://svnweb.freebsd.org/changeset/base/336643 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/11/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 23 17:26:38 2018 (r336642) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Mon Jul 23 17:35:20 2018 (r336643) @@ -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);