Skip to content

Commit ac7264f

Browse files
djahchankoikemehmetb0
authored andcommitted
ntfs3: Change to non-blocking allocation in ntfs_d_hash
BugLink: https://bugs.launchpad.net/bugs/2097301 [ Upstream commit 589996b ] d_hash is done while under "rcu-walk" and should not sleep. __get_name() allocates using GFP_KERNEL, having the possibility to sleep when under memory pressure. Change the allocation to GFP_NOWAIT. Reported-by: syzbot+7f71f79bbfb4427b00e1@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=7f71f79bbfb4427b00e1 Fixes: d392e85 ("fs/ntfs3: Fix the format of the "nocase" mount option") Signed-off-by: Diogo Jahchan Koike <djahchankoike@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com> Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
1 parent 9c5d291 commit ac7264f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/ntfs3/namei.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ static int ntfs_d_hash(const struct dentry *dentry, struct qstr *name)
501501
/*
502502
* Try slow way with current upcase table
503503
*/
504-
uni = __getname();
504+
uni = kmem_cache_alloc(names_cachep, GFP_NOWAIT);
505505
if (!uni)
506506
return -ENOMEM;
507507

@@ -523,7 +523,7 @@ static int ntfs_d_hash(const struct dentry *dentry, struct qstr *name)
523523
err = 0;
524524

525525
out:
526-
__putname(uni);
526+
kmem_cache_free(names_cachep, uni);
527527
return err;
528528
}
529529

0 commit comments

Comments
 (0)