diff options
author | Konstantin Komarov <almaz.alexandrovich@paragon-software.com> | 2024-05-30 10:59:13 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-08-03 10:00:22 +0300 |
commit | 8e0f398c6f5c39907d772c7b2db9863bbe3607f9 (patch) | |
tree | 383fdd11f25dea319b4708cfdcee673c1716b377 /fs | |
parent | d5ad80aabd5a76a5de52b7663b1f3223dd01ea38 (diff) | |
download | linux-8e0f398c6f5c39907d772c7b2db9863bbe3607f9.tar.xz |
fs/ntfs3: Correct undo if ntfs_create_inode failed
[ Upstream commit f28d0866d8ff798aa497971f93d0cc58f442d946 ]
Clusters allocated for Extended Attributes, must be freed
when rolling back inode creation.
Fixes: 82cae269cfa95 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ntfs3/inode.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c index bef3b4a36b75..9559d72f8660 100644 --- a/fs/ntfs3/inode.c +++ b/fs/ntfs3/inode.c @@ -1668,7 +1668,9 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, * The packed size of extended attribute is stored in direntry too. * 'fname' here points to inside new_de. */ - ntfs_save_wsl_perm(inode, &fname->dup.ea_size); + err = ntfs_save_wsl_perm(inode, &fname->dup.ea_size); + if (err) + goto out6; /* * update ea_size in file_name attribute too. @@ -1712,6 +1714,12 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, goto out2; out6: + attr = ni_find_attr(ni, NULL, NULL, ATTR_EA, NULL, 0, NULL, NULL); + if (attr && attr->non_res) { + /* Delete ATTR_EA, if non-resident. */ + attr_set_size(ni, ATTR_EA, NULL, 0, NULL, 0, NULL, false, NULL); + } + if (rp_inserted) ntfs_remove_reparse(sbi, IO_REPARSE_TAG_SYMLINK, &new_de->ref); |