]> www.infradead.org Git - users/willy/linux.git/commitdiff
ntfs3: Change to non-blocking allocation in ntfs_d_hash
authorDiogo Jahchan Koike <djahchankoike@gmail.com>
Mon, 2 Sep 2024 17:19:32 +0000 (14:19 -0300)
committerKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Tue, 1 Oct 2024 09:19:06 +0000 (12:19 +0300)
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: d392e85fd1e8 ("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>
fs/ntfs3/namei.c

index fc720ad9c57a4921fbafb95ac30e0b903ad119e5..4c35262449d7241a92f61048dde19fcd9102bf48 100644 (file)
@@ -395,7 +395,7 @@ static int ntfs_d_hash(const struct dentry *dentry, struct qstr *name)
        /*
         * Try slow way with current upcase table
         */
-       uni = __getname();
+       uni = kmem_cache_alloc(names_cachep, GFP_NOWAIT);
        if (!uni)
                return -ENOMEM;
 
@@ -417,7 +417,7 @@ static int ntfs_d_hash(const struct dentry *dentry, struct qstr *name)
        err = 0;
 
 out:
-       __putname(uni);
+       kmem_cache_free(names_cachep, uni);
        return err;
 }