]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs: Fix uninitialized 'offp' in statmount_string()
authorZhen Ni <zhen.ni@easystack.cn>
Mon, 13 Oct 2025 11:41:51 +0000 (19:41 +0800)
committerChristian Brauner <brauner@kernel.org>
Tue, 21 Oct 2025 12:21:46 +0000 (14:21 +0200)
commit0778ac7df5137d5041783fadfc201f8fd55a1d9b
tree47ec20417891f33ba573e69a5961767c0a75a7b9
parent98ac9cc4b4452ed7e714eddc8c90ac4ae5da1a09
fs: Fix uninitialized 'offp' in statmount_string()

In statmount_string(), most flags assign an output offset pointer (offp)
which is later updated with the string offset. However, the
STATMOUNT_MNT_UIDMAP and STATMOUNT_MNT_GIDMAP cases directly set the
struct fields instead of using offp. This leaves offp uninitialized,
leading to a possible uninitialized dereference when *offp is updated.

Fix it by assigning offp for UIDMAP and GIDMAP as well, keeping the code
path consistent.

Fixes: 37c4a9590e1e ("statmount: allow to retrieve idmappings")
Fixes: e52e97f09fb6 ("statmount: let unset strings be empty")
Cc: stable@vger.kernel.org
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
Link: https://patch.msgid.link/20251013114151.664341-1-zhen.ni@easystack.cn
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namespace.c