From nobody Fri Sep 25 20:07:40 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 03240449B12; Tue, 8 Sep 2026 21:15:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902143; cv=none; b=CYtYtozCxF59uC6vh7TXXxkhQR+U2dBd4VvDApwHXvT8HVVLY+61uVjBZTXnlag7Cidgx7wdatrzG37HM6ONcw3pCwkp0IKanLBg7+xBolV4SpjUBM5nfgHNNjlxWo2Oa5ceX2ah7YQHq3pr0Trw6imajPosd4Gu7p6R0K/rV28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902143; c=relaxed/simple; bh=mV84SZIgrDuXEajOV+VaHC60jYs2VDmdGuj2ftoecqk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ghpDVG0lGijLpgxKFqg9L/sFDA/aXRTaWpRbHNmzJQfzSjWuZwWXYYCC/tTRcl5xExl0BNeGZ4WOBAXlGjyMp6WQUS3yevjYFwitY2ySdx2FtpK38swhdLU+NLk0bXZfBU3P3cejAJnxnzSXQ7/zaA1yJ5jepgvEHdAQXr2fEpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=GG8krQ3w; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="GG8krQ3w" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:Message-Id:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:From:Reply-To; bh=1kcvINLQe7zq/DuzGWNi2heCC/ji3ZC1gBagaEJ6Vj0=; b=GG8krQ3wUJTQoE/osSajGP5/oG cKK7QkWm2pAaPaJuGUJyg+Vo4T754kGd9iZyH1Q8qkL34FpOc4lwfz3cLXzGcTiUqDkLlWHH7eLpd oMdgIo0QM7wrfMLwGA6QOZiP0L3364xofinPwPRoU6oJRB2yODhjIXBriGPd4EPyhNEaLrjSliD4u k1k3atUawPiy27JT8LnsjAGH0plpQPaYXG3FxTza2TFmRmDJX7RrsDpDTXIxgWolxBdbHdwcayusi TGfdBi9sWO0kLheBGJTmHXZ1Zt+iUzpRJGdjgKQxEflC313HI4iWfODXxmq66fwLSSWgik/FjsDdp vx6WhvNA==; Received: from 186-249-150-254.shared.desktop.com.br ([186.249.150.254] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1x43AI-00GhZP-IK; Tue, 08 Sep 2026 23:15:38 +0200 From: Mauricio Faria de Oliveira Date: Tue, 08 Sep 2026 18:16:12 -0300 Subject: [PATCH 1/5] gfs2: handle errors from __filemap_get_folio() with FGP_CREAT in gfs2_getbuf() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-gfs2_getbuf-error-checks-v1-1-7c59698f178f@igalia.com> References: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> In-Reply-To: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> To: Andreas Gruenbacher Cc: kernel-dev@igalia.com, gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 Function __filemap_get_folio() with FGP_CREAT might fail, for example, with ERR_PTR(-ENOMEM). This hits a kernel oops, as gfs2_getbuf() dereferences an error pointer: gfs2: fsid=3Dloop0: Trying to join cluster "lock_nolock", "loop0" gfs2: fsid=3Dloop0: Now mounting FS (format 1802)... Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] ... RIP: 0010:gfs2_getbuf+0x492/0x5a0 [ ... Call Trace: gfs2_meta_read+0x106/0x7a0 gfs2_meta_buffer+0x125/0x360 inode_go_instantiate+0xde/0x1510 gfs2_instantiate+0x102/0x1c0 gfs2_glock_wait+0x19a/0x2c0 gfs2_lookupi+0x2ba/0x570 gfs2_lookup_meta+0xad/0x160 init_inodes+0x350/0x20b0 gfs2_fill_super+0x19b6/0x2730 get_tree_bdev_flags+0x2f4/0x560 gfs2_get_tree+0x48/0x230 vfs_get_tree+0x87/0x2d0 vfs_cmd_create+0xb2/0x240 __do_sys_fsconfig+0x3d2/0x980 do_syscall_64+0xce/0x450 entry_SYSCALL_64_after_hwframe+0x77/0x7f ... That is noted more clearly in convenience function filemap_grab_folio() (snippet below) and checked by virtually all other callers in the kernel. ... * Return: A found or created folio. ERR_PTR(-ENOMEM) if no folio is found * and failed to create a folio. ... static inline struct folio *filemap_grab_folio(...) { return __filemap_get_folio(..., ... | FGP_CREAT, ...); } Thus, if __filemap_get_folio() returns an error, log it (as it's lost) and return NULL. Callers will be handled. Signed-off-by: Mauricio Faria de Oliveira --- fs/gfs2/meta_io.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index a87cfbf0df38706e6b7c63cc55f5251765d6b398..51b1a2e2bfadea6dabfac5ecba9= 83c615a1a69fa 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c @@ -145,6 +145,10 @@ struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl,= u64 blkno, int create) folio =3D __filemap_get_folio(mapping, index, FGP_LOCK | FGP_ACCESSED | FGP_CREAT, mapping_gfp_mask(mapping) | __GFP_NOFAIL); + if (IS_ERR(folio)) { + fs_err(sdp, "Error %ld creating buffer\n", PTR_ERR(folio)); + return NULL; + } bh =3D folio_buffers(folio); if (!bh) bh =3D create_empty_buffers(folio, --=20 2.47.3 From nobody Fri Sep 25 20:07:40 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0319745198A; Tue, 8 Sep 2026 21:15:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902145; cv=none; b=cOqCIih9GOwp7AG5y1tTe5pOHQuVJ0HVrBrQtZqC4KpsYZvm6kyuqm8AgBKqyAH/UL1CgpVE3gvDZq6jp9S+aZl/EbcKwLr0wXywqCAQnsSZTSTUojpiVV4e/HLK92lR6pYf+boDV81c1W29VrWOJhsTzyeTsib6Ug1p8TXaCG4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902145; c=relaxed/simple; bh=zDdrF9Sn8OKlpXaKIAkN+l5hQ2Z/AJVENwGhpKQlC/Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=oWikFx52SnoM7OUesLIhWo9niFhE1HuhNkvhwFbmvpDtAOUpZ2+LVplC4x+wC6VcCzG6cnfDG8bHF0KlVyTePPmkOqB8NoJYhHN2crUeLP/36Nlt5nKzoNwC6wDUPN8haSlVE/FM0HSJfm2qfdJdVg0pzSYbsanWdLS6TkukCno= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=rMI2g1tN; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="rMI2g1tN" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:Message-Id:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:From:Reply-To; bh=r91aiZES4W6lq6IQ4y2JAiOzuaqe05Gs5UjuSKcOaSU=; b=rMI2g1tNVACPOHrNVF44Uj4gVC nPCu9u3n2NmN/AVtV2h1Qkk1nXmvT9ULV2//OQKWx/xT+90v/zRELuRkESwaHjE2NYBWz2hPhSmY3 aNc5w/Br1w3u2NwSyWroX2JGjv9rGibfin4WJwV6+g/lc4acRV3UbbpfJzHQZ8/vG9xa/MqXPM676 ydMvQJaM/cyAwI9VSbw+uREWuZXhXTsyjlubqcZFZSyNXhLkmVLq3FXDG417D0pRwgNg+zSymPAqP JYNUP8qrBW/EjFAuf6V6C+1sO1qblCoDs4cmjMe8peS6YjkW8eauxctSA+HNZ25d5LHTZxchan7we e+McX4Tg==; Received: from 186-249-150-254.shared.desktop.com.br ([186.249.150.254] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1x43AK-00GhZP-9v; Tue, 08 Sep 2026 23:15:40 +0200 From: Mauricio Faria de Oliveira Date: Tue, 08 Sep 2026 18:16:13 -0300 Subject: [PATCH 2/5] gfs2: handle NULL return value in callers of gfs2_getbuf() with CREATE Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-gfs2_getbuf-error-checks-v1-2-7c59698f178f@igalia.com> References: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> In-Reply-To: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> To: Andreas Gruenbacher Cc: kernel-dev@igalia.com, gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 Now that gfs2_getbuf() with CREATE can return NULL (instead of hit a kernel oops), update its callers to handle it (and not hit another kernel oops). If gfs2_getbuf() returns NULL: - gfs2_metapath_ra() - gfs2_dir_readahead() Skip the rest of the loop. This should be OK as it's currently done if !trylock_buffer() or buffer_uptodate(), anyway. We can skip put_bh() as gfs2_getbuf() doesn't do get_bh() in this case. - gfs2_meta_new() Propagate NULL. Callers will be handled. - gfs2_meta_read() For either a block or read-ahead, fail as currently done by other cases. (Factor out the error path used multiple times now.) - gfs2_meta_ra() - For the first buffer: Popagate NULL. Callers will be handled. - For remaining buffers: Skip the rest of the loop. This should be OK as the condition to exit the loop is based on the first buffer (not remaining buffers), anyway. Signed-off-by: Mauricio Faria de Oliveira --- fs/gfs2/bmap.c | 2 ++ fs/gfs2/dir.c | 2 ++ fs/gfs2/meta_io.c | 26 +++++++++++++++++++------- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 73c62697116390f0f5f09f0b8fd267cc0790e953..a766b5816634d360a4bbae89f8b= cdd284071864a 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -302,6 +302,8 @@ static void gfs2_metapath_ra(struct gfs2_glock *gl, __b= e64 *start, __be64 *end) continue; =20 rabh =3D gfs2_getbuf(gl, be64_to_cpu(*t), CREATE); + if (!rabh) + continue; if (trylock_buffer(rabh)) { if (!buffer_uptodate(rabh)) { bh_submit(rabh, diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 0237b36b9eb16562ab3a3415b53547c43ab26f52..0d92f6c33dcb85dfa2a4b07f9f0= 9575834e75e01 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -1502,6 +1502,8 @@ static void gfs2_dir_readahead(struct inode *inode, u= nsigned hsize, u32 index, continue; =20 bh =3D gfs2_getbuf(gl, blocknr, 1); + if (!bh) + continue; if (trylock_buffer(bh)) { if (buffer_uptodate(bh)) { unlock_buffer(bh); diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c index 51b1a2e2bfadea6dabfac5ecba983c615a1a69fa..daa38fc7c825cdb70349caa7b55= ef333b10af7c2 100644 --- a/fs/gfs2/meta_io.c +++ b/fs/gfs2/meta_io.c @@ -199,6 +199,8 @@ struct buffer_head *gfs2_meta_new(struct gfs2_glock *gl= , u64 blkno) { struct buffer_head *bh; bh =3D gfs2_getbuf(gl, blkno, CREATE); + if (!bh) + return NULL; meta_prep_new(bh); return bh; } @@ -268,12 +270,13 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, = int flags, struct buffer_head *bh, *bhs[2]; int num =3D 0; =20 - if (gfs2_withdrawn(sdp)) { - *bhp =3D NULL; - return -EIO; - } + if (gfs2_withdrawn(sdp)) + goto error; =20 - *bhp =3D bh =3D gfs2_getbuf(gl, blkno, CREATE); + bh =3D gfs2_getbuf(gl, blkno, CREATE); + if (!bh) + goto error; + *bhp =3D bh; =20 lock_buffer(bh); if (buffer_uptodate(bh)) { @@ -286,6 +289,8 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, in= t flags, =20 if (rahead) { bh =3D gfs2_getbuf(gl, blkno + 1, CREATE); + if (!bh) + goto error; =20 lock_buffer(bh); if (buffer_uptodate(bh)) { @@ -307,11 +312,14 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, = int flags, if (tr && test_bit(TR_TOUCHED, &tr->tr_flags)) gfs2_io_error_bh(sdp, bh); brelse(bh); - *bhp =3D NULL; - return -EIO; + goto error; } =20 return 0; + +error: + *bhp =3D NULL; + return -EIO; } =20 /** @@ -494,6 +502,8 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl,= u64 dblock, u32 extlen) extlen =3D max_ra; =20 first_bh =3D gfs2_getbuf(gl, dblock, CREATE); + if (!first_bh) + return NULL; =20 if (buffer_uptodate(first_bh)) goto out; @@ -504,6 +514,8 @@ struct buffer_head *gfs2_meta_ra(struct gfs2_glock *gl,= u64 dblock, u32 extlen) =20 while (extlen) { bh =3D gfs2_getbuf(gl, dblock, CREATE); + if (!bh) + continue; =20 bh_readahead(bh, REQ_RAHEAD | REQ_META | REQ_PRIO); brelse(bh); --=20 2.47.3 From nobody Fri Sep 25 20:07:40 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97B3346D087; Tue, 8 Sep 2026 21:15:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902146; cv=none; b=A86nPKB9LePfla7Z7Hn3trn2d8KRUyLzaiog/1jyvMPBfgBzVToEHVsEUUxu06y2HHr9WUtX72QtU9JUWyUvAh/naVhq2iKwcAmUcXV3fwuPu0aLwXGDUEQETDeZhT1ylI7J/Rfs3KEIwPlfd9p8k4Ftde6euzRlf3zF3P/xJVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902146; c=relaxed/simple; bh=BaX/gApUF1YpvZFVaqxs+u1B+t9ffCtHL/0k1sb4UFU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gjLAMunpvjhg2cp6Mw51WsRSjqYpS1KMcj2GUCE4fidwsn133mWr6wEL5GndfqWN4ohEgQeUsYLsE/yb1v1G78iwmD8exx2+eAHVqJwOgvuS0wz+8DVVdl75q7hx69z35JAU5nhw5VPDj8dIsl3mfPug/zKCuLQLnRTXg97A4wQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=WCKZ0Cdz; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="WCKZ0Cdz" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:Message-Id:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:From:Reply-To; bh=8dfw+0EPuKtNINADQKW9iW9tjuvtrD/D7F9t6H2GO50=; b=WCKZ0Cdz4ueznBB1Gq6eVNZ/bi S6WpyFLQ0/L8jlojE3QhOInMDlZqg1C9fvxxAPrs5QCPsN4zL243s0suC91IKS5ZqeOizYkNQ2J1a /Zvt/74C+bXP5rcmY23A5sS7KOIe7gv5fsDXsFYJJZqnKx3tmJMZdtM99xKHJYG8OK7LGGLy/2X1u ND0+rNnNJOd2L2TxYkqVUzWaT+jD9OKh07vqshngu7Yq5YAmBDJBWKG4R8J6PmQiWwB//J6ISpZ3p Hp8ExIQg+HzmaomJe5GdXqWvN1/ZeJBXJN54rxi5Ez45IWl2G1jDaM+oJvFKx8vn5xn/r7U1S78+Y lthJnDdw==; Received: from 186-249-150-254.shared.desktop.com.br ([186.249.150.254] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1x43AM-00GhZP-1c; Tue, 08 Sep 2026 23:15:42 +0200 From: Mauricio Faria de Oliveira Date: Tue, 08 Sep 2026 18:16:14 -0300 Subject: [PATCH 3/5] gfs2: handle NULL return value in callers of gfs2_meta_new() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-gfs2_getbuf-error-checks-v1-3-7c59698f178f@igalia.com> References: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> In-Reply-To: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> To: Andreas Gruenbacher Cc: kernel-dev@igalia.com, gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 Now that gfs2_meta_new() can return NULL (instead of hit a kernel oops), update its callers to handle it (and not hit another kernel oops). If gfs2_meta_new() returns NULL: - new_leaf() It currently checks for NULL and returns -EIO. - gfs2_indirect_init() Return -EIO. The only caller is __gfs2_iomap_alloc() (same file), twice. Fail as currently done in other cases. - gfs2_dir_get_new_buffer() Return -EIO. The only two callers already check for errors. - gfs2_init_xattr() - init_dinode() Return -EIO. The only caller is gfs2_create_inode() (same file). Fail as currently done in the preceding error case. - buf_lo_scan_elements() - data_buf_lo_scan_elements() Return -EIO after releasing the just acquired bh_log buffer. - ea_alloc_blk() - ea_write() - ea_set_block() Return -EIO. The function can currently return errors. Signed-off-by: Mauricio Faria de Oliveira --- fs/gfs2/bmap.c | 25 +++++++++++++++++-------- fs/gfs2/dir.c | 2 ++ fs/gfs2/inode.c | 20 +++++++++++++++----- fs/gfs2/lops.c | 8 ++++++++ fs/gfs2/xattr.c | 6 ++++++ 5 files changed, 48 insertions(+), 13 deletions(-) diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index a766b5816634d360a4bbae89f8bcdd284071864a..1c14313acea084584ae5de69a11= 07b45e470606a 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -608,9 +608,9 @@ static int gfs2_hole_size(struct inode *inode, sector_t= lblock, u64 len, return ret; } =20 -static inline void gfs2_indirect_init(struct metapath *mp, - struct gfs2_glock *gl, unsigned int i, - unsigned offset, u64 bn) +static inline int gfs2_indirect_init(struct metapath *mp, + struct gfs2_glock *gl, unsigned int i, + unsigned int offset, u64 bn) { __be64 *ptr =3D (__be64 *)(mp->mp_bh[i - 1]->b_data + ((i > 1) ? sizeof(struct gfs2_meta_header) : @@ -618,11 +618,14 @@ static inline void gfs2_indirect_init(struct metapath= *mp, BUG_ON(i < 1); BUG_ON(mp->mp_bh[i] !=3D NULL); mp->mp_bh[i] =3D gfs2_meta_new(gl, bn); + if (!mp->mp_bh[i]) + return -EIO; gfs2_trans_add_meta(gl, mp->mp_bh[i]); gfs2_metatype_set(mp->mp_bh[i], GFS2_METATYPE_IN, GFS2_FORMAT_IN); gfs2_buffer_clear_tail(mp->mp_bh[i], sizeof(struct gfs2_meta_header)); ptr +=3D offset; *ptr =3D cpu_to_be64(bn); + return 0; } =20 enum alloc_state { @@ -723,8 +726,11 @@ static int __gfs2_iomap_alloc(struct inode *inode, str= uct iomap *iomap, zero_bn =3D *ptr; } for (; i - 1 < mp->mp_fheight - ip->i_height && n > 0; - i++, n--) - gfs2_indirect_init(mp, ip->i_gl, i, 0, bn++); + i++, n--) { + ret =3D gfs2_indirect_init(mp, ip->i_gl, i, 0, bn++); + if (ret) + goto out; + } if (i - 1 =3D=3D mp->mp_fheight - ip->i_height) { i--; gfs2_buffer_copy_tail(mp->mp_bh[i], @@ -751,9 +757,12 @@ static int __gfs2_iomap_alloc(struct inode *inode, str= uct iomap *iomap, case ALLOC_GROW_DEPTH: if (i > 1 && i < mp->mp_fheight) gfs2_trans_add_meta(ip->i_gl, mp->mp_bh[i-1]); - for (; i < mp->mp_fheight && n > 0; i++, n--) - gfs2_indirect_init(mp, ip->i_gl, i, - mp->mp_list[i-1], bn++); + for (; i < mp->mp_fheight && n > 0; i++, n--) { + ret =3D gfs2_indirect_init(mp, ip->i_gl, i, + mp->mp_list[i-1], bn++); + if (ret) + goto out; + } if (i =3D=3D mp->mp_fheight) state =3D ALLOC_DATA; if (n =3D=3D 0) diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 0d92f6c33dcb85dfa2a4b07f9f09575834e75e01..d1dc1e94b6c432d2ede504b04cb= 71959285a945d 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -93,6 +93,8 @@ int gfs2_dir_get_new_buffer(struct gfs2_inode *ip, u64 bl= ock, struct buffer_head *bh; =20 bh =3D gfs2_meta_new(ip->i_gl, block); + if (!bh) + return -EIO; gfs2_trans_add_meta(ip->i_gl, bh); gfs2_metatype_set(bh, GFS2_METATYPE_JD, GFS2_FORMAT_JD); gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header)); diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c index f361876c5583353a1196ed35be1c95af33a90c02..dda51390fee49b56279161fdd75= 5b3c2b6e7eac6 100644 --- a/fs/gfs2/inode.c +++ b/fs/gfs2/inode.c @@ -544,13 +544,15 @@ static void gfs2_init_dir(struct buffer_head *dibh, * take any ACLs, LSM xattrs, etc. */ =20 -static void gfs2_init_xattr(struct gfs2_inode *ip) +static int gfs2_init_xattr(struct gfs2_inode *ip) { struct gfs2_sbd *sdp =3D GFS2_SB(&ip->i_inode); struct buffer_head *bh; struct gfs2_ea_header *ea; =20 bh =3D gfs2_meta_new(ip->i_gl, ip->i_eattr); + if (!bh) + return -EIO; gfs2_trans_add_meta(ip->i_gl, bh); gfs2_metatype_set(bh, GFS2_METATYPE_EA, GFS2_FORMAT_EA); gfs2_buffer_clear_tail(bh, sizeof(struct gfs2_meta_header)); @@ -561,6 +563,7 @@ static void gfs2_init_xattr(struct gfs2_inode *ip) ea->ea_flags =3D GFS2_EAFLAG_LAST; =20 brelse(bh); + return 0; } =20 /** @@ -571,13 +574,15 @@ static void gfs2_init_xattr(struct gfs2_inode *ip) * */ =20 -static void init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip, - const char *symname) +static int init_dinode(struct gfs2_inode *dip, struct gfs2_inode *ip, + const char *symname) { struct gfs2_dinode *di; struct buffer_head *dibh; =20 dibh =3D gfs2_meta_new(ip->i_gl, ip->i_no_addr); + if (!dibh) + return -EIO; gfs2_trans_add_meta(ip->i_gl, dibh); di =3D (struct gfs2_dinode *)dibh->b_data; gfs2_dinode_out(ip, di); @@ -602,6 +607,7 @@ static void init_dinode(struct gfs2_inode *dip, struct = gfs2_inode *ip, =20 set_buffer_uptodate(dibh); brelse(dibh); + return 0; } =20 /** @@ -864,10 +870,14 @@ static int gfs2_create_inode(struct inode *dir, struc= t dentry *dentry, goto fail_gunlock3; =20 if (blocks > 1) { - gfs2_init_xattr(ip); + error =3D gfs2_init_xattr(ip); + if (error) + goto fail_gunlock3; xattr_initialized =3D true; } - init_dinode(dip, ip, symname); + error =3D init_dinode(dip, ip, symname); + if (error) + goto fail_gunlock3; gfs2_trans_end(sdp); =20 glock_set_object(ip->i_gl, ip); diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 6dabe73ad790d9cbf6f2725dd3e5e1c40c3781b8..192e71e630dce062361cc754f2b= a878fa23c0a7f 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -801,6 +801,10 @@ static int buf_lo_scan_elements(struct gfs2_jdesc *jd,= u32 start, return error; =20 bh_ip =3D gfs2_meta_new(gl, blkno); + if (!bh_ip) { + brelse(bh_log); + return -EIO; + } memcpy(bh_ip->b_data, bh_log->b_data, bh_log->b_size); =20 if (gfs2_meta_check(sdp, bh_ip)) @@ -1026,6 +1030,10 @@ static int databuf_lo_scan_elements(struct gfs2_jdes= c *jd, u32 start, return error; =20 bh_ip =3D gfs2_meta_new(gl, blkno); + if (!bh_ip) { + brelse(bh_log); + return -EIO; + } memcpy(bh_ip->b_data, bh_log->b_data, bh_log->b_size); =20 /* Unescape */ diff --git a/fs/gfs2/xattr.c b/fs/gfs2/xattr.c index b9f48d6f10a97a36365a2fe636ceb1cd476e4318..5aec4d0f240dc5beef18bc5619f= af6b375152c03 100644 --- a/fs/gfs2/xattr.c +++ b/fs/gfs2/xattr.c @@ -648,6 +648,8 @@ static int ea_alloc_blk(struct gfs2_inode *ip, struct b= uffer_head **bhp) return error; gfs2_trans_remove_revoke(sdp, block, 1); *bhp =3D gfs2_meta_new(ip->i_gl, block); + if (!*bhp) + return -EIO; gfs2_trans_add_meta(ip->i_gl, *bhp); gfs2_metatype_set(*bhp, GFS2_METATYPE_EA, GFS2_FORMAT_EA); gfs2_buffer_clear_tail(*bhp, sizeof(struct gfs2_meta_header)); @@ -710,6 +712,8 @@ static int ea_write(struct gfs2_inode *ip, struct gfs2_= ea_header *ea, return error; gfs2_trans_remove_revoke(sdp, block, 1); bh =3D gfs2_meta_new(ip->i_gl, block); + if (!bh) + return -EIO; gfs2_trans_add_meta(ip->i_gl, bh); gfs2_metatype_set(bh, GFS2_METATYPE_ED, GFS2_FORMAT_ED); =20 @@ -1011,6 +1015,8 @@ static int ea_set_block(struct gfs2_inode *ip, struct= gfs2_ea_request *er, return error; gfs2_trans_remove_revoke(sdp, blk, 1); indbh =3D gfs2_meta_new(ip->i_gl, blk); + if (!indbh) + return -EIO; gfs2_trans_add_meta(ip->i_gl, indbh); gfs2_metatype_set(indbh, GFS2_METATYPE_IN, GFS2_FORMAT_IN); gfs2_buffer_clear_tail(indbh, mh_size); --=20 2.47.3 From nobody Fri Sep 25 20:07:40 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A88D46EF8F; Tue, 8 Sep 2026 21:15:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902148; cv=none; b=DpAuTWZZMx8BTEr6kRcT70kevjRcubK40qIOyo6I6mKash2JzPkjJA8T460NUjht4V5zdi9lpmq91EgL+hyN4/N6sHMWN7s/G7qUXOKgzcCjriewUuD/KJRH+lzUt61+mMUNZ/MObbPY97OOJS7abBPmqZab3xJI7qRzwJ7QFsc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902148; c=relaxed/simple; bh=gnJdJFxyN9n/8EEEj3k1H2t58sMnyWyvkhrEjnCwA7Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bDb/+WO+EOhbcrGciLF0GfAbIIgbMTZWeVWKW7c1TVRXWj71QnU8vZwGnJHrGCwYEipOE441quqJJtHb9LAv7f+qHVGDtImRkYXoHpN34+OEoZ9EWdyKcu4vdnLlZgWmH4SgWa73I/y1aJ8pjBTcZAtfl4PVFWCRTgP0qU7yHRw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=ipVJkxZI; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="ipVJkxZI" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:Message-Id:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:From:Reply-To; bh=rit/GRM67RzziSsQPYEeLW9gGLmC6p1xfu05lnuNdlY=; b=ipVJkxZINpNR8yviLxtS7I/0Yn /F2Z2WcSlHWMkhvtcdCoRp/uDc4smXgDANOYP6IkPKz1vhNgDuYyYTPwwauKsOp85VIZcJjMDDJsT SXTqpSBcFUwvXxM7FIqDjnxW9A5T8H0UVwcMfAdJ1CCgY0qy8usnvcZy3MbXQKEFNg4Aqn6xqyeQ8 VOIRaflGq9rc1Y5mhMzI8vfvz8FwlJggNzUro4xVnl4hqlSae87YOzb4KW24W3RV609O+YnXk4C7x 841aA4sw5m9DMjE7+bZeCNC2P7uv+JLq28clcppKKE/acujksARoJ9z44fOX0xenxMfOuZQsCoHeN UmMnxYbw==; Received: from 186-249-150-254.shared.desktop.com.br ([186.249.150.254] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1x43AN-00GhZP-PX; Tue, 08 Sep 2026 23:15:44 +0200 From: Mauricio Faria de Oliveira Date: Tue, 08 Sep 2026 18:16:15 -0300 Subject: [PATCH 4/5] gfs2: handle NULL return value in callers of gfs2_meta_ra() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-gfs2_getbuf-error-checks-v1-4-7c59698f178f@igalia.com> References: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> In-Reply-To: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> To: Andreas Gruenbacher Cc: kernel-dev@igalia.com, gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 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 --- 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..d9e0b6b19567c8aa8518b9245e9= bdfd3ccf7c1a7 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 =3D gfs2_meta_ra(ip->i_gl, dblock, extlen); + if (!bh) { + error =3D -EIO; + goto fail; + } } else { error =3D 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..e39754e08f44d67b460a47744f4= 276cd168e356c 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c @@ -48,6 +48,8 @@ int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigne= d int blk, } =20 *bh =3D gfs2_meta_ra(gl, dblock, extlen); + if (!*bh) + error =3D -EIO; =20 return error; } --=20 2.47.3 From nobody Fri Sep 25 20:07:40 2026 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47C2544CF52; Tue, 8 Sep 2026 21:15:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=213.97.179.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902150; cv=none; b=RCt3A/q3aD27RMbDPP2Wjqwk79Vzgo6hyHu1FyUst3NGVv2z7DXTs7oYeGRS1XyPfm1LHoJHob/R6AVkwUc1mbvf3MGYYyzxGb9JP+hJwnryLA6hLRTvCEHazG2unYBhAlHHOWhpwbU/gak5oA1wY7xLqBuBh0/pa9H9qzNqgvw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788902150; c=relaxed/simple; bh=5MDXUumeScR8/sobsnhrXNvNHeuF6zeNbOWojP43an0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dc+dGifLZlHJ2UZ1K/XVT7glzxIgqohtEV6xErS/2BKq9KEJVKQV+QXiX8chlw473oAr5cdEW0crP53HW+ZtnywqUhBPYmEF+fFA1EfMNo8hrZXbzbjZG47FzORj6b36Dld7BYmgHTqqjxW+HOrmzVOAhMWdLUHeUlxjlqfVTmQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com; spf=pass smtp.mailfrom=igalia.com; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b=Wiaxj24Y; arc=none smtp.client-ip=213.97.179.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=igalia.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=igalia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=igalia.com header.i=@igalia.com header.b="Wiaxj24Y" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Cc:To:Message-Id:Content-Transfer-Encoding:Content-Type: MIME-Version:Subject:Date:From:From:Reply-To; bh=8aF6d5QbYLGDY2om4GTfaI0qkd0ggpTM0UzyIZrbAms=; b=Wiaxj24YEIRGGfe38XEeFU7Gwl BvU3mFRKZXxYcMBJZ7dj/gnvQT2Ctr+atQJWn43PA4o/RS2QJXrjshhXAN97tQxlE0cqMculLW/aa V+2IFHaOEHg/nZWFFVRxObeYf8uuTL14ZDT8q9Fvm+vHE1i7slz/lVYofxfEEEmS56J4HjW3YvAq1 nnELI1kbjtPDv4sF6WKoEI4Hfh5/pSyfKghClR+tBco8uxDzMHmvFeiVrkq12oW1RwC4iuYX4pGpM H5UJQjBUWikiESgH3D9uaBDtg9By2oG/ot2FR0ae+qH9EJMjHjYwfcgATjYwKjSHx9tbUeg2GvgJz 7KAew0Mg==; Received: from 186-249-150-254.shared.desktop.com.br ([186.249.150.254] helo=[127.0.1.1]) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1x43AP-00GhZP-HE; Tue, 08 Sep 2026 23:15:45 +0200 From: Mauricio Faria de Oliveira Date: Tue, 08 Sep 2026 18:16:16 -0300 Subject: [PATCH 5/5] gfs2: check for errors from filemap_get_folio() in gfs2_jhead_process_page() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260908-gfs2_getbuf-error-checks-v1-5-7c59698f178f@igalia.com> References: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> In-Reply-To: <20260908-gfs2_getbuf-error-checks-v1-0-7c59698f178f@igalia.com> To: Andreas Gruenbacher Cc: kernel-dev@igalia.com, gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, Mauricio Faria de Oliveira X-Mailer: b4 0.14.2 Let's check for a not-found folio pointer error, that is, ERR_PTR(-ENOENT), just in case, even though it is not expected (due to a previously acquired reference on the folio, per the function comment). If filemap_get_folio() returns an error, log it and return -EIO. The only caller is gfs2_chain_bio() (same file), twice, which can currently return errors, thus propagate the error. Signed-off-by: Mauricio Faria de Oliveira --- fs/gfs2/lops.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 192e71e630dce062361cc754f2ba878fa23c0a7f..78cadde990182223978ddbde2be= 25cfe963beabe 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -459,14 +459,21 @@ static bool gfs2_jhead_folio_search(struct gfs2_jdesc= *jd, * our references to the folio. */ =20 -static void gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long i= ndex, - struct gfs2_log_header_host *head, - bool *done) +static int gfs2_jhead_process_page(struct gfs2_jdesc *jd, unsigned long in= dex, + struct gfs2_log_header_host *head, + bool *done) { + struct gfs2_sbd *sdp =3D GFS2_SB(jd->jd_inode); struct folio *folio; =20 folio =3D filemap_get_folio(jd->jd_inode->i_mapping, index); =20 + /* This should not happen (see comment above), but check just in case */ + if (IS_ERR(folio)) { + fs_err(sdp, "Error %ld getting folio.\n", PTR_ERR(folio)); + return -EIO; + } + folio_wait_locked(folio); if (!folio_test_uptodate(folio)) *done =3D true; @@ -476,6 +483,7 @@ static void gfs2_jhead_process_page(struct gfs2_jdesc *= jd, unsigned long index, =20 /* filemap_get_folio() and the earlier filemap_grab_folio() */ folio_put_refs(folio, 2); + return 0; } =20 static struct bio *gfs2_chain_bio(struct bio *prev, unsigned int nr_iovecs, @@ -572,7 +580,9 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_= log_header_host *head) continue; } =20 - gfs2_jhead_process_page(jd, blocks_read >> shift, head, &done); + ret =3D gfs2_jhead_process_page(jd, blocks_read >> shift, head, &done); + if (ret) + goto error; blocks_read +=3D PAGE_SIZE >> bsize_shift; if (done) goto out; /* found */ @@ -583,7 +593,9 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_= log_header_host *head) if (bio) submit_bio(bio); while (blocks_read < block) { - gfs2_jhead_process_page(jd, blocks_read >> shift, head, &done); + ret =3D gfs2_jhead_process_page(jd, blocks_read >> shift, head, &done); + if (ret) + goto error; blocks_read +=3D PAGE_SIZE >> bsize_shift; } =20 @@ -592,6 +604,7 @@ int gfs2_find_jhead(struct gfs2_jdesc *jd, struct gfs2_= log_header_host *head) =20 truncate_inode_pages(mapping, 0); =20 +error: return ret; } =20 --=20 2.47.3