From: Patrick Fu <patrick.fu@intel.com> This patch adds the check of dev pointer in vhost async enqueue completion poll. If a NULL dev pointer detected, the poll function returns immediately. Coverity issue: 360839 Fixes: cd6760da10 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu <patrick.fu@intel.com> --- lib/librte_vhost/virtio_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 1d0be3dd4..235c31e28 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1635,6 +1635,9 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, uint16_t start_idx, pkts_idx, vq_size; uint64_t *async_pending_info; + if (!dev) + return 0; + VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__); if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) { VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n", -- 2.18.4
From: Patrick Fu <patrick.fu@intel.com> This patch adds the check of dev pointer in vhost async enqueue completion poll. If a NULL dev pointer detected, the poll function returns immediately. Coverity issue: 360839 Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu <patrick.fu@intel.com> --- v2: - change fixline number lib/librte_vhost/virtio_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 1d0be3dd4..235c31e28 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1635,6 +1635,9 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, uint16_t start_idx, pkts_idx, vq_size; uint64_t *async_pending_info; + if (!dev) + return 0; + VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__); if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) { VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n", -- 2.18.4
> -----Original Message-----
> From: Fu, Patrick <patrick.fu@intel.com>
> Sent: Thursday, July 16, 2020 11:38 PM
> To: dev@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo
> <chenbo.xia@intel.com>
> Cc: Fu, Patrick <patrick.fu@intel.com>
> Subject: [PATCH v2] vhost: fix missing null dev pointer check
>
> From: Patrick Fu <patrick.fu@intel.com>
>
> This patch adds the check of dev pointer in vhost async enqueue completion poll.
> If a NULL dev pointer detected, the poll function returns immediately.
>
> Coverity issue: 360839
> Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
>
> Signed-off-by: Patrick Fu <patrick.fu@intel.com>
> ---
> v2:
> - change fixline number
>
> lib/librte_vhost/virtio_net.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index
> 1d0be3dd4..235c31e28 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1635,6 +1635,9 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid,
> uint16_t queue_id,
> uint16_t start_idx, pkts_idx, vq_size;
> uint64_t *async_pending_info;
>
> + if (!dev)
> + return 0;
> +
> VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__);
> if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) {
> VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n",
> --
> 2.18.4
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
On 7/17/2020 9:08 AM, Xia, Chenbo wrote:
>
>> -----Original Message-----
>> From: Fu, Patrick <patrick.fu@intel.com>
>> Sent: Thursday, July 16, 2020 11:38 PM
>> To: dev@dpdk.org; maxime.coquelin@redhat.com; Xia, Chenbo
>> <chenbo.xia@intel.com>
>> Cc: Fu, Patrick <patrick.fu@intel.com>
>> Subject: [PATCH v2] vhost: fix missing null dev pointer check
>>
>> From: Patrick Fu <patrick.fu@intel.com>
>>
>> This patch adds the check of dev pointer in vhost async enqueue completion poll.
>> If a NULL dev pointer detected, the poll function returns immediately.
>>
>> Coverity issue: 360839
>> Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
>>
>> Signed-off-by: Patrick Fu <patrick.fu@intel.com>
>
> Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
>
Applied to dpdk-next-net/master, thanks.
What about below title (we try to avoid passing variable names in commit
titles)?
vhost: fix missing device pointer validity check
On 7/16/20 5:37 PM, patrick.fu@intel.com wrote:
> From: Patrick Fu <patrick.fu@intel.com>
>
> This patch adds the check of dev pointer in vhost async enqueue
> completion poll. If a NULL dev pointer detected, the poll function
> returns immediately.
>
> Coverity issue: 360839
> Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
>
> Signed-off-by: Patrick Fu <patrick.fu@intel.com>
> ---
> v2:
> - change fixline number
>
> lib/librte_vhost/virtio_net.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 1d0be3dd4..235c31e28 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1635,6 +1635,9 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
> uint16_t start_idx, pkts_idx, vq_size;
> uint64_t *async_pending_info;
>
> + if (!dev)
> + return 0;
> +
> VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__);
> if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) {
> VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n",
>
On 7/20/2020 4:55 PM, Maxime Coquelin wrote: > What about below title (we try to avoid passing variable names in commit > titles)? > vhost: fix missing device pointer validity check Existing commit dropped from next-net and patchwork status updated. > > On 7/16/20 5:37 PM, patrick.fu@intel.com wrote: >> From: Patrick Fu <patrick.fu@intel.com> >> >> This patch adds the check of dev pointer in vhost async enqueue >> completion poll. If a NULL dev pointer detected, the poll function >> returns immediately. >> >> Coverity issue: 360839 >> Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") >> >> Signed-off-by: Patrick Fu <patrick.fu@intel.com> <...>
From: Patrick Fu <patrick.fu@intel.com> This patch adds the check of dev pointer in vhost async enqueue completion poll. If a NULL dev pointer detected, the poll function returns immediately. Coverity issue: 360839 Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring") Signed-off-by: Patrick Fu <patrick.fu@intel.com> --- v2: - change fixline number v3: - revise commit message title lib/librte_vhost/virtio_net.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c index 1d0be3dd4..235c31e28 100644 --- a/lib/librte_vhost/virtio_net.c +++ b/lib/librte_vhost/virtio_net.c @@ -1635,6 +1635,9 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, uint16_t start_idx, pkts_idx, vq_size; uint64_t *async_pending_info; + if (!dev) + return 0; + VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__); if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) { VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n", -- 2.18.4
On 7/21/20 5:23 AM, patrick.fu@intel.com wrote:
> From: Patrick Fu <patrick.fu@intel.com>
>
> This patch adds the check of dev pointer in vhost async enqueue
> completion poll. If a NULL dev pointer detected, the poll function
> returns immediately.
>
> Coverity issue: 360839
> Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
>
> Signed-off-by: Patrick Fu <patrick.fu@intel.com>
> ---
> v2:
> - change fixline number
> v3:
> - revise commit message title
>
> lib/librte_vhost/virtio_net.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
> index 1d0be3dd4..235c31e28 100644
> --- a/lib/librte_vhost/virtio_net.c
> +++ b/lib/librte_vhost/virtio_net.c
> @@ -1635,6 +1635,9 @@ uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id,
> uint16_t start_idx, pkts_idx, vq_size;
> uint64_t *async_pending_info;
>
> + if (!dev)
> + return 0;
> +
> VHOST_LOG_DATA(DEBUG, "(%d) %s\n", dev->vid, __func__);
> if (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) {
> VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n",
>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
On 7/21/2020 9:36 AM, Maxime Coquelin wrote:
>
>
> On 7/21/20 5:23 AM, patrick.fu@intel.com wrote:
>> From: Patrick Fu <patrick.fu@intel.com>
>>
>> This patch adds the check of dev pointer in vhost async enqueue
>> completion poll. If a NULL dev pointer detected, the poll function
>> returns immediately.
>>
>> Coverity issue: 360839
>> Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
>>
>> Signed-off-by: Patrick Fu <patrick.fu@intel.com>
>
> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>
Applied to dpdk-next-net/master, thanks.