linux/drivers/infiniband/hw
Zilin Guan b2bc649c18 RDMA/mlx5: Fix memory leak in GET_DATA_DIRECT_SYSFS_PATH handler
[ Upstream commit 9b9d253908 ]

The UVERBS_HANDLER(MLX5_IB_METHOD_GET_DATA_DIRECT_SYSFS_PATH) function
allocates memory for the device path using kobject_get_path(). If the
length of the device path exceeds the output buffer length, the function
returns -ENOSPC but does not free the allocated memory, resulting in a
memory leak.

Add a kfree() 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: ec7ad65309 ("RDMA/mlx5: Introduce GET_DATA_DIRECT_SYSFS_PATH ioctl")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Link: https://patch.msgid.link/20260126074801.627898-1-zilin@seu.edu.cn
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-02-26 14:59:26 -08:00
..
bnxt_re RDMA/bnxt_re: fix dma_free_coherent() pointer 2026-01-08 10:16:52 +01:00
cxgb4 RDMA: Use %pe format specifier for error pointers 2025-09-21 07:34:49 -04:00
efa RDMA/efa: Remove possible negative shift 2026-01-08 10:16:49 +01:00
erdma RDMA v6.18 merge window pull request 2025-10-03 18:35:22 -07:00
hfi1 RDMA: Use %pe format specifier for error pointers 2025-09-21 07:34:49 -04:00
hns RDMA/hns: Notify ULP of remaining soft-WCs during reset 2026-02-26 14:59:23 -08:00
ionic RDMA/ionic: Fix memory leak of admin q_wr 2025-09-26 13:12:56 -03:00
irdma RDMA/irdma: avoid invalid read in irdma_net_event 2026-01-08 10:16:49 +01:00
mana RDMA/mana_ib: check cqe length for kernel CQs 2026-01-08 10:16:49 +01:00
mlx4 RDMA: Use %pe format specifier for error pointers 2025-09-21 07:34:49 -04:00
mlx5 RDMA/mlx5: Fix memory leak in GET_DATA_DIRECT_SYSFS_PATH handler 2026-02-26 14:59:26 -08:00
mthca IB: Extend UVERBS_METHOD_REG_MR to get DMAH 2025-07-23 01:42:11 -04:00
ocrdma IB: Extend UVERBS_METHOD_REG_MR to get DMAH 2025-07-23 01:42:11 -04:00
qedr IB: Extend UVERBS_METHOD_REG_MR to get DMAH 2025-07-23 01:42:11 -04:00
usnic IB: Extend UVERBS_METHOD_REG_MR to get DMAH 2025-07-23 01:42:11 -04:00
vmw_pvrdma IB: Extend UVERBS_METHOD_REG_MR to get DMAH 2025-07-23 01:42:11 -04:00
Makefile RDMA/ionic: Add Makefile/Kconfig to kernel build environment 2025-09-11 02:18:36 -04:00