Re: [PATCH 2/5] ntfs: return -ENOMEM from ntfs_inode_attach_all_extents()
From: liubaolin
Date: Thu Sep 03 2026 - 02:59:38 EST
在 2026/9/3 13:25, Hyunchul Lee 写道:
On Wed, Sep 02, 2026 at 03:32:46PM +0800, Baolin Liu wrote:
From: Baolin Liu <liubaolin@xxxxxxxxxx>
ntfs_inode_attach_all_extents() returns -1 when ntfs_extent_inode_open()
fails, and both callers propagate it unchanged, so userspace sees EPERM
from setxattr, reparse point creation and directory index updates on
inodes with an attribute list.
Both paths that return NULL here are allocation failures: the
kmem_cache_alloc() in ntfs_new_extent_inode() and the kvzalloc() that
grows ext.extent_ntfs_inos[]. Return -ENOMEM.
Fixes: af0db57d4293 ("ntfs: update inode operations")
Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
---
fs/ntfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 5aedc045f65a..747a60ae27c9 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -3025,7 +3025,7 @@ int ntfs_inode_attach_all_extents(struct ntfs_inode *ni)
prev_attached != MREF_LE(ale->mft_reference)) {
if (!ntfs_extent_inode_open(ni, ale->mft_reference)) {
ntfs_debug("Couldn't attach extent inode.\n");
- return -1;
+ return -ENOMEM;
Could you also fix the error handling of ntfs_extent_inode_open()?
It treats the failure of map_mft_record() as success. If we would
fix that, this patch would incorrectly convert every failures to
ENOMEM.
}
prev_attached = MREF_LE(ale->mft_reference);
}
--
2.51.0
Hi Hyunchul,
Thanks for the review.
I'll fix both issues you mentioned in v2 and send it soon.
Thanks,
Baolin