qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci: fixed mismatch of error-handling between pci_qdev_init() and qdev
@ 2014-11-05 10:11 SeokYeon Hwang
  2014-11-05 10:59 ` Paolo Bonzini
  2014-11-05 12:46 ` Michael S. Tsirkin
  0 siblings, 2 replies; 17+ messages in thread
From: SeokYeon Hwang @ 2014-11-05 10:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, SeokYeon Hwang, armbru, mst

pci_qdev_init() checks whether return value is 0 or not to figure out pci device is initialized successfully. Otherwise, device_realize() in qdev checks that return value is negative value to figure out the device is realized successfully.
When pci device returns positive number, pci_qdev_init() thinks that error is occured and makes the device unregistered. Nevertheless, qdev thinks that device is realized.
Finally, crash is occured by commands like 'qtree' that traverse qdev list.

So, pci_qdev_init() returns -1 when init function returns not 0.

Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 371699c..c149fdf 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1766,7 +1766,7 @@ static int pci_qdev_init(DeviceState *qdev)
         rc = pc->init(pci_dev);
         if (rc != 0) {
             do_pci_unregister_device(pci_dev);
-            return rc;
+            return -1;
         }
     }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-11-10  8:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-05 10:11 [Qemu-devel] [PATCH] pci: fixed mismatch of error-handling between pci_qdev_init() and qdev SeokYeon Hwang
2014-11-05 10:59 ` Paolo Bonzini
2014-11-05 12:46 ` Michael S. Tsirkin
2014-11-05 13:16   ` Markus Armbruster
2014-11-05 13:18     ` Paolo Bonzini
2014-11-05 13:28       ` Michael S. Tsirkin
2014-11-05 14:55         ` Paolo Bonzini
2014-11-06  2:26           ` SeokYeon Hwang
2014-11-06  9:20             ` Markus Armbruster
2014-11-06  9:26               ` Michael S. Tsirkin
2014-11-06  9:41               ` SeokYeon Hwang
2014-11-06  9:23             ` Michael S. Tsirkin
2014-11-07  4:17               ` SeokYeon Hwang
2014-11-07  7:45                 ` Markus Armbruster
2014-11-10  8:24                   ` SeokYeon Hwang
2014-11-10  8:50                     ` Markus Armbruster
2014-11-05 13:28   ` SeokYeon Hwang

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).