Unverified Commit ac772b55 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14317 exfat: fix out-of-bounds access of directory entries

parents 5ca706f2 bb848358
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -655,13 +655,19 @@ static int exfat_find(struct inode *dir, struct qstr *qname,
	info->type = exfat_get_entry_type(ep);
	info->attr = le16_to_cpu(ep->dentry.file.attr);
	info->size = le64_to_cpu(ep2->dentry.stream.valid_size);

	info->start_clu = le32_to_cpu(ep2->dentry.stream.start_clu);
	if (!is_valid_cluster(sbi, info->start_clu) && info->size) {
		exfat_warn(sb, "start_clu is invalid cluster(0x%x)",
				info->start_clu);
		info->size = 0;
	}

	if (info->size == 0) {
		info->flags = ALLOC_NO_FAT_CHAIN;
		info->start_clu = EXFAT_EOF_CLUSTER;
	} else {
		info->flags = ep2->dentry.stream.flags;
		info->start_clu =
			le32_to_cpu(ep2->dentry.stream.start_clu);
	}

	exfat_get_entry_time(sbi, &info->crtime,