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:   Wed, 11 May 2022 15:50:23 +0800
From:   Xu Yilun <yilun.xu@...el.com>
To:     Miaoqian Lin <linmq006@...il.com>
Cc:     Wu Hao <hao.wu@...el.com>, Tom Rix <trix@...hat.com>,
        Moritz Fischer <mdf@...nel.org>,
        Tim Whisonant <tim.whisonant@...el.com>,
        Enno Luebbers <enno.luebbers@...el.com>,
        Alan Tull <atull@...nel.org>, Shiva Rao <shiva.rao@...el.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-fpga@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fpga: Fix memory leak in build_info_create_dev

On Wed, May 11, 2022 at 10:44:00AM +0400, Miaoqian Lin wrote:
> platform_device_alloc() create a platform device object.
> we should call platform_device_put() in error path to
> release the resource.
> 
> Fixes: 543be3d8c999 ("fpga: add device feature list support")
> Signed-off-by: Miaoqian Lin <linmq006@...il.com>
> ---
>  drivers/fpga/dfl.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
> index 599bb21d86af..f0b945bd975f 100644
> --- a/drivers/fpga/dfl.c
> +++ b/drivers/fpga/dfl.c
> @@ -879,8 +879,10 @@ build_info_create_dev(struct build_feature_devs_info *binfo,
>  	INIT_LIST_HEAD(&binfo->sub_features);
>  
>  	fdev->id = dfl_id_alloc(type, &fdev->dev);
> -	if (fdev->id < 0)
> +	if (fdev->id < 0) {
> +		platform_device_put(fdev);
>  		return fdev->id;
> +	}

The build_info_free() will finally put the fdev, is it?

Thanks
Yilun

>  
>  	fdev->dev.parent = &binfo->cdev->region->dev;
>  	fdev->dev.devt = dfl_get_devt(dfl_devs[type].devt_type, fdev->id);
> -- 
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ