Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci/ixgbe Keep m_len and m_pkthdr.len consistent to ...



details:   https://anonhg.NetBSD.org/src/rev/f7cb4f692b2d
branches:  trunk
changeset: 379141:f7cb4f692b2d
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Fri May 14 05:15:17 2021 +0000

description:
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.

diffstat:

 sys/dev/pci/ixgbe/ix_txrx.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (49 lines):

diff -r 48d1a9b6fa2b -r f7cb4f692b2d sys/dev/pci/ixgbe/ix_txrx.c
--- a/sys/dev/pci/ixgbe/ix_txrx.c       Fri May 14 01:30:06 2021 +0000
+++ b/sys/dev/pci/ixgbe/ix_txrx.c       Fri May 14 05:15:17 2021 +0000
@@ -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;
 



Home | Main Index | Thread Index | Old Index