]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio/pds: Fix memory leak in pds_vfio_dirty_enable()
authorZilin Guan <zilin@seu.edu.cn>
Thu, 25 Dec 2025 14:31:50 +0000 (14:31 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:35 +0000 (10:14 +0100)
commita09b30ddd4ae83aba71e2bee89ea572d523d57b5
tree9f3f71b020bf9c9ec775dc53a929bcf31854ddd1
parent18b6574d4c6475a94f83615eee6ce50b6b2d2afe
vfio/pds: Fix memory leak in pds_vfio_dirty_enable()

[ Upstream commit 665077d78dc7941ce6a330c02023a2b469cc8cc7 ]

pds_vfio_dirty_enable() allocates memory for region_info. If
interval_tree_iter_first() returns NULL, the function returns -EINVAL
immediately without freeing the allocated memory, causing a memory leak.

Fix this by jumping to the out_free_region_info label to ensure
region_info is freed.

Fixes: 2e7c6feb4ef52 ("vfio/pds: Add multi-region support")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Link: https://lore.kernel.org/r/20251225143150.1117366-1-zilin@seu.edu.cn
Signed-off-by: Alex Williamson <alex@shazbot.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/pci/pds/dirty.c