* [PATCH] cramfs: Verify inode mode when loading from disk
@ 2025-08-12 14:52 Tetsuo Handa
2025-08-29 13:17 ` Tetsuo Handa
0 siblings, 1 reply; 3+ messages in thread
From: Tetsuo Handa @ 2025-08-12 14:52 UTC (permalink / raw)
To: Nicolas Pitre, LKML
The inode mode loaded from corrupted disk can be invalid. Do like what
commit 0a9e74051313 ("isofs: Verify inode mode when loading from disk")
does.
Reported-by: syzbot <syzbot+895c23f6917da440ed0d@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=895c23f6917da440ed0d
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
fs/cramfs/inode.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index b002e9b734f9..12daa85ed941 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -116,9 +116,18 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
inode_nohighmem(inode);
inode->i_data.a_ops = &cramfs_aops;
break;
- default:
+ case S_IFCHR:
+ case S_IFBLK:
+ case S_IFIFO:
+ case S_IFSOCK:
init_special_inode(inode, cramfs_inode->mode,
old_decode_dev(cramfs_inode->size));
+ break;
+ default:
+ printk(KERN_DEBUG "CRAMFS: Invalid file type 0%04o for inode %lu.\n",
+ inode->i_mode, inode->i_ino);
+ iget_failed(inode);
+ return ERR_PTR(-EIO);
}
inode->i_mode = cramfs_inode->mode;
--
2.50.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cramfs: Verify inode mode when loading from disk
2025-08-12 14:52 [PATCH] cramfs: Verify inode mode when loading from disk Tetsuo Handa
@ 2025-08-29 13:17 ` Tetsuo Handa
2025-08-30 2:27 ` Nicolas Pitre
0 siblings, 1 reply; 3+ messages in thread
From: Tetsuo Handa @ 2025-08-29 13:17 UTC (permalink / raw)
To: Nicolas Pitre, LKML; +Cc: Christian Brauner, Andrew Morton
Any questions? Should I find someone who can take this patch?
On 2025/08/12 23:52, Tetsuo Handa wrote:
> The inode mode loaded from corrupted disk can be invalid. Do like what
> commit 0a9e74051313 ("isofs: Verify inode mode when loading from disk")
> does.
>
> Reported-by: syzbot <syzbot+895c23f6917da440ed0d@syzkaller.appspotmail.com>
> Closes: https://syzkaller.appspot.com/bug?extid=895c23f6917da440ed0d
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> fs/cramfs/inode.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
> index b002e9b734f9..12daa85ed941 100644
> --- a/fs/cramfs/inode.c
> +++ b/fs/cramfs/inode.c
> @@ -116,9 +116,18 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
> inode_nohighmem(inode);
> inode->i_data.a_ops = &cramfs_aops;
> break;
> - default:
> + case S_IFCHR:
> + case S_IFBLK:
> + case S_IFIFO:
> + case S_IFSOCK:
> init_special_inode(inode, cramfs_inode->mode,
> old_decode_dev(cramfs_inode->size));
> + break;
> + default:
> + printk(KERN_DEBUG "CRAMFS: Invalid file type 0%04o for inode %lu.\n",
> + inode->i_mode, inode->i_ino);
> + iget_failed(inode);
> + return ERR_PTR(-EIO);
> }
>
> inode->i_mode = cramfs_inode->mode;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cramfs: Verify inode mode when loading from disk
2025-08-29 13:17 ` Tetsuo Handa
@ 2025-08-30 2:27 ` Nicolas Pitre
0 siblings, 0 replies; 3+ messages in thread
From: Nicolas Pitre @ 2025-08-30 2:27 UTC (permalink / raw)
To: Tetsuo Handa; +Cc: LKML, Christian Brauner, Andrew Morton
On Fri, 29 Aug 2025, Tetsuo Handa wrote:
> Any questions? Should I find someone who can take this patch?
Please add
Acked-by: Nicolas Pitre <nico@fluxnic.net>
and send it to linux-fsdevel@vger.kernel.org.
> On 2025/08/12 23:52, Tetsuo Handa wrote:
> > The inode mode loaded from corrupted disk can be invalid. Do like what
> > commit 0a9e74051313 ("isofs: Verify inode mode when loading from disk")
> > does.
> >
> > Reported-by: syzbot <syzbot+895c23f6917da440ed0d@syzkaller.appspotmail.com>
> > Closes: https://syzkaller.appspot.com/bug?extid=895c23f6917da440ed0d
> > Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> > ---
> > fs/cramfs/inode.c | 11 ++++++++++-
> > 1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
> > index b002e9b734f9..12daa85ed941 100644
> > --- a/fs/cramfs/inode.c
> > +++ b/fs/cramfs/inode.c
> > @@ -116,9 +116,18 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
> > inode_nohighmem(inode);
> > inode->i_data.a_ops = &cramfs_aops;
> > break;
> > - default:
> > + case S_IFCHR:
> > + case S_IFBLK:
> > + case S_IFIFO:
> > + case S_IFSOCK:
> > init_special_inode(inode, cramfs_inode->mode,
> > old_decode_dev(cramfs_inode->size));
> > + break;
> > + default:
> > + printk(KERN_DEBUG "CRAMFS: Invalid file type 0%04o for inode %lu.\n",
> > + inode->i_mode, inode->i_ino);
> > + iget_failed(inode);
> > + return ERR_PTR(-EIO);
> > }
> >
> > inode->i_mode = cramfs_inode->mode;
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-08-30 2:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 14:52 [PATCH] cramfs: Verify inode mode when loading from disk Tetsuo Handa
2025-08-29 13:17 ` Tetsuo Handa
2025-08-30 2:27 ` Nicolas Pitre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).