Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v2] fs/adfs: bigdir: Restore EIO errno return when checkbyte mismatch
       [not found] <20250801093806.1223287-1-zhen.ni@easystack.cn>
@ 2025-08-05  7:30 ` Zhen Ni
  0 siblings, 0 replies; only message in thread
From: Zhen Ni @ 2025-08-05  7:30 UTC (permalink / raw)
  To: Markus.Elfring, viro, linux, rmk+kernel; +Cc: linux-kernel, Zhen Ni, stable

The error path in adfs_fplus_read() prints an error message via
adfs_error() but incorrectly returns success (0) to the caller.
This occurs because the 'ret' variable remains set to 0 from the earlier
successful call to adfs_fplus_validate_tail().

Fix by setting 'ret = -EIO' before jumping to the error exit.

This issue was detected by smatch static analysis:
warning: fs/adfs/dir_fplus.c:146: adfs_fplus_read() warn: missing error
code 'ret'.

Fixes: d79288b4f61b ("fs/adfs: bigdir: calculate and validate directory checkbyte")
Cc: stable@vger.kernel.org
Signed-off-by: Zhen Ni <zhen.ni@easystack.cn>
---
Changes in v2:
- Add tags of 'Fixes' and 'Cc' in commit message
- Added error description and the corresponding fix in commit message
---
 fs/adfs/dir_fplus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c
index 4a15924014da..4334279409b2 100644
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -143,6 +143,7 @@ static int adfs_fplus_read(struct super_block *sb, u32 indaddr,
 
 	if (adfs_fplus_checkbyte(dir) != t->bigdircheckbyte) {
 		adfs_error(sb, "dir %06x checkbyte mismatch\n", indaddr);
+		ret = -EIO;
 		goto out;
 	}
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-05  8:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20250801093806.1223287-1-zhen.ni@easystack.cn>
2025-08-05  7:30 ` [PATCH v2] fs/adfs: bigdir: Restore EIO errno return when checkbyte mismatch Zhen Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox