aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch
diff options
context:
space:
mode:
authorMarek BehĂșn <kabel@kernel.org>2023-04-12 13:01:25 +0200
committerChristian Lamparter <chunkeey@gmail.com>2023-06-08 15:33:14 +0200
commit76cabb95da1994b84a373346c46e52ec836edfc7 (patch)
tree292892222b3d112739adc67e238e4ea85f84ccd0 /target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch
parent47437563aafcd7158584cbfc991f754f27aebeba (diff)
downloadupstream-76cabb95da1994b84a373346c46e52ec836edfc7.tar.gz
upstream-76cabb95da1994b84a373346c46e52ec836edfc7.tar.bz2
upstream-76cabb95da1994b84a373346c46e52ec836edfc7.zip
kernel: Backport mvneta crash fix to 5.15
Backport Russell King's series [1] net: mvneta: reduce size of TSO header allocation to pending-5.15 to fix random crashes on Turris Omnia. This also backports two patches that are dependencies to this series: net: mvneta: Delete unused variable net: mvneta: fix potential double-frees in mvneta_txq_sw_deinit() [1] https://lore.kernel.org/netdev/ZCsbJ4nG+So%2Fn9qY@shell.armlinux.org.uk/ Signed-off-by: Marek BehĂșn <kabel@kernel.org> Signed-off-by: Christian Lamparter <chunkeey@gmail.com> (squashed) (cherry picked from commit 7b31c2e9ed4da7bfeecbd393c17c249eca870717)
Diffstat (limited to 'target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch')
-rw-r--r--target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch b/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch
new file mode 100644
index 0000000000..4db3ffe4e1
--- /dev/null
+++ b/target/linux/generic/pending-5.15/704-02-v6.4-net-mvneta-mark-mapped-and-tso-buffers-separately.patch
@@ -0,0 +1,42 @@
+From e3c77d0a1b635d114c147fd2078afb57ed558b81 Mon Sep 17 00:00:00 2001
+From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
+Date: Mon, 3 Apr 2023 19:30:25 +0100
+Subject: [PATCH 2/5] net: mvneta: mark mapped and tso buffers separately
+
+Mark dma-mapped skbs and TSO buffers separately, so we can use
+buf->type to identify their differences.
+
+Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
+---
+ drivers/net/ethernet/marvell/mvneta.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/marvell/mvneta.c
++++ b/drivers/net/ethernet/marvell/mvneta.c
+@@ -607,6 +607,7 @@ struct mvneta_rx_desc {
+ #endif
+
+ enum mvneta_tx_buf_type {
++ MVNETA_TYPE_TSO,
+ MVNETA_TYPE_SKB,
+ MVNETA_TYPE_XDP_TX,
+ MVNETA_TYPE_XDP_NDO,
+@@ -1852,7 +1853,8 @@ static void mvneta_txq_bufs_free(struct
+ dma_unmap_single(pp->dev->dev.parent,
+ tx_desc->buf_phys_addr,
+ tx_desc->data_size, DMA_TO_DEVICE);
+- if (buf->type == MVNETA_TYPE_SKB && buf->skb) {
++ if ((buf->type == MVNETA_TYPE_TSO ||
++ buf->type == MVNETA_TYPE_SKB) && buf->skb) {
+ bytes_compl += buf->skb->len;
+ pkts_compl++;
+ dev_kfree_skb_any(buf->skb);
+@@ -2607,7 +2609,7 @@ mvneta_tso_put_hdr(struct sk_buff *skb,
+ tx_desc->command |= MVNETA_TXD_F_DESC;
+ tx_desc->buf_phys_addr = txq->tso_hdrs_phys +
+ txq->txq_put_index * TSO_HEADER_SIZE;
+- buf->type = MVNETA_TYPE_SKB;
++ buf->type = MVNETA_TYPE_TSO;
+ buf->skb = NULL;
+
+ mvneta_txq_inc_put(txq);