[PATCH 0/5] gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf() and its caller chain
From: Mauricio Faria de Oliveira
Date: Tue Sep 08 2026 - 18:43:36 EST
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@xxxxxxxxxx>
---
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@xxxxxxxxxx>