[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.2.9 17/45] hw/nvme: take a reference on the subsystem on vf re
From: |
Michael Tokarev |
Subject: |
[Stable-8.2.9 17/45] hw/nvme: take a reference on the subsystem on vf realization |
Date: |
Mon, 27 Jan 2025 23:25:58 +0300 |
Make sure we grab a reference on the subsystem when a VF is realized.
Otherwise, the subsytem will be unrealized automatically when the VFs
are unregistered and unreffed.
This fixes a latent bug but was not exposed until commit 08f632848008
("pcie: Release references of virtual functions"). This was then fixed
(or rather, hidden) by commit c613ad25125b ("pcie_sriov: Do not manually
unrealize"), but that was then reverted (due to other issues) in commit
b0fdaee5d1ed, exposing the bug yet again.
Cc: qemu-stable@nongnu.org
Fixes: 08f632848008 ("pcie: Release references of virtual functions")
Reviewed-by: Jesper Wendel Devantier <foss@defmacro.it>
Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
(cherry picked from commit 6651f8f2e5051f6750c2534ab3151339b3c476a2)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 94a37a3aef..4c400aa005 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -8346,6 +8346,13 @@ static void nvme_realize(PCIDevice *pci_dev, Error
**errp)
*/
n->params.serial = g_strdup(pn->params.serial);
n->subsys = pn->subsys;
+
+ /*
+ * Assigning this link (strong link) causes an `object_unref` later in
+ * `object_release_link_property`. Increment the refcount to balance
+ * this out.
+ */
+ object_ref(OBJECT(pn->subsys));
}
if (!nvme_check_params(n, errp)) {
--
2.39.5
- [Stable-8.2.9 08/45] scsi: megasas: Internal cdbs have 16-byte length, (continued)
- [Stable-8.2.9 08/45] scsi: megasas: Internal cdbs have 16-byte length, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 07/45] ssh: Do not switch session to non-blocking mode, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 09/45] tests/9p: fix Rreaddir response name, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 10/45] tests/9p: add missing Rgetattr response name, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 11/45] tests/9p: add 'use-after-unlink' test, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 12/45] 9pfs: remove obsolete comment in v9fs_getattr(), Michael Tokarev, 2025/01/28
- [Stable-8.2.9 13/45] 9pfs: fix 'Tgetattr' after unlink, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 14/45] tests/9p: also check 'Tgetattr' in 'use-after-unlink' test, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 15/45] target/ppc: Fix non-maskable interrupt while halted, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 18/45] hw/openrisc/openrisc_sim: keep serial@90000000 as default, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 17/45] hw/nvme: take a reference on the subsystem on vf realization,
Michael Tokarev <=
- [Stable-8.2.9 16/45] hw/nvme: fix msix_uninit with exclusive bar, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 20/45] Update FreeBSD CI jobs FreeBSD 14.1, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 21/45] .gitlab-ci.d/cirrus: Remove the netbsd and openbsd jobs, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 23/45] 9pfs: fix regression regarding CVE-2023-2861, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 19/45] target/riscv: Avoid bad shift in riscv_cpu_do_interrupt(), Michael Tokarev, 2025/01/28
- [Stable-8.2.9 22/45] .gitlab-ci.d/cirrus: Drop support for macOS 13 (Ventura), Michael Tokarev, 2025/01/28
- [Stable-8.2.9 25/45] fuzz: specify audiodev for usb-audio, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 24/45] tcg/riscv: Fix StoreStore barrier generation, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 26/45] x86/loader: only patch linux kernels, Michael Tokarev, 2025/01/28
- [Stable-8.2.9 27/45] edk2: get version + date from git submodule, Michael Tokarev, 2025/01/28