[PATCH 4/5] ntfs: propagate the map_mft_record() error in ntfs_attrlist_entry_add()

From: Baolin Liu

Date: Wed Sep 02 2026 - 03:47:16 EST


From: Baolin Liu <liubaolin@xxxxxxxxxx>

ntfs_attrlist_entry_add() replaces the map_mft_record() error with -EIO,
so an -ENOMEM allocation failure is reported as an I/O error. Both
callers pass the value on to ntfs_attr_add(), which no longer collapses
it since commit 8efe00b098b5 ("ntfs: preserve error code in
ntfs_resident_attr_record_add()").

Return PTR_ERR(ni_mrec) instead. Also fix the debug message.

Fixes: 495e90fa3348 ("ntfs: update attrib operations")
Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
---
fs/ntfs/attrlist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs/attrlist.c b/fs/ntfs/attrlist.c
index be3086d34338..a1c00e426e80 100644
--- a/fs/ntfs/attrlist.c
+++ b/fs/ntfs/attrlist.c
@@ -139,8 +139,8 @@ int ntfs_attrlist_entry_add(struct ntfs_inode *ni, struct attr_record *attr)

ni_mrec = map_mft_record(ni);
if (IS_ERR(ni_mrec)) {
- ntfs_debug("Invalid arguments.\n");
- return -EIO;
+ ntfs_debug("Failed to map mft record.\n");
+ return PTR_ERR(ni_mrec);
}

mref = MK_LE_MREF(ni->mft_no, le16_to_cpu(ni_mrec->sequence_number));
--
2.51.0