Skip to contentSkip to conversation

vhost: fix missing null dev pointer check

PATCH Superseded [email protected] 4 participants 9 messages Jul 14, 2020 – Jul 21, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost: fix missing null dev pointer check

From: Patrick Fu <[email protected]>

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")
---
 lib/librte_vhost/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_vhost/virtio_net.c +3 -0
index 1d0be3dd4..235c31e28 100644
@@ -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",
Signature · 1 line
2.18.4
#1 lore raw

PATCH v2 1/1 vhost: fix missing null dev pointer check

From: Patrick Fu <[email protected]>

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")

---
v2:
- change fixline number

 lib/librte_vhost/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_vhost/virtio_net.c +3 -0
index 1d0be3dd4..235c31e28 100644
@@ -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",
Signature · 1 line
2.18.4
Reviewed-by on v2 1/1
#2 lore raw
Quoted 39 lines

-----Original Message-----
From: Fu, Patrick <[email protected]>
Sent: Thursday, July 16, 2020 11:38 PM
To: [email protected]; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>
Subject: [PATCH v2] vhost: fix missing null dev pointer check

From: Patrick Fu <[email protected]>

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")

---
v2:
- change fixline number

 lib/librte_vhost/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_vhost/virtio_net.c index renamed from lib/librte_vhost/virtio_net.c +0 -0

1d0be3dd4..235c31e28 100644

lib/librte_vhost/virtio_net.c +3 -0
@@ -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))) {
Quoted 3 lines

VHOST_LOG_DATA(ERR, "(%d) %s: invalid virtqueue idx %d.\n",
--
2.18.4

Applied
#3 lore raw
Quoted 14 lines · Chenbo
Quoted 14 lines

-----Original Message-----
From: Fu, Patrick <[email protected]>
Sent: Thursday, July 16, 2020 11:38 PM
To: [email protected]; [email protected]; Xia, Chenbo <[email protected]>
Cc: Fu, Patrick <[email protected]>
Subject: [PATCH v2] vhost: fix missing null dev pointer check

From: Patrick Fu <[email protected]>

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.

Quoted 7 lines
Quoted 4 lines

Coverity issue: 360839

Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")

Applied to dpdk-next-net/master, thanks.

#4 lore raw
In reply to [email protected]

What about below title (we try to avoid passing variable names in commit titles)?
vhost: fix missing device pointer validity check

Quoted 32 lines · On 7/16/20 5:37 PM, [email protected] wrote:

From: Patrick Fu <[email protected]>

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")

---
v2:
- change fixline number

 lib/librte_vhost/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_vhost/virtio_net.c +3 -0
index 1d0be3dd4..235c31e28 100644
@@ -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",
#5 lore raw
Quoted 3 lines · Maxime Coquelin

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.

Quoted 12 lines · On 7/16/20 5:37 PM, [email protected] wrote:
Quoted 10 lines

From: Patrick Fu <[email protected]>

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")

<...>

#6 lore raw

PATCH v3 1/1 vhost: fix missing device pointer validity check

In reply to [email protected]

From: Patrick Fu <[email protected]>

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")

---
v2:
- change fixline number
v3:
- revise commit message title

 lib/librte_vhost/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_vhost/virtio_net.c +3 -0
index 1d0be3dd4..235c31e28 100644
@@ -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",
Signature · 1 line
2.18.4
Reviewed-by on v3 1/1
#7 lore raw

Re: [dpdk-dev] [PATCH v3] vhost: fix missing device pointer validity check

Quoted 25 lines · On 7/21/20 5:23 AM, [email protected] wrote:

From: Patrick Fu <[email protected]>

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")

---
v2:
- change fixline number
v3:
- revise commit message title

 lib/librte_vhost/virtio_net.c | 3 +++
 1 file changed, 3 insertions(+)
lib/librte_vhost/virtio_net.c +0 -0
index 1d0be3dd4..235c31e28 100644

lib/librte_vhost/virtio_net.c uint16_t rte_vhost_poll_enqueue_completed(int vid, uint16_t queue_id, · line 1643

Quoted 9 lines
lib/librte_vhost/virtio_net.c +3 -0
@@ -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",

Thanks,
Maxime

Applied
#8 lore raw

Re: [dpdk-dev] [PATCH v3] vhost: fix missing device pointer validity check

Quoted 9 lines · Maxime Coquelin
Quoted 6 lines · On 7/21/20 5:23 AM, [email protected] wrote:

From: Patrick Fu <[email protected]>

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.

Quoted 7 lines
Quoted 4 lines

Coverity issue: 360839

Fixes cd6760da1076 ("vhost: introduce async enqueue for split ring")

Applied to dpdk-next-net/master, thanks.