From 74893785ab7e102ac27f96152f33cde81cbc5b54 Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Sat, 26 Oct 2024 13:06:15 +0900 Subject: [PATCH] exfat: fix uninit-value in __exfat_get_dentry_set 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. Signed-off-by: Namjae Jeon --- namei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/namei.c b/namei.c index 40f8691..2bd9df2 100644 --- a/namei.c +++ b/namei.c @@ -346,6 +346,7 @@ static int exfat_find_empty_entry(struct inode *inode, if (ei->start_clu == EXFAT_EOF_CLUSTER) { ei->start_clu = clu.dir; p_dir->dir = clu.dir; + hint_femp.eidx = 0; } /* append to the FAT chain */