From: Mauricio Faria de Oliveira <mfo@igalia.com>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: kernel-dev@igalia.com, gfs2@lists.linux.dev,
linux-kernel@vger.kernel.org,
Mauricio Faria de Oliveira <mfo@igalia.com>
Subject: [PATCH 4/5] gfs2: handle NULL return value in callers of gfs2_meta_ra()
Date: Tue, 08 Sep 2026 18:16:15 -0300 [thread overview]
Message-ID: <20260908-gfs2_getbuf-error-checks-v1-4-7c59698f178f@igalia.com> (raw)
In-Reply-To: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com>
Now that gfs2_meta_ra() can return NULL (instead of hit a kernel oops),
update its callers to handle it (and not hit another kernel oops).
If gfs2_meta_ra() returns NULL:
- gfs2_quota_init()
It currently checks for NULL and returns -EIO.
- gfs2_dir_read_data()
Return -EIO. Fail as currently done in other cases.
- gfs2_replay_read_block()
Return -EIO. It can currently return errors.
Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
---
fs/gfs2/dir.c | 4 ++++
fs/gfs2/recovery.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index d1dc1e94b6c432d2ede504b04cb71959285a945d..d9e0b6b19567c8aa8518b9245e9bdfd3ccf7c1a7 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -302,6 +302,10 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, __be64 *buf,
goto fail;
BUG_ON(extlen < 1);
bh = gfs2_meta_ra(ip->i_gl, dblock, extlen);
+ if (!bh) {
+ error = -EIO;
+ goto fail;
+ }
} else {
error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, 0, &bh);
if (error)
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index 616c46aa3434ae6ad84d10d678ca3f6dbe9492f5..e39754e08f44d67b460a47744f4276cd168e356c 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -48,6 +48,8 @@ int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk,
}
*bh = gfs2_meta_ra(gl, dblock, extlen);
+ if (!*bh)
+ error = -EIO;
return error;
}
--
2.47.3
next prev parent reply other threads:[~2026-09-08 21:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 21:16 [PATCH 0/5] gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf() and its caller chain Mauricio Faria de Oliveira
2026-09-08 21:16 ` [PATCH 1/5] gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf() Mauricio Faria de Oliveira
2026-09-08 21:16 ` [PATCH 2/5] gfs2: handle NULL return value in callers of gfs2_getbuf() with CREATE Mauricio Faria de Oliveira
2026-09-08 21:16 ` [PATCH 3/5] gfs2: handle NULL return value in callers of gfs2_meta_new() Mauricio Faria de Oliveira
2026-09-08 21:16 ` Mauricio Faria de Oliveira [this message]
2026-09-08 21:16 ` [PATCH 5/5] gfs2: check for errors from filemap_get_folio() in gfs2_jhead_process_page() Mauricio Faria de Oliveira
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=20260908-gfs2_getbuf-error-checks-v1-4-7c59698f178f@igalia.com \
--to=mfo@igalia.com \
--cc=agruenba@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=kernel-dev@igalia.com \
--cc=linux-kernel@vger.kernel.org \
/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®