* [dpdk-dev] [PATCH] vhost: fix off-by-one error on nr_desc check
@ 2016-07-25 14:09 Maxime Coquelin
2016-07-25 15:24 ` Yuanhan Liu
0 siblings, 1 reply; 4+ messages in thread
From: Maxime Coquelin @ 2016-07-25 14:09 UTC (permalink / raw)
To: huawei.xie, yuanhan.liu; +Cc: dev, Maxime Coquelin
nr_desc is not an index but the number of descriptors,
so can be equal to the virtqueue size.
Fixes: a436f53ebfeb ("vhost: avoid dead loop chain")
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
Hi Yuanhan,
I faced the bug while testing my indirect descriptor patch, it happens
as soon as the number of chained descritors is above 2.
But the bug may in theory also be faced with normal descriptors, so it might
be good to have it 16.07?
Regards,
Maxime
---
lib/librte_vhost/vhost_rxtx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c
index bc00518..08a73fd 100644
--- a/lib/librte_vhost/vhost_rxtx.c
+++ b/lib/librte_vhost/vhost_rxtx.c
@@ -748,7 +748,7 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq,
break;
if (unlikely(desc->next >= vq->size ||
- ++nr_desc >= vq->size))
+ ++nr_desc > vq->size))
return -1;
desc = &vq->desc[desc->next];
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix off-by-one error on nr_desc check
2016-07-25 14:09 [dpdk-dev] [PATCH] vhost: fix off-by-one error on nr_desc check Maxime Coquelin
@ 2016-07-25 15:24 ` Yuanhan Liu
2016-07-25 15:28 ` Maxime Coquelin
2016-07-25 15:47 ` Thomas Monjalon
0 siblings, 2 replies; 4+ messages in thread
From: Yuanhan Liu @ 2016-07-25 15:24 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: huawei.xie, dev, Thomas Monjalon
On Mon, Jul 25, 2016 at 04:09:58PM +0200, Maxime Coquelin wrote:
> nr_desc is not an index but the number of descriptors,
> so can be equal to the virtqueue size.
>
> Fixes: a436f53ebfeb ("vhost: avoid dead loop chain")
>
> Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks for catching it!
> ---
> Hi Yuanhan,
>
> I faced the bug while testing my indirect descriptor patch, it happens
> as soon as the number of chained descritors is above 2.
>
> But the bug may in theory also be faced with normal descriptors,
In theory, yes, and only in one case, that there is a Tx has 256
descriptors chained. If that happens, I doubt things work well.
So I would say it just happens __in theory__.
> so it might
> be good to have it 16.07?
Even though, it apparently fixes a bug, so I think we could have it
for 16.07.
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
--yliu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix off-by-one error on nr_desc check
2016-07-25 15:24 ` Yuanhan Liu
@ 2016-07-25 15:28 ` Maxime Coquelin
2016-07-25 15:47 ` Thomas Monjalon
1 sibling, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2016-07-25 15:28 UTC (permalink / raw)
To: Yuanhan Liu; +Cc: huawei.xie, dev, Thomas Monjalon
On 07/25/2016 05:24 PM, Yuanhan Liu wrote:
> On Mon, Jul 25, 2016 at 04:09:58PM +0200, Maxime Coquelin wrote:
>> nr_desc is not an index but the number of descriptors,
>> so can be equal to the virtqueue size.
>>
>> Fixes: a436f53ebfeb ("vhost: avoid dead loop chain")
>>
>> Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>
> Thanks for catching it!
>
>> ---
>> Hi Yuanhan,
>>
>> I faced the bug while testing my indirect descriptor patch, it happens
>> as soon as the number of chained descritors is above 2.
>>
>> But the bug may in theory also be faced with normal descriptors,
>
> In theory, yes, and only in one case, that there is a Tx has 256
> descriptors chained. If that happens, I doubt things work well.
> So I would say it just happens __in theory__.
Right.
>
>> so it might
>> be good to have it 16.07?
>
> Even though, it apparently fixes a bug, so I think we could have it
> for 16.07.
Good, but don't delay 16.07 for that! :)
>
> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
>
> --yliu
>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [dpdk-dev] [PATCH] vhost: fix off-by-one error on nr_desc check
2016-07-25 15:24 ` Yuanhan Liu
2016-07-25 15:28 ` Maxime Coquelin
@ 2016-07-25 15:47 ` Thomas Monjalon
1 sibling, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2016-07-25 15:47 UTC (permalink / raw)
To: Maxime Coquelin; +Cc: Yuanhan Liu, huawei.xie, dev
2016-07-25 23:24, Yuanhan Liu:
> On Mon, Jul 25, 2016 at 04:09:58PM +0200, Maxime Coquelin wrote:
> > nr_desc is not an index but the number of descriptors,
> > so can be equal to the virtqueue size.
> >
> > Fixes: a436f53ebfeb ("vhost: avoid dead loop chain")
> >
> > Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>
> > Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
>
> Thanks for catching it!
>
> > ---
> > Hi Yuanhan,
> >
> > I faced the bug while testing my indirect descriptor patch, it happens
> > as soon as the number of chained descritors is above 2.
> >
> > But the bug may in theory also be faced with normal descriptors,
>
> In theory, yes, and only in one case, that there is a Tx has 256
> descriptors chained. If that happens, I doubt things work well.
> So I would say it just happens __in theory__.
>
> > so it might
> > be good to have it 16.07?
>
> Even though, it apparently fixes a bug, so I think we could have it
> for 16.07.
>
> Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-25 15:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-25 14:09 [dpdk-dev] [PATCH] vhost: fix off-by-one error on nr_desc check Maxime Coquelin
2016-07-25 15:24 ` Yuanhan Liu
2016-07-25 15:28 ` Maxime Coquelin
2016-07-25 15:47 ` Thomas Monjalon
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).