DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] vhost: fix possible out of bound access for indirect descs
@ 2019-01-21  8:12 Tiwei Bie
  2019-01-21  8:29 ` Maxime Coquelin
  2019-01-21 12:43 ` Maxime Coquelin
  0 siblings, 2 replies; 3+ messages in thread
From: Tiwei Bie @ 2019-01-21  8:12 UTC (permalink / raw)
  To: maxime.coquelin, zhihong.wang, dev; +Cc: haiyue.wang, stable

Fix a possible out of bound access which may happen when handling
indirect descs in split ring.

Fixes: 1be4ebb1c464 ("vhost: support indirect descriptor in mergeable Rx")
Cc: stable@dpdk.org

Reported-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
---
 lib/librte_vhost/virtio_net.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c
index 0893a1d04..37a4c00d2 100644
--- a/lib/librte_vhost/virtio_net.c
+++ b/lib/librte_vhost/virtio_net.c
@@ -310,6 +310,7 @@ fill_vec_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	uint32_t len    = 0;
 	uint64_t dlen;
 	uint32_t nr_descs = vq->size;
+	uint32_t cnt    = 0;
 	struct vring_desc *descs = vq->desc;
 	struct vring_desc *idesc = NULL;
 
@@ -348,12 +349,7 @@ fill_vec_buf_split(struct virtio_net *dev, struct vhost_virtqueue *vq,
 	}
 
 	while (1) {
-		if (unlikely(idx >= vq->size)) {
-			free_ind_table(idesc);
-			return -1;
-		}
-
-		if (unlikely(nr_descs-- == 0)) {
+		if (unlikely(idx >= nr_descs || cnt++ >= nr_descs)) {
 			free_ind_table(idesc);
 			return -1;
 		}
-- 
2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fix possible out of bound access for indirect descs
  2019-01-21  8:12 [dpdk-dev] [PATCH] vhost: fix possible out of bound access for indirect descs Tiwei Bie
@ 2019-01-21  8:29 ` Maxime Coquelin
  2019-01-21 12:43 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2019-01-21  8:29 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev; +Cc: haiyue.wang, stable



On 1/21/19 9:12 AM, Tiwei Bie wrote:
> Fix a possible out of bound access which may happen when handling
> indirect descs in split ring.
> 
> Fixes: 1be4ebb1c464 ("vhost: support indirect descriptor in mergeable Rx")
> Cc: stable@dpdk.org
> 
> Reported-by: Haiyue Wang <haiyue.wang@intel.com>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   lib/librte_vhost/virtio_net.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)


Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] vhost: fix possible out of bound access for indirect descs
  2019-01-21  8:12 [dpdk-dev] [PATCH] vhost: fix possible out of bound access for indirect descs Tiwei Bie
  2019-01-21  8:29 ` Maxime Coquelin
@ 2019-01-21 12:43 ` Maxime Coquelin
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Coquelin @ 2019-01-21 12:43 UTC (permalink / raw)
  To: Tiwei Bie, zhihong.wang, dev; +Cc: haiyue.wang, stable



On 1/21/19 9:12 AM, Tiwei Bie wrote:
> Fix a possible out of bound access which may happen when handling
> indirect descs in split ring.
> 
> Fixes: 1be4ebb1c464 ("vhost: support indirect descriptor in mergeable Rx")
> Cc: stable@dpdk.org
> 
> Reported-by: Haiyue Wang <haiyue.wang@intel.com>
> Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
> ---
>   lib/librte_vhost/virtio_net.c | 8 ++------
>   1 file changed, 2 insertions(+), 6 deletions(-)
> 


Applide to dpdk-next-virtio/master.

Thanks,
Maxime

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-01-21 12:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21  8:12 [dpdk-dev] [PATCH] vhost: fix possible out of bound access for indirect descs Tiwei Bie
2019-01-21  8:29 ` Maxime Coquelin
2019-01-21 12:43 ` Maxime Coquelin

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