All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: zhanghailiang <zhang.zhanghailiang@huawei.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] filter-buffer: fix segfault while start qemu with status=off property
Date: Fri, 1 Apr 2016 15:39:30 +0800	[thread overview]
Message-ID: <56FE25B2.7000203@redhat.com> (raw)
In-Reply-To: <1459494489-3532-1-git-send-email-zhang.zhanghailiang@huawei.com>



On 04/01/2016 03:08 PM, zhanghailiang wrote:
> After commit 338d3f, we support 'status' property for filter object.
> The segfault can be triggered by starting qemu with 'status=off' property
> for filter, when the s->incoming_queue is NULL, we reference it directly
> in qemu_net_queue_flush().
>
> Let's check the value of 's->incoming_queue' before calling
> qemu_net_queue_flush().
>
> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> ---
>  net/filter-buffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/filter-buffer.c b/net/filter-buffer.c
> index cc6bd94..79e2ce3 100644
> --- a/net/filter-buffer.c
> +++ b/net/filter-buffer.c
> @@ -34,7 +34,7 @@ static void filter_buffer_flush(NetFilterState *nf)
>  {
>      FilterBufferState *s = FILTER_BUFFER(nf);
>  
> -    if (!qemu_net_queue_flush(s->incoming_queue)) {
> +    if (s->incoming_queue && !qemu_net_queue_flush(s->incoming_queue)) {
>          /* Unable to empty the queue, purge remaining packets */
>          qemu_net_queue_purge(s->incoming_queue, nf->netdev);
>      }

We'd better handle this at generic layer and don't let a specific net
filter need to worry about this.

Looks like the issue is we may trigger status_changed() too early (even
before the the filter was initialized).

How about not call status_changed() if the initialization is not done?

  reply	other threads:[~2016-04-01  7:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01  7:08 [Qemu-devel] [PATCH] filter-buffer: fix segfault while start qemu with status=off property zhanghailiang
2016-04-01  7:39 ` Jason Wang [this message]
2016-04-01  8:24   ` Hailiang Zhang
2016-04-01  9:10     ` Wen Congyang
2016-04-01  9:33       ` Hailiang Zhang
2016-04-05  0:53         ` Jason Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56FE25B2.7000203@redhat.com \
    --to=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.