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 2/2] virtio: don't free memory until the underlying struct device has been released
Date: Sun, 4 Jan 2015 17:40:49 +0200 [thread overview]
Message-ID: <20150104154049.GA6546@redhat.com> (raw)
In-Reply-To: <54A9563F.3070902@oracle.com>
On Sun, Jan 04, 2015 at 10:03:27AM -0500, Sasha Levin wrote:
> On 01/04/2015 06:26 AM, Michael S. Tsirkin wrote:
> > On Fri, Jan 02, 2015 at 02:47:40PM -0500, Sasha Levin wrote:
> >> > When releasing a virtio device, We can't free a struct virtio_device until the
> >> > underlying struct device has been released, which might not happen immediately
> >> > on device_unregister() even if that was the device's last reference.
> >> >
> >> > Instead, free the memory only once we know the device is gone in the release
> >> > callback.
> >> >
> >> > Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> >
> > Isn't this an old bug: do we need to copy stable on a fix?
> >
> > What is the behaviour without this patch?
> > Is there a way to make this cause a crash?
>
> It will oops if CONFIG_DEBUG_KOBJECT_RELEASE is enabled. I guess
> it needs to go to stable as well.
>
>
> Thanks,
> Sasha
I see.
It's probably a good idea to document the crash in the commit log,
and also add a code comment.
I'll post the series with these minor tweaks, please confirm
that this fixes the issues for you.
--
MST
WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: linux-kernel@vger.kernel.org,
Rusty Russell <rusty@rustcorp.com.au>,
"open list:VIRTIO CORE,
NET..." <virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH 2/2] virtio: don't free memory until the underlying struct device has been released
Date: Sun, 4 Jan 2015 17:40:49 +0200 [thread overview]
Message-ID: <20150104154049.GA6546@redhat.com> (raw)
In-Reply-To: <54A9563F.3070902@oracle.com>
On Sun, Jan 04, 2015 at 10:03:27AM -0500, Sasha Levin wrote:
> On 01/04/2015 06:26 AM, Michael S. Tsirkin wrote:
> > On Fri, Jan 02, 2015 at 02:47:40PM -0500, Sasha Levin wrote:
> >> > When releasing a virtio device, We can't free a struct virtio_device until the
> >> > underlying struct device has been released, which might not happen immediately
> >> > on device_unregister() even if that was the device's last reference.
> >> >
> >> > Instead, free the memory only once we know the device is gone in the release
> >> > callback.
> >> >
> >> > Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> >
> > Isn't this an old bug: do we need to copy stable on a fix?
> >
> > What is the behaviour without this patch?
> > Is there a way to make this cause a crash?
>
> It will oops if CONFIG_DEBUG_KOBJECT_RELEASE is enabled. I guess
> it needs to go to stable as well.
>
>
> Thanks,
> Sasha
I see.
It's probably a good idea to document the crash in the commit log,
and also add a code comment.
I'll post the series with these minor tweaks, please confirm
that this fixes the issues for you.
--
MST
next prev parent reply other threads:[~2015-01-04 15:40 UTC|newest]
Thread overview: 12+ 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 ` 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-02 19:47 ` Sasha Levin
2015-01-04 11:26 ` Michael S. Tsirkin
2015-01-04 11:26 ` Michael S. Tsirkin
2015-01-04 15:03 ` Sasha Levin
2015-01-04 15:03 ` Sasha Levin
2015-01-04 15:40 ` Michael S. Tsirkin [this message]
2015-01-04 15:40 ` Michael S. Tsirkin
2015-01-04 11:12 ` [PATCH 1/2] virtio_pci: double free and invalid memory access of device vqs Michael S. Tsirkin
2015-01-04 11:12 ` Michael S. Tsirkin
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=20150104154049.GA6546@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 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.