* [Qemu-devel] [PATCH] io: remove mistaken call to object_ref on QTask
@ 2016-06-07 14:19 Daniel P. Berrange
2016-06-07 14:51 ` Eric Blake
2016-06-07 15:23 ` [Qemu-devel] [PATCH STABLE 2.6] " Daniel P. Berrange
0 siblings, 2 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2016-06-07 14:19 UTC (permalink / raw)
To: qemu-devel; +Cc: Ben Aitchison, Daniel P. Berrange
The QTask struct is just a standalone struct, not a QOM Object,
so calling object_ref() on it is not appropriate. This results
in mangling the 'destroy' field in the QTask struct, causing
the later call to qtask_free() to try to call the function
at address 0x1, with predictably segfault happy results.
There is in fact no need for ref counting with QTask, as the
call to qtask_abort() or qtask_complete() will automatically
free associated memory.
This fixes the crash shown in
https://bugs.launchpad.net/qemu/+bug/1589923
Reported-by: Ben Aitchison <ben@meh.net.nz>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
io/channel-websock.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/io/channel-websock.c b/io/channel-websock.c
index 239c75a..533bd4b 100644
--- a/io/channel-websock.c
+++ b/io/channel-websock.c
@@ -317,14 +317,13 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,
return TRUE;
}
- object_ref(OBJECT(task));
trace_qio_channel_websock_handshake_reply(ioc);
qio_channel_add_watch(
wioc->master,
G_IO_OUT,
qio_channel_websock_handshake_send,
task,
- (GDestroyNotify)object_unref);
+ NULL);
return FALSE;
}
--
2.5.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] io: remove mistaken call to object_ref on QTask
2016-06-07 14:19 [Qemu-devel] [PATCH] io: remove mistaken call to object_ref on QTask Daniel P. Berrange
@ 2016-06-07 14:51 ` Eric Blake
2016-06-07 15:23 ` [Qemu-devel] [PATCH STABLE 2.6] " Daniel P. Berrange
1 sibling, 0 replies; 3+ messages in thread
From: Eric Blake @ 2016-06-07 14:51 UTC (permalink / raw)
To: Daniel P. Berrange, qemu-devel; +Cc: Ben Aitchison
[-- Attachment #1: Type: text/plain, Size: 983 bytes --]
On 06/07/2016 08:19 AM, Daniel P. Berrange wrote:
> The QTask struct is just a standalone struct, not a QOM Object,
> so calling object_ref() on it is not appropriate. This results
> in mangling the 'destroy' field in the QTask struct, causing
> the later call to qtask_free() to try to call the function
> at address 0x1, with predictably segfault happy results.
>
> There is in fact no need for ref counting with QTask, as the
> call to qtask_abort() or qtask_complete() will automatically
> free associated memory.
>
> This fixes the crash shown in
>
> https://bugs.launchpad.net/qemu/+bug/1589923
>
> Reported-by: Ben Aitchison <ben@meh.net.nz>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> io/channel-websock.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH STABLE 2.6] io: remove mistaken call to object_ref on QTask
2016-06-07 14:19 [Qemu-devel] [PATCH] io: remove mistaken call to object_ref on QTask Daniel P. Berrange
2016-06-07 14:51 ` Eric Blake
@ 2016-06-07 15:23 ` Daniel P. Berrange
1 sibling, 0 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2016-06-07 15:23 UTC (permalink / raw)
To: qemu-devel, qemu-stable; +Cc: Ben Aitchison
Adding qemu-stable for 2.6
On Tue, Jun 07, 2016 at 03:19:05PM +0100, Daniel P. Berrange wrote:
> The QTask struct is just a standalone struct, not a QOM Object,
> so calling object_ref() on it is not appropriate. This results
> in mangling the 'destroy' field in the QTask struct, causing
> the later call to qtask_free() to try to call the function
> at address 0x1, with predictably segfault happy results.
>
> There is in fact no need for ref counting with QTask, as the
> call to qtask_abort() or qtask_complete() will automatically
> free associated memory.
>
> This fixes the crash shown in
>
> https://bugs.launchpad.net/qemu/+bug/1589923
>
> Reported-by: Ben Aitchison <ben@meh.net.nz>
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
> io/channel-websock.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/io/channel-websock.c b/io/channel-websock.c
> index 239c75a..533bd4b 100644
> --- a/io/channel-websock.c
> +++ b/io/channel-websock.c
> @@ -317,14 +317,13 @@ static gboolean qio_channel_websock_handshake_io(QIOChannel *ioc,
> return TRUE;
> }
>
> - object_ref(OBJECT(task));
> trace_qio_channel_websock_handshake_reply(ioc);
> qio_channel_add_watch(
> wioc->master,
> G_IO_OUT,
> qio_channel_websock_handshake_send,
> task,
> - (GDestroyNotify)object_unref);
> + NULL);
> return FALSE;
> }
>
> --
> 2.5.5
>
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-07 15:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-07 14:19 [Qemu-devel] [PATCH] io: remove mistaken call to object_ref on QTask Daniel P. Berrange
2016-06-07 14:51 ` Eric Blake
2016-06-07 15:23 ` [Qemu-devel] [PATCH STABLE 2.6] " Daniel P. Berrange
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).