Skip to contentSkip to conversation

net/cnxk: fix crash in IPsec telemetry

PATCH Applied David Marchand 2 participants 2 messages May 19, 2022 – Jun 13, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/cnxk: fix crash in IPsec telemetry

Calling this telemetry callback with no argument caused a crash.

Fixes 41cc645c214f ("net/cnxk: add inline IPsec telemetry for CN9K")
---
 drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c +3 -0
index dfad5af8fe..bfdbd1ee5d 100644
@@ -229,6 +229,9 @@ ethdev_sec_tel_handle_info(const char *cmd __rte_unused, const char *params,
 	uint32_t i;
 	int ret;
 
+	if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+		return -EINVAL;
+
 	port_id = strtoul(params, &end_p, 0);
 	if (errno != 0)
 		return -EINVAL;
Signature · 1 line
2.36.1
Applied
#1 lore raw
Quoted 7 lines · David Marchand

Calling this telemetry callback with no argument caused a crash.

Fixes 41cc645c214f ("net/cnxk: add inline IPsec telemetry for CN9K")

Applied to dpdk-next-net-mrvl/for-next-net. Thanks

Quoted 21 lines
---
 drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/cnxk/cnxk_ethdev_sec_telemetry.c +3 -1
index dfad5af8fe..bfdbd1ee5d 100644
@@ -229,6 +229,9 @@ ethdev_sec_tel_handle_info(const char *cmd __rte_unused, const char *params,
        uint32_t i;
        int ret;
 
+       if (params == NULL || strlen(params) == 0 || !isdigit(*params))
+               return -EINVAL;
+
        port_id = strtoul(params, &end_p, 0);
        if (errno != 0)
                return -EINVAL;
--

2.36.1