Re: [PATCH v2 2/5] ntfs: fix error handling in ntfs_extent_inode_open and propagate errors

From: liubaolin

Date: Sat Sep 05 2026 - 06:52:51 EST




在 2026/9/4 22:20, Namjae Jeon 写道:
@@ -2968,8 +2967,10 @@ static struct ntfs_inode *ntfs_extent_inode_open(struct ntfs_inode *base_ni,
i = (base_ni->nr_extents + 4) * sizeof(struct ntfs_inode *);

extent_nis = kvzalloc(i, GFP_NOFS);
- if (!extent_nis)
+ if (!extent_nis) {
+ ni = ERR_PTR(-ENOMEM);
It overwrites ni with ERR_PTR(-ENOMEM). ntfs_destroy_ext_inode() must
be called before doing so.

goto err_out;
+ }
if (base_ni->nr_extents) {
memcpy(extent_nis, base_ni->ext.extent_ntfs_inos,
i - 4 * sizeof(struct ntfs_inode *));

Hi Namjae,

Thanks for the review!

Sorry, that was my oversight. I should call ntfs_destroy_ext_inode(ni) first and then return ERR_PTR(-ENOMEM) directly.

I'll send v3 soon.

Thanks,
Baolin.