[dpdk-stable] patch 'ethdev: validate input in register info' has been queued to stable release 20.11.2

Xueming Li xuemingl at nvidia.com
Mon May 10 18:01:41 CEST 2021


Hi,

FYI, your patch has been queued to stable release 20.11.2

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/12/21. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/963fcacd9561f8f666878d7128228c3822b0ea9a

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From 963fcacd9561f8f666878d7128228c3822b0ea9a Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang at huawei.com>
Date: Fri, 2 Apr 2021 10:58:49 +0800
Subject: [PATCH] ethdev: validate input in register info
Cc: Luca Boccassi <bluca at debian.org>

[ upstream commit 94af45f4005ee0c3152db45a3669bec5238a3c10 ]

This patch adds validity check of input pointer in regs dump API.

Fixes: 7a3f27cbf59b ("ethdev: add access to specific device info")
Fixes: 936eda25e8da ("net/hns3: support dump register")

Signed-off-by: Chengchang Tang <tangchengchang at huawei.com>
Signed-off-by: Min Hu (Connor) <humin29 at huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 drivers/net/hns3/hns3_regs.c   | 5 -----
 lib/librte_ethdev/rte_ethdev.c | 2 ++
 lib/librte_ethdev/rte_ethdev.h | 1 +
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c
index 3d2e66a594..d725f14001 100644
--- a/drivers/net/hns3/hns3_regs.c
+++ b/drivers/net/hns3/hns3_regs.c
@@ -322,11 +322,6 @@ hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs)
 	uint32_t *data;
 	int ret;
 
-	if (regs == NULL) {
-		hns3_err(hw, "the input parameter regs is NULL!");
-		return -EINVAL;
-	}
-
 	ret = hns3_get_regs_length(hw, &length);
 	if (ret)
 		return ret;
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 8e34c874ac..3e3a5bd8cf 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -5258,6 +5258,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
 	struct rte_eth_dev *dev;
 
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
+	if (info == NULL)
+		return -EINVAL;
 
 	dev = &rte_eth_devices[port_id];
 	RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP);
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 760214efb8..1cd1ef9d54 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -4395,6 +4395,7 @@ int rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info);
  * @return
  *   - (0) if successful.
  *   - (-ENOTSUP) if hardware doesn't support.
+ *   - (-EINVAL) if bad parameter.
  *   - (-ENODEV) if *port_id* invalid.
  *   - (-EIO) if device is removed.
  *   - others depends on the specific operations implementation.
-- 
2.25.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-05-10 23:59:30.546710300 +0800
+++ 0153-ethdev-validate-input-in-register-info.patch	2021-05-10 23:59:26.590000000 +0800
@@ -1 +1 @@
-From 94af45f4005ee0c3152db45a3669bec5238a3c10 Mon Sep 17 00:00:00 2001
+From 963fcacd9561f8f666878d7128228c3822b0ea9a Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Luca Boccassi <bluca at debian.org>
+
+[ upstream commit 94af45f4005ee0c3152db45a3669bec5238a3c10 ]
@@ -10 +12,0 @@
-Cc: stable at dpdk.org
@@ -22 +24 @@
-index d53c132b1e..5d15613c67 100644
+index 3d2e66a594..d725f14001 100644
@@ -25 +27 @@
-@@ -484,11 +484,6 @@ hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs)
+@@ -322,11 +322,6 @@ hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs)
@@ -38 +40 @@
-index bb195abe70..3fe200d508 100644
+index 8e34c874ac..3e3a5bd8cf 100644
@@ -41 +43 @@
-@@ -5286,6 +5286,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
+@@ -5258,6 +5258,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info)
@@ -51 +53 @@
-index f5bbc10b68..1ad7cda27d 100644
+index 760214efb8..1cd1ef9d54 100644
@@ -54 +56 @@
-@@ -4403,6 +4403,7 @@ int rte_eth_get_monitor_addr(uint16_t port_id, uint16_t queue_id,
+@@ -4395,6 +4395,7 @@ int rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info);


More information about the stable mailing list