summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorWentao Liang <vulab@iscas.ac.cn>2026-09-16 17:11:41 +0000
committerJuergen Gross <jgross@suse.com>2026-10-09 10:34:47 +0200
commitcfaf31becde901f7a2376d36db628f8be0bc7283 (patch)
treeb1aa5a666e3fcd067f31fa94839d92084cbc4358 /drivers
parent3b4854b69ee70fffb2fa7acac09e715a7efcbae1 (diff)
xen-pciback: Fix pcistub_device ref leak in pcistub_get_gsi_from_sbdf()
pcistub_get_gsi_from_sbdf() obtains the stub device with pcistub_device_find(), which returns it with its kref incremented, and returns psdev->gsi without dropping that reference again. The caller cannot release it either, so every lookup leaks one reference to the stub device. Release the reference after reading gsi. Fixes: 2fae6bb7be32 ("xen/privcmd: Add new syscall to get gsi from dev") Cc: stable@vger.kernel.org Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Reviewed-by: Juergen Gross <jgross@suse.com> Reviewed-by: Jiqian Chen <Jiqian.Chen@amd.com> Signed-off-by: Juergen Gross <jgross@suse.com> Message-ID: <20260916171141.2086627-1-vulab@iscas.ac.cn>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/xen/xen-pciback/pci_stub.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/xen/xen-pciback/pci_stub.c b/drivers/xen/xen-pciback/pci_stub.c
index 79a2b5dfd694..d1a335233aab 100644
--- a/drivers/xen/xen-pciback/pci_stub.c
+++ b/drivers/xen/xen-pciback/pci_stub.c
@@ -234,13 +234,16 @@ static int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
int bus = PCI_BUS_NUM(sbdf);
int slot = PCI_SLOT(sbdf);
int func = PCI_FUNC(sbdf);
+ int gsi;
psdev = pcistub_device_find(domain, bus, slot, func);
-
if (!psdev)
return -ENODEV;
- return psdev->gsi;
+ gsi = psdev->gsi;
+ pcistub_device_put(psdev);
+
+ return gsi;
}
#endif