* [dpdk-dev] [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-bounds read
2015-12-10 17:57 [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Huawei
@ 2015-12-10 17:57 ` Huawei
2015-12-11 14:48 ` Mcnamara, John
2015-12-10 17:57 ` [dpdk-dev] [PATCH] virtio: fix virtio_net_hdr desc pointing to the same buffer Huawei
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Huawei @ 2015-12-10 17:57 UTC (permalink / raw)
To: dev
CID 107126 (#1 OF 1): Out-of-bounds read
Fixes: 8f972312b8f4 ("vhost: support vhost-user")
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
lib/librte_vhost/vhost_user/vhost-net-user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c b/lib/librte_vhost/vhost_user/vhost-net-user.c
index 2dc0547..549f907 100644
--- a/lib/librte_vhost/vhost_user/vhost-net-user.c
+++ b/lib/librte_vhost/vhost_user/vhost-net-user.c
@@ -333,7 +333,7 @@ vserver_message_handler(int connfd, void *dat, int *remove)
ctx.fh = cfd_ctx->fh;
ret = read_vhost_message(connfd, &msg);
- if (ret <= 0 || msg.request > VHOST_USER_MAX) {
+ if (ret <= 0 || msg.request >= VHOST_USER_MAX) {
if (ret < 0)
RTE_LOG(ERR, VHOST_CONFIG,
"vhost read message failed\n");
--
1.8.1.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-bounds read
2015-12-10 17:57 ` [dpdk-dev] [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-bounds read Huawei
@ 2015-12-11 14:48 ` Mcnamara, John
2015-12-11 14:57 ` Xie, Huawei
0 siblings, 1 reply; 12+ messages in thread
From: Mcnamara, John @ 2015-12-11 14:48 UTC (permalink / raw)
To: Xie, Huawei, dev
> -----Original Message-----
> From: Huawei Xie
> Sent: Thursday, December 10, 2015 5:57 PM
> To: dev@dpdk.org
> Cc: Mcnamara, John; Xie, Huawei
> Subject: [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-
> bounds read
>
> CID 107126 (#1 OF 1): Out-of-bounds read
> Fixes: 8f972312b8f4 ("vhost: support vhost-user")
>
> Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Thanks. In future could you also update the Coverity Action to "Fix Submitted".
I'll do it this time for the ones I ack.
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-dev] [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-bounds read
2015-12-11 14:48 ` Mcnamara, John
@ 2015-12-11 14:57 ` Xie, Huawei
0 siblings, 0 replies; 12+ messages in thread
From: Xie, Huawei @ 2015-12-11 14:57 UTC (permalink / raw)
To: Mcnamara, John, dev
On 12/11/2015 10:49 PM, Mcnamara, John wrote:
>> -----Original Message-----
>> From: Huawei Xie
>> Sent: Thursday, December 10, 2015 5:57 PM
>> To: dev@dpdk.org
>> Cc: Mcnamara, John; Xie, Huawei
>> Subject: [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-
>> bounds read
>>
>> CID 107126 (#1 OF 1): Out-of-bounds read
>> Fixes: 8f972312b8f4 ("vhost: support vhost-user")
>>
>> Signed-off-by: Huawei Xie <huawei.xie@intel.com>
> Thanks. In future could you also update the Coverity Action to "Fix Submitted".
> I'll do it this time for the ones I ack.
Thanks John. I already planned to do this.
>
> Acked-by: John McNamara <john.mcnamara@intel.com>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH] virtio: fix virtio_net_hdr desc pointing to the same buffer
2015-12-10 17:57 [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Huawei
2015-12-10 17:57 ` [dpdk-dev] [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-bounds read Huawei
@ 2015-12-10 17:57 ` Huawei
2015-12-10 17:57 ` [dpdk-dev] [PATCH 2/4] vhost: Fix Coverity issue with missed break in switch Huawei
` (3 subsequent siblings)
5 siblings, 0 replies; 12+ messages in thread
From: Huawei @ 2015-12-10 17:57 UTC (permalink / raw)
To: dev
The virtio_net_hdr desc all pointed to the same buffer. It doesn't cause
issue because in the simple TX mode we don't use the header. This patch
makes the header desc point to different buffer.
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
drivers/net/virtio/virtio_rxtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 74b39ef..6cfd315 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -352,7 +352,7 @@ virtio_dev_vring_start(struct virtqueue *vq, int queue_type)
vq->vq_ring.desc[i + mid_idx].next = i;
vq->vq_ring.desc[i + mid_idx].addr =
vq->virtio_net_hdr_mem +
- mid_idx * vq->hw->vtnet_hdr_size;
+ i * vq->hw->vtnet_hdr_size;
vq->vq_ring.desc[i + mid_idx].len =
vq->hw->vtnet_hdr_size;
vq->vq_ring.desc[i + mid_idx].flags =
--
1.8.1.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH 2/4] vhost: Fix Coverity issue with missed break in switch
2015-12-10 17:57 [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Huawei
2015-12-10 17:57 ` [dpdk-dev] [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-bounds read Huawei
2015-12-10 17:57 ` [dpdk-dev] [PATCH] virtio: fix virtio_net_hdr desc pointing to the same buffer Huawei
@ 2015-12-10 17:57 ` Huawei
2015-12-11 14:51 ` Mcnamara, John
2015-12-10 17:57 ` [dpdk-dev] [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking Huawei
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Huawei @ 2015-12-10 17:57 UTC (permalink / raw)
To: dev
CID 107114 (#1 of 1): Missing break in switch
Fixes: 8f972312b8f4 ("vhost: support vhost-user")
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
lib/librte_vhost/vhost_user/vhost-net-user.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/librte_vhost/vhost_user/vhost-net-user.c b/lib/librte_vhost/vhost_user/vhost-net-user.c
index 549f907..8b7a448 100644
--- a/lib/librte_vhost/vhost_user/vhost-net-user.c
+++ b/lib/librte_vhost/vhost_user/vhost-net-user.c
@@ -389,6 +389,8 @@ vserver_message_handler(int connfd, void *dat, int *remove)
case VHOST_USER_SET_LOG_BASE:
RTE_LOG(INFO, VHOST_CONFIG, "not implemented.\n");
+ break;
+
case VHOST_USER_SET_LOG_FD:
close(msg.fds[0]);
RTE_LOG(INFO, VHOST_CONFIG, "not implemented.\n");
--
1.8.1.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking
2015-12-10 17:57 [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Huawei
` (2 preceding siblings ...)
2015-12-10 17:57 ` [dpdk-dev] [PATCH 2/4] vhost: Fix Coverity issue with missed break in switch Huawei
@ 2015-12-10 17:57 ` Huawei
2015-12-11 14:53 ` Mcnamara, John
2015-12-10 17:57 ` [dpdk-dev] [PATCH 4/4] vhost: Fix Coverity issue with logically dead code Huawei
2015-12-13 1:16 ` [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Thomas Monjalon
5 siblings, 1 reply; 12+ messages in thread
From: Huawei @ 2015-12-10 17:57 UTC (permalink / raw)
To: dev
CID 107113 (#1 of 1): Missing unlock (LOCK)5. missing_unlock: Returning
without unlocking pfdset->fd_mutex.
Fixes: fbf7e07ca142 ("vhost: add select based event driven processing")
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
lib/librte_vhost/vhost_user/fd_man.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/librte_vhost/vhost_user/fd_man.c b/lib/librte_vhost/vhost_user/fd_man.c
index d68b270..087aaed 100644
--- a/lib/librte_vhost/vhost_user/fd_man.c
+++ b/lib/librte_vhost/vhost_user/fd_man.c
@@ -150,8 +150,10 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat)
/* Find a free slot in the list. */
i = fdset_find_free_slot(pfdset);
- if (i == -1)
+ if (i == -1) {
+ pthread_mutex_unlock(&pfdset->fd_mutex);
return -2;
+ }
fdset_add_fd(pfdset, i, fd, rcb, wcb, dat);
pfdset->num++;
--
1.8.1.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-dev] [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking
2015-12-10 17:57 ` [dpdk-dev] [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking Huawei
@ 2015-12-11 14:53 ` Mcnamara, John
0 siblings, 0 replies; 12+ messages in thread
From: Mcnamara, John @ 2015-12-11 14:53 UTC (permalink / raw)
To: Xie, Huawei, dev
> -----Original Message-----
> From: Huawei Xie
> Sent: Thursday, December 10, 2015 5:57 PM
> To: dev@dpdk.org
> Cc: Mcnamara, John; Xie, Huawei
> Subject: [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking
>
> CID 107113 (#1 of 1): Missing unlock (LOCK)5. missing_unlock: Returning
> without unlocking pfdset->fd_mutex.
> Fixes: fbf7e07ca142 ("vhost: add select based event driven processing")
>
> Signed-off-by: Huawei Xie <huawei.xie@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [dpdk-dev] [PATCH 4/4] vhost: Fix Coverity issue with logically dead code
2015-12-10 17:57 [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Huawei
` (3 preceding siblings ...)
2015-12-10 17:57 ` [dpdk-dev] [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking Huawei
@ 2015-12-10 17:57 ` Huawei
2015-12-11 14:54 ` Mcnamara, John
2015-12-13 1:16 ` [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Thomas Monjalon
5 siblings, 1 reply; 12+ messages in thread
From: Huawei @ 2015-12-10 17:57 UTC (permalink / raw)
To: dev
CID 107107 (#1 of 1): Logically dead code
Fixes: af4f2c5feb2e ("vhost: fix code style")
Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
lib/librte_vhost/virtio-net.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/librte_vhost/virtio-net.c b/lib/librte_vhost/virtio-net.c
index 8364938..de78a0f 100644
--- a/lib/librte_vhost/virtio-net.c
+++ b/lib/librte_vhost/virtio-net.c
@@ -863,8 +863,7 @@ int rte_vhost_enable_guest_notification(struct virtio_net *dev,
return -1;
}
- dev->virtqueue[queue_id]->used->flags =
- enable ? 0 : VRING_USED_F_NO_NOTIFY;
+ dev->virtqueue[queue_id]->used->flags = VRING_USED_F_NO_NOTIFY;
return 0;
}
--
1.8.1.4
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library
2015-12-10 17:57 [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Huawei
` (4 preceding siblings ...)
2015-12-10 17:57 ` [dpdk-dev] [PATCH 4/4] vhost: Fix Coverity issue with logically dead code Huawei
@ 2015-12-13 1:16 ` Thomas Monjalon
5 siblings, 0 replies; 12+ messages in thread
From: Thomas Monjalon @ 2015-12-13 1:16 UTC (permalink / raw)
To: huawei.xie; +Cc: dev
2015-12-11 01:57, Huawei@dpdk.org, Xie@dpdk.org:
> Huawei Xie (4):
> vhost: Fix Coverity issue with possible array out-of-bounds read
> vhost: Fix Coverity issue with missed break in switch
> vhost: Fix Coverity issue with missed unlocking
> vhost: Fix Coverity issue with logically dead code
Simple fixes.
Applied, thanks
^ permalink raw reply [flat|nested] 12+ messages in thread