projects/linux·commit ebebb04b

hfsplus: avoid double unload_nls() on mount failure

ebebb04b · Shardul Bankar <[email protected]> · 2026-02-04 22:34:40 +05:30

The recent commit "hfsplus: ensure sb->s_fs_info is always cleaned up"
[1] introduced a custom ->kill_sb() handler (hfsplus_kill_super) that
cleans up the s_fs_info structure (including the NLS table) on
superblock destruction.

However, the error handling path in hfsplus_fill_super() still calls
unload_nls() before returning an error. Since the VFS layer calls
->kill_sb() when fill_super fails, this results in unload_nls() being
called twice for the same sbi->nls pointer: once in hfsplus_fill_super()
and again in hfsplus_kill_super() (via delayed_free).

Remove the explicit unload_nls() call from the error path in
hfsplus_fill_super() to rely solely on the cleanup in ->kill_sb().

[1] https://lore.kernel.org/r/[email protected]/

Reported-by: Al Viro <[email protected]>
Link: https://lore.kernel.org/r/20260203043806.GF3183987@ZenIV/
Signed-off-by: Shardul Bankar <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Viacheslav Dubeyko <[email protected]>
Commit
ebebb04baefdace1e0dc17f7779e5549063ca592
Parents
14b428cf

Changes

1 files changed · +0 −1

FileStatusAddDelContent
fs/hfsplus/super.cmodified+0−1View file

fs/hfsplus/super.c

View file
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 942b8ff..592d8fb 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -652,7 +652,6 @@ out_free_vhdr:
kfree(sbi->s_vhdr_buf);
kfree(sbi->s_backup_vhdr_buf);
out_unload_nls:
- unload_nls(sbi->nls);
unload_nls(nls);
return err;
}