|
Kmods SIG |
50e2b3 |
From 9eb78c25327548b905598975aa3ded4ef244b94a Mon Sep 17 00:00:00 2001
|
|
Kmods SIG |
50e2b3 |
From: Artem Labazov <123321artyom@gmail.com>
|
|
Kmods SIG |
50e2b3 |
Date: Mon, 7 Dec 2020 09:04:36 +0900
|
|
Kmods SIG |
50e2b3 |
Subject: [Backport 9eb78c253275] exfat: Avoid allocating upcase table using
|
|
Kmods SIG |
50e2b3 |
kcalloc()
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
The table for Unicode upcase conversion requires an order-5 allocation,
|
|
Kmods SIG |
50e2b3 |
which may fail on a highly-fragmented system:
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
pool-udisksd: page allocation failure: order:5,
|
|
Kmods SIG |
50e2b3 |
mode:0x40dc0(GFP_KERNEL|__GFP_COMP|__GFP_ZERO), nodemask=(null),
|
|
Kmods SIG |
50e2b3 |
cpuset=/,mems_allowed=0
|
|
Kmods SIG |
50e2b3 |
CPU: 4 PID: 3756880 Comm: pool-udisksd Tainted: G U
|
|
Kmods SIG |
50e2b3 |
5.8.10-200.fc32.x86_64 #1
|
|
Kmods SIG |
50e2b3 |
Hardware name: Dell Inc. XPS 13 9360/0PVG6D, BIOS 2.13.0 11/14/2019
|
|
Kmods SIG |
50e2b3 |
Call Trace:
|
|
Kmods SIG |
50e2b3 |
dump_stack+0x6b/0x88
|
|
Kmods SIG |
50e2b3 |
warn_alloc.cold+0x75/0xd9
|
|
Kmods SIG |
50e2b3 |
? _cond_resched+0x16/0x40
|
|
Kmods SIG |
50e2b3 |
? __alloc_pages_direct_compact+0x144/0x150
|
|
Kmods SIG |
50e2b3 |
__alloc_pages_slowpath.constprop.0+0xcfa/0xd30
|
|
Kmods SIG |
50e2b3 |
? __schedule+0x28a/0x840
|
|
Kmods SIG |
50e2b3 |
? __wait_on_bit_lock+0x92/0xa0
|
|
Kmods SIG |
50e2b3 |
__alloc_pages_nodemask+0x2df/0x320
|
|
Kmods SIG |
50e2b3 |
kmalloc_order+0x1b/0x80
|
|
Kmods SIG |
50e2b3 |
kmalloc_order_trace+0x1d/0xa0
|
|
Kmods SIG |
50e2b3 |
exfat_create_upcase_table+0x115/0x390 [exfat]
|
|
Kmods SIG |
50e2b3 |
exfat_fill_super+0x3ef/0x7f0 [exfat]
|
|
Kmods SIG |
50e2b3 |
? sget_fc+0x1d0/0x240
|
|
Kmods SIG |
50e2b3 |
? exfat_init_fs_context+0x120/0x120 [exfat]
|
|
Kmods SIG |
50e2b3 |
get_tree_bdev+0x15c/0x250
|
|
Kmods SIG |
50e2b3 |
vfs_get_tree+0x25/0xb0
|
|
Kmods SIG |
50e2b3 |
do_mount+0x7c3/0xaf0
|
|
Kmods SIG |
50e2b3 |
? copy_mount_options+0xab/0x180
|
|
Kmods SIG |
50e2b3 |
__x64_sys_mount+0x8e/0xd0
|
|
Kmods SIG |
50e2b3 |
do_syscall_64+0x4d/0x90
|
|
Kmods SIG |
50e2b3 |
entry_SYSCALL_64_after_hwframe+0x44/0xa9
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Make the driver use kvcalloc() to eliminate the issue.
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
Fixes: 370e812b3ec1 ("exfat: add nls operations")
|
|
Kmods SIG |
50e2b3 |
Cc: stable@vger.kernel.org #v5.7+
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Artem Labazov <123321artyom@gmail.com>
|
|
Kmods SIG |
50e2b3 |
Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
|
|
Kmods SIG |
50e2b3 |
---
|
|
Kmods SIG |
50e2b3 |
src/nls.c | 6 +++---
|
|
Kmods SIG |
50e2b3 |
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
diff --git a/src/nls.c b/src/nls.c
|
|
Kmods SIG |
50e2b3 |
index 675d0e7058c5a01afe9bdcba4c915e983184c639..314d5407a1be50ac2c789c8a58afda8e1baec413 100644
|
|
Kmods SIG |
50e2b3 |
--- a/src/nls.c
|
|
Kmods SIG |
50e2b3 |
+++ b/src/nls.c
|
|
Kmods SIG |
50e2b3 |
@@ -659,7 +659,7 @@ static int exfat_load_upcase_table(struct super_block *sb,
|
|
Kmods SIG |
50e2b3 |
unsigned char skip = false;
|
|
Kmods SIG |
50e2b3 |
unsigned short *upcase_table;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- upcase_table = kcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
|
|
Kmods SIG |
50e2b3 |
+ upcase_table = kvcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
|
|
Kmods SIG |
50e2b3 |
if (!upcase_table)
|
|
Kmods SIG |
50e2b3 |
return -ENOMEM;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
@@ -715,7 +715,7 @@ static int exfat_load_default_upcase_table(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
unsigned short uni = 0, *upcase_table;
|
|
Kmods SIG |
50e2b3 |
unsigned int index = 0;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
- upcase_table = kcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
|
|
Kmods SIG |
50e2b3 |
+ upcase_table = kvcalloc(UTBL_COUNT, sizeof(unsigned short), GFP_KERNEL);
|
|
Kmods SIG |
50e2b3 |
if (!upcase_table)
|
|
Kmods SIG |
50e2b3 |
return -ENOMEM;
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
@@ -803,5 +803,5 @@ int exfat_create_upcase_table(struct super_block *sb)
|
|
Kmods SIG |
50e2b3 |
|
|
Kmods SIG |
50e2b3 |
void exfat_free_upcase_table(struct exfat_sb_info *sbi)
|
|
Kmods SIG |
50e2b3 |
{
|
|
Kmods SIG |
50e2b3 |
- kfree(sbi->vol_utbl);
|
|
Kmods SIG |
50e2b3 |
+ kvfree(sbi->vol_utbl);
|
|
Kmods SIG |
50e2b3 |
}
|
|
Kmods SIG |
50e2b3 |
--
|
|
Kmods SIG |
50e2b3 |
2.31.1
|
|
Kmods SIG |
50e2b3 |
|