]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fs/filesystems: Fix potential unsigned integer underflow in fs_name()
authorZijun Hu <quic_zijuhu@quicinc.com>
Thu, 10 Apr 2025 11:45:27 +0000 (19:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2025 10:07:23 +0000 (11:07 +0100)
commitb7c280980c7099aafb0efa2e5d318ad1b1bbd43d
tree8c31f35a308a47375bdbf97f58f2b1910f92f2e1
parent347867cb424edae5fec1622712c8dd0a2c42918f
fs/filesystems: Fix potential unsigned integer underflow in fs_name()

[ Upstream commit 1363c134ade81e425873b410566e957fecebb261 ]

fs_name() has @index as unsigned int, so there is underflow risk for
operation '@index--'.

Fix by breaking the for loop when '@index == 0' which is also more proper
than '@index <= 0' for unsigned integer comparison.

Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/20250410-fix_fs-v1-1-7c14ccc8ebaa@quicinc.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/filesystems.c