]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pnfs/blocklayout: Fix memory leak in bl_parse_scsi()
authorZilin Guan <zilin@seu.edu.cn>
Thu, 25 Dec 2025 08:45:26 +0000 (08:45 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Jan 2026 10:21:14 +0000 (11:21 +0100)
commit51926204465e7d2ce71c396e0403aed58140a292
tree5729188a9dfb65223af0c68d4b6945df157d3a4e
parented5d3f2f6885eb99f729e6ffd946e3aa058bd3eb
pnfs/blocklayout: Fix memory leak in bl_parse_scsi()

[ Upstream commit 5a74af51c3a6f4cd22c128b0c1c019f68fa90011 ]

In bl_parse_scsi(), if the block device length is zero, the function
returns immediately without releasing the file reference obtained via
bl_open_path(), leading to a memory leak.

Fix this by jumping to the out_blkdev_put label to ensure the file
reference is properly released.

Fixes: d76c769c8db4c ("pnfs/blocklayout: Don't add zero-length pnfs_block_dev")
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/blocklayout/dev.c