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/32a052254a8d
branches:  trunk
changeset: 983288:32a052254a8d
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 9e42f89f1f81 -r 32a052254a8d 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 @@
                 * 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 @@
                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 @@
                        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