From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Chengwen Feng <fengchengwen@huawei.com>,
thomas@monjalon.net, ferruh.yigit@amd.com,
Chenbo Xia <chenbo.xia@intel.com>, Yong Liu <yong.liu@intel.com>,
Ivan Dyukov <i.dyukov@samsung.com>,
Ferruh Yigit <ferruh.yigit@intel.com>,
Xiao Wang <xiao.w.wang@intel.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH 7/9] net/virtio: fix segment fault when parse devargs
Date: Thu, 9 Mar 2023 16:21:08 +0100 [thread overview]
Message-ID: <20aae1d9-5da0-4a80-95ce-d2ced1ffa836@redhat.com> (raw)
In-Reply-To: <20230302075012.32423-8-fengchengwen@huawei.com>
On 3/2/23 08:50, 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'
> (e.g. vectorized,vdpa).
>
> Fixes: 4710e16a4a7b ("net/virtio: add parameter to enable vectorized path")
> Fixes: 44d7b2e87b69 ("net/virtio: refactor devargs parsing")
> Fixes: 440f03c25378 ("net/virtio: skip device probe in vDPA mode")
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
> drivers/net/virtio/virtio_ethdev.c | 3 +++
> drivers/net/virtio/virtio_pci_ethdev.c | 3 +++
> 2 files changed, 6 insertions(+)
>
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index 0103d95920..d10f42bba2 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -2054,6 +2054,9 @@ virtio_dev_speed_capa_get(uint32_t speed)
> static int vectorized_check_handler(__rte_unused const char *key,
> const char *value, void *ret_val)
> {
> + if (value == NULL || ret_val == NULL)
> + return -EINVAL;
> +
> if (strcmp(value, "1") == 0)
> *(int *)ret_val = 1;
> else
> diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
> index abc63b0935..9b4b846f8a 100644
> --- a/drivers/net/virtio/virtio_pci_ethdev.c
> +++ b/drivers/net/virtio/virtio_pci_ethdev.c
> @@ -148,6 +148,9 @@ eth_virtio_pci_uninit(struct rte_eth_dev *eth_dev)
> static int vdpa_check_handler(__rte_unused const char *key,
> const char *value, void *ret_val)
> {
> + if (value == NULL || ret_val == NULL)
> + return -EINVAL;
> +
> if (strcmp(value, "1") == 0)
> *(int *)ret_val = 1;
> else
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
next prev parent reply other threads:[~2023-03-09 15:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 7:50 [PATCH 0/9] fix kvargs callback prototype not clearly defined Chengwen Feng
2023-03-02 7:50 ` [PATCH 1/9] kvargs: detailed definition of callback prototype Chengwen Feng
2023-03-09 13:12 ` Olivier Matz
2023-03-02 7:50 ` [PATCH 2/9] compressdev: fix segment fault when parse input args Chengwen Feng
2023-03-02 7:50 ` [PATCH 3/9] compressdev: fix null name " Chengwen Feng
2023-03-02 7:50 ` [PATCH 4/9] cryptodev: fix segment fault " Chengwen Feng
2023-03-02 8:11 ` [EXT] " Akhil Goyal
2023-03-02 9:21 ` fengchengwen
2023-03-02 7:50 ` [PATCH 5/9] cryptodev: fix null name " Chengwen Feng
2023-03-02 7:50 ` [PATCH 6/9] net/hns3: fix segment fault when parse runtime config Chengwen Feng
2023-03-08 7:37 ` Dongdong Liu
2023-03-02 7:50 ` [PATCH 7/9] net/virtio: fix segment fault when parse devargs Chengwen Feng
2023-03-09 15:21 ` Maxime Coquelin [this message]
2023-03-02 7:50 ` [PATCH 8/9] dma/skeleton: " Chengwen Feng
2023-03-02 7:50 ` [PATCH 9/9] raw/skeleton: " Chengwen Feng
2023-03-02 9:17 ` [PATCH 0/9] fix kvargs callback prototype not clearly defined fengchengwen
2023-03-09 15:19 ` David Marchand
-- strict thread matches above, loose matches on Subject: below --
2023-03-02 7:48 Chengwen Feng
2023-03-02 7:48 ` [PATCH 7/9] net/virtio: fix segment fault when parse devargs Chengwen Feng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20aae1d9-5da0-4a80-95ce-d2ced1ffa836@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=chenbo.xia@intel.com \
--cc=dev@dpdk.org \
--cc=fengchengwen@huawei.com \
--cc=ferruh.yigit@amd.com \
--cc=ferruh.yigit@intel.com \
--cc=i.dyukov@samsung.com \
--cc=thomas@monjalon.net \
--cc=xiao.w.wang@intel.com \
--cc=yong.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).