From: Sasha Levin Date: Sun, 12 Nov 2023 19:19:16 +0000 (-0500) Subject: Fixes for 6.6 X-Git-Tag: v4.14.330~55 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e9076536ea865af5b5f24f9eac73ad29faad09af;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.6 Signed-off-by: Sasha Levin --- diff --git a/queue-6.6/fs-dlm-simplify-buffer-size-computation-in-dlm_creat.patch b/queue-6.6/fs-dlm-simplify-buffer-size-computation-in-dlm_creat.patch new file mode 100644 index 00000000000..a140b2d9e30 --- /dev/null +++ b/queue-6.6/fs-dlm-simplify-buffer-size-computation-in-dlm_creat.patch @@ -0,0 +1,74 @@ +From 064e0ad5cebe699d5a455a10d67b73c659145956 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Oct 2023 18:04:41 -0400 +Subject: fs: dlm: Simplify buffer size computation in dlm_create_debug_file() + +From: Christophe JAILLET + +[ Upstream commit 19b3102c0b5350621e7492281f2be0f071fb7e31 ] + +Use sizeof(name) instead of the equivalent, but hard coded, +DLM_LOCKSPACE_LEN + 8. + +This is less verbose and more future proof. + +Signed-off-by: Christophe JAILLET +Signed-off-by: Alexander Aring +Signed-off-by: David Teigland +Signed-off-by: Sasha Levin +--- + fs/dlm/debug_fs.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c +index fc44ab6657cab..c93359ceaae61 100644 +--- a/fs/dlm/debug_fs.c ++++ b/fs/dlm/debug_fs.c +@@ -987,7 +987,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) + /* format 2 */ + + memset(name, 0, sizeof(name)); +- snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_locks", ls->ls_name); ++ snprintf(name, sizeof(name), "%s_locks", ls->ls_name); + + ls->ls_debug_locks_dentry = debugfs_create_file(name, + 0644, +@@ -998,7 +998,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) + /* format 3 */ + + memset(name, 0, sizeof(name)); +- snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_all", ls->ls_name); ++ snprintf(name, sizeof(name), "%s_all", ls->ls_name); + + ls->ls_debug_all_dentry = debugfs_create_file(name, + S_IFREG | S_IRUGO, +@@ -1009,7 +1009,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) + /* format 4 */ + + memset(name, 0, sizeof(name)); +- snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_toss", ls->ls_name); ++ snprintf(name, sizeof(name), "%s_toss", ls->ls_name); + + ls->ls_debug_toss_dentry = debugfs_create_file(name, + S_IFREG | S_IRUGO, +@@ -1018,7 +1018,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) + &format4_fops); + + memset(name, 0, sizeof(name)); +- snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name); ++ snprintf(name, sizeof(name), "%s_waiters", ls->ls_name); + + ls->ls_debug_waiters_dentry = debugfs_create_file(name, + 0644, +@@ -1029,7 +1029,7 @@ void dlm_create_debug_file(struct dlm_ls *ls) + /* format 5 */ + + memset(name, 0, sizeof(name)); +- snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_queued_asts", ls->ls_name); ++ snprintf(name, sizeof(name), "%s_queued_asts", ls->ls_name); + + ls->ls_debug_queued_asts_dentry = debugfs_create_file(name, + 0644, +-- +2.42.0 + diff --git a/queue-6.6/module-decompress-use-kvmalloc-consistently.patch b/queue-6.6/module-decompress-use-kvmalloc-consistently.patch new file mode 100644 index 00000000000..190db0f5418 --- /dev/null +++ b/queue-6.6/module-decompress-use-kvmalloc-consistently.patch @@ -0,0 +1,71 @@ +From a193933edaf55a7326529dade630915da0e61bba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Nov 2023 09:19:14 +0100 +Subject: module/decompress: use kvmalloc() consistently + +From: Andrea Righi + +[ Upstream commit 17fc8084aa8f9d5235f252fc3978db657dd77e92 ] + +We consistently switched from kmalloc() to vmalloc() in module +decompression to prevent potential memory allocation failures with large +modules, however vmalloc() is not as memory-efficient and fast as +kmalloc(). + +Since we don't know in general the size of the workspace required by the +decompression algorithm, it is more reasonable to use kvmalloc() +consistently, also considering that we don't have special memory +requirements here. + +Suggested-by: Linus Torvalds +Tested-by: Andrea Righi +Signed-off-by: Andrea Righi +Signed-off-by: Linus Torvalds +Signed-off-by: Sasha Levin +--- + kernel/module/decompress.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/kernel/module/decompress.c b/kernel/module/decompress.c +index 4156d59be4408..474e68f0f0634 100644 +--- a/kernel/module/decompress.c ++++ b/kernel/module/decompress.c +@@ -100,7 +100,7 @@ static ssize_t module_gzip_decompress(struct load_info *info, + s.next_in = buf + gzip_hdr_len; + s.avail_in = size - gzip_hdr_len; + +- s.workspace = vmalloc(zlib_inflate_workspacesize()); ++ s.workspace = kvmalloc(zlib_inflate_workspacesize(), GFP_KERNEL); + if (!s.workspace) + return -ENOMEM; + +@@ -138,7 +138,7 @@ static ssize_t module_gzip_decompress(struct load_info *info, + out_inflate_end: + zlib_inflateEnd(&s); + out: +- vfree(s.workspace); ++ kvfree(s.workspace); + return retval; + } + #elif defined(CONFIG_MODULE_COMPRESS_XZ) +@@ -241,7 +241,7 @@ static ssize_t module_zstd_decompress(struct load_info *info, + } + + wksp_size = zstd_dstream_workspace_bound(header.windowSize); +- wksp = vmalloc(wksp_size); ++ wksp = kvmalloc(wksp_size, GFP_KERNEL); + if (!wksp) { + retval = -ENOMEM; + goto out; +@@ -284,7 +284,7 @@ static ssize_t module_zstd_decompress(struct load_info *info, + retval = new_size; + + out: +- vfree(wksp); ++ kvfree(wksp); + return retval; + } + #else +-- +2.42.0 + diff --git a/queue-6.6/series b/queue-6.6/series index 07867e0e398..5f90feb82d5 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -577,3 +577,5 @@ net-sched-act_ct-always-fill-offloading-tuple-iifidx.patch risc-v-don-t-fail-in-riscv_of_parent_hartid-for-disa.patch net-ti-icss-iep-fix-setting-counter-value.patch drivers-perf-do-not-broadcast-to-other-cpus-when-sta.patch +module-decompress-use-kvmalloc-consistently.patch +fs-dlm-simplify-buffer-size-computation-in-dlm_creat.patch