diff mbox series

ocfs2: fix panic in failed foilio allocation

Message ID 150746ad-32ae-415e-bf1d-6dfd195fbb65@oracle.com (mailing list archive)
State New
Headers show
Series ocfs2: fix panic in failed foilio allocation | expand

Commit Message

Mark Tinguely April 10, 2025, 7:56 p.m. UTC
In commit 7e119cff9d0a, "ocfs2: convert w_pages to w_folios" the
chunk page allocations became order 0 folio allocations. If an
allocation failed, the folio array entry should be NULL so the
error path can skip the entry. In the port it is -ENOMEM and
the error path panics trying to free this bad value.

Signed-off-by: Mark Tinguely <mark.tinguely@oracle.com>
Cc: stable@vger.kernel.org
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Jun Piao <piaojun@huawei.com>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
---
  fs/ocfs2/aops.c | 1 +
  1 file changed, 1 insertion(+)

  		}
diff mbox series

Patch

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 40b6bce12951..89aadc6cdd87 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -1071,6 +1071,7 @@  static int ocfs2_grab_folios_for_write(struct 
address_space *mapping,
  			if (IS_ERR(wc->w_folios[i])) {
  				ret = PTR_ERR(wc->w_folios[i]);
  				mlog_errno(ret);
+				wc->w_folios[i] = NULL;
  				goto out;
  			}