[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210510102019.663806438@linuxfoundation.org>
Date: Mon, 10 May 2021 12:21:19 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Hyeongseok Kim <hyeongseok@...il.com>,
Sungjong Seo <sj1557.seo@...sung.com>,
Namjae Jeon <namjae.jeon@...sung.com>
Subject: [PATCH 5.11 289/342] exfat: fix erroneous discard when clear cluster bit
From: Hyeongseok Kim <hyeongseok@...il.com>
commit 77edfc6e51055b61cae2f54c8e6c3bb7c762e4fe upstream.
If mounted with discard option, exFAT issues discard command when clear
cluster bit to remove file. But the input parameter of cluster-to-sector
calculation is abnormally added by reserved cluster size which is 2,
leading to discard unrelated sectors included in target+2 cluster.
With fixing this, remove the wrong comments in set/clear/find bitmap
functions.
Fixes: 1e49a94cf707 ("exfat: add bitmap operations")
Cc: stable@...r.kernel.org # v5.7+
Signed-off-by: Hyeongseok Kim <hyeongseok@...il.com>
Acked-by: Sungjong Seo <sj1557.seo@...sung.com>
Signed-off-by: Namjae Jeon <namjae.jeon@...sung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/exfat/balloc.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
--- a/fs/exfat/balloc.c
+++ b/fs/exfat/balloc.c
@@ -141,10 +141,6 @@ void exfat_free_bitmap(struct exfat_sb_i
kfree(sbi->vol_amap);
}
-/*
- * If the value of "clu" is 0, it means cluster 2 which is the first cluster of
- * the cluster heap.
- */
int exfat_set_bitmap(struct inode *inode, unsigned int clu)
{
int i, b;
@@ -162,10 +158,6 @@ int exfat_set_bitmap(struct inode *inode
return 0;
}
-/*
- * If the value of "clu" is 0, it means cluster 2 which is the first cluster of
- * the cluster heap.
- */
void exfat_clear_bitmap(struct inode *inode, unsigned int clu)
{
int i, b;
@@ -186,8 +178,7 @@ void exfat_clear_bitmap(struct inode *in
int ret_discard;
ret_discard = sb_issue_discard(sb,
- exfat_cluster_to_sector(sbi, clu +
- EXFAT_RESERVED_CLUSTERS),
+ exfat_cluster_to_sector(sbi, clu),
(1 << sbi->sect_per_clus_bits), GFP_NOFS, 0);
if (ret_discard == -EOPNOTSUPP) {
Powered by blists - more mailing lists