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]
Message-ID: <20240624175809.kmub3gjg5awxjzyw@4VRSMR2-DT.corp.robot.car>
Date: Mon, 24 Jun 2024 10:58:09 -0700
From: Russ Weight <russ.weight@...ux.dev>
To: Ma Ke <make24@...as.ac.cn>
Cc: hao.wu@...el.com, trix@...hat.com, mdf@...nel.org, yilun.xu@...el.com,
	linux-fpga@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fpga: dfl: fix potential memory leak in
 vfio_intx_enable()


On Sun, Jun 23, 2024 at 03:40:19PM +0800, Ma Ke wrote:
> We should free 'feature->irq_ctx[idx].name' to avoid 'name'
> memory leak when request_irq() failed.
> 
> Signed-off-by: Ma Ke <make24@...as.ac.cn>
> ---
>  drivers/fpga/dfl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
> index 094ee97ea26c..c52ebece5aef 100644
> --- a/drivers/fpga/dfl.c
> +++ b/drivers/fpga/dfl.c
> @@ -1911,7 +1911,7 @@ static int do_set_irq_trigger(struct dfl_feature *feature, unsigned int idx,
>  			  feature->irq_ctx[idx].name, trigger);
>  	if (!ret) {
>  		feature->irq_ctx[idx].trigger = trigger;
> -		return ret;
> +		goto free_name;

I believe (!ret) represents the success case and that simply
returning is the right thing to do. In the case of an error,
eventfd_ctx_put() and kfree() are both called.

>  	}
>  
>  	eventfd_ctx_put(trigger);
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ