[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <673d9a83.050a0220.363a1b.0004.GAE@google.com>
Date: Wed, 20 Nov 2024 00:14:59 -0800
From: syzbot <syzbot+fd05de09d1267725aa95@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] Re: kernel BUG in ocfs2_reserve_suballoc_bits()
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.
***
Subject: Re: kernel BUG in ocfs2_reserve_suballoc_bits()
Author: dmantipov@...dex.ru
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bf9aa14fc523d2763fc9a10672a709224e8fcaf4
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 60df52e4c1f8..d65326d36b1c 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -2440,6 +2440,13 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,
status = 0;
acquired = 0;
+
+ /* Do not trust a filesystem which is known for containing errors. */
+ if (ocfs2_has_errors(osb)) {
+ status = -EINVAL;
+ goto bail;
+ }
+
/* We'll allow faking a readonly metadata lock for
* rodevices. */
if (ocfs2_is_hard_readonly(osb)) {
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 51c52768132d..a48f79ca750a 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -665,6 +665,17 @@ static inline int ocfs2_is_soft_readonly(struct ocfs2_super *osb)
return ret;
}
+static inline int ocfs2_has_errors(struct ocfs2_super *osb)
+{
+ int ret;
+
+ spin_lock(&osb->osb_lock);
+ ret = osb->osb_flags & OCFS2_OSB_ERROR_FS;
+ spin_unlock(&osb->osb_lock);
+
+ return ret;
+}
+
static inline int ocfs2_clusterinfo_valid(struct ocfs2_super *osb)
{
return (osb->s_feature_incompat &
Powered by blists - more mailing lists