1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

Do the invariant check before the mbuf is dereferenced.

This commit is contained in:
Adrian Chadd 2009-05-27 01:56:37 +00:00
parent c099cafa14
commit 2d8fae9867
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=192870

View File

@ -1065,6 +1065,8 @@ xn_txeof(struct netfront_info *np)
id = txr->id;
m = np->xn_cdata.xn_tx_chain[id];
KASSERT(m != NULL, ("mbuf not found in xn_tx_chain"));
M_ASSERTVALID(m);
/*
* Increment packet count if this is the last
@ -1072,8 +1074,6 @@ xn_txeof(struct netfront_info *np)
*/
if (!m->m_next)
ifp->if_opackets++;
KASSERT(m != NULL, ("mbuf not found in xn_tx_chain"));
M_ASSERTVALID(m);
if (unlikely(gnttab_query_foreign_access(
np->grant_tx_ref[id]) != 0)) {
printf("network_tx_buf_gc: warning "