mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
fs/ntfs3: fix ntfs_fnd leak when compare function is missing
indx_insert_entry(), indx_delete_entry() and indx_update_dup() take a
finder via fnd_get() before calling get_cmp_func(). If no compare
function is available they return -EINVAL and never release the finder.
Jump to the existing out path so fnd_put() still runs.
Fixes: 3a2141b2f1 ("fs/ntfs3: resolve compare function in public index APIs")
Signed-off-by: liyouhong <liyouhong@kylinos.cn>
Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
This commit is contained in:
parent
ea25564bf0
commit
86ba91170c
|
|
@ -2058,7 +2058,8 @@ int indx_insert_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
|
|||
cmp = get_cmp_func(root);
|
||||
if (unlikely(!cmp)) {
|
||||
WARN_ON_ONCE(1);
|
||||
return -EINVAL;
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (fnd_is_empty(fnd)) {
|
||||
|
|
@ -2415,7 +2416,8 @@ int indx_delete_entry(struct ntfs_index *indx, struct ntfs_inode *ni,
|
|||
cmp = get_cmp_func(root);
|
||||
if (unlikely(!cmp)) {
|
||||
WARN_ON_ONCE(1);
|
||||
return -EINVAL;
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Locate the entry to remove. */
|
||||
|
|
@ -2806,7 +2808,8 @@ int indx_update_dup(struct ntfs_inode *ni, struct ntfs_sb_info *sbi,
|
|||
cmp = get_cmp_func(root);
|
||||
if (unlikely(!cmp)) {
|
||||
WARN_ON_ONCE(1);
|
||||
return -EINVAL;
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Find entry in directory. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user