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:   Fri, 5 May 2023 08:55:51 -0300
From:   Jason Gunthorpe <jgg@...pe.ca>
To:     ye.xingchen@....com.cn
Cc:     kevin.tian@...el.com, joro@...tes.org, will@...nel.org,
        robin.murphy@....com, iommu@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] iommufd/selftest: Use fdget() and fdput()

On Fri, May 05, 2023 at 02:12:39PM +0800, ye.xingchen@....com.cn wrote:
> From: Ye Xingchen <ye.xingchen@....com.cn>
> 
> convert the fget()/fput() uses to fdget()/fdput().
> 
> Signed-off-by: Ye Xingchen <ye.xingchen@....com.cn>
> ---
>  drivers/iommu/iommufd/selftest.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c
> index 74c2076105d4..d3512fa673a5 100644
> --- a/drivers/iommu/iommufd/selftest.c
> +++ b/drivers/iommu/iommufd/selftest.c
> @@ -583,17 +583,16 @@ static const struct file_operations iommfd_test_staccess_fops;
> 
>  static struct selftest_access *iommufd_access_get(int fd)
>  {
> -	struct file *file;
> +	struct fd f = fdget(fd);
> 
> -	file = fget(fd);
> -	if (!file)
> +	if (!f.file)
>  		return ERR_PTR(-EBADFD);

Why are you doing these conversions? This is wrong, fdget has to be
paired with fdput(), since the struct fd doesn't leave the stack frame
it cannot be correct.

I see your other patches have the same problem.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ