io: remove mistaken call to object_ref on QTask
PATCH 1/1 io: remove mistaken call to object_ref on QTask
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
--- io/channel-websock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
io/channel-websock.c +1 -2
@@ -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; }
Signature · 1 line
2.5.5
Quoted 12 lines · 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 toqtask_free()to try to call the function at address0x1, with predictably segfault happy results.There is in fact no need for ref counting with QTask, as the call to
qtask_abort()orqtask_complete()will automatically free associated memory.This fixes the crash shown in
Quoted 8 lines
https://bugs.launchpad.net/qemu/+bug/1589923
Reported-by Ben Aitchison <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- io/channel-websock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Signature · 2 lines
Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Adding qemu-stable for 2.6
Quoted 43 lines · 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 toqtask_free()to try to call the function at address0x1, with predictably segfault happy results.There is in fact no need for ref counting with QTask, as the call to
qtask_abort()orqtask_complete()will automatically free associated memory.This fixes the crash shown in
https://bugs.launchpad.net/qemu/+bug/1589923
Reported-by Ben Aitchison <[email protected]>Signed-off-by Daniel P. Berrange <[email protected]>--- io/channel-websock.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)io/channel-websock.c +1
-2@@ -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; }Signature · 1 line
2.5.5
Regards,
Daniel
Signature · 4 lines
|: 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 :|