Skip to contentSkip to conversation

ocfs2: fix panic in failed foilio allocation

PATCH New Mark Tinguely 1 participant 2 messages Apr 10, 2025 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 ocfs2: fix panic in failed foilio allocation

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.

Cc Changwei Ge <[email protected]>
Cc Joel Becker <[email protected]>
Cc Jun Piao <[email protected]>
Cc Junxiao Bi <[email protected]>
Cc Mark Fasheh <[email protected]>
---
 fs/ocfs2/aops.c | 1 +
 1 file changed, 1 insertion(+)
fs/ocfs2/aops.c +1 -0
index 40b6bce12951..89aadc6cdd87 100644
@@ -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;
 			}
 		}
Signature · 1 line
2.39.5 (Apple Git-154)
#2 lore raw

PATCH 1/1 ocfs2: fix panic in failed foilio allocation

In reply to a message not in the archive

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.

Cc Changwei Ge <[email protected]>
Cc Joel Becker <[email protected]>
Cc Jun Piao <[email protected]>
Cc Junxiao Bi <[email protected]>
Cc Mark Fasheh <[email protected]>
---
 fs/ocfs2/aops.c | 1 +
 1 file changed, 1 insertion(+)
fs/ocfs2/aops.c +1 -0
index 40b6bce12951..89aadc6cdd87 100644
@@ -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;
 			}
 		}
Signature · 1 line
2.39.5 (Apple Git-154)