From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: linux-kernel@vger.kernel.org, "open list:VIRTIO CORE,
NET..." <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 1/2] virtio_pci: double free and invalid memory access of device vqs
Date: Sun, 4 Jan 2015 13:12:40 +0200 [thread overview]
Message-ID: <20150104111240.GA4336@redhat.com> (raw)
In-Reply-To: <1420228060-18721-1-git-send-email-sasha.levin@oracle.com>
On Fri, Jan 02, 2015 at 02:47:39PM -0500, Sasha Levin wrote:
> Device VQs were getting freed twice: once in every devices removal functions,
> and then again in virtio_pci_legacy_remove().
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
I see. This used to be harmless because it used to be idempotent,
and safe to call any number of times.
I think your patch is right for 3.20:
Acked-by: Michael S. Tsirkin <mst@redhat.com>
but for 3.19 I'd prefer a more conservative approach of making
del_vqs idempotent again.
I'll post a patch like this shortly.
> ---
> drivers/virtio/virtio_pci_legacy.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_pci_legacy.c b/drivers/virtio/virtio_pci_legacy.c
> index 6c76f0f..913ca23 100644
> --- a/drivers/virtio/virtio_pci_legacy.c
> +++ b/drivers/virtio/virtio_pci_legacy.c
> @@ -298,7 +298,6 @@ void virtio_pci_legacy_remove(struct pci_dev *pci_dev)
>
> unregister_virtio_device(&vp_dev->vdev);
>
> - vp_del_vqs(&vp_dev->vdev);
> pci_iounmap(pci_dev, vp_dev->ioaddr);
> pci_release_regions(pci_dev);
> pci_disable_device(pci_dev);
> --
> 1.7.10.4
prev parent reply other threads:[~2015-01-04 11:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-02 19:47 [PATCH 1/2] virtio_pci: double free and invalid memory access of device vqs Sasha Levin
2015-01-02 19:47 ` [PATCH 2/2] virtio: don't free memory until the underlying struct device has been released Sasha Levin
2015-01-04 11:26 ` Michael S. Tsirkin
2015-01-04 15:03 ` Sasha Levin
2015-01-04 15:40 ` Michael S. Tsirkin
2015-01-04 11:12 ` Michael S. Tsirkin [this message]
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=20150104111240.GA4336@redhat.com \
--to=mst@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sasha.levin@oracle.com \
--cc=virtualization@lists.linux-foundation.org \
/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 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).