[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <672c547e.050a0220.350062.0289.GAE@google.com>
Date: Wed, 06 Nov 2024 21:47:42 -0800
From: syzbot <syzbot+ac2116e48989e84a2893@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] Re: kernel BUG in clear_inode()
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.
***
Subject: Re: kernel BUG in clear_inode()
Author: dmantipov@...dex.ru
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ff7afaeca1a15fbeaa2c4795ee806c0667bd77b2
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index a360b24ed320..debfc1389cb3 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -3029,14 +3029,23 @@ static void duplicateIXtree(struct super_block *sb, s64 blkno,
*
* RETURN VALUES:
* 0 - success
- * -ENOMEM - insufficient memory
+ * -EINVAL - unexpected inode type
*/
static int copy_from_dinode(struct dinode * dip, struct inode *ip)
{
struct jfs_inode_info *jfs_ip = JFS_IP(ip);
struct jfs_sb_info *sbi = JFS_SBI(ip->i_sb);
+ int fileset = le32_to_cpu(dip->di_fileset);
+
+ switch (fileset) {
+ case AGGR_RESERVED_I: case AGGREGATE_I: case BMAP_I:
+ case LOG_I: case BADBLOCK_I: case FILESYSTEM_I:
+ break;
+ default:
+ return -EINVAL;
+ }
- jfs_ip->fileset = le32_to_cpu(dip->di_fileset);
+ jfs_ip->fileset = fileset;
jfs_ip->mode2 = le32_to_cpu(dip->di_mode);
jfs_set_inode_flags(ip);
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index d68a4e6ac345..845abc598334 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -1467,8 +1467,14 @@ static struct dentry *jfs_lookup(struct inode *dip, struct dentry *dentry, unsig
ip = ERR_PTR(rc);
} else {
ip = jfs_iget(dip->i_sb, inum);
- if (IS_ERR(ip))
- jfs_err("jfs_lookup: iget failed on inum %d", (uint)inum);
+ if (IS_ERR(ip)) {
+ long err = PTR_ERR(ip);
+
+ jfs_err("%s: iget failed on inum %d with error"
+ " %ld, consider running 'jfs_fsck -f /dev/%s'",
+ __func__, (uint)inum, err, dip->i_sb->s_id);
+ return ERR_PTR(err);
+ }
}
return d_splice_alias(ip, dentry);
--
2.47.0
Powered by blists - more mailing lists