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