Skip to content

Commit f28d086

Browse files
fs/ntfs3: Correct undo if ntfs_create_inode failed
Clusters allocated for Extended Attributes, must be freed when rolling back inode creation. Fixes: 82cae26 ("fs/ntfs3: Add initialization of super block") Signed-off-by: Konstantin Komarov <[email protected]>
1 parent a0dde5d commit f28d086

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fs/ntfs3/inode.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1666,7 +1666,9 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
16661666
* The packed size of extended attribute is stored in direntry too.
16671667
* 'fname' here points to inside new_de.
16681668
*/
1669-
ntfs_save_wsl_perm(inode, &fname->dup.ea_size);
1669+
err = ntfs_save_wsl_perm(inode, &fname->dup.ea_size);
1670+
if (err)
1671+
goto out6;
16701672

16711673
/*
16721674
* update ea_size in file_name attribute too.
@@ -1710,6 +1712,12 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir,
17101712
goto out2;
17111713

17121714
out6:
1715+
attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL);
1716+
if (attr && attr->non_res) {
1717+
/* Delete ATTR_EA, if non-resident. */
1718+
attr_set_size(ni, ATTR_EA, NULL, 0, NULL, 0, NULL, false, NULL);
1719+
}
1720+
17131721
if (rp_inserted)
17141722
ntfs_remove_reparse(sbi, IO_REPARSE_TAG_SYMLINK, &new_de->ref);
17151723

0 commit comments

Comments
 (0)