* [PATCH] exfat: free new directory cluster if zeroing fails
@ 2026-07-28 4:29 Yichong Chen
2026-07-28 8:51 ` Namjae Jeon
0 siblings, 1 reply; 2+ messages in thread
From: Yichong Chen @ 2026-07-28 4:29 UTC (permalink / raw)
To: linkinjeon, sj1557.seo; +Cc: yuezhang.mo, exfat, linux-kernel, Yichong Chen
exfat_alloc_new_dir() allocates a cluster for a new directory before
zeroing it. If exfat_zeroed_cluster() fails, the function returns the
error but leaves the allocated cluster in use.
Free the newly allocated cluster before returning the zeroing error.
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
---
fs/exfat/dir.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
index 4fd4ec52b8c0..8d2ae6e33cbf 100644
--- a/fs/exfat/dir.c
+++ b/fs/exfat/dir.c
@@ -299,7 +299,13 @@ int exfat_alloc_new_dir(struct inode *inode, struct exfat_chain *clu)
if (ret)
return ret;
- return exfat_zeroed_cluster(inode, clu->dir);
+ ret = exfat_zeroed_cluster(inode, clu->dir);
+ if (ret) {
+ exfat_free_cluster(inode, clu);
+ return ret;
+ }
+
+ return 0;
}
int exfat_calc_num_entries(struct exfat_uni_name *p_uniname)
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] exfat: free new directory cluster if zeroing fails
2026-07-28 4:29 [PATCH] exfat: free new directory cluster if zeroing fails Yichong Chen
@ 2026-07-28 8:51 ` Namjae Jeon
0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2026-07-28 8:51 UTC (permalink / raw)
To: Yichong Chen; +Cc: sj1557.seo, yuezhang.mo, exfat, linux-kernel
On Tue, Jul 28, 2026 at 1:29 PM Yichong Chen <chenyichong@uniontech.com> wrote:
>
> exfat_alloc_new_dir() allocates a cluster for a new directory before
> zeroing it. If exfat_zeroed_cluster() fails, the function returns the
> error but leaves the allocated cluster in use.
>
> Free the newly allocated cluster before returning the zeroing error.
>
> Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Applied it to #dev.
Thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-28 8:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-28 4:29 [PATCH] exfat: free new directory cluster if zeroing fails Yichong Chen
2026-07-28 8:51 ` Namjae Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®