All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: 陈梁 <chenliang0016@icloud.com>
Cc: "kwolf@redhat.com" <kwolf@redhat.com>,
	ChenLiang <chenliang88@huawei.com>,
	"Huangweidong (C)" <weidong.huang@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"stefanha@redhat.com" <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] ide: fix double free
Date: Wed, 02 Jul 2014 15:09:37 +0200	[thread overview]
Message-ID: <53B40491.4000405@redhat.com> (raw)
In-Reply-To: <30F7BCE3-5A87-4AA0-86CA-E467842FE3A5@icloud.com>

Il 02/07/2014 14:54, 陈梁 ha scritto:
>> > The second call should have happened within dma_aio_cancel's call to
>> > bdrv_aio_cancel.  This is the real bug.
> IMO, the second need not happened within dma_aio_cancel's call to bdrv_aio_cancel.
> The double free will be happened if dam_aio_cancel is called.

The callback must not be invoked after bdrv_aio_cancel.  This is the 
fundamental invariant of bdrv_aio_cancel.  All implementations of AIOCB 
must respect it, or bugs like this one happen.

Here, either bdrv_aio_cancel was not invoked, or the invariant was broken.

The other invariant, this time in dma-helpers.c, is that dma_bdrv_cb 
either exits with no pending AIOCB, or it exits with a non-NULL 
dbs->acb.  If bdrv_aio_cancel was not invoked, this invariant was broken 
because there is a pending AIOCB but it is not in dbs->acb.

Paolo

  reply	other threads:[~2014-07-02 13:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02  8:50 [Qemu-devel] [PATCH] ide: fix double free arei.gonglei
2014-07-02  9:04 ` Paolo Bonzini
2014-07-02  9:24   ` ChenLiang
2014-07-02  9:25     ` Paolo Bonzini
2014-07-02  9:46       ` Gonglei (Arei)
2014-07-02 10:16         ` Paolo Bonzini
2014-07-02 11:12           ` ChenLiang
2014-07-02 11:24             ` Paolo Bonzini
2014-07-02 11:33           ` ChenLiang
2014-07-02 11:40             ` Paolo Bonzini
2014-07-02 11:57               ` ChenLiang
2014-07-02 12:19                 ` Paolo Bonzini
2014-07-02 12:46                   ` 陈梁
2014-07-02 12:54                   ` 陈梁
2014-07-02 13:09                     ` Paolo Bonzini [this message]
2014-07-03  2:23                   ` ChenLiang
2014-07-03 10:41                     ` Paolo Bonzini
2014-07-07  8:12                       ` ChenLiang
2014-07-07 12:38                         ` Paolo Bonzini

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=53B40491.4000405@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=chenliang0016@icloud.com \
    --cc=chenliang88@huawei.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=weidong.huang@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.