[PATCH v3 5/6] qnx6: abort mount on superblock magic mismatch when silent is set
From: Hui Peng
Date: Thu Sep 24 2026 - 03:44:13 EST
In qnx6_fill_super() and qnx6_mmi_fill_super(), when the superblock magic
number check fails and silent is non-zero, the function prints no message
but continues executing into superblock parameter processing, resulting in
invalid memory accesses on non-qnx6 filesystem images.
Jump to the error cleanup label when superblock magic mismatch occurs
regardless of the silent flag setting.
Fixes: 5d026c724220 ("fs: initial qnx6fs addition")
Cc: stable@xxxxxxxxxxxxxxx
Tested-by: Matthias Goergens <matthias.goergens@xxxxxxxxx>
Reviewed-by: Matthias Goergens <matthias.goergens@xxxxxxxxx>
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@xxxxxxxxx>
---
Changes in v3:
- Add Tested-by and Reviewed-by tags from Matthias Goergens.
- Update Fixes: tag SHA to 5d026c724220 ("fs: initial qnx6fs addition").
Changes in v2:
- Split out as patch 5/6 as requested by maintainers.
fs/qnx6/inode.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 49e29a918a2d..a32066d98188 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -328,8 +328,10 @@ static int qnx6_fill_super(struct super_block *s, void *data, int silent)
if (dfs->s_magic != cpu_to_fs32(sbi, QNX6_SUPER_MAGIC)) {
if (!silent)
pr_err("wrong signature\n");
+ brelse(sb_buf);
+ sb_buf = NULL;
} else {
sbi->s_bytesex = BYTESEX_LE;
}