]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.6
authorSasha Levin <sashal@kernel.org>
Sun, 12 Nov 2023 19:19:16 +0000 (14:19 -0500)
committerSasha Levin <sashal@kernel.org>
Sun, 12 Nov 2023 19:19:16 +0000 (14:19 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-6.6/fs-dlm-simplify-buffer-size-computation-in-dlm_creat.patch [new file with mode: 0644]
queue-6.6/module-decompress-use-kvmalloc-consistently.patch [new file with mode: 0644]
queue-6.6/series

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 (file)
index 0000000..a140b2d
--- /dev/null
@@ -0,0 +1,74 @@
+From 064e0ad5cebe699d5a455a10d67b73c659145956 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 10 Oct 2023 18:04:41 -0400
+Subject: fs: dlm: Simplify buffer size computation in dlm_create_debug_file()
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ 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 <christophe.jaillet@wanadoo.fr>
+Signed-off-by: Alexander Aring <aahringo@redhat.com>
+Signed-off-by: David Teigland <teigland@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 (file)
index 0000000..190db0f
--- /dev/null
@@ -0,0 +1,71 @@
+From a193933edaf55a7326529dade630915da0e61bba Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 2 Nov 2023 09:19:14 +0100
+Subject: module/decompress: use kvmalloc() consistently
+
+From: Andrea Righi <andrea.righi@canonical.com>
+
+[ 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 <torvalds@linux-foundation.org>
+Tested-by: Andrea Righi <andrea.righi@canonical.com>
+Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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
+
index 07867e0e3986aa55500053d4a1a67de43ee3ad6d..5f90feb82d52ec3db6f1250d3e32f264e7b313d8 100644 (file)
@@ -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