VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: hyeongseok.kim <hyeongseok@gmail.com> 2020-06-04 13:54:28 +0900 committer: Namjae Jeon <namjae.jeon@samsung.com> 2020-06-09 16:50:12 +0900 commit: a949824f01f3b39f737d77aed6cba47aced09319 parent: 29bbb14bfc80dd760b07d2be0a27e610562982e3
Commit Summary:
exfat: fix range validation error in alloc and free cluster
Diffstat:
1 file changed, 2 insertions, 2 deletions
diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c
index 267e5e09eb13..4e5c5c9c0f2d 100644
--- a/fs/exfat/fatent.c
+++ b/fs/exfat/fatent.c
@@ -169,7 +169,7 @@ int exfat_free_cluster(struct inode *inode, struct exfat_chain *p_chain)
 		return 0;
 
 	/* check cluster validation */
-	if (p_chain->dir < 2 && p_chain->dir >= sbi->num_clusters) {
+	if (!is_valid_cluster(sbi, p_chain->dir)) {
 		exfat_err(sb, "invalid start cluster (%u)", p_chain->dir);
 		return -EIO;
 	}
@@ -346,7 +346,7 @@ int exfat_alloc_cluster(struct inode *inode, unsigned int num_alloc,
 	}
 
 	/* check cluster validation */
-	if (hint_clu < EXFAT_FIRST_CLUSTER && hint_clu >= sbi->num_clusters) {
+	if (!is_valid_cluster(sbi, hint_clu)) {
 		exfat_err(sb, "hint_cluster is invalid (%u)",
 			hint_clu);
 		hint_clu = EXFAT_FIRST_CLUSTER;