mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ghanshyam Agrawal <ghanshyam1898@gmail.com>
To: mark@fasheh.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com
Cc: Ghanshyam Agrawal <ghanshyam1898@gmail.com>,
	ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
	syzbot+adfd64e93c46b99c957e@syzkaller.appspotmail.com
Subject: [PATCH] ocfs2: bug fix when bh is null
Date: Sat,  7 Sep 2024 03:42:08 +0530	[thread overview]
Message-ID: <20240906221208.136692-1-ghanshyam1898@gmail.com> (raw)

Reported-by: syzbot+adfd64e93c46b99c957e@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=adfd64e93c46b99c957e
Signed-off-by: Ghanshyam Agrawal <ghanshyam1898@gmail.com>
---
 fs/ocfs2/buffer_head_io.c | 1 -
 fs/ocfs2/uptodate.c       | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
index cdb9b9bdea1f..e62c7e1de4eb 100644
--- a/fs/ocfs2/buffer_head_io.c
+++ b/fs/ocfs2/buffer_head_io.c
@@ -235,7 +235,6 @@ int ocfs2_read_blocks(struct ocfs2_caching_info *ci, u64 block, int nr,
 		if (bhs[i] == NULL) {
 			bhs[i] = sb_getblk(sb, block++);
 			if (bhs[i] == NULL) {
-				ocfs2_metadata_cache_io_unlock(ci);
 				status = -ENOMEM;
 				mlog_errno(status);
 				/* Don't forget to put previous bh! */
diff --git a/fs/ocfs2/uptodate.c b/fs/ocfs2/uptodate.c
index 09854925fa5c..3242291402c3 100644
--- a/fs/ocfs2/uptodate.c
+++ b/fs/ocfs2/uptodate.c
@@ -471,7 +471,7 @@ void ocfs2_set_buffer_uptodate(struct ocfs2_caching_info *ci,
 
 	/* The block may very well exist in our cache already, so avoid
 	 * doing any more work in that case. */
-	if (ocfs2_buffer_cached(ci, bh))
+	if (bh == NULL || ocfs2_buffer_cached(ci, bh))
 		return;
 
 	trace_ocfs2_set_buffer_uptodate_begin(
-- 
2.34.1


             reply	other threads:[~2024-09-06 22:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-06 22:12 Ghanshyam Agrawal [this message]
2024-09-09  1:39 ` Su Yue
2024-09-09  2:27   ` Joseph Qi

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=20240906221208.136692-1-ghanshyam1898@gmail.com \
    --to=ghanshyam1898@gmail.com \
    --cc=jlbec@evilplan.org \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@lists.linux.dev \
    --cc=syzbot+adfd64e93c46b99c957e@syzkaller.appspotmail.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

all inboxes | Powered by JetHome®