lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 7 May 2024 16:12:14 +0700
From: "Suthikulpanit, Suravee" <suravee.suthikulpanit@....com>
To: "Kun(llfl)" <llfl@...ux.alibaba.com>, Joerg Roedel <joro@...tes.org>,
 Will Deacon <will@...nel.org>, Jerry Snitselaar <jsnitsel@...hat.com>
Cc: Robin Murphy <robin.murphy@....com>, iommu@...ts.linux.dev,
 linux-kernel@...r.kernel.org, Vasant Hegde <vasant.hegde@....com>
Subject: Re: [PATCH 1/1] iommu/amd: Fix sysfs leak in iommu init

Thanks for finding this sysfs leak.

On 5/7/2024 9:32 AM, Kun(llfl) wrote:
> During the iommu initialization, iommu_init_pci() adds sysfs nodes.
> However, these nodes aren't remove in free_iommu_resources() subsequently.
> 
> Fixes: ad8694bac410 ("iommu/amd: Move AMD IOMMU driver into subdirectory")

Actually, this commit only move the code into new directory structure. 
The original commit was:

commit 39ab9555c24110671f8dc671311a26e5c985b592
Author: Joerg Roedel <jroedel@...e.de>
Date:   Wed Feb 1 16:56:46 2017 +0100

     iommu: Add sysfs bindings for struct iommu_device

> Signed-off-by: Kun(llfl) <llfl@...ux.alibaba.com>
> ---
>   drivers/iommu/amd/init.c | 7 +++++++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
> index ac6754a85f35..624ea2549f64 100644
> --- a/drivers/iommu/amd/init.c
> +++ b/drivers/iommu/amd/init.c
> @@ -1678,8 +1678,15 @@ static void __init free_pci_segments(void)
>   	}
>   }
>   
> +static void __init free_sysfs(struct amd_iommu *iommu)
> +{
> +	if (iommu->iommu.dev)
> +		iommu_device_sysfs_remove(&iommu->iommu);
> +}
> +
>   static void __init free_iommu_one(struct amd_iommu *iommu)
>   {
> +	free_sysfs(iommu);

As part of the clean up, we also need to also call 
iommu_device_unregister() before iommu_device_sysfs_remove().

Thanks,
Suravee

>   	free_cwwb_sem(iommu);
>   	free_command_buffer(iommu);
>   	free_event_buffer(iommu);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ