Skip to content

Commit 942ac8d

Browse files
mwajdeczrodrigovivi
authored andcommitted
drm/xe/configfs: Fix pci_dev reference leak
We are using pci_get_domain_bus_and_slot() function to verify if the given config directory name matches any existing PCI device, but we missed to call matching pci_dev_put() to release reference. While around, also change error code in case of no device match, to make it more specific than generic formatting error. Fixes: 16280de ("drm/xe: Add configfs to enable survivability mode") Signed-off-by: Michal Wajdeczko <[email protected]> Cc: Lucas De Marchi <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Reviewed-by: Jonathan Cavitt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lucas De Marchi <[email protected]> (cherry picked from commit 0bdd05c2a82bbf2419415d012fd4f5faeca7f1af) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 4846856 commit 942ac8d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/xe/xe_configfs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,8 @@ static struct config_group *xe_config_make_device_group(struct config_group *gro
267267

268268
pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, function));
269269
if (!pdev)
270-
return ERR_PTR(-EINVAL);
270+
return ERR_PTR(-ENODEV);
271+
pci_dev_put(pdev);
271272

272273
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
273274
if (!dev)

0 commit comments

Comments
 (0)