qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] net: Only flush queue or call sent callback on


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH] net: Only flush queue or call sent callback on successful delivery
Date: Fri, 28 Oct 2011 10:13:14 +0100

On Thu, Oct 27, 2011 at 10:02 AM, Mark Wu <address@hidden> wrote:
> Now queue flushing and sent callback could be invoked even on delivery
> failure. We add a checking of receiver's return value to avoid this
> case.
>
> Signed-off-by: Mark Wu <address@hidden>
> ---
>  net/queue.c |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 deletions(-)

What problem are you trying to fix?

> @@ -251,7 +253,7 @@ void qemu_net_queue_flush(NetQueue *queue)
>             break;
>         }
>
> -        if (packet->sent_cb) {
> +        if (ret > 0 && packet->sent_cb) {
>             packet->sent_cb(packet->sender, ret);

This looks wrong.  ret is passed as an argument to the callback.  You
are skipping the callback on error and not giving it a chance to see
negative ret.

Looking at virtio_net_tx_complete() this causes a virtqueue element leak.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]