diff --git a/sys/kern/kern_mbuf.c b/sys/kern/kern_mbuf.c --- a/sys/kern/kern_mbuf.c +++ b/sys/kern/kern_mbuf.c @@ -1650,11 +1650,16 @@ struct ifnet * m_rcvif_restore(struct mbuf *m) { + struct ifnet *ifp; M_ASSERTPKTHDR(m); + NET_EPOCH_ASSERT(); + + ifp = ifnet_byindexgen(m->m_pkthdr.rcvidx, m->m_pkthdr.rcvgen); + if (ifp == NULL || (ifp->if_flags & IFF_DYING)) + return (NULL); - return ((m->m_pkthdr.rcvif = ifnet_byindexgen(m->m_pkthdr.rcvidx, - m->m_pkthdr.rcvgen))); + return (m->m_pkthdr.rcvif = ifp); } /*