]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pnfs/flexfiles: Fix memory leak in nfs4_ff_alloc_deviceid_node()
authorZilin Guan <zilin@seu.edu.cn>
Thu, 25 Dec 2025 07:41:03 +0000 (07:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:21:14 +0000 (11:21 +0100)
commited5d3f2f6885eb99f729e6ffd946e3aa058bd3eb
tree25968d4ff44dae9b20dab1853c98962ba9819889
parent19b4d9ab5e77843eac0429c019470c02f8710b55
pnfs/flexfiles: Fix memory leak in nfs4_ff_alloc_deviceid_node()

[ Upstream commit 0c728083654f0066f5e10a1d2b0bd0907af19a58 ]

In nfs4_ff_alloc_deviceid_node(), if the allocation for ds_versions fails,
the function jumps to the out_scratch label without freeing the already
allocated dsaddrs list, leading to a memory leak.

Fix this by jumping to the out_err_drain_dsaddrs label, which properly
frees the dsaddrs list before cleaning up other resources.

Fixes: d67ae825a59d6 ("pnfs/flexfiles: Add the FlexFile Layout Driver")
Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/nfs/flexfilelayout/flexfilelayoutdev.c