代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/dpdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 5b84cc2a652f2646d2d4b4cdc1e6b00c13f4d790 Mon Sep 17 00:00:00 2001
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Fri, 27 May 2022 11:40:54 +0800
Subject: [PATCH 104/122] dma/hisilicon: enhance CQ scan robustness
The CQ (completion queue) descriptors were updated by hardware, and then
scanned by driver to retrieve hardware completion status.
This patch enhances robustness by following:
1. replace while (true) with a finite loop to avoid potential dead loop.
2. check the csq_head field in CQ descriptor to avoid status array
overflows.
Fixes: 2db4f0b82360 ("dma/hisilicon: add data path")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/dma/hisilicon/hisi_dmadev.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c
index f5c3cd914d..fbe09284ed 100644
--- a/drivers/dma/hisilicon/hisi_dmadev.c
+++ b/drivers/dma/hisilicon/hisi_dmadev.c
@@ -634,7 +634,7 @@ hisi_dma_scan_cq(struct hisi_dma_dev *hw)
uint16_t count = 0;
uint64_t misc;
- while (true) {
+ while (count < hw->cq_depth) {
cqe = &hw->cqe[cq_head];
misc = cqe->misc;
misc = rte_le_to_cpu_64(misc);
@@ -642,6 +642,16 @@ hisi_dma_scan_cq(struct hisi_dma_dev *hw)
break;
csq_head = FIELD_GET(CQE_SQ_HEAD_MASK, misc);
+ if (unlikely(csq_head > hw->sq_depth_mask)) {
+ /**
+ * Defensive programming to prevent overflow of the
+ * status array indexed by csq_head. Only error logs
+ * are used for prompting.
+ */
+ HISI_DMA_ERR(hw, "invalid csq_head:%u!\n", csq_head);
+ count = 0;
+ break;
+ }
if (unlikely(misc & CQE_STATUS_MASK))
hw->status[csq_head] = FIELD_GET(CQE_STATUS_MASK,
misc);
--
2.22.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。