* [Qemu-devel] [PATCH] NetKVM: fix for indirectc mode when vring is full
@ 2014-12-10 7:28 Ting Wang
2014-12-14 13:30 ` Yan Vugenfirer
0 siblings, 1 reply; 3+ messages in thread
From: Ting Wang @ 2014-12-10 7:28 UTC (permalink / raw)
To: yvugenfi, qemu-devel; +Cc: boby.chen, wu.wubin, Ting Wang
In function vring_add_indirect, there is no limiti
about free entry in vring. If vring is full,
vq->num_free will be less than zero, and
the address of vq->vring.desc becomes illegal.
Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
---
NetKVM/NDIS5/VirtIO/VirtIORing.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/NetKVM/NDIS5/VirtIO/VirtIORing.c b/NetKVM/NDIS5/VirtIO/VirtIORing.c
index 90ace4c..0f3783c 100644
--- a/NetKVM/NDIS5/VirtIO/VirtIORing.c
+++ b/NetKVM/NDIS5/VirtIO/VirtIORing.c
@@ -150,7 +150,7 @@ static int vring_add_buf(struct virtqueue *_vq,
return -1;
}
- if (va_indirect)
+ if (va_indirect && (out + in) > 1 && vq->num_free)
{
int ret = vring_add_indirect(_vq, sg, out, in, va_indirect, phys_indirect);
if (ret >= 0)
--
1.8.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] NetKVM: fix for indirectc mode when vring is full
2014-12-10 7:28 [Qemu-devel] [PATCH] NetKVM: fix for indirectc mode when vring is full Ting Wang
@ 2014-12-14 13:30 ` Yan Vugenfirer
2014-12-15 8:53 ` Wangting (Kathy)
0 siblings, 1 reply; 3+ messages in thread
From: Yan Vugenfirer @ 2014-12-14 13:30 UTC (permalink / raw)
To: Ting Wang; +Cc: Dmitry Fleytman, boby.chen, qemu-devel, wu.wubin
Thanks!
The fix is correct, but I am not sure this patch is needed.
This is a frozen part of the code with XP and Windows 2003 support for NetKVM only.
The library that is used for newer OSes and other drivers has this fix: https://github.com/YanVugenfirer/kvm-guest-drivers-windows/commit/264f1b6c86f5eeca5e2c9fbd24e3de8dbd0bee1d
In the NetKVM driver code itself we are testing for those conditions before calling to add_buf (check ParaNdis_DoSubmitPacket function in https://github.com/YanVugenfirer/kvm-guest-drivers-windows/blob/stable/NetKVM/NDIS5/Common/ParaNdis-Common.c#L1528).
Best regads,
Yan.
> On Dec 10, 2014, at 9:28 AM, Ting Wang <kathy.wangting@huawei.com> wrote:
>
> In function vring_add_indirect, there is no limiti
> about free entry in vring. If vring is full,
> vq->num_free will be less than zero, and
> the address of vq->vring.desc becomes illegal.
>
> Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
> ---
> NetKVM/NDIS5/VirtIO/VirtIORing.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/NetKVM/NDIS5/VirtIO/VirtIORing.c b/NetKVM/NDIS5/VirtIO/VirtIORing.c
> index 90ace4c..0f3783c 100644
> --- a/NetKVM/NDIS5/VirtIO/VirtIORing.c
> +++ b/NetKVM/NDIS5/VirtIO/VirtIORing.c
> @@ -150,7 +150,7 @@ static int vring_add_buf(struct virtqueue *_vq,
> return -1;
> }
>
> - if (va_indirect)
> + if (va_indirect && (out + in) > 1 && vq->num_free)
> {
> int ret = vring_add_indirect(_vq, sg, out, in, va_indirect, phys_indirect);
> if (ret >= 0)
> --
> 1.8.5
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] NetKVM: fix for indirectc mode when vring is full
2014-12-14 13:30 ` Yan Vugenfirer
@ 2014-12-15 8:53 ` Wangting (Kathy)
0 siblings, 0 replies; 3+ messages in thread
From: Wangting (Kathy) @ 2014-12-15 8:53 UTC (permalink / raw)
To: Yan Vugenfirer; +Cc: Dmitry Fleytman, boby.chen, qemu-devel, wu.wubin
okay, thank you, I think it is better for net and other feature with one virtio code set like linux.
On 2014-12-14 21:30, Yan Vugenfirer wrote:
> Thanks!
>
> The fix is correct, but I am not sure this patch is needed.
> This is a frozen part of the code with XP and Windows 2003 support for NetKVM only.
>
> The library that is used for newer OSes and other drivers has this fix: https://github.com/YanVugenfirer/kvm-guest-drivers-windows/commit/264f1b6c86f5eeca5e2c9fbd24e3de8dbd0bee1d
>
> In the NetKVM driver code itself we are testing for those conditions before calling to add_buf (check ParaNdis_DoSubmitPacket function in https://github.com/YanVugenfirer/kvm-guest-drivers-windows/blob/stable/NetKVM/NDIS5/Common/ParaNdis-Common.c#L1528).
>
> Best regads,
> Yan.
>
>> On Dec 10, 2014, at 9:28 AM, Ting Wang <kathy.wangting@huawei.com> wrote:
>>
>> In function vring_add_indirect, there is no limiti
>> about free entry in vring. If vring is full,
>> vq->num_free will be less than zero, and
>> the address of vq->vring.desc becomes illegal.
>>
>> Signed-off-by: Ting Wang <kathy.wangting@huawei.com>
>> ---
>> NetKVM/NDIS5/VirtIO/VirtIORing.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/NetKVM/NDIS5/VirtIO/VirtIORing.c b/NetKVM/NDIS5/VirtIO/VirtIORing.c
>> index 90ace4c..0f3783c 100644
>> --- a/NetKVM/NDIS5/VirtIO/VirtIORing.c
>> +++ b/NetKVM/NDIS5/VirtIO/VirtIORing.c
>> @@ -150,7 +150,7 @@ static int vring_add_buf(struct virtqueue *_vq,
>> return -1;
>> }
>>
>> - if (va_indirect)
>> + if (va_indirect && (out + in) > 1 && vq->num_free)
>> {
>> int ret = vring_add_indirect(_vq, sg, out, in, va_indirect, phys_indirect);
>> if (ret >= 0)
>> --
>> 1.8.5
>>
>>
>
>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-15 8:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10 7:28 [Qemu-devel] [PATCH] NetKVM: fix for indirectc mode when vring is full Ting Wang
2014-12-14 13:30 ` Yan Vugenfirer
2014-12-15 8:53 ` Wangting (Kathy)
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).