Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 589996b

Browse files
Diogo Jahchan Koikeaalexandrovich
authored andcommitted
ntfs3: Change to non-blocking allocation in ntfs_d_hash
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: [email protected] 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 <[email protected]> Signed-off-by: Konstantin Komarov <[email protected]>
1 parent bdd6baf commit 589996b

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
@@ -395,7 +395,7 @@ static int ntfs_d_hash(const struct dentry *dentry, struct qstr *name)
395395
/*
396396
* Try slow way with current upcase table
397397
*/
398-
uni = __getname();
398+
uni = kmem_cache_alloc(names_cachep, GFP_NOWAIT);
399399
if (!uni)
400400
return -ENOMEM;
401401

@@ -417,7 +417,7 @@ static int ntfs_d_hash(const struct dentry *dentry, struct qstr *name)
417417
err = 0;
418418

419419
out:
420-
__putname(uni);
420+
kmem_cache_free(names_cachep, uni);
421421
return err;
422422
}
423423

0 commit comments

Comments
 (0)