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:
liyouhong 2026-07-29 14:49:32 +08:00 committed by Konstantin Komarov
parent ea25564bf0
commit 86ba91170c
No known key found for this signature in database
GPG Key ID: A9B0331F832407B6

View File

@ -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. */