From: Zijie Zhao affs_iget() only adds a file type to i_mode for the secondary types it knows. Any other stype in a corrupted header block yields an inode with no S_IFMT bits, which lookup instantiates and which trips the VFS_BUG_ON_INODE() in may_open() with CONFIG_DEBUG_VFS. Fail such inodes with -EIO, as is already done for ST_LINKFILE. Found by a static analysis tool. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Fixes: af153bb63a33 ("vfs: catch invalid modes in may_open()") Signed-off-by: Zijie Zhao --- The fix and the changelog were drafted with AI assistance (Claude Code, with a second review by OpenAI Codex), then reviewed by the submitter. Testing: - Compile-tested on x86_64 (allmodconfig, W=1): fs/affs/inode.o; no new warnings. - checkpatch.pl --strict: no errors or warnings. --- fs/affs/inode.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/affs/inode.c b/fs/affs/inode.c index c7de9c793ab8..7b390842f5b2 100644 --- a/fs/affs/inode.c +++ b/fs/affs/inode.c @@ -147,6 +147,10 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) inode->i_op = &affs_symlink_inode_operations; inode->i_data.a_ops = &affs_symlink_aops; break; + default: + affs_warning(sb, "read_inode", "unknown stype %d on inode %d", + be32_to_cpu(tail->stype), block); + goto bad_inode; } inode_set_mtime(inode, --- base-commit: 007722b8211f7b34fdf21b1e6a9c32497633ea29 change-id: 20261203-kbug-l1898-c580037d8c5f Best regards, -- Zijie Zhao