Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2009 01:56:37 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192870 - head/sys/dev/xen/netfront
Message-ID:  <200905270156.n4R1ubKq080410@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Wed May 27 01:56:37 2009
New Revision: 192870
URL: http://svn.freebsd.org/changeset/base/192870

Log:
  Do the invariant check before the mbuf is dereferenced.

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==============================================================================
--- head/sys/dev/xen/netfront/netfront.c	Wed May 27 01:54:26 2009	(r192869)
+++ head/sys/dev/xen/netfront/netfront.c	Wed May 27 01:56:37 2009	(r192870)
@@ -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 "



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