* [PATCH 22.11] net/hns3: fix overwrite mbuf in vector path
@ 2025-10-28 3:16 Chengwen Feng
0 siblings, 0 replies; 2+ messages in thread
From: Chengwen Feng @ 2025-10-28 3:16 UTC (permalink / raw)
To: stable; +Cc: luca.boccassi, fengchengwen
[ upstream commit 06b296a2264fcd1fe2d167f2d90a58607f5e81f5 ]
The vector path processes multiple descriptors at a time and modifies
the corresponding mbufs accordingly. When the mbufs cannot be applied
for, the previous patch [1] only clears the first descriptor's valid
bit, which is not enough. In this patch, the mbufs points to the
fake_mbuf to prevent overwrite.
[1] commit 01843ab2f2fc ("net/hns3: fix crash for NEON and SVE")
Fixes: a3d4f4d291d7 ("net/hns3: support NEON Rx")
Fixes: 01843ab2f2fc ("net/hns3: fix crash for NEON and SVE")
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
drivers/net/hns3/hns3_rxtx_vec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c
index 2265804fda..1af064e77f 100644
--- a/drivers/net/hns3/hns3_rxtx_vec.c
+++ b/drivers/net/hns3/hns3_rxtx_vec.c
@@ -69,8 +69,12 @@ hns3_rxq_rearm_mbuf(struct hns3_rx_queue *rxq)
/*
* Clear VLD bit for the first descriptor rearmed in case
* of going to receive packets later.
+ * And also point mbufs to fake_mbuf to prevent modification
+ * of the mbuf field during vector packet receiving.
*/
rxdp[0].rx.bd_base_info = 0;
+ for (i = 0; i < HNS3_VECTOR_RX_OFFSET_TABLE_LEN; i++)
+ rxep[i].mbuf = &rxq->fake_mbuf;
rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++;
return;
}
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH 22.11] net/hns3: fix overwrite mbuf in vector path
@ 2025-10-28 2:47 Chengwen Feng
0 siblings, 0 replies; 2+ messages in thread
From: Chengwen Feng @ 2025-10-28 2:47 UTC (permalink / raw)
To: stable; +Cc: luca.boccassi
[ upstream commit 06b296a2264fcd1fe2d167f2d90a58607f5e81f5 ]
The vector path processes multiple descriptors at a time and modifies
the corresponding mbufs accordingly. When the mbufs cannot be applied
for, the previous patch [1] only clears the first descriptor's valid
bit, which is not enough. In this patch, the mbufs points to the
fake_mbuf to prevent overwrite.
[1] commit 01843ab2f2fc ("net/hns3: fix crash for NEON and SVE")
Fixes: a3d4f4d291d7 ("net/hns3: support NEON Rx")
Fixes: 01843ab2f2fc ("net/hns3: fix crash for NEON and SVE")
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Dengdui Huang <huangdengdui@huawei.com>
---
drivers/net/hns3/hns3_rxtx_vec.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c
index 2265804fda..1af064e77f 100644
--- a/drivers/net/hns3/hns3_rxtx_vec.c
+++ b/drivers/net/hns3/hns3_rxtx_vec.c
@@ -69,8 +69,12 @@ hns3_rxq_rearm_mbuf(struct hns3_rx_queue *rxq)
/*
* Clear VLD bit for the first descriptor rearmed in case
* of going to receive packets later.
+ * And also point mbufs to fake_mbuf to prevent modification
+ * of the mbuf field during vector packet receiving.
*/
rxdp[0].rx.bd_base_info = 0;
+ for (i = 0; i < HNS3_VECTOR_RX_OFFSET_TABLE_LEN; i++)
+ rxep[i].mbuf = &rxq->fake_mbuf;
rte_eth_devices[rxq->port_id].data->rx_mbuf_alloc_failed++;
return;
}
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-28 3:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-28 3:16 [PATCH 22.11] net/hns3: fix overwrite mbuf in vector path Chengwen Feng
-- strict thread matches above, loose matches on Subject: below --
2025-10-28 2:47 Chengwen Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).