linux/drivers/i3c
Zilin Guan 8e71414e25 i3c: dw: Fix memory leak in dw_i3c_master_i2c_xfers()
[ Upstream commit 2537089413 ]

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: 62fe9d06f5 ("i3c: dw: Add power management support")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260126081121.644099-1-zilin@seu.edu.cn
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-02-26 14:58:58 -08:00
..
master i3c: dw: Fix memory leak in dw_i3c_master_i2c_xfers() 2026-02-26 14:58:58 -08:00
device.c i3c: Fix i3c_device_do_priv_xfers() kernel-doc indentation 2025-07-31 01:23:12 +02:00
internals.h i3c: fix big-endian FIFO transfers 2025-09-29 00:17:22 +02:00
Kconfig i3c: Add core I3C infrastructure 2018-11-12 10:33:49 +01:00
Makefile i3c: Add core I3C infrastructure 2018-11-12 10:33:49 +01:00
master.c i3c: master: Update hot-join flag only on success 2026-02-26 14:58:57 -08:00