[PATCH 1/5] drm/xe/configfs: Fix pci_dev reference leak
Cavitt, Jonathan
jonathan.cavitt at intel.com
Thu Jul 17 21:16:05 UTC 2025
-----Original Message-----
From: Intel-xe <intel-xe-bounces at lists.freedesktop.org> On Behalf Of Michal Wajdeczko
Sent: Thursday, July 17, 2025 11:48 AM
To: intel-xe at lists.freedesktop.org
Cc: Wajdeczko, Michal <Michal.Wajdeczko at intel.com>; De Marchi, Lucas <lucas.demarchi at intel.com>
Subject: [PATCH 1/5] 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: 16280ded45fb ("drm/xe: Add configfs to enable survivability mode")
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
> Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Since we're already being fairly granular with the changes in this patch series,
it probably would've been okay for us to separate the pci_dev_put addition
from the errno change here. But I won't make it a requirement.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
-Jonathan Cavitt
> ---
> drivers/gpu/drm/xe/xe_configfs.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_configfs.c b/drivers/gpu/drm/xe/xe_configfs.c
> index 8ec1ff1e4e80..e9b46a2d0019 100644
> --- a/drivers/gpu/drm/xe/xe_configfs.c
> +++ b/drivers/gpu/drm/xe/xe_configfs.c
> @@ -267,7 +267,8 @@ static struct config_group *xe_config_make_device_group(struct config_group *gro
>
> pdev = pci_get_domain_bus_and_slot(domain, bus, PCI_DEVFN(slot, function));
> if (!pdev)
> - return ERR_PTR(-EINVAL);
> + return ERR_PTR(-ENODEV);
> + pci_dev_put(pdev);
>
> dev = kzalloc(sizeof(*dev), GFP_KERNEL);
> if (!dev)
> --
> 2.47.1
>
>
More information about the Intel-xe
mailing list