mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 0/5] gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf() and its caller chain
Date: Tue, 08 Sep 2026 18:16:11 -0300	[thread overview]
Message-ID: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> (raw)

Currently, gfs2_getbuf() will hit a kernel oops for dereferencing an error
pointer if __filemap_get_folio() with FGP_CREAT fails, eg ERR_PTR(-ENOMEM),
as there is no error handling in this case.

The code and documentation in filemap.c and pagemap.h show that it indeed
may fail, and other callers in the kernel check for errors with FGP_CREAT.

This series adds such error handling in gfs2_getbuf() and its caller chain.

Tested with fstests on v7.3-rc1. It "Failed 51 out 788 tests" consistently,
plus one (different) flaky test on ~10 runs before and after this series.

Thanks,

Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
---
Mauricio Faria de Oliveira (5):
      gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf()
      gfs2: handle NULL return value in callers of gfs2_getbuf() with CREATE
      gfs2: handle NULL return value in callers of gfs2_meta_new()
      gfs2: handle NULL return value in callers of gfs2_meta_ra()
      gfs2: check for errors from filemap_get_folio() in gfs2_jhead_process_page()

 fs/gfs2/bmap.c     | 27 +++++++++++++++++++--------
 fs/gfs2/dir.c      |  8 ++++++++
 fs/gfs2/inode.c    | 20 +++++++++++++++-----
 fs/gfs2/lops.c     | 31 ++++++++++++++++++++++++++-----
 fs/gfs2/meta_io.c  | 30 +++++++++++++++++++++++-------
 fs/gfs2/recovery.c |  2 ++
 fs/gfs2/xattr.c    |  6 ++++++
 7 files changed, 99 insertions(+), 25 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260908-gfs2_getbuf-error-checks-e8f89a08acc4

Best regards,
-- 
Mauricio Faria de Oliveira <mfo@igalia.com>


             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 Mauricio Faria de Oliveira [this message]
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 ` [PATCH 4/5] gfs2: handle NULL return value in callers of gfs2_meta_ra() Mauricio Faria de Oliveira
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-0-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®