Module Name: src
Committed By: msaitoh
Date: Fri May 14 05:15:17 UTC 2021
Modified Files:
src/sys/dev/pci/ixgbe: ix_txrx.c
Log Message:
Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
Arm's bus_dmamap_load_mbuf() keeps a pointer to the original mbuf
and bus_dmamap_sync() refers it. ixgbe_rxeof() modified mbuf's m_len
inconsistently with m_pkthdr and dm_mapsize. "ifconfig down up" made
panic by referring the inconsistent mbuf length.
To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/ixgbe/ix_txrx.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/ixgbe/ix_txrx.c
diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.73 src/sys/dev/pci/ixgbe/ix_txrx.c:1.74
--- src/sys/dev/pci/ixgbe/ix_txrx.c:1.73 Fri May 14 01:30:06 2021
+++ src/sys/dev/pci/ixgbe/ix_txrx.c Fri May 14 05:15:17 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ix_txrx.c,v 1.73 2021/05/14 01:30:06 knakahara Exp $ */
+/* $NetBSD: ix_txrx.c,v 1.74 2021/05/14 05:15:17 msaitoh Exp $ */
/******************************************************************************
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.73 2021/05/14 01:30:06 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.74 2021/05/14 05:15:17 msaitoh Exp $");
#include "opt_inet.h"
#include "opt_inet6.h"
@@ -1949,7 +1949,6 @@ ixgbe_rxeof(struct ix_queue *que)
* buffer struct and pass this along from one
* descriptor to the next, until we get EOP.
*/
- mp->m_len = len;
/*
* See if there is a stored head
* that determines what we are
@@ -1958,6 +1957,7 @@ ixgbe_rxeof(struct ix_queue *que)
if (sendmp != NULL) { /* secondary frag */
rbuf->buf = newmp;
rbuf->fmp = NULL;
+ mp->m_len = len;
mp->m_flags &= ~M_PKTHDR;
sendmp->m_pkthdr.len += mp->m_len;
} else {
@@ -1983,12 +1983,13 @@ ixgbe_rxeof(struct ix_queue *que)
if (sendmp == NULL) {
rbuf->buf = newmp;
rbuf->fmp = NULL;
+ mp->m_len = len;
sendmp = mp;
}
/* first desc of a non-ps chain */
sendmp->m_flags |= M_PKTHDR;
- sendmp->m_pkthdr.len = mp->m_len;
+ sendmp->m_pkthdr.len = len;
}
++processed;