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: <aXed6/fa3bCJhxPF@lizhi-Precision-Tower-5810>
Date: Mon, 26 Jan 2026 12:01:31 -0500
From: Frank Li <Frank.li@....com>
To: Zilin Guan <zilin@....edu.cn>
Cc: alexandre.belloni@...tlin.com, aniketmaurya@...gle.com,
	linux-i3c@...ts.infradead.org, linux-kernel@...r.kernel.org,
	jianhao.xu@....edu.cn
Subject: Re: [PATCH] i3c: dw: Fix memory leak in dw_i3c_master_i2c_xfers()

On Mon, Jan 26, 2026 at 08:11:21AM +0000, Zilin Guan wrote:
> The dw_i3c_master_i2c_xfers() function allocates memory for the xfer
> structure using dw_i3c_master_alloc_xfer(). If pm_runtime_resume_and_get()
> fails, the function returns without freeing the allocated xfer, resulting
> in a memory leak.
>
> Add a dw_i3c_master_free_xfer() call to the error path to ensure the
> allocated memory is properly freed.
>
> Compile tested only. Issue found using a prototype static analysis tool
> and code review.
>
> Fixes: 62fe9d06f570 ("i3c: dw: Add power management support")
> Signed-off-by: Zilin Guan <zilin@....edu.cn>
> ---

Reviewed-by: Frank Li <Frank.Li@....com>

After https://lore.kernel.org/linux-i3c/176840902682.1305594.13987931108275156748.b4-ty@bootlin.com/T/#t

driver's runtime pm get code can be removed.

Frank

>  drivers/i3c/master/dw-i3c-master.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c
> index 889e2ed5bc83..3e6f66dff2ec 100644
> --- a/drivers/i3c/master/dw-i3c-master.c
> +++ b/drivers/i3c/master/dw-i3c-master.c
> @@ -1099,6 +1099,7 @@ static int dw_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
>  		dev_err(master->dev,
>  			"<%s> cannot resume i3c bus master, err: %d\n",
>  			__func__, ret);
> +		dw_i3c_master_free_xfer(xfer);
>  		return ret;
>  	}
>
> --
> 2.34.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ