* [PATCH 0/5] fix segment fault when parse args
@ 2023-03-14 12:48 Chengwen Feng
2023-03-14 12:48 ` [PATCH 1/5] app/pdump: " Chengwen Feng
` (6 more replies)
0 siblings, 7 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-14 12:48 UTC (permalink / raw)
To: thomas, ferruh.yigit; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
It may leads to segment fault when parse args with 'only key', this
patchset fixes rest of them.
Chengwen Feng (5):
app/pdump: fix segment fault when parse args
net/memif: fix segment fault when parse devargs
net/pcap: fix segment fault when parse devargs
net/ring: fix segment fault when parse devargs
net/sfc: fix segment fault when parse devargs
app/pdump/main.c | 12 ++++++++++++
drivers/net/memif/rte_eth_memif.c | 30 ++++++++++++++++++++++++++++++
drivers/net/pcap/pcap_ethdev.c | 13 +++++++++++--
drivers/net/ring/rte_eth_ring.c | 6 ++++++
drivers/net/sfc/sfc.c | 3 +++
drivers/net/sfc/sfc_ev.c | 3 +++
drivers/net/sfc/sfc_kvargs.c | 6 ++++++
7 files changed, 71 insertions(+), 2 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH 1/5] app/pdump: fix segment fault when parse args
2023-03-14 12:48 [PATCH 0/5] fix segment fault when parse args Chengwen Feng
@ 2023-03-14 12:48 ` Chengwen Feng
2023-03-16 17:34 ` Ferruh Yigit
2023-03-14 12:48 ` [PATCH 2/5] net/memif: fix segment fault when parse devargs Chengwen Feng
` (5 subsequent siblings)
6 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-14 12:48 UTC (permalink / raw)
To: thomas, ferruh.yigit, Reshma Pattan, Stephen Hemminger; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse --pdump args with 'only keys'
(e.g. 'port,queue=*').
Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
app/pdump/main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/app/pdump/main.c b/app/pdump/main.c
index c6cf9d9c87..d286952483 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -170,6 +170,9 @@ parse_device_id(const char *key __rte_unused, const char *value,
{
struct pdump_tuples *pt = extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
pt->device_id = strdup(value);
pt->dump_by_type = DEVICE_ID;
@@ -182,6 +185,9 @@ parse_queue(const char *key __rte_unused, const char *value, void *extra_args)
unsigned long n;
struct pdump_tuples *pt = extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (!strcmp(value, "*"))
pt->queue = RTE_PDUMP_ALL_QUEUES;
else {
@@ -197,6 +203,9 @@ parse_rxtxdev(const char *key, const char *value, void *extra_args)
struct pdump_tuples *pt = extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (!strcmp(key, PDUMP_RX_DEV_ARG)) {
strlcpy(pt->rx_dev, value, sizeof(pt->rx_dev));
/* identify the tx stream type for pcap vdev */
@@ -220,6 +229,9 @@ parse_uint_value(const char *key, const char *value, void *extra_args)
char *end;
int ret = 0;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
errno = 0;
v = extra_args;
t = strtoul(value, &end, 10);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH 2/5] net/memif: fix segment fault when parse devargs
2023-03-14 12:48 [PATCH 0/5] fix segment fault when parse args Chengwen Feng
2023-03-14 12:48 ` [PATCH 1/5] app/pdump: " Chengwen Feng
@ 2023-03-14 12:48 ` Chengwen Feng
2023-03-16 18:20 ` Ferruh Yigit
2023-03-14 12:48 ` [PATCH 3/5] net/pcap: " Chengwen Feng
` (4 subsequent siblings)
6 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-14 12:48 UTC (permalink / raw)
To: thomas, ferruh.yigit, Jakub Grajciar, Ferruh Yigit; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes: 2f865ed07bb6 ("net/memif: use abstract socket address")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/memif/rte_eth_memif.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 6a8ff5b4eb..c6674ddf25 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -1720,6 +1720,9 @@ memif_set_role(const char *key __rte_unused, const char *value,
{
enum memif_role_t *role = (enum memif_role_t *)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (strstr(value, "server") != NULL) {
*role = MEMIF_ROLE_SERVER;
} else if (strstr(value, "client") != NULL) {
@@ -1742,6 +1745,9 @@ memif_set_zc(const char *key __rte_unused, const char *value, void *extra_args)
{
uint32_t *flags = (uint32_t *)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (strstr(value, "yes") != NULL) {
if (!rte_mcfg_get_single_file_segments()) {
MIF_LOG(ERR, "Zero-copy doesn't support multi-file segments.");
@@ -1762,6 +1768,9 @@ memif_set_id(const char *key __rte_unused, const char *value, void *extra_args)
{
memif_interface_id_t *id = (memif_interface_id_t *)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
/* even if parsing fails, 0 is a valid id */
*id = strtoul(value, NULL, 10);
return 0;
@@ -1773,6 +1782,9 @@ memif_set_bs(const char *key __rte_unused, const char *value, void *extra_args)
unsigned long tmp;
uint16_t *pkt_buffer_size = (uint16_t *)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
tmp = strtoul(value, NULL, 10);
if (tmp == 0 || tmp > 0xFFFF) {
MIF_LOG(ERR, "Invalid buffer size: %s.", value);
@@ -1789,6 +1801,9 @@ memif_set_rs(const char *key __rte_unused, const char *value, void *extra_args)
memif_log2_ring_size_t *log2_ring_size =
(memif_log2_ring_size_t *)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
tmp = strtoul(value, NULL, 10);
if (tmp == 0 || tmp > ETH_MEMIF_MAX_LOG2_RING_SIZE) {
MIF_LOG(ERR, "Invalid ring size: %s (max %u).",
@@ -1840,6 +1855,9 @@ memif_set_socket_filename(const char *key __rte_unused, const char *value,
{
const char **socket_filename = (const char **)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
*socket_filename = value;
return 0;
}
@@ -1849,6 +1867,9 @@ memif_set_is_socket_abstract(const char *key __rte_unused, const char *value, vo
{
uint32_t *flags = (uint32_t *)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (strstr(value, "yes") != NULL) {
*flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
} else if (strstr(value, "no") != NULL) {
@@ -1870,6 +1891,9 @@ memif_set_owner(const char *key, const char *value, void *extra_args)
char *end = NULL;
uint32_t *id = (uint32_t *)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
val = strtoul(value, &end, 10);
if (*value == '\0' || *end != '\0') {
MIF_LOG(ERR, "Failed to parse %s: %s.", key, value);
@@ -1889,6 +1913,9 @@ memif_set_mac(const char *key __rte_unused, const char *value, void *extra_args)
{
struct rte_ether_addr *ether_addr = (struct rte_ether_addr *)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (rte_ether_unformat_addr(value, ether_addr) < 0)
MIF_LOG(WARNING, "Failed to parse mac '%s'.", value);
return 0;
@@ -1899,6 +1926,9 @@ memif_set_secret(const char *key __rte_unused, const char *value, void *extra_ar
{
const char **secret = (const char **)extra_args;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
*secret = value;
return 0;
}
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH 3/5] net/pcap: fix segment fault when parse devargs
2023-03-14 12:48 [PATCH 0/5] fix segment fault when parse args Chengwen Feng
2023-03-14 12:48 ` [PATCH 1/5] app/pdump: " Chengwen Feng
2023-03-14 12:48 ` [PATCH 2/5] net/memif: fix segment fault when parse devargs Chengwen Feng
@ 2023-03-14 12:48 ` Chengwen Feng
2023-03-16 18:20 ` Ferruh Yigit
2023-03-14 12:48 ` [PATCH 4/5] net/ring: " Chengwen Feng
` (3 subsequent siblings)
6 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-14 12:48 UTC (permalink / raw)
To: thomas, ferruh.yigit, Ferruh Yigit, Ido Goshen,
Juhamatti Kuusisaari, Cian Ferriter
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 4c173302c307 ("pcap: add new driver")
Fixes: 53bf48403409 ("net/pcap: capture only ingress packets from Rx iface")
Fixes: c9507cd0cada ("net/pcap: support physical interface MAC address")
Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/pcap/pcap_ethdev.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index bfec085045..3fa121c521 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -1034,6 +1034,9 @@ open_rx_pcap(const char *key, const char *value, void *extra_args)
struct pmd_devargs *rx = extra_args;
pcap_t *pcap = NULL;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (open_single_rx_pcap(pcap_filename, &pcap) < 0)
return -1;
@@ -1056,6 +1059,9 @@ open_tx_pcap(const char *key, const char *value, void *extra_args)
struct pmd_devargs *dumpers = extra_args;
pcap_dumper_t *dumper;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (open_single_tx_pcap(pcap_filename, &dumper) < 0)
return -1;
@@ -1077,6 +1083,9 @@ open_rx_tx_iface(const char *key, const char *value, void *extra_args)
struct pmd_devargs *tx = extra_args;
pcap_t *pcap = NULL;
+ if (value == NULL || extra_args == NULL)
+ return -EINVAL;
+
if (open_single_iface(iface, &pcap) < 0)
return -1;
@@ -1163,7 +1172,7 @@ static int
select_phy_mac(const char *key __rte_unused, const char *value,
void *extra_args)
{
- if (extra_args) {
+ if (value != NULL && extra_args != NULL) {
const int phy_mac = atoi(value);
int *enable_phy_mac = extra_args;
@@ -1177,7 +1186,7 @@ static int
get_infinite_rx_arg(const char *key __rte_unused,
const char *value, void *extra_args)
{
- if (extra_args) {
+ if (value != NULL && extra_args != NULL) {
const int infinite_rx = atoi(value);
int *enable_infinite_rx = extra_args;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH 4/5] net/ring: fix segment fault when parse devargs
2023-03-14 12:48 [PATCH 0/5] fix segment fault when parse args Chengwen Feng
` (2 preceding siblings ...)
2023-03-14 12:48 ` [PATCH 3/5] net/pcap: " Chengwen Feng
@ 2023-03-14 12:48 ` Chengwen Feng
2023-03-14 12:48 ` [PATCH 5/5] net/sfc: " Chengwen Feng
` (2 subsequent siblings)
6 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-14 12:48 UTC (permalink / raw)
To: thomas, ferruh.yigit, Bruce Richardson, Neil Horman, Ferruh Yigit; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 61934c0956d4 ("ring: convert to use of PMD_REGISTER_DRIVER and fix linking")
Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/ring/rte_eth_ring.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index e8bc9b6271..4edff83531 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -562,6 +562,9 @@ static int parse_kvlist(const char *key __rte_unused,
char *node;
char *end;
+ if (value == NULL || data == NULL)
+ return -EINVAL;
+
name = strdup(value);
ret = -EINVAL;
@@ -630,6 +633,9 @@ parse_internal_args(const char *key __rte_unused, const char *value,
void *args;
int ret, n;
+ if (value == NULL)
+ return -EINVAL;
+
/* make sure 'value' is valid pointer length */
if (strnlen(value, ETH_RING_INTERNAL_ARG_MAX_LEN) >=
ETH_RING_INTERNAL_ARG_MAX_LEN) {
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH 5/5] net/sfc: fix segment fault when parse devargs
2023-03-14 12:48 [PATCH 0/5] fix segment fault when parse args Chengwen Feng
` (3 preceding siblings ...)
2023-03-14 12:48 ` [PATCH 4/5] net/ring: " Chengwen Feng
@ 2023-03-14 12:48 ` Chengwen Feng
2023-03-16 18:20 ` Ferruh Yigit
2023-03-16 18:18 ` [PATCH 0/5] fix segment fault when parse args Ferruh Yigit
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
6 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-14 12:48 UTC (permalink / raw)
To: thomas, ferruh.yigit, Andrew Rybchenko, Roman Zhukov, Andrew Lee,
Robert Stonehouse, Ferruh Yigit, Andy Moreton
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 9e7fc8b8f3be ("net/sfc: add device parameter to choose FW variant")
Fixes: c22d3c508e0c ("net/sfc: support parameter to choose performance profile")
Fixes: 63d588ff2692 ("net/sfc: libefx-based driver stub")
Fixes: df1bfde4ff0d ("net/sfc: factor out libefx-based Rx datapath")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/sfc/sfc.c | 3 +++
drivers/net/sfc/sfc_ev.c | 3 +++
drivers/net/sfc/sfc_kvargs.c | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 22753e3417..c5271347a4 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -1108,6 +1108,9 @@ sfc_kvarg_fv_variant_handler(__rte_unused const char *key,
{
uint32_t *value = opaque;
+ if (value_str == NULL || opaque == NULL)
+ return -EINVAL;
+
if (strcasecmp(value_str, SFC_KVARG_FW_VARIANT_DONT_CARE) == 0)
*value = EFX_FW_VARIANT_DONT_CARE;
else if (strcasecmp(value_str, SFC_KVARG_FW_VARIANT_FULL_FEATURED) == 0)
diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c
index f949abbfc3..4cd900bd76 100644
--- a/drivers/net/sfc/sfc_ev.c
+++ b/drivers/net/sfc/sfc_ev.c
@@ -955,6 +955,9 @@ sfc_kvarg_perf_profile_handler(__rte_unused const char *key,
{
uint32_t *value = opaque;
+ if (value_str == NULL || opaque == NULL)
+ return -EINVAL;
+
if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_THROUGHPUT) == 0)
*value = EFX_EVQ_FLAGS_TYPE_THROUGHPUT;
else if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_LOW_LATENCY) == 0)
diff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c
index 783cb43ae6..f77c4af345 100644
--- a/drivers/net/sfc/sfc_kvargs.c
+++ b/drivers/net/sfc/sfc_kvargs.c
@@ -85,6 +85,9 @@ sfc_kvarg_bool_handler(__rte_unused const char *key,
};
bool *value = opaque;
+ if (!key || !opaque)
+ return -EINVAL;
+
if (sfc_kvarg_match_value(value_str, true_strs,
RTE_DIM(true_strs)))
*value = true;
@@ -120,6 +123,9 @@ int
sfc_kvarg_string_handler(__rte_unused const char *key,
const char *value_str, void *opaque)
{
+ if (value_str == NULL || opaque == NULL)
+ return -EINVAL;
+
*(const char **)opaque = value_str;
return 0;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 1/5] app/pdump: fix segment fault when parse args
2023-03-14 12:48 ` [PATCH 1/5] app/pdump: " Chengwen Feng
@ 2023-03-16 17:34 ` Ferruh Yigit
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2023-03-16 17:34 UTC (permalink / raw)
To: Chengwen Feng, thomas, Reshma Pattan, Stephen Hemminger; +Cc: dev
On 3/14/2023 12:48 PM, Chengwen Feng wrote:
> The rte_kvargs_process() was used to parse KV pairs, it also supports
> to parse 'only keys' (e.g. socket_id) type. And the callback function
> parameter 'value' is NULL when parsed 'only keys'.
>
> This patch fixes segment fault when parse --pdump args with 'only keys'
> (e.g. 'port,queue=*').
>
> Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Hi Chengwen,
Thanks for the fix, +1 to patch.
> ---
> app/pdump/main.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/app/pdump/main.c b/app/pdump/main.c
> index c6cf9d9c87..d286952483 100644
> --- a/app/pdump/main.c
> +++ b/app/pdump/main.c
> @@ -170,6 +170,9 @@ parse_device_id(const char *key __rte_unused, const char *value,
> {
> struct pdump_tuples *pt = extra_args;
>
> + if (value == NULL || extra_args == NULL)
> + return -EINVAL;
> +
Do we need to check 'extra_args'?
It is not something changes in the runtime, functions provides this
callback is local to this file and in control, also if 'extra_args' is
not provided correctly it will crash immediately so easy to detect it.
But +1 to check 'value', since that depends what user provided and need
to verify user input.
Same comment for all set.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 0/5] fix segment fault when parse args
2023-03-14 12:48 [PATCH 0/5] fix segment fault when parse args Chengwen Feng
` (4 preceding siblings ...)
2023-03-14 12:48 ` [PATCH 5/5] net/sfc: " Chengwen Feng
@ 2023-03-16 18:18 ` Ferruh Yigit
2023-03-17 2:43 ` fengchengwen
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
6 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2023-03-16 18:18 UTC (permalink / raw)
To: Chengwen Feng, thomas; +Cc: dev, David Marchand
On 3/14/2023 12:48 PM, Chengwen Feng wrote:
> The rte_kvargs_process() was used to parse KV pairs, it also supports
> to parse 'only keys' (e.g. socket_id) type. And the callback function
> parameter 'value' is NULL when parsed 'only keys'.
>
> It may leads to segment fault when parse args with 'only key', this
> patchset fixes rest of them.
>
> Chengwen Feng (5):
> app/pdump: fix segment fault when parse args
> net/memif: fix segment fault when parse devargs
> net/pcap: fix segment fault when parse devargs
> net/ring: fix segment fault when parse devargs
> net/sfc: fix segment fault when parse devargs
Hi Chengwen,
Did you scan all `rte_kvargs_process()` instances?
And if there would be a way to tell kvargs that a value is expected (or
not) this checks could be done in kvargs layer, I think this also can be
to look at.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 2/5] net/memif: fix segment fault when parse devargs
2023-03-14 12:48 ` [PATCH 2/5] net/memif: fix segment fault when parse devargs Chengwen Feng
@ 2023-03-16 18:20 ` Ferruh Yigit
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2023-03-16 18:20 UTC (permalink / raw)
To: Chengwen Feng, thomas, Jakub Grajciar, Ferruh Yigit
Cc: dev, Stephen Hemminger, Andrew Rybchenko, Olivier Matz
On 3/14/2023 12:48 PM, Chengwen Feng wrote:
> The rte_kvargs_process() was used to parse KV pairs, it also supports
> to parse 'only keys' (e.g. socket_id) type. And the callback function
> parameter 'value' is NULL when parsed 'only keys'.
>
> This patch fixes segment fault when parse input args with 'only keys'.
>
> Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
> Fixes: 2f865ed07bb6 ("net/memif: use abstract socket address")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
<...>
> @@ -1889,6 +1913,9 @@ memif_set_mac(const char *key __rte_unused, const char *value, void *extra_args)
> {
> struct rte_ether_addr *ether_addr = (struct rte_ether_addr *)extra_args;
>
> + if (value == NULL || extra_args == NULL)
> + return -EINVAL;
> +
> if (rte_ether_unformat_addr(value, ether_addr) < 0)
> MIF_LOG(WARNING, "Failed to parse mac '%s'.", value);
Not related to the patch, but to record it,
it seems public 'rte_ether_unformat_addr()' API is missing parameter
verification, we need to fix it.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 3/5] net/pcap: fix segment fault when parse devargs
2023-03-14 12:48 ` [PATCH 3/5] net/pcap: " Chengwen Feng
@ 2023-03-16 18:20 ` Ferruh Yigit
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2023-03-16 18:20 UTC (permalink / raw)
To: Chengwen Feng, thomas, Ferruh Yigit, Ido Goshen,
Juhamatti Kuusisaari, Cian Ferriter
Cc: dev
On 3/14/2023 12:48 PM, Chengwen Feng wrote:
> The rte_kvargs_process() was used to parse KV pairs, it also supports
> to parse 'only keys' (e.g. socket_id) type. And the callback function
> parameter 'value' is NULL when parsed 'only keys'.
>
> This patch fixes segment fault when parse input args with 'only keys'.
>
> Fixes: 4c173302c307 ("pcap: add new driver")
> Fixes: 53bf48403409 ("net/pcap: capture only ingress packets from Rx iface")
> Fixes: c9507cd0cada ("net/pcap: support physical interface MAC address")
> Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file")
> Cc: stable@dpdk.org
>
Can you please check following callbacks too:
`rx_iface_args_process()`
`open_tx_iface()`
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 5/5] net/sfc: fix segment fault when parse devargs
2023-03-14 12:48 ` [PATCH 5/5] net/sfc: " Chengwen Feng
@ 2023-03-16 18:20 ` Ferruh Yigit
0 siblings, 0 replies; 72+ messages in thread
From: Ferruh Yigit @ 2023-03-16 18:20 UTC (permalink / raw)
To: Chengwen Feng, thomas, Andrew Rybchenko, Roman Zhukov,
Andrew Lee, Robert Stonehouse, Ferruh Yigit, Andy Moreton
Cc: dev
On 3/14/2023 12:48 PM, Chengwen Feng wrote:
> The rte_kvargs_process() was used to parse KV pairs, it also supports
> to parse 'only keys' (e.g. socket_id) type. And the callback function
> parameter 'value' is NULL when parsed 'only keys'.
>
> This patch fixes segment fault when parse input args with 'only keys'.
>
> Fixes: 9e7fc8b8f3be ("net/sfc: add device parameter to choose FW variant")
> Fixes: c22d3c508e0c ("net/sfc: support parameter to choose performance profile")
> Fixes: 63d588ff2692 ("net/sfc: libefx-based driver stub")
> Fixes: df1bfde4ff0d ("net/sfc: factor out libefx-based Rx datapath")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
<...>
> index 783cb43ae6..f77c4af345 100644
> --- a/drivers/net/sfc/sfc_kvargs.c
> +++ b/drivers/net/sfc/sfc_kvargs.c
> @@ -85,6 +85,9 @@ sfc_kvarg_bool_handler(__rte_unused const char *key,
> };
> bool *value = opaque;
>
> + if (!key || !opaque)
> + return -EINVAL;
s/key/value_str/ ?
And better to be consistent with compression syntax,
`!ptr` vs `ptr == NULL"
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 0/5] fix segment fault when parse args
2023-03-16 18:18 ` [PATCH 0/5] fix segment fault when parse args Ferruh Yigit
@ 2023-03-17 2:43 ` fengchengwen
2023-03-21 13:50 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: fengchengwen @ 2023-03-17 2:43 UTC (permalink / raw)
To: Ferruh Yigit, thomas; +Cc: dev, David Marchand
On 2023/3/17 2:18, Ferruh Yigit wrote:
> On 3/14/2023 12:48 PM, Chengwen Feng wrote:
>> The rte_kvargs_process() was used to parse KV pairs, it also supports
>> to parse 'only keys' (e.g. socket_id) type. And the callback function
>> parameter 'value' is NULL when parsed 'only keys'.
>>
>> It may leads to segment fault when parse args with 'only key', this
>> patchset fixes rest of them.
>>
>> Chengwen Feng (5):
>> app/pdump: fix segment fault when parse args
>> net/memif: fix segment fault when parse devargs
>> net/pcap: fix segment fault when parse devargs
>> net/ring: fix segment fault when parse devargs
>> net/sfc: fix segment fault when parse devargs
>
> Hi Chengwen,
>
> Did you scan all `rte_kvargs_process()` instances?
No, I was just looking at the modules I was concerned about.
I looked at it briefly, and some modules had the same problem.
>
>
> And if there would be a way to tell kvargs that a value is expected (or
> not) this checks could be done in kvargs layer, I think this also can be
> to look at.
Yes, the way to tell kvargs may lead to a lot of modifys and also break ABI.
I also think about just set value = "" when only exist key, It could perfectly solve the above segment scene.
But it also break the API's behavior.
Or continue fix the exist code (about 10+ place more),
for new invoking, because the 'arg_handler_t' already well documented (52ab17efdecf935792ee1d0cb749c0dbd536c083),
they'll take the initiative to prevent this.
Hope for more advise for the next.
> .
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 00/44] fix segment fault when parse args
2023-03-14 12:48 [PATCH 0/5] fix segment fault when parse args Chengwen Feng
` (5 preceding siblings ...)
2023-03-16 18:18 ` [PATCH 0/5] fix segment fault when parse args Ferruh Yigit
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 01/44] app/pdump: " Chengwen Feng
` (43 more replies)
6 siblings, 44 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
It may leads to segment fault when parse args with 'only key', this
patchset fixes rest of them.
Chengwen Feng (44):
app/pdump: fix segment fault when parse args
ethdev: fix segment fault when parse args
net/memif: fix segment fault when parse devargs
net/pcap: fix segment fault when parse devargs
net/ring: fix segment fault when parse devargs
net/sfc: fix segment fault when parse devargs
net/af_xdp: fix segment fault when parse devargs
net/ark: fix segment fault when parse devargs
net/cnxk: fix segment fault when parse devargs
net/cxgbe: fix segment fault when parse devargs
net/dpaa2: fix segment fault when parse devargs
net/ena: fix segment fault when parse devargs
net/enic: fix segment fault when parse devargs
net/fm10k: fix segment fault when parse devargs
net/i40e: fix segment fault when parse devargs
net/iavf: fix segment fault when parse devargs
net/ice: fix segment fault when parse devargs
net/idpf: fix segment fault when parse devargs
net/ionic: fix segment fault when parse devargs
net/mana: fix segment fault when parse devargs
net/mlx4: fix segment fault when parse devargs
net/mvneta: fix segment fault when parse devargs
net/mvpp2: fix segment fault when parse devargs
net/netvsc: fix segment fault when parse devargs
net/octeontx: fix segment fault when parse devargs
net/pfe: fix segment fault when parse devargs
net/qede: fix segment fault when parse devargs
baseband/la12xx: fix segment fault when parse devargs
bus/pci: fix segment fault when parse args
common/mlx5: fix segment fault when parse devargs
crypto/cnxk: fix segment fault when parse devargs
crypto/dpaa_sec: fix segment fault when parse devargs
crypto/dpaa2_sec: fix segment fault when parse devargs
crypto/mvsam: fix segment fault when parse devargs
crypto/scheduler: fix segment fault when parse devargs
dma/dpaa2: fix segment fault when parse devargs
event/cnxk: fix segment fault when parse devargs
event/dlb2: fix segment fault when parse devargs
event/dpaa: fix segment fault when parse devargs
event/octeontx: fix segment fault when parse devargs
event/opdl: fix segment fault when parse devargs
event/sw: fix segment fault when parse devargs
mempool/cnxk: fix segment fault when parse devargs
raw/cnxk_gpio: fix segment fault when parse devargs
---
v2: according Ferruh's comments:
fix all 'rte_kvargs_process()' bug instances.
only judge value validation.
app/pdump/main.c | 12 ++++++
drivers/baseband/la12xx/bbdev_la12xx.c | 3 ++
drivers/bus/pci/pci_params.c | 2 +
drivers/common/mlx5/mlx5_common.c | 5 +++
drivers/crypto/cnxk/cnxk_cryptodev_devargs.c | 3 ++
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 2 +
drivers/crypto/dpaa_sec/dpaa_sec.c | 3 ++
drivers/crypto/mvsam/rte_mrvl_pmd.c | 6 +++
drivers/crypto/scheduler/scheduler_pmd.c | 21 +++++++++++
drivers/dma/dpaa2/dpaa2_qdma.c | 3 ++
drivers/event/cnxk/cnxk_eventdev.c | 6 +++
drivers/event/cnxk/cnxk_eventdev.h | 6 +++
drivers/event/cnxk/cnxk_tim_evdev.c | 6 +++
drivers/event/dlb2/dlb2.c | 5 ++-
drivers/event/dpaa/dpaa_eventdev.c | 3 ++
drivers/event/octeontx/ssovf_evdev.c | 2 +
drivers/event/opdl/opdl_evdev.c | 9 +++++
drivers/event/sw/sw_evdev.c | 12 ++++++
drivers/mempool/cnxk/cnxk_mempool.c | 3 ++
drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++
drivers/net/ark/ark_ethdev.c | 3 ++
drivers/net/cnxk/cnxk_ethdev_devargs.c | 39 ++++++++++++++++++++
drivers/net/cnxk/cnxk_ethdev_sec.c | 12 ++++++
drivers/net/cxgbe/cxgbe_main.c | 3 ++
drivers/net/dpaa2/dpaa2_ethdev.c | 3 ++
drivers/net/ena/ena_ethdev.c | 6 +++
drivers/net/enic/enic_ethdev.c | 6 +++
drivers/net/fm10k/fm10k_ethdev.c | 3 ++
drivers/net/i40e/i40e_ethdev.c | 15 ++++++++
drivers/net/iavf/iavf_ethdev.c | 6 +++
drivers/net/ice/ice_dcf_ethdev.c | 6 +++
drivers/net/ice/ice_ethdev.c | 6 +++
drivers/net/idpf/idpf_ethdev.c | 6 +++
drivers/net/ionic/ionic_dev_pci.c | 3 ++
drivers/net/mana/mana.c | 3 ++
drivers/net/memif/rte_eth_memif.c | 30 +++++++++++++++
drivers/net/mlx4/mlx4.c | 3 ++
drivers/net/mvneta/mvneta_ethdev.c | 3 ++
drivers/net/mvpp2/mrvl_ethdev.c | 3 ++
drivers/net/mvpp2/mrvl_qos.c | 6 ++-
drivers/net/netvsc/hn_ethdev.c | 3 ++
drivers/net/octeontx/octeontx_ethdev.c | 3 ++
drivers/net/pcap/pcap_ethdev.c | 18 ++++++++-
drivers/net/pfe/pfe_ethdev.c | 3 ++
drivers/net/qede/qede_ethdev.c | 3 ++
drivers/net/ring/rte_eth_ring.c | 6 +++
drivers/net/sfc/sfc.c | 3 ++
drivers/net/sfc/sfc_ev.c | 3 ++
drivers/net/sfc/sfc_kvargs.c | 6 +++
drivers/raw/cnxk_gpio/cnxk_gpio.c | 6 +++
lib/ethdev/rte_class_eth.c | 6 +++
51 files changed, 345 insertions(+), 4 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 01/44] app/pdump: fix segment fault when parse args
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 02/44] ethdev: " Chengwen Feng
` (42 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Reshma Pattan, Stephen Hemminger; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse --pdump args with 'only keys'
(e.g. 'port,queue=*').
Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
app/pdump/main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/app/pdump/main.c b/app/pdump/main.c
index c6cf9d9c87..ff6940e2e5 100644
--- a/app/pdump/main.c
+++ b/app/pdump/main.c
@@ -170,6 +170,9 @@ parse_device_id(const char *key __rte_unused, const char *value,
{
struct pdump_tuples *pt = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
pt->device_id = strdup(value);
pt->dump_by_type = DEVICE_ID;
@@ -182,6 +185,9 @@ parse_queue(const char *key __rte_unused, const char *value, void *extra_args)
unsigned long n;
struct pdump_tuples *pt = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (!strcmp(value, "*"))
pt->queue = RTE_PDUMP_ALL_QUEUES;
else {
@@ -197,6 +203,9 @@ parse_rxtxdev(const char *key, const char *value, void *extra_args)
struct pdump_tuples *pt = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (!strcmp(key, PDUMP_RX_DEV_ARG)) {
strlcpy(pt->rx_dev, value, sizeof(pt->rx_dev));
/* identify the tx stream type for pcap vdev */
@@ -220,6 +229,9 @@ parse_uint_value(const char *key, const char *value, void *extra_args)
char *end;
int ret = 0;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
v = extra_args;
t = strtoul(value, &end, 10);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 02/44] ethdev: fix segment fault when parse args
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 01/44] app/pdump: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 03/44] net/memif: fix segment fault when parse devargs Chengwen Feng
` (41 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Andrew Rybchenko; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse args with 'only keys'
(e.g. 'mac,representor').
Fixes: c10cdce180a6 ("ethdev: support MAC address as iterator filter")
Fixes: a7d3c6271d55 ("ethdev: support representor id as iterator filter")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
lib/ethdev/rte_class_eth.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/ethdev/rte_class_eth.c b/lib/ethdev/rte_class_eth.c
index b61dae849d..b9fc25348b 100644
--- a/lib/ethdev/rte_class_eth.c
+++ b/lib/ethdev/rte_class_eth.c
@@ -46,6 +46,9 @@ eth_mac_cmp(const char *key __rte_unused,
struct rte_eth_dev_info dev_info;
uint32_t index;
+ if (value == NULL)
+ return -EINVAL;
+
/* Parse devargs MAC address. */
if (rte_ether_unformat_addr(value, &mac) < 0)
return -1; /* invalid devargs value */
@@ -72,6 +75,9 @@ eth_representor_cmp(const char *key __rte_unused,
if ((data->dev_flags & RTE_ETH_DEV_REPRESENTOR) == 0)
return -1; /* not a representor port */
+ if (value == NULL)
+ return -EINVAL;
+
/* Parse devargs representor values. */
values = strdup(value);
if (values == NULL)
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 03/44] net/memif: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 01/44] app/pdump: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 02/44] ethdev: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 04/44] net/pcap: " Chengwen Feng
` (40 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Jakub Grajciar, Ferruh Yigit; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Fixes: 2f865ed07bb6 ("net/memif: use abstract socket address")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/memif/rte_eth_memif.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index 6a8ff5b4eb..6fafb6de1f 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -1720,6 +1720,9 @@ memif_set_role(const char *key __rte_unused, const char *value,
{
enum memif_role_t *role = (enum memif_role_t *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (strstr(value, "server") != NULL) {
*role = MEMIF_ROLE_SERVER;
} else if (strstr(value, "client") != NULL) {
@@ -1742,6 +1745,9 @@ memif_set_zc(const char *key __rte_unused, const char *value, void *extra_args)
{
uint32_t *flags = (uint32_t *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (strstr(value, "yes") != NULL) {
if (!rte_mcfg_get_single_file_segments()) {
MIF_LOG(ERR, "Zero-copy doesn't support multi-file segments.");
@@ -1762,6 +1768,9 @@ memif_set_id(const char *key __rte_unused, const char *value, void *extra_args)
{
memif_interface_id_t *id = (memif_interface_id_t *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
/* even if parsing fails, 0 is a valid id */
*id = strtoul(value, NULL, 10);
return 0;
@@ -1773,6 +1782,9 @@ memif_set_bs(const char *key __rte_unused, const char *value, void *extra_args)
unsigned long tmp;
uint16_t *pkt_buffer_size = (uint16_t *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
tmp = strtoul(value, NULL, 10);
if (tmp == 0 || tmp > 0xFFFF) {
MIF_LOG(ERR, "Invalid buffer size: %s.", value);
@@ -1789,6 +1801,9 @@ memif_set_rs(const char *key __rte_unused, const char *value, void *extra_args)
memif_log2_ring_size_t *log2_ring_size =
(memif_log2_ring_size_t *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
tmp = strtoul(value, NULL, 10);
if (tmp == 0 || tmp > ETH_MEMIF_MAX_LOG2_RING_SIZE) {
MIF_LOG(ERR, "Invalid ring size: %s (max %u).",
@@ -1840,6 +1855,9 @@ memif_set_socket_filename(const char *key __rte_unused, const char *value,
{
const char **socket_filename = (const char **)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
*socket_filename = value;
return 0;
}
@@ -1849,6 +1867,9 @@ memif_set_is_socket_abstract(const char *key __rte_unused, const char *value, vo
{
uint32_t *flags = (uint32_t *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (strstr(value, "yes") != NULL) {
*flags |= ETH_MEMIF_FLAG_SOCKET_ABSTRACT;
} else if (strstr(value, "no") != NULL) {
@@ -1870,6 +1891,9 @@ memif_set_owner(const char *key, const char *value, void *extra_args)
char *end = NULL;
uint32_t *id = (uint32_t *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
val = strtoul(value, &end, 10);
if (*value == '\0' || *end != '\0') {
MIF_LOG(ERR, "Failed to parse %s: %s.", key, value);
@@ -1889,6 +1913,9 @@ memif_set_mac(const char *key __rte_unused, const char *value, void *extra_args)
{
struct rte_ether_addr *ether_addr = (struct rte_ether_addr *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (rte_ether_unformat_addr(value, ether_addr) < 0)
MIF_LOG(WARNING, "Failed to parse mac '%s'.", value);
return 0;
@@ -1899,6 +1926,9 @@ memif_set_secret(const char *key __rte_unused, const char *value, void *extra_ar
{
const char **secret = (const char **)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
*secret = value;
return 0;
}
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 04/44] net/pcap: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (2 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 03/44] net/memif: fix segment fault when parse devargs Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 05/44] net/ring: " Chengwen Feng
` (39 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Ido Goshen, Ferruh Yigit,
Juhamatti Kuusisaari, Cian Ferriter
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 4c173302c307 ("pcap: add new driver")
Fixes: 53bf48403409 ("net/pcap: capture only ingress packets from Rx iface")
Fixes: c9507cd0cada ("net/pcap: support physical interface MAC address")
Fixes: a3f5252e5cbd ("net/pcap: enable infinitely Rx a pcap file")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/pcap/pcap_ethdev.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c
index bfec085045..9dc66e7ee9 100644
--- a/drivers/net/pcap/pcap_ethdev.c
+++ b/drivers/net/pcap/pcap_ethdev.c
@@ -1034,6 +1034,9 @@ open_rx_pcap(const char *key, const char *value, void *extra_args)
struct pmd_devargs *rx = extra_args;
pcap_t *pcap = NULL;
+ if (value == NULL)
+ return -EINVAL;
+
if (open_single_rx_pcap(pcap_filename, &pcap) < 0)
return -1;
@@ -1056,6 +1059,9 @@ open_tx_pcap(const char *key, const char *value, void *extra_args)
struct pmd_devargs *dumpers = extra_args;
pcap_dumper_t *dumper;
+ if (value == NULL)
+ return -EINVAL;
+
if (open_single_tx_pcap(pcap_filename, &dumper) < 0)
return -1;
@@ -1077,6 +1083,9 @@ open_rx_tx_iface(const char *key, const char *value, void *extra_args)
struct pmd_devargs *tx = extra_args;
pcap_t *pcap = NULL;
+ if (value == NULL)
+ return -EINVAL;
+
if (open_single_iface(iface, &pcap) < 0)
return -1;
@@ -1143,6 +1152,9 @@ open_rx_iface(const char *key, const char *value, void *extra_args)
static inline int
rx_iface_args_process(const char *key, const char *value, void *extra_args)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(key, ETH_PCAP_RX_IFACE_ARG) == 0 ||
strcmp(key, ETH_PCAP_RX_IFACE_IN_ARG) == 0)
return open_rx_iface(key, value, extra_args);
@@ -1156,6 +1168,8 @@ rx_iface_args_process(const char *key, const char *value, void *extra_args)
static int
open_tx_iface(const char *key, const char *value, void *extra_args)
{
+ if (value == NULL)
+ return -EINVAL;
return open_iface(key, value, extra_args);
}
@@ -1163,7 +1177,7 @@ static int
select_phy_mac(const char *key __rte_unused, const char *value,
void *extra_args)
{
- if (extra_args) {
+ if (value != NULL && extra_args != NULL) {
const int phy_mac = atoi(value);
int *enable_phy_mac = extra_args;
@@ -1177,7 +1191,7 @@ static int
get_infinite_rx_arg(const char *key __rte_unused,
const char *value, void *extra_args)
{
- if (extra_args) {
+ if (value != NULL && extra_args != NULL) {
const int infinite_rx = atoi(value);
int *enable_infinite_rx = extra_args;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 05/44] net/ring: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (3 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 04/44] net/pcap: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 06/44] net/sfc: " Chengwen Feng
` (38 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Bruce Richardson, Neil Horman, Ferruh Yigit; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 61934c0956d4 ("ring: convert to use of PMD_REGISTER_DRIVER and fix linking")
Fixes: 96cb19521147 ("net/ring: use EAL APIs in PMD specific API")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/ring/rte_eth_ring.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index e8bc9b6271..88b19e205e 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -562,6 +562,9 @@ static int parse_kvlist(const char *key __rte_unused,
char *node;
char *end;
+ if (value == NULL)
+ return -EINVAL;
+
name = strdup(value);
ret = -EINVAL;
@@ -630,6 +633,9 @@ parse_internal_args(const char *key __rte_unused, const char *value,
void *args;
int ret, n;
+ if (value == NULL)
+ return -EINVAL;
+
/* make sure 'value' is valid pointer length */
if (strnlen(value, ETH_RING_INTERNAL_ARG_MAX_LEN) >=
ETH_RING_INTERNAL_ARG_MAX_LEN) {
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 06/44] net/sfc: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (4 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 05/44] net/ring: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 07/44] net/af_xdp: " Chengwen Feng
` (37 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Andrew Rybchenko, Roman Zhukov, Andrew Lee,
Robert Stonehouse, Andy Moreton, Ferruh Yigit
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 9e7fc8b8f3be ("net/sfc: add device parameter to choose FW variant")
Fixes: c22d3c508e0c ("net/sfc: support parameter to choose performance profile")
Fixes: 63d588ff2692 ("net/sfc: libefx-based driver stub")
Fixes: df1bfde4ff0d ("net/sfc: factor out libefx-based Rx datapath")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/sfc/sfc.c | 3 +++
drivers/net/sfc/sfc_ev.c | 3 +++
drivers/net/sfc/sfc_kvargs.c | 6 ++++++
3 files changed, 12 insertions(+)
diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c
index 22753e3417..d17abefd6c 100644
--- a/drivers/net/sfc/sfc.c
+++ b/drivers/net/sfc/sfc.c
@@ -1108,6 +1108,9 @@ sfc_kvarg_fv_variant_handler(__rte_unused const char *key,
{
uint32_t *value = opaque;
+ if (value_str == NULL)
+ return -EINVAL;
+
if (strcasecmp(value_str, SFC_KVARG_FW_VARIANT_DONT_CARE) == 0)
*value = EFX_FW_VARIANT_DONT_CARE;
else if (strcasecmp(value_str, SFC_KVARG_FW_VARIANT_FULL_FEATURED) == 0)
diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c
index f949abbfc3..bf85ee2b8e 100644
--- a/drivers/net/sfc/sfc_ev.c
+++ b/drivers/net/sfc/sfc_ev.c
@@ -955,6 +955,9 @@ sfc_kvarg_perf_profile_handler(__rte_unused const char *key,
{
uint32_t *value = opaque;
+ if (value_str == NULL)
+ return -EINVAL;
+
if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_THROUGHPUT) == 0)
*value = EFX_EVQ_FLAGS_TYPE_THROUGHPUT;
else if (strcasecmp(value_str, SFC_KVARG_PERF_PROFILE_LOW_LATENCY) == 0)
diff --git a/drivers/net/sfc/sfc_kvargs.c b/drivers/net/sfc/sfc_kvargs.c
index 783cb43ae6..5b3b7fecad 100644
--- a/drivers/net/sfc/sfc_kvargs.c
+++ b/drivers/net/sfc/sfc_kvargs.c
@@ -85,6 +85,9 @@ sfc_kvarg_bool_handler(__rte_unused const char *key,
};
bool *value = opaque;
+ if (value_str == NULL)
+ return -EINVAL;
+
if (sfc_kvarg_match_value(value_str, true_strs,
RTE_DIM(true_strs)))
*value = true;
@@ -120,6 +123,9 @@ int
sfc_kvarg_string_handler(__rte_unused const char *key,
const char *value_str, void *opaque)
{
+ if (value_str == NULL)
+ return -EINVAL;
+
*(const char **)opaque = value_str;
return 0;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 07/44] net/af_xdp: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (5 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 06/44] net/sfc: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 08/44] net/ark: " Chengwen Feng
` (36 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Ciara Loftus, Qi Zhang, Stephen Hemminger,
Luca Boccassi, Xiaolong Ye, Ferruh Yigit
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD")
Fixes: 288a85aef192 ("net/af_xdp: enable custom XDP program loading")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/af_xdp/rte_eth_af_xdp.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 2a20a6960c..519a57aeba 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1897,6 +1897,9 @@ parse_budget_arg(const char *key __rte_unused,
int *i = (int *)extra_args;
char *end;
+ if (value == NULL)
+ return -EINVAL;
+
*i = strtol(value, &end, 10);
if (*i < 0 || *i > UINT16_MAX) {
AF_XDP_LOG(ERR, "Invalid busy_budget %i, must be >= 0 and <= %u\n",
@@ -1915,6 +1918,9 @@ parse_integer_arg(const char *key __rte_unused,
int *i = (int *)extra_args;
char *end;
+ if (value == NULL)
+ return -EINVAL;
+
*i = strtol(value, &end, 10);
if (*i < 0) {
AF_XDP_LOG(ERR, "Argument has to be positive.\n");
@@ -1931,6 +1937,9 @@ parse_name_arg(const char *key __rte_unused,
{
char *name = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (strnlen(value, IFNAMSIZ) > IFNAMSIZ - 1) {
AF_XDP_LOG(ERR, "Invalid name %s, should be less than %u bytes.\n",
value, IFNAMSIZ);
@@ -1949,6 +1958,9 @@ parse_prog_arg(const char *key __rte_unused,
{
char *path = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (strnlen(value, PATH_MAX) == PATH_MAX) {
AF_XDP_LOG(ERR, "Invalid path %s, should be less than %u bytes.\n",
value, PATH_MAX);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 08/44] net/ark: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (6 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 07/44] net/af_xdp: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 09/44] net/cnxk: " Chengwen Feng
` (35 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Shepard Siegel, Ed Czeck, John Miller,
Ferruh Yigit
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 1502d443d885 ("net/ark: replace compile time log config with runtime")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/ark/ark_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index b2995427c8..8baaffd746 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -898,6 +898,9 @@ process_pktdir_arg(const char *key, const char *value,
struct ark_adapter *ark =
(struct ark_adapter *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
ark->pkt_dir_v = strtol(value, NULL, 16);
ARK_PMD_LOG(DEBUG, "pkt_dir_v = 0x%x\n", ark->pkt_dir_v);
return 0;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 09/44] net/cnxk: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (7 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 08/44] net/ark: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 10/44] net/cxgbe: " Chengwen Feng
` (34 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Nithin Dabilpuram, Kiran Kumar K,
Sunil Kumar Kori, Satha Rao, Jerin Jacob, Satheesh Paul
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 7eabd6c63773 ("net/cnxk: support inline security setup for cn9k")
Fixes: d25433c7a852 ("net/cnxk: add common devargs parsing")
Fixes: df5cf15faaa9 ("net/cnxk: support IPsec rule reservation scheme")
Fixes: 7eabd6c63773 ("net/cnxk: support inline security setup for cn9k")
Fixes: c91d30f46d4c ("net/cnxk: support configuring channel mask via devargs")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/cnxk/cnxk_ethdev_devargs.c | 39 ++++++++++++++++++++++++++
drivers/net/cnxk/cnxk_ethdev_sec.c | 12 ++++++++
2 files changed, 51 insertions(+)
diff --git a/drivers/net/cnxk/cnxk_ethdev_devargs.c b/drivers/net/cnxk/cnxk_ethdev_devargs.c
index e1a0845ece..9dde7937f2 100644
--- a/drivers/net/cnxk/cnxk_ethdev_devargs.c
+++ b/drivers/net/cnxk/cnxk_ethdev_devargs.c
@@ -25,6 +25,9 @@ parse_outb_nb_desc(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
*(uint16_t *)extra_args = val;
@@ -38,6 +41,9 @@ parse_outb_nb_crypto_qs(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
if (val < 1 || val > 64)
@@ -54,6 +60,9 @@ parse_ipsec_in_spi_range(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
val = strtoul(value, NULL, 0);
if (errno)
@@ -70,6 +79,9 @@ parse_ipsec_out_max_sa(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
val = strtoul(value, NULL, 0);
if (errno)
@@ -86,6 +98,9 @@ parse_flow_max_priority(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint16_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
/* Limit the max priority to 32 */
@@ -103,6 +118,9 @@ parse_flow_prealloc_size(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint16_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
/* Limit the prealloc size to 32 */
@@ -120,6 +138,9 @@ parse_reta_size(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
if (val <= RTE_ETH_RSS_RETA_SIZE_64)
@@ -144,6 +165,9 @@ parse_pre_l2_hdr_info(const char *key, const char *value, void *extra_args)
char *tok1 = NULL, *tok2 = NULL;
uint16_t off, off_mask, dir;
+ if (value == NULL)
+ return -EINVAL;
+
RTE_SET_USED(key);
off = strtol(value, &tok1, 16);
tok1++;
@@ -164,6 +188,9 @@ parse_flag(const char *key, const char *value, void *extra_args)
{
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
*(uint16_t *)extra_args = atoi(value);
return 0;
@@ -175,6 +202,9 @@ parse_sqb_count(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
*(uint16_t *)extra_args = val;
@@ -188,6 +218,9 @@ parse_meta_bufsize(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
val = strtoul(value, NULL, 0);
if (errno)
@@ -203,6 +236,9 @@ parse_switch_header_type(const char *key, const char *value, void *extra_args)
{
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "higig2") == 0)
*(uint16_t *)extra_args = ROC_PRIV_FLAGS_HIGIG;
@@ -231,6 +267,9 @@ parse_sdp_channel_mask(const char *key, const char *value, void *extra_args)
uint16_t chan = 0, mask = 0;
char *next = 0;
+ if (value == NULL)
+ return -EINVAL;
+
/* next will point to the separator '/' */
chan = strtol(value, &next, 16);
mask = strtol(++next, 0, 16);
diff --git a/drivers/net/cnxk/cnxk_ethdev_sec.c b/drivers/net/cnxk/cnxk_ethdev_sec.c
index aa8a378a00..6d1fc754b8 100644
--- a/drivers/net/cnxk/cnxk_ethdev_sec.c
+++ b/drivers/net/cnxk/cnxk_ethdev_sec.c
@@ -133,6 +133,9 @@ parse_max_ipsec_rules(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
if (val < 1 || val > 4095)
@@ -248,6 +251,9 @@ parse_val_u32(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
val = strtoul(value, NULL, 0);
if (errno)
@@ -264,6 +270,9 @@ parse_selftest(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
*(uint8_t *)extra_args = !!(val == 1);
@@ -277,6 +286,9 @@ parse_inl_cpt_channel(const char *key, const char *value, void *extra_args)
uint16_t chan = 0, mask = 0;
char *next = 0;
+ if (value == NULL)
+ return -EINVAL;
+
/* next will point to the separator '/' */
chan = strtol(value, &next, 16);
mask = strtol(++next, 0, 16);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 10/44] net/cxgbe: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (8 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 09/44] net/cnxk: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 11/44] net/dpaa2: " Chengwen Feng
` (33 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Rahul Lakkireddy, Kumar Sanghvi,
Shagun Agrawal, Karra Satwik
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: cda260a4ac1a ("net/cxgbe: add option to keep outer VLAN tag in QinQ")
Fixes: dd7c9f12762e ("net/cxgbe: separate VF only devargs")
Fixes: 536db938a444 ("net/cxgbe: add devargs to control filtermode and filtermask")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/cxgbe/cxgbe_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/cxgbe/cxgbe_main.c b/drivers/net/cxgbe/cxgbe_main.c
index f8dd833032..2f2acbcf5a 100644
--- a/drivers/net/cxgbe/cxgbe_main.c
+++ b/drivers/net/cxgbe/cxgbe_main.c
@@ -746,6 +746,9 @@ void cxgbe_print_port_info(struct adapter *adap)
static int check_devargs_handler(const char *key, const char *value, void *p)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (!strncmp(key, CXGBE_DEVARG_CMN_KEEP_OVLAN, strlen(key)) ||
!strncmp(key, CXGBE_DEVARG_CMN_TX_MODE_LATENCY, strlen(key)) ||
!strncmp(key, CXGBE_DEVARG_VF_FORCE_LINK_UP, strlen(key))) {
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 11/44] net/dpaa2: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (9 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 10/44] net/cxgbe: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 12/44] net/ena: " Chengwen Feng
` (32 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Hemant Agrawal, Sachin Saxena,
Karra Satwik, Rahul Lakkireddy
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 536db938a444 ("net/cxgbe: add devargs to control filtermode and filtermask")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/dpaa2/dpaa2_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 679f33ae1a..c54e10f3b7 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -2545,6 +2545,9 @@ static int
check_devargs_handler(__rte_unused const char *key, const char *value,
__rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "1"))
return -1;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 12/44] net/ena: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (10 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 11/44] net/dpaa2: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 13/44] net/enic: " Chengwen Feng
` (31 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Marcin Wojtas, Michal Krawczyk,
Shai Brandes, Evgeny Schemeilin, Igor Chauskin, Dawid Gorecki,
Guy Tzalik
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: cc0c5d251928 ("net/ena: make Tx completion timeout configurable")
Fixes: 8a7a73f26cc9 ("net/ena: support large LLQ headers")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/ena/ena_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index efcb163027..82a6c75824 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -3444,6 +3444,9 @@ static int ena_process_uint_devarg(const char *key,
char *str_end;
uint64_t uint_value;
+ if (value == NULL)
+ return -EINVAL;
+
uint_value = strtoull(value, &str_end, 10);
if (value == str_end) {
PMD_INIT_LOG(ERR,
@@ -3482,6 +3485,9 @@ static int ena_process_bool_devarg(const char *key,
struct ena_adapter *adapter = opaque;
bool bool_value;
+ if (value == NULL)
+ return -EINVAL;
+
/* Parse the value. */
if (strcmp(value, "1") == 0) {
bool_value = true;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 13/44] net/enic: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (11 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 12/44] net/ena: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 21:37 ` John Daley (johndale)
2023-03-20 9:20 ` [PATCH v2 14/44] net/fm10k: " Chengwen Feng
` (30 subsequent siblings)
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, John Daley, Hyong Youb Kim; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 93fb21fdbe23 ("net/enic: enable overlay offload for VXLAN and GENEVE")
Fixes: e39c2756e21a ("net/enic: add devarg to specify ingress VLAN rewrite mode")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/enic/enic_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index cdf0915591..b67016e0a3 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -1148,6 +1148,9 @@ static int enic_parse_zero_one(const char *key,
struct enic *enic;
bool b;
+ if (value == NULL)
+ return -EINVAL;
+
enic = (struct enic *)opaque;
if (strcmp(value, "0") == 0) {
b = false;
@@ -1173,6 +1176,9 @@ static int enic_parse_ig_vlan_rewrite(__rte_unused const char *key,
{
struct enic *enic;
+ if (value == NULL)
+ return -EINVAL;
+
enic = (struct enic *)opaque;
if (strcmp(value, "trunk") == 0) {
/* Trunk mode: always tag */
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 14/44] net/fm10k: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (12 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 13/44] net/enic: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 15/44] net/i40e: " Chengwen Feng
` (29 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Qi Zhang, Xiao Wang, Jing Chen, John McNamara; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 7958b1310d5e ("fm10k: enable FTAG based forwarding")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/fm10k/fm10k_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 8b83063f0a..2096c6ffab 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -2873,6 +2873,9 @@ static const struct eth_dev_ops fm10k_eth_dev_ops = {
static int ftag_check_handler(__rte_unused const char *key,
const char *value, __rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "1"))
return -1;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 15/44] net/i40e: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (13 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 14/44] net/fm10k: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 16/44] net/iavf: " Chengwen Feng
` (28 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Yuying Zhang, Beilei Xing, John McNamara,
Zhe Tao, Jingjing Wu, Xiaolong Ye, Qi Zhang, Alvin Zhang,
Wei Dai
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 79f2248219c0 ("net/i40e: add floating VEB option")
Fixes: cfdfca493cae ("net/i40e: fix multiple driver support")
Fixes: 56270b4208ab ("net/i40e: limit the number of VF messages")
Fixes: ee653bd80044 ("net/i40e: determine number of queues per VF at run time")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/i40e/i40e_ethdev.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 371f42233e..1338b9b92d 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -829,6 +829,9 @@ floating_veb_list_handler(__rte_unused const char *key,
int min, max;
bool *vf_floating_veb = opaque;
+ if (floating_veb_value == NULL)
+ return -EINVAL;
+
while (isblank(*floating_veb_value))
floating_veb_value++;
@@ -921,6 +924,9 @@ i40e_check_floating_handler(__rte_unused const char *key,
const char *value,
__rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "1"))
return -1;
@@ -1258,6 +1264,9 @@ i40e_parse_multi_drv_handler(__rte_unused const char *key,
pf = (struct i40e_pf *)opaque;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
support_multi_driver = strtoul(value, &end, 10);
if (errno != 0 || end == value || *end != 0) {
@@ -1347,6 +1356,9 @@ read_vf_msg_config(__rte_unused const char *key,
{
struct i40e_vf_msg_cfg *cfg = opaque;
+ if (value == NULL)
+ return -EINVAL;
+
if (sscanf(value, "%u@%u:%u", &cfg->max_msg, &cfg->period,
&cfg->ignore_second) != 3) {
memset(cfg, 0, sizeof(*cfg));
@@ -4693,6 +4705,9 @@ static int i40e_pf_parse_vf_queue_number_handler(const char *key,
pf = (struct i40e_pf *)opaque;
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
num = strtoul(value, &end, 0);
if (errno != 0 || end == value || *end != 0) {
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 16/44] net/iavf: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (14 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 15/44] net/i40e: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 17/44] net/ice: " Chengwen Feng
` (27 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Jingjing Wu, Beilei Xing, Qi Zhang,
Wenjun Wu, Xiaolong Ye, Haiyue Wang
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: b14e8a57b9fe ("net/iavf: support quanta size configuration")
Fixes: 4cce7422dd38 ("net/iavf: stop PCI probe in DCF mode")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/iavf/iavf_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 3196210f2c..654741b71f 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -2185,6 +2185,9 @@ parse_u16(__rte_unused const char *key, const char *value, void *args)
u16 *num = (u16 *)args;
u16 tmp;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
tmp = strtoull(value, NULL, 10);
if (errno || !tmp) {
@@ -2815,6 +2818,9 @@ static int
iavf_dcf_cap_check_handler(__rte_unused const char *key,
const char *value, __rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "dcf"))
return -1;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 17/44] net/ice: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (15 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 16/44] net/iavf: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 18/44] net/idpf: " Chengwen Feng
` (26 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Qiming Yang, Qi Zhang, Zhichao Zeng,
Haiyue Wang, Ray Kinsella
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 9e984bc53bc9 ("net/ice: add option to disable ACL engine in DCF")
Fixes: 7564d5509611 ("net/ice: add DCF hardware initialization")
Fixes: 603beeb970b5 ("net/ice: add safe mode devarg")
Fixes: 79d559de896b ("net/ice: add option for setting HW debug mask")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/ice/ice_dcf_ethdev.c | 6 ++++++
drivers/net/ice/ice_ethdev.c | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
index dcbf2af5b0..9fe712ebd1 100644
--- a/drivers/net/ice/ice_dcf_ethdev.c
+++ b/drivers/net/ice/ice_dcf_ethdev.c
@@ -1933,6 +1933,9 @@ static int
ice_dcf_engine_disabled_handler(__rte_unused const char *key,
const char *value, __rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "off"))
return -1;
@@ -1943,6 +1946,9 @@ static int
ice_dcf_cap_check_handler(__rte_unused const char *key,
const char *value, __rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "dcf"))
return -1;
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 9a88cf9796..0917d20515 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1887,6 +1887,9 @@ parse_bool(const char *key, const char *value, void *args)
char *end;
int num;
+ if (value == NULL)
+ return -EINVAL;
+
num = strtoul(value, &end, 10);
if (num != 0 && num != 1) {
@@ -1906,6 +1909,9 @@ parse_u64(const char *key, const char *value, void *args)
u64 *num = (u64 *)args;
u64 tmp;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
tmp = strtoull(value, NULL, 16);
if (errno) {
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 18/44] net/idpf: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (16 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 17/44] net/ice: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 19/44] net/ionic: " Chengwen Feng
` (25 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Jingjing Wu, Beilei Xing, Junfeng Guo,
Xiao Wang, Wenjun Wu, Xiaoyun Li
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 549343c25db8 ("net/idpf: support device initialization")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/idpf/idpf_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/idpf/idpf_ethdev.c b/drivers/net/idpf/idpf_ethdev.c
index 46aec6ae37..105dcc8744 100644
--- a/drivers/net/idpf/idpf_ethdev.c
+++ b/drivers/net/idpf/idpf_ethdev.c
@@ -903,6 +903,9 @@ parse_vport(const char *key, const char *value, void *args)
struct idpf_devargs *devargs = args;
const char *pos = value;
+ if (value == NULL)
+ return -EINVAL;
+
devargs->req_vport_nb = 0;
if (*pos == '[')
@@ -936,6 +939,9 @@ parse_bool(const char *key, const char *value, void *args)
char *end;
int num;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
num = strtoul(value, &end, 10);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 19/44] net/ionic: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (17 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 18/44] net/idpf: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 20/44] net/mana: " Chengwen Feng
` (24 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Andrew Boyer, Neel Patel; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 9de21005e201 ("net/ionic: add Q-in-CMB option")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/ionic/ionic_dev_pci.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ionic/ionic_dev_pci.c b/drivers/net/ionic/ionic_dev_pci.c
index 5e74a6da71..5ba86c7a2e 100644
--- a/drivers/net/ionic/ionic_dev_pci.c
+++ b/drivers/net/ionic/ionic_dev_pci.c
@@ -103,6 +103,9 @@ ionic_pci_devarg_cmb(const char *key __rte_unused, const char *val, void *arg)
{
struct ionic_adapter *adapter = arg;
+ if (val == NULL)
+ return -EINVAL;
+
if (!strcmp(val, "1")) {
IONIC_PRINT(NOTICE, "%s enabled", PMD_IONIC_CMB_KVARG);
adapter->q_in_cmb = true;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 20/44] net/mana: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (18 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 19/44] net/ionic: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-21 22:19 ` Long Li
2023-03-20 9:20 ` [PATCH v2 21/44] net/mlx4: " Chengwen Feng
` (23 subsequent siblings)
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Long Li; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 517ed6e2d590 ("net/mana: add basic driver with build environment")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/mana/mana.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c
index 8a782c0d63..9c097c02ba 100644
--- a/drivers/net/mana/mana.c
+++ b/drivers/net/mana/mana.c
@@ -750,6 +750,9 @@ mana_arg_parse_callback(const char *key, const char *val, void *private)
return 1;
}
+ if (val == NULL)
+ return -EINVAL;
+
ret = rte_ether_unformat_addr(val, &conf->mac_array[conf->index]);
if (ret) {
DRV_LOG(ERR, "Invalid MAC address %s", val);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 21/44] net/mlx4: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (19 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 20/44] net/mana: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 22/44] net/mvneta: " Chengwen Feng
` (22 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Matan Azrad, Viacheslav Ovsiienko,
Adrien Mazarguil, Gaetan Rivet
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 001a520e419f ("net/mlx4: add port parameter")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/mlx4/mlx4.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index a54016f4a2..7c11f3a129 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -521,6 +521,9 @@ mlx4_arg_parse(const char *key, const char *val, struct mlx4_conf *conf)
{
unsigned long tmp;
+ if (val == NULL)
+ return -EINVAL;
+
errno = 0;
tmp = strtoul(val, NULL, 0);
if (errno) {
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 22/44] net/mvneta: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (20 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 21/44] net/mlx4: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:33 ` [EXT] " Liron Himi
2023-03-20 9:20 ` [PATCH v2 23/44] net/mvpp2: " Chengwen Feng
` (21 subsequent siblings)
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Zyta Szpak, Liron Himi, Dmitri Epshtein,
Natalie Samsonov, Andrzej Ostruszka, Yelena Krivosheev
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 4ccc8d770d3b ("net/mvneta: add PMD skeleton")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/mvneta/mvneta_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index d7953ac7cb..babe825ff9 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -91,6 +91,9 @@ mvneta_ifnames_get(const char *key __rte_unused, const char *value,
{
struct mvneta_ifnames *ifnames = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
ifnames->names[ifnames->idx++] = value;
return 0;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 23/44] net/mvpp2: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (21 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 22/44] net/mvneta: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:33 ` [EXT] " Liron Himi
2023-03-20 9:20 ` [PATCH v2 24/44] net/netvsc: " Chengwen Feng
` (20 subsequent siblings)
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Liron Himi, Tomasz Duszynski, Jacek Siuda; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton")
Fixes: c2b5ae61c07e ("net/mvpp2: support DSA mode")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/mvpp2/mrvl_ethdev.c | 3 +++
drivers/net/mvpp2/mrvl_qos.c | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index 89c83f1c1f..a631d6d9cc 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -3180,6 +3180,9 @@ mrvl_get_ifnames(const char *key __rte_unused, const char *value,
{
struct mrvl_ifnames *ifnames = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
ifnames->names[ifnames->idx++] = value;
return 0;
diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c
index f43217bc58..f217a8d71a 100644
--- a/drivers/net/mvpp2/mrvl_qos.c
+++ b/drivers/net/mvpp2/mrvl_qos.c
@@ -656,12 +656,16 @@ int
mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args)
{
struct mrvl_cfg **cfg = extra_args;
- struct rte_cfgfile *file = rte_cfgfile_load(path, 0);
+ struct rte_cfgfile *file;
uint32_t val;
int n, i, ret;
const char *entry;
char sec_name[32];
+ if (path == NULL)
+ return -EINVAL;
+
+ file = rte_cfgfile_load(path, 0);
if (file == NULL) {
MRVL_LOG(ERR, "Cannot load configuration %s\n", path);
return -1;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 24/44] net/netvsc: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (22 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 23/44] net/mvpp2: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-21 22:20 ` Long Li
2023-03-20 9:20 ` [PATCH v2 25/44] net/octeontx: " Chengwen Feng
` (19 subsequent siblings)
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Long Li, Stephen Hemminger; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: a25d39a3eb69 ("net/netvsc: allow tuning latency with devargs")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/netvsc/hn_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index d0bbc0a4c0..e13eb03176 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -157,6 +157,9 @@ static int hn_set_parameter(const char *key, const char *value, void *opaque)
char *endp = NULL;
unsigned long v;
+ if (value == NULL)
+ return -EINVAL;
+
v = strtoul(value, &endp, 0);
if (*value == '\0' || *endp != '\0') {
PMD_DRV_LOG(ERR, "invalid parameter %s=%s", key, value);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 25/44] net/octeontx: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (23 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 24/44] net/netvsc: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 26/44] net/pfe: " Chengwen Feng
` (18 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Harman Kalra, Santosh Shukla, Jerin Jacob; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: f7be70e5130e ("net/octeontx: add net device probe and remove")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/octeontx/octeontx_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index d52a3e73d5..d11f359c7b 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -70,6 +70,9 @@ parse_integer_arg(const char *key __rte_unused,
{
int *i = (int *)extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
*i = atoi(value);
if (*i < 0) {
octeontx_log_err("argument has to be positive.");
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 26/44] net/pfe: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (24 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 25/44] net/octeontx: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 27/44] net/qede: " Chengwen Feng
` (17 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Gagandeep Singh, Nipun Gupta, Akhil Goyal; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 67fc3ff97c39 ("net/pfe: introduce basic functions")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/pfe/pfe_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index 0352a57950..6e09c9443b 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -888,6 +888,9 @@ parse_integer_arg(const char *key __rte_unused,
char *end;
errno = 0;
+ if (value == NULL)
+ return -EINVAL;
+
i = strtol(value, &end, 10);
if (*end != 0 || errno != 0 || i < 0 || i > 1) {
PFE_PMD_ERR("Supported Port IDS are 0 and 1");
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 27/44] net/qede: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (25 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 26/44] net/pfe: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 28/44] baseband/la12xx: " Chengwen Feng
` (16 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Rasesh Mody, Devendra Singh Rawat; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: f64b91b0eb5d ("net/qede: replace config option with run-time arg")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/qede/qede_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index a4923670d6..e1d57723fa 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1211,6 +1211,9 @@ static int qede_args_check(const char *key, const char *val, void *opaque)
struct qede_dev *qdev = QEDE_INIT_QDEV(eth_dev);
struct ecore_dev *edev = QEDE_INIT_EDEV(qdev);
+ if (val == NULL)
+ return -EINVAL;
+
errno = 0;
tmp = strtoul(val, NULL, 0);
if (errno) {
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 28/44] baseband/la12xx: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (26 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 27/44] net/qede: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 29/44] bus/pci: fix segment fault when parse args Chengwen Feng
` (15 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Gagandeep Singh, Hemant Agrawal,
Nicolas Chautru, Akhil Goyal
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 915cdc075dba ("baseband/la12xx: support multiple modems")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/baseband/la12xx/bbdev_la12xx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/baseband/la12xx/bbdev_la12xx.c b/drivers/baseband/la12xx/bbdev_la12xx.c
index bb754a5395..19c526ddd7 100644
--- a/drivers/baseband/la12xx/bbdev_la12xx.c
+++ b/drivers/baseband/la12xx/bbdev_la12xx.c
@@ -936,6 +936,9 @@ parse_integer_arg(const char *key __rte_unused,
int i;
char *end;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
i = strtol(value, &end, 10);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 29/44] bus/pci: fix segment fault when parse args
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (27 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 28/44] baseband/la12xx: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 30/44] common/mlx5: fix segment fault when parse devargs Chengwen Feng
` (14 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Gaetan Rivet; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 4410c1b0c0a2 ("bus/pci: add iteration filter on address")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/bus/pci/pci_params.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bus/pci/pci_params.c b/drivers/bus/pci/pci_params.c
index d24cc201b8..b8bee6a6c1 100644
--- a/drivers/bus/pci/pci_params.c
+++ b/drivers/bus/pci/pci_params.c
@@ -34,6 +34,8 @@ pci_addr_kv_cmp(const char *key __rte_unused,
struct rte_pci_addr *addr1 = &_addr1;
struct rte_pci_addr *addr2 = _addr2;
+ if (value == NULL)
+ return -EINVAL;
if (rte_pci_addr_parse(value, addr1))
return -1;
return -abs(rte_pci_addr_cmp(addr1, addr2));
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 30/44] common/mlx5: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (28 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 29/44] bus/pci: fix segment fault when parse args Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 31/44] crypto/cnxk: " Chengwen Feng
` (13 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Matan Azrad, Viacheslav Ovsiienko, Xueming Li; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: ad435d320473 ("common/mlx5: add bus-agnostic layer")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/common/mlx5/mlx5_common.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c
index 0ad14a48c7..e4cf829c14 100644
--- a/drivers/common/mlx5/mlx5_common.c
+++ b/drivers/common/mlx5/mlx5_common.c
@@ -365,6 +365,11 @@ devargs_class_handler(__rte_unused const char *key,
char *found;
char *refstr = NULL;
+ if (class_names == NULL) {
+ *ret = -EINVAL;
+ return *ret;
+ }
+
*ret = 0;
scratch = strdup(class_names);
if (scratch == NULL) {
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 31/44] crypto/cnxk: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (29 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 30/44] common/mlx5: fix segment fault when parse devargs Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 32/44] crypto/dpaa_sec: " Chengwen Feng
` (12 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Ankur Dwivedi, Anoob Joseph,
Tejasree Kondoj, Jerin Jacob
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 135e0b71fa30 ("crypto/cnxk: add max queue pairs limit option")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/crypto/cnxk/cnxk_cryptodev_devargs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_devargs.c b/drivers/crypto/cnxk/cnxk_cryptodev_devargs.c
index c3e9bdb2d1..936bf8fbf4 100644
--- a/drivers/crypto/cnxk/cnxk_cryptodev_devargs.c
+++ b/drivers/crypto/cnxk/cnxk_cryptodev_devargs.c
@@ -16,6 +16,9 @@ parse_max_qps_limit(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = atoi(value);
if (val < CNXK_MAX_QPS_LIMIT_MIN || val > CNXK_MAX_QPS_LIMIT_MAX)
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 32/44] crypto/dpaa_sec: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (30 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 31/44] crypto/cnxk: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 33/44] crypto/dpaa2_sec: " Chengwen Feng
` (11 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Gagandeep Singh, Hemant Agrawal; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: b1bbf222bef1 ("crypto/dpaa_sec: add debug prints")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/crypto/dpaa_sec/dpaa_sec.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c
index db52683847..2e2940f011 100644
--- a/drivers/crypto/dpaa_sec/dpaa_sec.c
+++ b/drivers/crypto/dpaa_sec/dpaa_sec.c
@@ -3584,6 +3584,9 @@ static int
check_devargs_handler(__rte_unused const char *key, const char *value,
__rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
dpaa_sec_dp_dump = atoi(value);
if (dpaa_sec_dp_dump > DPAA_SEC_DP_FULL_DUMP) {
DPAA_SEC_WARN("WARN: DPAA_SEC_DP_DUMP_LEVEL is not "
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 33/44] crypto/dpaa2_sec: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (31 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 32/44] crypto/dpaa_sec: " Chengwen Feng
@ 2023-03-20 9:20 ` Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 34/44] crypto/mvsam: " Chengwen Feng
` (10 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:20 UTC (permalink / raw)
To: thomas, ferruh.yigit, Gagandeep Singh, Hemant Agrawal, Nipun Gupta; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 4562de326d30 ("crypto/dpaa2_sec: support ordered queue")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
index 392bf74856..3b2927361f 100644
--- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
+++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c
@@ -4242,6 +4242,8 @@ check_devargs_handler(const char *key, const char *value,
if (!strcmp(key, "drv_strict_order")) {
priv->en_loose_ordered = false;
} else if (!strcmp(key, "drv_dump_mode")) {
+ if (value == NULL)
+ return -EINVAL;
dpaa2_sec_dp_dump = atoi(value);
if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_FULL_DUMP) {
DPAA2_SEC_WARN("WARN: DPAA2_SEC_DP_DUMP_LEVEL is not "
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 34/44] crypto/mvsam: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (32 preceding siblings ...)
2023-03-20 9:20 ` [PATCH v2 33/44] crypto/dpaa2_sec: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-20 9:33 ` [EXT] " Liron Himi
2023-03-20 9:21 ` [PATCH v2 35/44] crypto/scheduler: " Chengwen Feng
` (9 subsequent siblings)
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Michael Shamis, Liron Himi, Pablo de Lara,
Tomasz Duszynski
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 25b05a1c806b ("crypto/mvsam: parse max number of sessions")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/crypto/mvsam/rte_mrvl_pmd.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 1641da9ca6..8f99197beb 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -1126,6 +1126,9 @@ parse_integer_arg(const char *key __rte_unused,
{
int *i = (int *) extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
*i = atoi(value);
if (*i < 0) {
MRVL_LOG(ERR, "Argument has to be positive!");
@@ -1142,6 +1145,9 @@ parse_name_arg(const char *key __rte_unused,
{
struct rte_cryptodev_pmd_init_params *params = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
MRVL_LOG(ERR, "Invalid name %s, should be less than %u bytes!",
value, RTE_CRYPTODEV_NAME_MAX_LEN - 1);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 35/44] crypto/scheduler: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (33 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 34/44] crypto/mvsam: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 36/44] dma/dpaa2: " Chengwen Feng
` (8 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Kai Ji, Pablo de Lara, Fan Zhang,
Kirill Rybalchenko, Declan Doherty
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 503e9c5afb38 ("crypto/scheduler: register as vdev driver")
Fixes: 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
Fixes: a0e805ee086a ("crypto/scheduler: add more options")
Fixes: ee9586dd15fb ("crypto/scheduler: add mode-specific parameter")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/crypto/scheduler/scheduler_pmd.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/crypto/scheduler/scheduler_pmd.c b/drivers/crypto/scheduler/scheduler_pmd.c
index 9d1ce46622..7fa8bef4f2 100644
--- a/drivers/crypto/scheduler/scheduler_pmd.c
+++ b/drivers/crypto/scheduler/scheduler_pmd.c
@@ -272,6 +272,9 @@ parse_integer_arg(const char *key __rte_unused,
{
int *i = (int *) extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
*i = atoi(value);
if (*i < 0) {
CR_SCHED_LOG(ERR, "Argument has to be positive.");
@@ -338,6 +341,9 @@ parse_corelist_arg(const char *key __rte_unused,
{
struct scheduler_init_params *params = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
params->nb_wc = 0;
const char *token = value;
@@ -367,6 +373,9 @@ parse_name_arg(const char *key __rte_unused,
{
struct rte_cryptodev_pmd_init_params *params = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
CR_SCHED_LOG(ERR, "Invalid name %s, should be less than "
"%u bytes.", value,
@@ -386,6 +395,9 @@ parse_worker_arg(const char *key __rte_unused,
{
struct scheduler_init_params *param = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (param->nb_workers >= RTE_CRYPTODEV_SCHEDULER_MAX_NB_WORKERS) {
CR_SCHED_LOG(ERR, "Too many workers.");
return -ENOMEM;
@@ -404,6 +416,9 @@ parse_mode_arg(const char *key __rte_unused,
struct scheduler_init_params *param = extra_args;
uint32_t i;
+ if (value == NULL)
+ return -EINVAL;
+
for (i = 0; i < RTE_DIM(scheduler_mode_map); i++) {
if (strcmp(value, scheduler_mode_map[i].name) == 0) {
param->mode = (enum rte_cryptodev_scheduler_mode)
@@ -427,6 +442,9 @@ parse_mode_param_arg(const char *key __rte_unused,
{
struct scheduler_init_params *param = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
strlcpy(param->mode_param_str, value,
RTE_CRYPTODEV_SCHEDULER_NAME_MAX_LEN);
@@ -440,6 +458,9 @@ parse_ordering_arg(const char *key __rte_unused,
struct scheduler_init_params *param = extra_args;
uint32_t i;
+ if (value == NULL)
+ return -EINVAL;
+
for (i = 0; i < RTE_DIM(scheduler_ordering_map); i++) {
if (strcmp(value, scheduler_ordering_map[i].name) == 0) {
param->enable_ordering =
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 36/44] dma/dpaa2: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (34 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 35/44] crypto/scheduler: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 37/44] event/cnxk: " Chengwen Feng
` (7 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Gagandeep Singh, Hemant Agrawal, Nipun Gupta; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 9e2f8ca6c224 ("dma/dpaa2: support DMA operations")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/dma/dpaa2/dpaa2_qdma.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/dma/dpaa2/dpaa2_qdma.c b/drivers/dma/dpaa2/dpaa2_qdma.c
index d5a5f08ecc..14c0d28181 100644
--- a/drivers/dma/dpaa2/dpaa2_qdma.c
+++ b/drivers/dma/dpaa2/dpaa2_qdma.c
@@ -1169,6 +1169,9 @@ check_devargs_handler(__rte_unused const char *key,
const char *value,
__rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "1"))
return -1;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 37/44] event/cnxk: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (35 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 36/44] dma/dpaa2: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 38/44] event/dlb2: " Chengwen Feng
` (6 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Pavan Nikhilesh, Shijith Thotton; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 38c2e3240ba8 ("event/cnxk: add option to control SSO HWGRP QoS")
Fixes: 20345cbda6d3 ("event/cnxk: support WQE stashing")
Fixes: 1b06a817b835 ("event/cnxk: add option to disable NPA")
Fixes: e656d40fd12f ("event/cnxk: add option for in-flight buffer count")
Fixes: 8a3d58c189fd ("event/cnxk: add option to control timer adapters")
Fixes: 8bdbae66b299 ("event/cnxk: add external clock support for timer")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/event/cnxk/cnxk_eventdev.c | 6 ++++++
drivers/event/cnxk/cnxk_eventdev.h | 6 ++++++
drivers/event/cnxk/cnxk_tim_evdev.c | 6 ++++++
3 files changed, 18 insertions(+)
diff --git a/drivers/event/cnxk/cnxk_eventdev.c b/drivers/event/cnxk/cnxk_eventdev.c
index cb9ba5d353..970681adfc 100644
--- a/drivers/event/cnxk/cnxk_eventdev.c
+++ b/drivers/event/cnxk/cnxk_eventdev.c
@@ -565,6 +565,9 @@ parse_sso_kvargs_qos_dict(const char *key, const char *value, void *opaque)
{
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
/* Dict format [Qx-TAQ-IAQ][Qz-TAQ-IAQ] use '-' cause ',' isn't allowed.
* Everything is expressed in percentages, 0 represents default.
*/
@@ -578,6 +581,9 @@ parse_sso_kvargs_stash_dict(const char *key, const char *value, void *opaque)
{
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
/* Dict format [Qx|<stash_offset>|<stash_length>] use '|' cause ','
* isn't allowed.
*/
diff --git a/drivers/event/cnxk/cnxk_eventdev.h b/drivers/event/cnxk/cnxk_eventdev.h
index c7cbd722ab..acd705183c 100644
--- a/drivers/event/cnxk/cnxk_eventdev.h
+++ b/drivers/event/cnxk/cnxk_eventdev.h
@@ -169,6 +169,9 @@ parse_kvargs_flag(const char *key, const char *value, void *opaque)
{
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
*(uint8_t *)opaque = !!atoi(value);
return 0;
}
@@ -178,6 +181,9 @@ parse_kvargs_value(const char *key, const char *value, void *opaque)
{
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
*(uint32_t *)opaque = (uint32_t)atoi(value);
return 0;
}
diff --git a/drivers/event/cnxk/cnxk_tim_evdev.c b/drivers/event/cnxk/cnxk_tim_evdev.c
index 121480df15..e5450fd9bf 100644
--- a/drivers/event/cnxk/cnxk_tim_evdev.c
+++ b/drivers/event/cnxk/cnxk_tim_evdev.c
@@ -490,6 +490,9 @@ cnxk_tim_parse_kvargs_dict(const char *key, const char *value, void *opaque)
{
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
/* Dict format [ring-chunk_sz-disable_npa-enable_stats] use '-' as ','
* isn't allowed. 0 represents default.
*/
@@ -528,6 +531,9 @@ cnxk_tim_parse_kvargs_dsv(const char *key, const char *value, void *opaque)
{
RTE_SET_USED(key);
+ if (value == NULL)
+ return -EINVAL;
+
/* DSV format GPIO-PTP-SYNCE-BTS use '-' as ','
* isn't allowed. 0 represents default.
*/
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 38/44] event/dlb2: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (36 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 37/44] event/cnxk: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-24 16:26 ` Sevincer, Abdullah
2023-03-20 9:21 ` [PATCH v2 39/44] event/dpaa: " Chengwen Feng
` (5 subsequent siblings)
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Timothy McDaniel, Abdullah Sevincer; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 8d1d9070bbe9 ("event/dlb2: optimize producer port probing")
Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/event/dlb2/dlb2.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c
index 60c5cd4804..d436cf852a 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -329,6 +329,9 @@ set_numa_node(const char *key __rte_unused, const char *value, void *opaque)
int *socket_id = opaque;
int ret;
+ if (value == NULL)
+ return -EINVAL;
+
ret = dlb2_string_to_int(socket_id, value);
if (ret < 0)
return ret;
@@ -542,7 +545,7 @@ set_cos_bw(const char *key __rte_unused,
{
struct dlb2_cos_bw *cos_bw = opaque;
- if (opaque == NULL) {
+ if (value == NULL || opaque == NULL) {
DLB2_LOG_ERR("NULL pointer\n");
return -EINVAL;
}
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 39/44] event/dpaa: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (37 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 38/44] event/dlb2: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 40/44] event/octeontx: " Chengwen Feng
` (4 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Hemant Agrawal, Sachin Saxena; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 77b5311d0ece ("event/dpaa: support select based event")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/event/dpaa/dpaa_eventdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c
index 4b3d16735b..0d5593e862 100644
--- a/drivers/event/dpaa/dpaa_eventdev.c
+++ b/drivers/event/dpaa/dpaa_eventdev.c
@@ -959,6 +959,9 @@ static struct eventdev_ops dpaa_eventdev_ops = {
static int flag_check_handler(__rte_unused const char *key,
const char *value, __rte_unused void *opaque)
{
+ if (value == NULL)
+ return -EINVAL;
+
if (strcmp(value, "1"))
return -1;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 40/44] event/octeontx: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (38 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 39/44] event/dpaa: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 41/44] event/opdl: " Chengwen Feng
` (3 subsequent siblings)
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Jerin Jacob, Pavan Nikhilesh; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 3516327e00fd ("event/octeontx: add selftest to device arguments")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/event/octeontx/ssovf_evdev.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/event/octeontx/ssovf_evdev.c b/drivers/event/octeontx/ssovf_evdev.c
index 650266b996..b9b5fa8668 100644
--- a/drivers/event/octeontx/ssovf_evdev.c
+++ b/drivers/event/octeontx/ssovf_evdev.c
@@ -717,6 +717,8 @@ static int
ssovf_parsekv(const char *key __rte_unused, const char *value, void *opaque)
{
int *flag = opaque;
+ if (value == NULL)
+ return -EINVAL;
*flag = !!atoi(value);
return 0;
}
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 41/44] event/opdl: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (39 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 40/44] event/octeontx: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-23 13:48 ` Liang Ma
2023-03-20 9:21 ` [PATCH v2 42/44] event/sw: " Chengwen Feng
` (2 subsequent siblings)
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Liang Ma, Peter Mccarthy; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 3c7f3dcfb099 ("event/opdl: add PMD main body and helper function")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/event/opdl/opdl_evdev.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c
index 9ce8b39b60..f90d31aa19 100644
--- a/drivers/event/opdl/opdl_evdev.c
+++ b/drivers/event/opdl/opdl_evdev.c
@@ -580,6 +580,8 @@ static int
assign_numa_node(const char *key __rte_unused, const char *value, void *opaque)
{
int *socket_id = opaque;
+ if (value == NULL)
+ return -EINVAL;
*socket_id = atoi(value);
if (*socket_id >= RTE_MAX_NUMA_NODES)
return -1;
@@ -590,6 +592,10 @@ static int
set_do_validation(const char *key __rte_unused, const char *value, void *opaque)
{
int *do_val = opaque;
+
+ if (value == NULL)
+ return -EINVAL;
+
*do_val = atoi(value);
if (*do_val != 0)
*do_val = 1;
@@ -601,6 +607,9 @@ set_do_test(const char *key __rte_unused, const char *value, void *opaque)
{
int *do_test = opaque;
+ if (value == NULL)
+ return -EINVAL;
+
*do_test = atoi(value);
if (*do_test != 0)
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 42/44] event/sw: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (40 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 41/44] event/opdl: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-20 11:58 ` Van Haaren, Harry
2023-03-20 9:21 ` [PATCH v2 43/44] mempool/cnxk: " Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 44/44] raw/cnxk_gpio: " Chengwen Feng
43 siblings, 1 reply; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Harry van Haaren, Bruce Richardson,
Jerin Jacob, Radu Nicolau
Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: aaa4a221da26 ("event/sw: add new software-only eventdev driver")
Fixes: 70207f35e21f ("event/sw: improve performance")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/event/sw/sw_evdev.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/event/sw/sw_evdev.c b/drivers/event/sw/sw_evdev.c
index cfd659d774..524a84c244 100644
--- a/drivers/event/sw/sw_evdev.c
+++ b/drivers/event/sw/sw_evdev.c
@@ -875,6 +875,8 @@ static int
assign_numa_node(const char *key __rte_unused, const char *value, void *opaque)
{
int *socket_id = opaque;
+ if (value == NULL)
+ return -EINVAL;
*socket_id = atoi(value);
if (*socket_id >= RTE_MAX_NUMA_NODES)
return -1;
@@ -885,6 +887,8 @@ static int
set_sched_quanta(const char *key __rte_unused, const char *value, void *opaque)
{
int *quanta = opaque;
+ if (value == NULL)
+ return -EINVAL;
*quanta = atoi(value);
if (*quanta < 0 || *quanta >= 4096)
return -1;
@@ -895,6 +899,8 @@ static int
set_credit_quanta(const char *key __rte_unused, const char *value, void *opaque)
{
int *credit = opaque;
+ if (value == NULL)
+ return -EINVAL;
*credit = atoi(value);
if (*credit < 0 || *credit >= 128)
return -1;
@@ -905,6 +911,8 @@ static int
set_deq_burst_sz(const char *key __rte_unused, const char *value, void *opaque)
{
int *deq_burst_sz = opaque;
+ if (value == NULL)
+ return -EINVAL;
*deq_burst_sz = atoi(value);
if (*deq_burst_sz < 0 || *deq_burst_sz > SCHED_DEQUEUE_MAX_BURST_SIZE)
return -1;
@@ -915,6 +923,8 @@ static int
set_min_burst_sz(const char *key __rte_unused, const char *value, void *opaque)
{
int *min_burst_sz = opaque;
+ if (value == NULL)
+ return -EINVAL;
*min_burst_sz = atoi(value);
if (*min_burst_sz < 0 || *min_burst_sz > SCHED_DEQUEUE_MAX_BURST_SIZE)
return -1;
@@ -925,6 +935,8 @@ static int
set_refill_once(const char *key __rte_unused, const char *value, void *opaque)
{
int *refill_once_per_call = opaque;
+ if (value == NULL)
+ return -EINVAL;
*refill_once_per_call = atoi(value);
if (*refill_once_per_call < 0 || *refill_once_per_call > 1)
return -1;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 43/44] mempool/cnxk: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (41 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 42/44] event/sw: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 44/44] raw/cnxk_gpio: " Chengwen Feng
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Ashwin Sekhar T K, Pavan Nikhilesh; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 0a50a5aad299 ("mempool/cnxk: add device probe/remove")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/mempool/cnxk/cnxk_mempool.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/mempool/cnxk/cnxk_mempool.c b/drivers/mempool/cnxk/cnxk_mempool.c
index 78caf987d0..d803e5928d 100644
--- a/drivers/mempool/cnxk/cnxk_mempool.c
+++ b/drivers/mempool/cnxk/cnxk_mempool.c
@@ -36,6 +36,9 @@ parse_max_pools_handler(const char *key, const char *value, void *extra_args)
RTE_SET_USED(key);
uint32_t val;
+ if (value == NULL)
+ return -EINVAL;
+
val = rte_align32pow2(atoi(value));
if (val < npa_aura_size_to_u32(NPA_AURA_SZ_128))
val = 128;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* [PATCH v2 44/44] raw/cnxk_gpio: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
` (42 preceding siblings ...)
2023-03-20 9:21 ` [PATCH v2 43/44] mempool/cnxk: " Chengwen Feng
@ 2023-03-20 9:21 ` Chengwen Feng
43 siblings, 0 replies; 72+ messages in thread
From: Chengwen Feng @ 2023-03-20 9:21 UTC (permalink / raw)
To: thomas, ferruh.yigit, Jakub Palider, Tomasz Duszynski, Jerin Jacob; +Cc: dev
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: d0b8a4e19131 ("raw/cnxk_gpio: add GPIO driver skeleton")
Fixes: ecc0dd455e9a ("raw/cnxk_gpio: add option to select subset of GPIOs")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/raw/cnxk_gpio/cnxk_gpio.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.c b/drivers/raw/cnxk_gpio/cnxk_gpio.c
index e2907c18b5..5a28e307d2 100644
--- a/drivers/raw/cnxk_gpio/cnxk_gpio.c
+++ b/drivers/raw/cnxk_gpio/cnxk_gpio.c
@@ -67,6 +67,9 @@ cnxk_gpio_parse_arg_gpiochip(const char *key __rte_unused, const char *value,
{
long val;
+ if (value == NULL)
+ return -EINVAL;
+
errno = 0;
val = strtol(value, NULL, 10);
if (errno)
@@ -81,6 +84,9 @@ static int
cnxk_gpio_parse_arg_allowlist(const char *key __rte_unused, const char *value,
void *extra_args __rte_unused)
{
+ if (value == NULL)
+ return -EINVAL;
+
allowlist = strdup(value);
if (!allowlist)
return -ENOMEM;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* RE: [EXT] [PATCH v2 34/44] crypto/mvsam: fix segment fault when parse devargs
2023-03-20 9:21 ` [PATCH v2 34/44] crypto/mvsam: " Chengwen Feng
@ 2023-03-20 9:33 ` Liron Himi
0 siblings, 0 replies; 72+ messages in thread
From: Liron Himi @ 2023-03-20 9:33 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit, Michael Shamis,
Pablo de Lara, Tomasz Duszynski
Cc: dev, Liron Himi
Acked-by: Liron Himi <lironh@marvell.com>
-----Original Message-----
From: Chengwen Feng <fengchengwen@huawei.com>
Sent: Monday, 20 March 2023 11:21
To: thomas@monjalon.net; ferruh.yigit@amd.com; Michael Shamis <michaelsh@marvell.com>; Liron Himi <lironh@marvell.com>; Pablo de Lara <pablo.de.lara.guarch@intel.com>; Tomasz Duszynski <tduszynski@marvell.com>
Cc: dev@dpdk.org
Subject: [EXT] [PATCH v2 34/44] crypto/mvsam: fix segment fault when parse devargs
External Email
----------------------------------------------------------------------
The rte_kvargs_process() was used to parse KV pairs, it also supports to parse 'only keys' (e.g. socket_id) type. And the callback function parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 25b05a1c806b ("crypto/mvsam: parse max number of sessions")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/crypto/mvsam/rte_mrvl_pmd.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/crypto/mvsam/rte_mrvl_pmd.c b/drivers/crypto/mvsam/rte_mrvl_pmd.c
index 1641da9ca6..8f99197beb 100644
--- a/drivers/crypto/mvsam/rte_mrvl_pmd.c
+++ b/drivers/crypto/mvsam/rte_mrvl_pmd.c
@@ -1126,6 +1126,9 @@ parse_integer_arg(const char *key __rte_unused, {
int *i = (int *) extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
*i = atoi(value);
if (*i < 0) {
MRVL_LOG(ERR, "Argument has to be positive!"); @@ -1142,6 +1145,9 @@ parse_name_arg(const char *key __rte_unused, {
struct rte_cryptodev_pmd_init_params *params = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
if (strlen(value) >= RTE_CRYPTODEV_NAME_MAX_LEN - 1) {
MRVL_LOG(ERR, "Invalid name %s, should be less than %u bytes!",
value, RTE_CRYPTODEV_NAME_MAX_LEN - 1);
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* RE: [EXT] [PATCH v2 23/44] net/mvpp2: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 23/44] net/mvpp2: " Chengwen Feng
@ 2023-03-20 9:33 ` Liron Himi
0 siblings, 0 replies; 72+ messages in thread
From: Liron Himi @ 2023-03-20 9:33 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit, Tomasz Duszynski, Jacek Siuda
Cc: dev, Liron Himi
Acked-by: Liron Himi <lironh@marvell.com>
-----Original Message-----
From: Chengwen Feng <fengchengwen@huawei.com>
Sent: Monday, 20 March 2023 11:21
To: thomas@monjalon.net; ferruh.yigit@amd.com; Liron Himi <lironh@marvell.com>; Tomasz Duszynski <tduszynski@marvell.com>; Jacek Siuda <jck@semihalf.com>
Cc: dev@dpdk.org
Subject: [EXT] [PATCH v2 23/44] net/mvpp2: fix segment fault when parse devargs
External Email
----------------------------------------------------------------------
The rte_kvargs_process() was used to parse KV pairs, it also supports to parse 'only keys' (e.g. socket_id) type. And the callback function parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton")
Fixes: c2b5ae61c07e ("net/mvpp2: support DSA mode")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/mvpp2/mrvl_ethdev.c | 3 +++
drivers/net/mvpp2/mrvl_qos.c | 6 +++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c index 89c83f1c1f..a631d6d9cc 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -3180,6 +3180,9 @@ mrvl_get_ifnames(const char *key __rte_unused, const char *value, {
struct mrvl_ifnames *ifnames = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
ifnames->names[ifnames->idx++] = value;
return 0;
diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c index f43217bc58..f217a8d71a 100644
--- a/drivers/net/mvpp2/mrvl_qos.c
+++ b/drivers/net/mvpp2/mrvl_qos.c
@@ -656,12 +656,16 @@ int
mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args) {
struct mrvl_cfg **cfg = extra_args;
- struct rte_cfgfile *file = rte_cfgfile_load(path, 0);
+ struct rte_cfgfile *file;
uint32_t val;
int n, i, ret;
const char *entry;
char sec_name[32];
+ if (path == NULL)
+ return -EINVAL;
+
+ file = rte_cfgfile_load(path, 0);
if (file == NULL) {
MRVL_LOG(ERR, "Cannot load configuration %s\n", path);
return -1;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* RE: [EXT] [PATCH v2 22/44] net/mvneta: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 22/44] net/mvneta: " Chengwen Feng
@ 2023-03-20 9:33 ` Liron Himi
0 siblings, 0 replies; 72+ messages in thread
From: Liron Himi @ 2023-03-20 9:33 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit, Zyta Szpak, Dmitri Epshtein,
Natalie Samsonov, Andrzej Ostruszka, Yelena Krivosheev
Cc: dev, Liron Himi
Acked-by: Liron Himi <lironh@marvell.com>
-----Original Message-----
From: Chengwen Feng <fengchengwen@huawei.com>
Sent: Monday, 20 March 2023 11:21
To: thomas@monjalon.net; ferruh.yigit@amd.com; Zyta Szpak <zr@semihalf.com>; Liron Himi <lironh@marvell.com>; Dmitri Epshtein <dima@marvell.com>; Natalie Samsonov <nsamsono@marvell.com>; Andrzej Ostruszka <amo@semihalf.com>; Yelena Krivosheev <yelena@marvell.com>
Cc: dev@dpdk.org
Subject: [EXT] [PATCH v2 22/44] net/mvneta: fix segment fault when parse devargs
External Email
----------------------------------------------------------------------
The rte_kvargs_process() was used to parse KV pairs, it also supports to parse 'only keys' (e.g. socket_id) type. And the callback function parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 4ccc8d770d3b ("net/mvneta: add PMD skeleton")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/mvneta/mvneta_ethdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index d7953ac7cb..babe825ff9 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -91,6 +91,9 @@ mvneta_ifnames_get(const char *key __rte_unused, const char *value, {
struct mvneta_ifnames *ifnames = extra_args;
+ if (value == NULL)
+ return -EINVAL;
+
ifnames->names[ifnames->idx++] = value;
return 0;
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* RE: [PATCH v2 42/44] event/sw: fix segment fault when parse devargs
2023-03-20 9:21 ` [PATCH v2 42/44] event/sw: " Chengwen Feng
@ 2023-03-20 11:58 ` Van Haaren, Harry
0 siblings, 0 replies; 72+ messages in thread
From: Van Haaren, Harry @ 2023-03-20 11:58 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit, Richardson, Bruce,
Jerin Jacob, Nicolau, Radu
Cc: dev
> -----Original Message-----
> From: Chengwen Feng <fengchengwen@huawei.com>
> Sent: Monday, March 20, 2023 9:21 AM
> To: thomas@monjalon.net; ferruh.yigit@amd.com; Van Haaren, Harry
> <harry.van.haaren@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Jerin Jacob <jerin.jacob@caviumnetworks.com>;
> Nicolau, Radu <radu.nicolau@intel.com>
> Cc: dev@dpdk.org
> Subject: [PATCH v2 42/44] event/sw: fix segment fault when parse devargs
>
> The rte_kvargs_process() was used to parse KV pairs, it also supports
> to parse 'only keys' (e.g. socket_id) type. And the callback function
> parameter 'value' is NULL when parsed 'only keys'.
>
> This patch fixes segment fault when parse input args with 'only keys'.
>
> Fixes: aaa4a221da26 ("event/sw: add new software-only eventdev driver")
> Fixes: 70207f35e21f ("event/sw: improve performance")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH v2 13/44] net/enic: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 13/44] net/enic: " Chengwen Feng
@ 2023-03-20 21:37 ` John Daley (johndale)
0 siblings, 0 replies; 72+ messages in thread
From: John Daley (johndale) @ 2023-03-20 21:37 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit, Hyong Youb Kim (hyonkim); +Cc: dev
[-- Attachment #1: Type: text/plain, Size: 1869 bytes --]
Reviewed-by: John Daley johndale@cisco.com<mailto:johndale@cisco.com>
From: Chengwen Feng <fengchengwen@huawei.com>
Date: Monday, March 20, 2023 at 2:28 AM
To: thomas@monjalon.net <thomas@monjalon.net>, ferruh.yigit@amd.com <ferruh.yigit@amd.com>, John Daley (johndale) <johndale@cisco.com>, Hyong Youb Kim (hyonkim) <hyonkim@cisco.com>
Cc: dev@dpdk.org <dev@dpdk.org>
Subject: [PATCH v2 13/44] net/enic: fix segment fault when parse devargs
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 93fb21fdbe23 ("net/enic: enable overlay offload for VXLAN and GENEVE")
Fixes: e39c2756e21a ("net/enic: add devarg to specify ingress VLAN rewrite mode")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/net/enic/enic_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index cdf0915591..b67016e0a3 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -1148,6 +1148,9 @@ static int enic_parse_zero_one(const char *key,
struct enic *enic;
bool b;
+ if (value == NULL)
+ return -EINVAL;
+
enic = (struct enic *)opaque;
if (strcmp(value, "0") == 0) {
b = false;
@@ -1173,6 +1176,9 @@ static int enic_parse_ig_vlan_rewrite(__rte_unused const char *key,
{
struct enic *enic;
+ if (value == NULL)
+ return -EINVAL;
+
enic = (struct enic *)opaque;
if (strcmp(value, "trunk") == 0) {
/* Trunk mode: always tag */
--
2.17.1
[-- Attachment #2: Type: text/html, Size: 4776 bytes --]
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 0/5] fix segment fault when parse args
2023-03-17 2:43 ` fengchengwen
@ 2023-03-21 13:50 ` Ferruh Yigit
2023-03-22 1:15 ` fengchengwen
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2023-03-21 13:50 UTC (permalink / raw)
To: fengchengwen, thomas, Olivier Matz; +Cc: dev, David Marchand
On 3/17/2023 2:43 AM, fengchengwen wrote:
> On 2023/3/17 2:18, Ferruh Yigit wrote:
>> On 3/14/2023 12:48 PM, Chengwen Feng wrote:
>>> The rte_kvargs_process() was used to parse KV pairs, it also supports
>>> to parse 'only keys' (e.g. socket_id) type. And the callback function
>>> parameter 'value' is NULL when parsed 'only keys'.
>>>
>>> It may leads to segment fault when parse args with 'only key', this
>>> patchset fixes rest of them.
>>>
>>> Chengwen Feng (5):
>>> app/pdump: fix segment fault when parse args
>>> net/memif: fix segment fault when parse devargs
>>> net/pcap: fix segment fault when parse devargs
>>> net/ring: fix segment fault when parse devargs
>>> net/sfc: fix segment fault when parse devargs
>>
>> Hi Chengwen,
>>
>> Did you scan all `rte_kvargs_process()` instances?
>
> No, I was just looking at the modules I was concerned about.
> I looked at it briefly, and some modules had the same problem.
>
>>
>>
>> And if there would be a way to tell kvargs that a value is expected (or
>> not) this checks could be done in kvargs layer, I think this also can be
>> to look at.
>
> Yes, the way to tell kvargs may lead to a lot of modifys and also break ABI.
> I also think about just set value = "" when only exist key, It could perfectly solve the above segment scene.
> But it also break the API's behavior.
>
What about having a new API, like `rte_kvargs_process_extended()`,
That gets an additional flag as parameter, which may have values like
following to indicate if key expects a value or not:
ARG_MAY_HAVE_VALUE --> "key=value" OR 'key'
ARG_WITH_VALUE --> "key=value"
ARG_NO_VALUE --> 'key'
Default flag can be 'ARG_MAY_HAVE_VALUE' and it becomes same as
`rte_kvargs_process()`.
This way instead of adding checks, relevant usage can be replaced by
`rte_kvargs_process_extended()`, this requires similar amount of change
but code will be more clean I think.
Do you think does this work?
>
> Or continue fix the exist code (about 10+ place more),
> for new invoking, because the 'arg_handler_t' already well documented (52ab17efdecf935792ee1d0cb749c0dbd536c083),
> they'll take the initiative to prevent this.
>
>
> Hope for more advise for the next.
>
>> .
>>
^ permalink raw reply [flat|nested] 72+ messages in thread
* RE: [PATCH v2 20/44] net/mana: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 20/44] net/mana: " Chengwen Feng
@ 2023-03-21 22:19 ` Long Li
0 siblings, 0 replies; 72+ messages in thread
From: Long Li @ 2023-03-21 22:19 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit; +Cc: dev
> Subject: [PATCH v2 20/44] net/mana: fix segment fault when parse devargs
>
> The rte_kvargs_process() was used to parse KV pairs, it also supports to parse
> 'only keys' (e.g. socket_id) type. And the callback function parameter 'value' is
> NULL when parsed 'only keys'.
>
> This patch fixes segment fault when parse input args with 'only keys'.
>
> Fixes: 517ed6e2d590 ("net/mana: add basic driver with build environment")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Long Li <longli@microsoft.com>
> ---
> drivers/net/mana/mana.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index
> 8a782c0d63..9c097c02ba 100644
> --- a/drivers/net/mana/mana.c
> +++ b/drivers/net/mana/mana.c
> @@ -750,6 +750,9 @@ mana_arg_parse_callback(const char *key, const char
> *val, void *private)
> return 1;
> }
>
> + if (val == NULL)
> + return -EINVAL;
> +
> ret = rte_ether_unformat_addr(val, &conf->mac_array[conf->index]);
> if (ret) {
> DRV_LOG(ERR, "Invalid MAC address %s", val);
> --
> 2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* RE: [PATCH v2 24/44] net/netvsc: fix segment fault when parse devargs
2023-03-20 9:20 ` [PATCH v2 24/44] net/netvsc: " Chengwen Feng
@ 2023-03-21 22:20 ` Long Li
0 siblings, 0 replies; 72+ messages in thread
From: Long Li @ 2023-03-21 22:20 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit, Stephen Hemminger; +Cc: dev
> Subject: [PATCH v2 24/44] net/netvsc: fix segment fault when parse devargs
>
> The rte_kvargs_process() was used to parse KV pairs, it also supports to parse
> 'only keys' (e.g. socket_id) type. And the callback function parameter 'value' is
> NULL when parsed 'only keys'.
>
> This patch fixes segment fault when parse input args with 'only keys'.
>
> Fixes: a25d39a3eb69 ("net/netvsc: allow tuning latency with devargs")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Thank you.
Acked-by: Long Li <longli@microsoft.com>
> ---
> drivers/net/netvsc/hn_ethdev.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
> index d0bbc0a4c0..e13eb03176 100644
> --- a/drivers/net/netvsc/hn_ethdev.c
> +++ b/drivers/net/netvsc/hn_ethdev.c
> @@ -157,6 +157,9 @@ static int hn_set_parameter(const char *key, const
> char *value, void *opaque)
> char *endp = NULL;
> unsigned long v;
>
> + if (value == NULL)
> + return -EINVAL;
> +
> v = strtoul(value, &endp, 0);
> if (*value == '\0' || *endp != '\0') {
> PMD_DRV_LOG(ERR, "invalid parameter %s=%s", key, value);
> --
> 2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 0/5] fix segment fault when parse args
2023-03-21 13:50 ` Ferruh Yigit
@ 2023-03-22 1:15 ` fengchengwen
2023-03-22 8:53 ` Ferruh Yigit
0 siblings, 1 reply; 72+ messages in thread
From: fengchengwen @ 2023-03-22 1:15 UTC (permalink / raw)
To: Ferruh Yigit, thomas, Olivier Matz; +Cc: dev, David Marchand
On 2023/3/21 21:50, Ferruh Yigit wrote:
> On 3/17/2023 2:43 AM, fengchengwen wrote:
>> On 2023/3/17 2:18, Ferruh Yigit wrote:
>>> On 3/14/2023 12:48 PM, Chengwen Feng wrote:
>>>> The rte_kvargs_process() was used to parse KV pairs, it also supports
>>>> to parse 'only keys' (e.g. socket_id) type. And the callback function
>>>> parameter 'value' is NULL when parsed 'only keys'.
>>>>
>>>> It may leads to segment fault when parse args with 'only key', this
>>>> patchset fixes rest of them.
>>>>
>>>> Chengwen Feng (5):
>>>> app/pdump: fix segment fault when parse args
>>>> net/memif: fix segment fault when parse devargs
>>>> net/pcap: fix segment fault when parse devargs
>>>> net/ring: fix segment fault when parse devargs
>>>> net/sfc: fix segment fault when parse devargs
>>>
>>> Hi Chengwen,
>>>
>>> Did you scan all `rte_kvargs_process()` instances?
>>
>> No, I was just looking at the modules I was concerned about.
>> I looked at it briefly, and some modules had the same problem.
>>
>>>
>>>
>>> And if there would be a way to tell kvargs that a value is expected (or
>>> not) this checks could be done in kvargs layer, I think this also can be
>>> to look at.
>>
>> Yes, the way to tell kvargs may lead to a lot of modifys and also break ABI.
>> I also think about just set value = "" when only exist key, It could perfectly solve the above segment scene.
>> But it also break the API's behavior.
>>
>
> What about having a new API, like `rte_kvargs_process_extended()`,
>
> That gets an additional flag as parameter, which may have values like
> following to indicate if key expects a value or not:
> ARG_MAY_HAVE_VALUE --> "key=value" OR 'key'
> ARG_WITH_VALUE --> "key=value"
> ARG_NO_VALUE --> 'key'
>
> Default flag can be 'ARG_MAY_HAVE_VALUE' and it becomes same as
> `rte_kvargs_process()`.
>
> This way instead of adding checks, relevant usage can be replaced by
> `rte_kvargs_process_extended()`, this requires similar amount of change
> but code will be more clean I think.
>
> Do you think does this work?
Yes, it can work.
But I think the introduction of new API adds some complexity.
And a good API definition could more simpler.
>
>
>>
>> Or continue fix the exist code (about 10+ place more),
>> for new invoking, because the 'arg_handler_t' already well documented (52ab17efdecf935792ee1d0cb749c0dbd536c083),
>> they'll take the initiative to prevent this.
>>
>>
>> Hope for more advise for the next.
>>
>>> .
>>>
>
> .
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 0/5] fix segment fault when parse args
2023-03-22 1:15 ` fengchengwen
@ 2023-03-22 8:53 ` Ferruh Yigit
2023-03-22 13:49 ` Thomas Monjalon
0 siblings, 1 reply; 72+ messages in thread
From: Ferruh Yigit @ 2023-03-22 8:53 UTC (permalink / raw)
To: fengchengwen, thomas, Olivier Matz; +Cc: dev, David Marchand
On 3/22/2023 1:15 AM, fengchengwen wrote:
> On 2023/3/21 21:50, Ferruh Yigit wrote:
>> On 3/17/2023 2:43 AM, fengchengwen wrote:
>>> On 2023/3/17 2:18, Ferruh Yigit wrote:
>>>> On 3/14/2023 12:48 PM, Chengwen Feng wrote:
>>>>> The rte_kvargs_process() was used to parse KV pairs, it also supports
>>>>> to parse 'only keys' (e.g. socket_id) type. And the callback function
>>>>> parameter 'value' is NULL when parsed 'only keys'.
>>>>>
>>>>> It may leads to segment fault when parse args with 'only key', this
>>>>> patchset fixes rest of them.
>>>>>
>>>>> Chengwen Feng (5):
>>>>> app/pdump: fix segment fault when parse args
>>>>> net/memif: fix segment fault when parse devargs
>>>>> net/pcap: fix segment fault when parse devargs
>>>>> net/ring: fix segment fault when parse devargs
>>>>> net/sfc: fix segment fault when parse devargs
>>>>
>>>> Hi Chengwen,
>>>>
>>>> Did you scan all `rte_kvargs_process()` instances?
>>>
>>> No, I was just looking at the modules I was concerned about.
>>> I looked at it briefly, and some modules had the same problem.
>>>
>>>>
>>>>
>>>> And if there would be a way to tell kvargs that a value is expected (or
>>>> not) this checks could be done in kvargs layer, I think this also can be
>>>> to look at.
>>>
>>> Yes, the way to tell kvargs may lead to a lot of modifys and also break ABI.
>>> I also think about just set value = "" when only exist key, It could perfectly solve the above segment scene.
>>> But it also break the API's behavior.
>>>
>>
>> What about having a new API, like `rte_kvargs_process_extended()`,
>>
>> That gets an additional flag as parameter, which may have values like
>> following to indicate if key expects a value or not:
>> ARG_MAY_HAVE_VALUE --> "key=value" OR 'key'
>> ARG_WITH_VALUE --> "key=value"
>> ARG_NO_VALUE --> 'key'
>>
>> Default flag can be 'ARG_MAY_HAVE_VALUE' and it becomes same as
>> `rte_kvargs_process()`.
>>
>> This way instead of adding checks, relevant usage can be replaced by
>> `rte_kvargs_process_extended()`, this requires similar amount of change
>> but code will be more clean I think.
>>
>> Do you think does this work?
>
> Yes, it can work.
>
> But I think the introduction of new API adds some complexity.
> And a good API definition could more simpler.
>
Other option is changing existing API, but that may be widely used and
changing it impacts applications, I don't think it worth.
Of course we can live with as it is and add checks to the callback
functions, although I still believe a new 'process()' API is better idea.
>>
>>
>>>
>>> Or continue fix the exist code (about 10+ place more),
>>> for new invoking, because the 'arg_handler_t' already well documented (52ab17efdecf935792ee1d0cb749c0dbd536c083),
>>> they'll take the initiative to prevent this.
>>>
>>>
>>> Hope for more advise for the next.
>>>
>>>> .
>>>>
>>
>> .
>>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 0/5] fix segment fault when parse args
2023-03-22 8:53 ` Ferruh Yigit
@ 2023-03-22 13:49 ` Thomas Monjalon
2023-03-23 11:58 ` fengchengwen
0 siblings, 1 reply; 72+ messages in thread
From: Thomas Monjalon @ 2023-03-22 13:49 UTC (permalink / raw)
To: fengchengwen, Olivier Matz, Ferruh Yigit; +Cc: dev, David Marchand
22/03/2023 09:53, Ferruh Yigit:
> On 3/22/2023 1:15 AM, fengchengwen wrote:
> > On 2023/3/21 21:50, Ferruh Yigit wrote:
> >> On 3/17/2023 2:43 AM, fengchengwen wrote:
> >>> On 2023/3/17 2:18, Ferruh Yigit wrote:
> >>>> On 3/14/2023 12:48 PM, Chengwen Feng wrote:
> >>>>> The rte_kvargs_process() was used to parse KV pairs, it also supports
> >>>>> to parse 'only keys' (e.g. socket_id) type. And the callback function
> >>>>> parameter 'value' is NULL when parsed 'only keys'.
> >>>>>
> >>>>> It may leads to segment fault when parse args with 'only key', this
> >>>>> patchset fixes rest of them.
> >>>>>
> >>>>> Chengwen Feng (5):
> >>>>> app/pdump: fix segment fault when parse args
> >>>>> net/memif: fix segment fault when parse devargs
> >>>>> net/pcap: fix segment fault when parse devargs
> >>>>> net/ring: fix segment fault when parse devargs
> >>>>> net/sfc: fix segment fault when parse devargs
> >>>>
> >>>> Hi Chengwen,
> >>>>
> >>>> Did you scan all `rte_kvargs_process()` instances?
> >>>
> >>> No, I was just looking at the modules I was concerned about.
> >>> I looked at it briefly, and some modules had the same problem.
> >>>
> >>>>
> >>>>
> >>>> And if there would be a way to tell kvargs that a value is expected (or
> >>>> not) this checks could be done in kvargs layer, I think this also can be
> >>>> to look at.
> >>>
> >>> Yes, the way to tell kvargs may lead to a lot of modifys and also break ABI.
> >>> I also think about just set value = "" when only exist key, It could perfectly solve the above segment scene.
> >>> But it also break the API's behavior.
> >>>
> >>
> >> What about having a new API, like `rte_kvargs_process_extended()`,
> >>
> >> That gets an additional flag as parameter, which may have values like
> >> following to indicate if key expects a value or not:
> >> ARG_MAY_HAVE_VALUE --> "key=value" OR 'key'
> >> ARG_WITH_VALUE --> "key=value"
> >> ARG_NO_VALUE --> 'key'
> >>
> >> Default flag can be 'ARG_MAY_HAVE_VALUE' and it becomes same as
> >> `rte_kvargs_process()`.
> >>
> >> This way instead of adding checks, relevant usage can be replaced by
> >> `rte_kvargs_process_extended()`, this requires similar amount of change
> >> but code will be more clean I think.
> >>
> >> Do you think does this work?
> >
> > Yes, it can work.
> >
> > But I think the introduction of new API adds some complexity.
> > And a good API definition could more simpler.
> >
>
> Other option is changing existing API, but that may be widely used and
> changing it impacts applications, I don't think it worth.
I've planned a change in kvargs API 5 years ago and never did it:
From doc/guides/rel_notes/deprecation.rst:
"
* kvargs: The function ``rte_kvargs_process`` will get a new parameter
for returning key match count. It will ease handling of no-match case.
"
> Of course we can live with as it is and add checks to the callback
> functions, although I still believe a new 'process()' API is better idea.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 0/5] fix segment fault when parse args
2023-03-22 13:49 ` Thomas Monjalon
@ 2023-03-23 11:58 ` fengchengwen
2023-03-23 12:51 ` Thomas Monjalon
0 siblings, 1 reply; 72+ messages in thread
From: fengchengwen @ 2023-03-23 11:58 UTC (permalink / raw)
To: Thomas Monjalon, Olivier Matz, Ferruh Yigit; +Cc: dev, David Marchand
On 2023/3/22 21:49, Thomas Monjalon wrote:
> 22/03/2023 09:53, Ferruh Yigit:
>> On 3/22/2023 1:15 AM, fengchengwen wrote:
>>> On 2023/3/21 21:50, Ferruh Yigit wrote:
>>>> On 3/17/2023 2:43 AM, fengchengwen wrote:
>>>>> On 2023/3/17 2:18, Ferruh Yigit wrote:
>>>>>> On 3/14/2023 12:48 PM, Chengwen Feng wrote:
>>>>>>> The rte_kvargs_process() was used to parse KV pairs, it also supports
>>>>>>> to parse 'only keys' (e.g. socket_id) type. And the callback function
>>>>>>> parameter 'value' is NULL when parsed 'only keys'.
>>>>>>>
>>>>>>> It may leads to segment fault when parse args with 'only key', this
>>>>>>> patchset fixes rest of them.
>>>>>>>
>>>>>>> Chengwen Feng (5):
>>>>>>> app/pdump: fix segment fault when parse args
>>>>>>> net/memif: fix segment fault when parse devargs
>>>>>>> net/pcap: fix segment fault when parse devargs
>>>>>>> net/ring: fix segment fault when parse devargs
>>>>>>> net/sfc: fix segment fault when parse devargs
>>>>>>
>>>>>> Hi Chengwen,
>>>>>>
>>>>>> Did you scan all `rte_kvargs_process()` instances?
>>>>>
>>>>> No, I was just looking at the modules I was concerned about.
>>>>> I looked at it briefly, and some modules had the same problem.
>>>>>
>>>>>>
>>>>>>
>>>>>> And if there would be a way to tell kvargs that a value is expected (or
>>>>>> not) this checks could be done in kvargs layer, I think this also can be
>>>>>> to look at.
>>>>>
>>>>> Yes, the way to tell kvargs may lead to a lot of modifys and also break ABI.
>>>>> I also think about just set value = "" when only exist key, It could perfectly solve the above segment scene.
>>>>> But it also break the API's behavior.
>>>>>
>>>>
>>>> What about having a new API, like `rte_kvargs_process_extended()`,
>>>>
>>>> That gets an additional flag as parameter, which may have values like
>>>> following to indicate if key expects a value or not:
>>>> ARG_MAY_HAVE_VALUE --> "key=value" OR 'key'
>>>> ARG_WITH_VALUE --> "key=value"
>>>> ARG_NO_VALUE --> 'key'
>>>>
>>>> Default flag can be 'ARG_MAY_HAVE_VALUE' and it becomes same as
>>>> `rte_kvargs_process()`.
>>>>
>>>> This way instead of adding checks, relevant usage can be replaced by
>>>> `rte_kvargs_process_extended()`, this requires similar amount of change
>>>> but code will be more clean I think.
>>>>
>>>> Do you think does this work?
>>>
>>> Yes, it can work.
>>>
>>> But I think the introduction of new API adds some complexity.
>>> And a good API definition could more simpler.
>>>
>>
>> Other option is changing existing API, but that may be widely used and
>> changing it impacts applications, I don't think it worth.
>
> I've planned a change in kvargs API 5 years ago and never did it:
>>From doc/guides/rel_notes/deprecation.rst:
> "
> * kvargs: The function ``rte_kvargs_process`` will get a new parameter
> for returning key match count. It will ease handling of no-match case.
> "
I think it's okay to add extra parameter for rte_kvargs_process. But it will
break ABI.
Also I notice patchset was deferred in patchwork.
Does it mean that the new version can't accept until the 23.11 release cycle ?
>
>> Of course we can live with as it is and add checks to the callback
>> functions, although I still believe a new 'process()' API is better idea.
>
>
>
> .
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH 0/5] fix segment fault when parse args
2023-03-23 11:58 ` fengchengwen
@ 2023-03-23 12:51 ` Thomas Monjalon
0 siblings, 0 replies; 72+ messages in thread
From: Thomas Monjalon @ 2023-03-23 12:51 UTC (permalink / raw)
To: Olivier Matz, Ferruh Yigit, fengchengwen; +Cc: dev, David Marchand
23/03/2023 12:58, fengchengwen:
> On 2023/3/22 21:49, Thomas Monjalon wrote:
> > 22/03/2023 09:53, Ferruh Yigit:
> >> On 3/22/2023 1:15 AM, fengchengwen wrote:
> >>> On 2023/3/21 21:50, Ferruh Yigit wrote:
> >>>> On 3/17/2023 2:43 AM, fengchengwen wrote:
> >>>>> On 2023/3/17 2:18, Ferruh Yigit wrote:
> >>>>>> On 3/14/2023 12:48 PM, Chengwen Feng wrote:
> >>>>>>> The rte_kvargs_process() was used to parse KV pairs, it also supports
> >>>>>>> to parse 'only keys' (e.g. socket_id) type. And the callback function
> >>>>>>> parameter 'value' is NULL when parsed 'only keys'.
> >>>>>>>
> >>>>>>> It may leads to segment fault when parse args with 'only key', this
> >>>>>>> patchset fixes rest of them.
> >>>>>>>
> >>>>>>> Chengwen Feng (5):
> >>>>>>> app/pdump: fix segment fault when parse args
> >>>>>>> net/memif: fix segment fault when parse devargs
> >>>>>>> net/pcap: fix segment fault when parse devargs
> >>>>>>> net/ring: fix segment fault when parse devargs
> >>>>>>> net/sfc: fix segment fault when parse devargs
> >>>>>>
> >>>>>> Hi Chengwen,
> >>>>>>
> >>>>>> Did you scan all `rte_kvargs_process()` instances?
> >>>>>
> >>>>> No, I was just looking at the modules I was concerned about.
> >>>>> I looked at it briefly, and some modules had the same problem.
> >>>>>
> >>>>>>
> >>>>>>
> >>>>>> And if there would be a way to tell kvargs that a value is expected (or
> >>>>>> not) this checks could be done in kvargs layer, I think this also can be
> >>>>>> to look at.
> >>>>>
> >>>>> Yes, the way to tell kvargs may lead to a lot of modifys and also break ABI.
> >>>>> I also think about just set value = "" when only exist key, It could perfectly solve the above segment scene.
> >>>>> But it also break the API's behavior.
> >>>>>
> >>>>
> >>>> What about having a new API, like `rte_kvargs_process_extended()`,
> >>>>
> >>>> That gets an additional flag as parameter, which may have values like
> >>>> following to indicate if key expects a value or not:
> >>>> ARG_MAY_HAVE_VALUE --> "key=value" OR 'key'
> >>>> ARG_WITH_VALUE --> "key=value"
> >>>> ARG_NO_VALUE --> 'key'
> >>>>
> >>>> Default flag can be 'ARG_MAY_HAVE_VALUE' and it becomes same as
> >>>> `rte_kvargs_process()`.
> >>>>
> >>>> This way instead of adding checks, relevant usage can be replaced by
> >>>> `rte_kvargs_process_extended()`, this requires similar amount of change
> >>>> but code will be more clean I think.
> >>>>
> >>>> Do you think does this work?
> >>>
> >>> Yes, it can work.
> >>>
> >>> But I think the introduction of new API adds some complexity.
> >>> And a good API definition could more simpler.
> >>>
> >>
> >> Other option is changing existing API, but that may be widely used and
> >> changing it impacts applications, I don't think it worth.
> >
> > I've planned a change in kvargs API 5 years ago and never did it:
> >>From doc/guides/rel_notes/deprecation.rst:
> > "
> > * kvargs: The function ``rte_kvargs_process`` will get a new parameter
> > for returning key match count. It will ease handling of no-match case.
> > "
>
> I think it's okay to add extra parameter for rte_kvargs_process. But it will
> break ABI.
> Also I notice patchset was deferred in patchwork.
>
> Does it mean that the new version can't accept until the 23.11 release cycle ?
It is a bit too late to take a decision in 23.03 cycle.
Let's continue this discussion.
We can either have some fixes in 23.07 or have an ABI breaking change in 23.11.
^ permalink raw reply [flat|nested] 72+ messages in thread
* Re: [PATCH v2 41/44] event/opdl: fix segment fault when parse devargs
2023-03-20 9:21 ` [PATCH v2 41/44] event/opdl: " Chengwen Feng
@ 2023-03-23 13:48 ` Liang Ma
0 siblings, 0 replies; 72+ messages in thread
From: Liang Ma @ 2023-03-23 13:48 UTC (permalink / raw)
To: Chengwen Feng; +Cc: thomas, ferruh.yigit, Peter Mccarthy, dev
On Mon, Mar 20, 2023 at 09:21:07AM +0000, Chengwen Feng wrote:
> The rte_kvargs_process() was used to parse KV pairs, it also supports
> to parse 'only keys' (e.g. socket_id) type. And the callback function
> parameter 'value' is NULL when parsed 'only keys'.
>
> This patch fixes segment fault when parse input args with 'only keys'.
>
> Fixes: 3c7f3dcfb099 ("event/opdl: add PMD main body and helper function")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Liang Ma <liangma@liangbit.com>>
> ---
> drivers/event/opdl/opdl_evdev.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c
> index 9ce8b39b60..f90d31aa19 100644
> --- a/drivers/event/opdl/opdl_evdev.c
> +++ b/drivers/event/opdl/opdl_evdev.c
> @@ -580,6 +580,8 @@ static int
> assign_numa_node(const char *key __rte_unused, const char *value, void *opaque)
> {
> int *socket_id = opaque;
> + if (value == NULL)
> + return -EINVAL;
> *socket_id = atoi(value);
> if (*socket_id >= RTE_MAX_NUMA_NODES)
> return -1;
> @@ -590,6 +592,10 @@ static int
> set_do_validation(const char *key __rte_unused, const char *value, void *opaque)
> {
> int *do_val = opaque;
> +
> + if (value == NULL)
> + return -EINVAL;
> +
> *do_val = atoi(value);
> if (*do_val != 0)
> *do_val = 1;
> @@ -601,6 +607,9 @@ set_do_test(const char *key __rte_unused, const char *value, void *opaque)
> {
> int *do_test = opaque;
>
> + if (value == NULL)
> + return -EINVAL;
> +
> *do_test = atoi(value);
>
> if (*do_test != 0)
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 72+ messages in thread
* RE: [PATCH v2 38/44] event/dlb2: fix segment fault when parse devargs
2023-03-20 9:21 ` [PATCH v2 38/44] event/dlb2: " Chengwen Feng
@ 2023-03-24 16:26 ` Sevincer, Abdullah
0 siblings, 0 replies; 72+ messages in thread
From: Sevincer, Abdullah @ 2023-03-24 16:26 UTC (permalink / raw)
To: Chengwen Feng, thomas, ferruh.yigit, McDaniel, Timothy; +Cc: dev
Acked-by: Abdullah Sevincer <abdullah.sevincer@intel.com>
-----Original Message-----
From: Chengwen Feng <fengchengwen@huawei.com>
Sent: Monday, March 20, 2023 2:21 AM
To: thomas@monjalon.net; ferruh.yigit@amd.com; McDaniel, Timothy <timothy.mcdaniel@intel.com>; Sevincer, Abdullah <abdullah.sevincer@intel.com>
Cc: dev@dpdk.org
Subject: [PATCH v2 38/44] event/dlb2: fix segment fault when parse devargs
The rte_kvargs_process() was used to parse KV pairs, it also supports to parse 'only keys' (e.g. socket_id) type. And the callback function parameter 'value' is NULL when parsed 'only keys'.
This patch fixes segment fault when parse input args with 'only keys'.
Fixes: 8d1d9070bbe9 ("event/dlb2: optimize producer port probing")
Fixes: bec8901bfe9f ("event/dlb2: support ldb port specific COS")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
drivers/event/dlb2/dlb2.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c index 60c5cd4804..d436cf852a 100644
--- a/drivers/event/dlb2/dlb2.c
+++ b/drivers/event/dlb2/dlb2.c
@@ -329,6 +329,9 @@ set_numa_node(const char *key __rte_unused, const char *value, void *opaque)
int *socket_id = opaque;
int ret;
+ if (value == NULL)
+ return -EINVAL;
+
ret = dlb2_string_to_int(socket_id, value);
if (ret < 0)
return ret;
@@ -542,7 +545,7 @@ set_cos_bw(const char *key __rte_unused, {
struct dlb2_cos_bw *cos_bw = opaque;
- if (opaque == NULL) {
+ if (value == NULL || opaque == NULL) {
DLB2_LOG_ERR("NULL pointer\n");
return -EINVAL;
}
--
2.17.1
^ permalink raw reply [flat|nested] 72+ messages in thread
end of thread, other threads:[~2023-03-24 16:26 UTC | newest]
Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 12:48 [PATCH 0/5] fix segment fault when parse args Chengwen Feng
2023-03-14 12:48 ` [PATCH 1/5] app/pdump: " Chengwen Feng
2023-03-16 17:34 ` Ferruh Yigit
2023-03-14 12:48 ` [PATCH 2/5] net/memif: fix segment fault when parse devargs Chengwen Feng
2023-03-16 18:20 ` Ferruh Yigit
2023-03-14 12:48 ` [PATCH 3/5] net/pcap: " Chengwen Feng
2023-03-16 18:20 ` Ferruh Yigit
2023-03-14 12:48 ` [PATCH 4/5] net/ring: " Chengwen Feng
2023-03-14 12:48 ` [PATCH 5/5] net/sfc: " Chengwen Feng
2023-03-16 18:20 ` Ferruh Yigit
2023-03-16 18:18 ` [PATCH 0/5] fix segment fault when parse args Ferruh Yigit
2023-03-17 2:43 ` fengchengwen
2023-03-21 13:50 ` Ferruh Yigit
2023-03-22 1:15 ` fengchengwen
2023-03-22 8:53 ` Ferruh Yigit
2023-03-22 13:49 ` Thomas Monjalon
2023-03-23 11:58 ` fengchengwen
2023-03-23 12:51 ` Thomas Monjalon
2023-03-20 9:20 ` [PATCH v2 00/44] " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 01/44] app/pdump: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 02/44] ethdev: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 03/44] net/memif: fix segment fault when parse devargs Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 04/44] net/pcap: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 05/44] net/ring: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 06/44] net/sfc: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 07/44] net/af_xdp: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 08/44] net/ark: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 09/44] net/cnxk: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 10/44] net/cxgbe: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 11/44] net/dpaa2: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 12/44] net/ena: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 13/44] net/enic: " Chengwen Feng
2023-03-20 21:37 ` John Daley (johndale)
2023-03-20 9:20 ` [PATCH v2 14/44] net/fm10k: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 15/44] net/i40e: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 16/44] net/iavf: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 17/44] net/ice: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 18/44] net/idpf: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 19/44] net/ionic: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 20/44] net/mana: " Chengwen Feng
2023-03-21 22:19 ` Long Li
2023-03-20 9:20 ` [PATCH v2 21/44] net/mlx4: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 22/44] net/mvneta: " Chengwen Feng
2023-03-20 9:33 ` [EXT] " Liron Himi
2023-03-20 9:20 ` [PATCH v2 23/44] net/mvpp2: " Chengwen Feng
2023-03-20 9:33 ` [EXT] " Liron Himi
2023-03-20 9:20 ` [PATCH v2 24/44] net/netvsc: " Chengwen Feng
2023-03-21 22:20 ` Long Li
2023-03-20 9:20 ` [PATCH v2 25/44] net/octeontx: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 26/44] net/pfe: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 27/44] net/qede: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 28/44] baseband/la12xx: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 29/44] bus/pci: fix segment fault when parse args Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 30/44] common/mlx5: fix segment fault when parse devargs Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 31/44] crypto/cnxk: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 32/44] crypto/dpaa_sec: " Chengwen Feng
2023-03-20 9:20 ` [PATCH v2 33/44] crypto/dpaa2_sec: " Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 34/44] crypto/mvsam: " Chengwen Feng
2023-03-20 9:33 ` [EXT] " Liron Himi
2023-03-20 9:21 ` [PATCH v2 35/44] crypto/scheduler: " Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 36/44] dma/dpaa2: " Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 37/44] event/cnxk: " Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 38/44] event/dlb2: " Chengwen Feng
2023-03-24 16:26 ` Sevincer, Abdullah
2023-03-20 9:21 ` [PATCH v2 39/44] event/dpaa: " Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 40/44] event/octeontx: " Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 41/44] event/opdl: " Chengwen Feng
2023-03-23 13:48 ` Liang Ma
2023-03-20 9:21 ` [PATCH v2 42/44] event/sw: " Chengwen Feng
2023-03-20 11:58 ` Van Haaren, Harry
2023-03-20 9:21 ` [PATCH v2 43/44] mempool/cnxk: " Chengwen Feng
2023-03-20 9:21 ` [PATCH v2 44/44] raw/cnxk_gpio: " 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).