[PATCH v5 3/6] qnx6: release bh on error path in qnx6_fill_super()
From: Hui Peng
Date: Wed Sep 30 2026 - 04:21:47 EST
In qnx6_fill_super(), when indirect block tree level validation fails at
mmi_success, the code jumps to label out: before sbi is assigned. Reading
sbi->sb_buf at label out: reads an uninitialized stack pointer sbi, causing
a general protection fault under CONFIG_INIT_STACK_ALL_PATTERN and leaking
qs->sb_buf.
Use qs->sb_buf instead of sbi->sb_buf at label out: to safely release
qs->sb_buf when mounting mmi_fs images.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: LLM
Signed-off-by: Hui Peng <benquike@xxxxxxxxx>
---
Changes in v5:
- Use qs->sb_buf instead of sbi->sb_buf at label out: to prevent reading
uninitialized sbi when mounting mmi_fs images, as pointed out by
Matthias Goergens.
fs/qnx6/inode.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 3c880854c867..0a68d0eb4b71 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -465,6 +465,10 @@ static int qnx6_fill_super(struct super_block *s, struct fs_context *fc)
out1:
iput(sbi->inodes);
out:
+ if (qs->sb_buf && !bh1 && !bh2) {
+ brelse(qs->sb_buf);
+ qs->sb_buf = NULL;
+ }
brelse(bh1);
brelse(bh2);
outnobh:
--
2.47.3