Skip to content

Commit 2941b8b

Browse files
namjaejeonWen Zhiwei
authored andcommitted
exfat: fix uninit-value in __exfat_get_dentry_set
stable inclusion from stable-v6.6.64 commit 0d53178a3d8b916fefbb7a5f2ec33d30f968493e category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IBL4B6 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=0d53178a3d8b916fefbb7a5f2ec33d30f968493e -------------------------------- commit 02dffe9ab092fc4c8800aee68cb7eafd37a980c4 upstream. There is no check if stream size and start_clu are invalid. If start_clu is EOF cluster and stream size is 4096, It will cause uninit value access. because ei->hint_femp.eidx could be 128(if cluster size is 4K) and wrong hint will allocate next cluster. and this cluster will be same with the cluster that is allocated by exfat_extend_valid_size(). The previous patch will check invalid start_clu, but for clarity, initialize hint_femp.eidx to zero. Cc: [email protected] Reported-by: [email protected] Tested-by: [email protected] Reviewed-by: Yuezhang Mo <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Wen Zhiwei <[email protected]>
1 parent 1142b09 commit 2941b8b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/exfat/namei.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ static int exfat_find_empty_entry(struct inode *inode,
377377
if (ei->start_clu == EXFAT_EOF_CLUSTER) {
378378
ei->start_clu = clu.dir;
379379
p_dir->dir = clu.dir;
380+
hint_femp.eidx = 0;
380381
}
381382

382383
/* append to the FAT chain */

0 commit comments

Comments
 (0)