public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: syzbot <syzbot+fd05de09d1267725aa95@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] Re: kernel BUG in ocfs2_reserve_suballoc_bits()
Date: Wed, 20 Nov 2024 00:14:59 -0800	[thread overview]
Message-ID: <673d9a83.050a0220.363a1b.0004.GAE@google.com> (raw)
In-Reply-To: <67253f50.050a0220.35b515.0179.GAE@google.com>

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: Re: kernel BUG in ocfs2_reserve_suballoc_bits()
Author: dmantipov@yandex.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 &

  parent reply	other threads:[~2024-11-20  8:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-01 20:51 [syzbot] [ocfs2?] kernel BUG in ocfs2_reserve_suballoc_bits syzbot
2024-11-06 23:12 ` syzbot
2024-11-20  8:14 ` syzbot [this message]
2025-10-22 15:05 ` Forwarded: #syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 552c50713f273b494ac6c77052032a49bc9255e2 syzbot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=673d9a83.050a0220.363a1b.0004.GAE@google.com \
    --to=syzbot+fd05de09d1267725aa95@syzkaller.appspotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox