Skip to content

Commit 0778ac7

Browse files
nizhen-tbrauner
authored andcommitted
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: 37c4a95 ("statmount: allow to retrieve idmappings") Fixes: e52e97f ("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>
1 parent 98ac9cc commit 0778ac7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/namespace.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5454,11 +5454,11 @@ static int statmount_string(struct kstatmount *s, u64 flag)
54545454
ret = statmount_sb_source(s, seq);
54555455
break;
54565456
case STATMOUNT_MNT_UIDMAP:
5457-
sm->mnt_uidmap = start;
5457+
offp = &sm->mnt_uidmap;
54585458
ret = statmount_mnt_uidmap(s, seq);
54595459
break;
54605460
case STATMOUNT_MNT_GIDMAP:
5461-
sm->mnt_gidmap = start;
5461+
offp = &sm->mnt_gidmap;
54625462
ret = statmount_mnt_gidmap(s, seq);
54635463
break;
54645464
default:

0 commit comments

Comments
 (0)