From owner-dev-commits-src-all@freebsd.org Thu Apr 15 23:01:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 171C05DBAB2; Thu, 15 Apr 2021 23:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FLvwy06hlz4y85; Thu, 15 Apr 2021 23:01:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB3BB1A0B0; Thu, 15 Apr 2021 23:01:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13FN1rXD037142; Thu, 15 Apr 2021 23:01:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13FN1rJa037141; Thu, 15 Apr 2021 23:01:53 GMT (envelope-from git) Date: Thu, 15 Apr 2021 23:01:53 GMT Message-Id: <202104152301.13FN1rJa037141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Tai-hwa Liang Subject: git: bdf316e892e9 - main - fwip(4): fixing kernel panic when receiving unicast packet MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bdf316e892e9a7afa70e094135b5d05fbc26e867 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Apr 2021 23:01:54 -0000 The branch main has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=bdf316e892e9a7afa70e094135b5d05fbc26e867 commit bdf316e892e9a7afa70e094135b5d05fbc26e867 Author: Tai-hwa Liang AuthorDate: 2021-04-15 14:24:14 +0000 Commit: Tai-hwa Liang CommitDate: 2021-04-15 22:56:07 +0000 fwip(4): fixing kernel panic when receiving unicast packet Wrapping fwip_unicast_input() with NET_EPOCH_{ENTER,EXIT} to avoid a NET_EPOCH_ASSERT() in netisr_dispatch(). Reviewed by: hselasky MFC after: 2 weeks --- sys/dev/firewire/if_fwip.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/firewire/if_fwip.c b/sys/dev/firewire/if_fwip.c index 46cd56e30748..e45fd67baea7 100644 --- a/sys/dev/firewire/if_fwip.c +++ b/sys/dev/firewire/if_fwip.c @@ -838,6 +838,7 @@ fwip_unicast_input(struct fw_xfer *xfer) uint64_t address; struct mbuf *m; struct m_tag *mtag; + struct epoch_tracker et; struct ifnet *ifp; struct fwip_softc *fwip; struct fw_pkt *fp; @@ -863,6 +864,7 @@ fwip_unicast_input(struct fw_xfer *xfer) } else { rtcode = FWRCODE_COMPLETE; } + NET_EPOCH_ENTER(et); /* * Pick up a new mbuf and stick it on the back of the receive @@ -876,7 +878,7 @@ fwip_unicast_input(struct fw_xfer *xfer) if (rtcode != FWRCODE_COMPLETE) { m_freem(m); if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); - return; + goto done; } if (bpf_peers_present(ifp->if_bpf)) { @@ -911,6 +913,8 @@ fwip_unicast_input(struct fw_xfer *xfer) m->m_pkthdr.rcvif = ifp; firewire_input(ifp, m, fp->mode.wreqb.src); if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); +done: + NET_EPOCH_EXIT(et); } static devclass_t fwip_devclass;