From: Zhenzhong Duan <zhenzhong.duan@intel.com>
To: qemu-devel@nongnu.org
Cc: alex.williamson@redhat.com, clg@redhat.com,
joao.m.martins@oracle.com, avihaih@nvidia.com,
chao.p.peng@intel.com
Subject: [PATCH v3 2/3] vfio/pci: Fix a segfault in vfio_realize
Date: Wed, 21 Jun 2023 16:02:03 +0800 [thread overview]
Message-ID: <20230621080204.420723-3-zhenzhong.duan@intel.com> (raw)
In-Reply-To: <20230621080204.420723-1-zhenzhong.duan@intel.com>
In case irqchip_change_notifier isn't added, removing it triggers segfault.
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
hw/vfio/pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
index c71b0955d81c..82c4cf4f7609 100644
--- a/hw/vfio/pci.c
+++ b/hw/vfio/pci.c
@@ -3222,7 +3222,9 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
out_deregister:
pci_device_set_intx_routing_notifier(&vdev->pdev, NULL);
- kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
+ if (vdev->irqchip_change_notifier.notify) {
+ kvm_irqchip_remove_change_notifier(&vdev->irqchip_change_notifier);
+ }
out_teardown:
vfio_teardown_msi(vdev);
vfio_bars_exit(vdev);
--
2.34.1
next prev parent reply other threads:[~2023-06-21 8:15 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-21 8:02 [PATCH v3 0/3] VFIO migration related refactor and bug fix Zhenzhong Duan
2023-06-21 8:02 ` [PATCH v3 1/3] vfio/pci: Fix resource leak in vfio_realize Zhenzhong Duan
2023-06-21 11:08 ` Joao Martins
2023-06-25 6:00 ` Duan, Zhenzhong
2023-06-26 7:02 ` Duan, Zhenzhong
2023-06-26 10:07 ` Joao Martins
2023-06-27 2:38 ` Duan, Zhenzhong
2023-06-27 10:21 ` Joao Martins
2023-06-27 10:28 ` Duan, Zhenzhong
2023-06-21 8:02 ` Zhenzhong Duan [this message]
2023-06-21 11:08 ` [PATCH v3 2/3] vfio/pci: Fix a segfault " Joao Martins
2023-06-25 6:01 ` Duan, Zhenzhong
2023-06-26 9:58 ` Joao Martins
2023-06-21 8:02 ` [PATCH v3 3/3] vfio/migration: vfio/migration: Refactor and fix print of "Migration disabled" Zhenzhong Duan
2023-06-26 9:34 ` Avihai Horon
2023-06-26 10:18 ` Joao Martins
2023-06-27 2:55 ` Duan, Zhenzhong
2023-06-27 10:56 ` Joao Martins
2023-06-28 2:26 ` Duan, Zhenzhong
2023-06-27 2:46 ` Duan, Zhenzhong
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=20230621080204.420723-3-zhenzhong.duan@intel.com \
--to=zhenzhong.duan@intel.com \
--cc=alex.williamson@redhat.com \
--cc=avihaih@nvidia.com \
--cc=chao.p.peng@intel.com \
--cc=clg@redhat.com \
--cc=joao.m.martins@oracle.com \
--cc=qemu-devel@nongnu.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).