[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZYg8n2x6wtxNN4JK@casper.infradead.org>
Date: Sun, 24 Dec 2023 14:13:51 +0000
From: Matthew Wilcox <willy@...radead.org>
To: Edward Adam Davis <eadavis@...com>
Cc: syzbot+2c4a3b922a860084cc7f@...kaller.appspotmail.com,
adilger.kernel@...ger.ca, linux-ext4@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
syzkaller-bugs@...glegroups.com, tytso@....edu
Subject: Re: [PATCH] ext4: fix WARNING in lock_two_nondirectories
On Sun, Dec 24, 2023 at 07:53:00PM +0800, Edward Adam Davis wrote:
> If inode is the ext4 boot loader inode, then when it is a directory, the inode
> should also be set to bad inode.
... what? Are you saying that syzbot has randomly created a filesystem
where the boot loader inode is a directory? If so, I'd suggest just
rejecting the filesystem with EFSCORRUPT.
> Reported-and-tested-by: syzbot+2c4a3b922a860084cc7f@...kaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@...com>
> ---
> fs/ext4/inode.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 61277f7f8722..b311f610f008 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -4944,8 +4944,12 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino,
> inode->i_fop = &ext4_file_operations;
> ext4_set_aops(inode);
> } else if (S_ISDIR(inode->i_mode)) {
> - inode->i_op = &ext4_dir_inode_operations;
> - inode->i_fop = &ext4_dir_operations;
> + if (ino == EXT4_BOOT_LOADER_INO)
> + make_bad_inode(inode);
> + else {
> + inode->i_op = &ext4_dir_inode_operations;
> + inode->i_fop = &ext4_dir_operations;
> + }
> } else if (S_ISLNK(inode->i_mode)) {
> /* VFS does not allow setting these so must be corruption */
> if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) {
> --
> 2.43.0
>
>
Powered by blists - more mailing lists