summaryrefslogtreecommitdiff
path: root/kernel/padata.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2024-09-04 12:15:38 +0200
committerThomas Gleixner <tglx@linutronix.de>2024-09-04 12:15:38 +0200
commiteb876ea724835126f215c9a5bcc9e6148e2a6d15 (patch)
tree689c215270b023c2f94a6629c7f1d3ef8e49c28a /kernel/padata.c
parent2dce993165088dbe728faa21547e3b74213b6732 (diff)
parent67784a74e258a467225f0e68335df77acd67b7ab (diff)
Merge branch 'linus' into smp/core
Pull in upstream changes so further patches don't conflict.
Diffstat (limited to 'kernel/padata.c')
-rw-r--r--kernel/padata.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/padata.c b/kernel/padata.c
index 53f4bc9127127..0fa6c28954603 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -517,6 +517,13 @@ void __init padata_do_multithreaded(struct padata_mt_job *job)
ps.chunk_size = max(ps.chunk_size, job->min_chunk);
ps.chunk_size = roundup(ps.chunk_size, job->align);
+ /*
+ * chunk_size can be 0 if the caller sets min_chunk to 0. So force it
+ * to at least 1 to prevent divide-by-0 panic in padata_mt_helper().`
+ */
+ if (!ps.chunk_size)
+ ps.chunk_size = 1U;
+
list_for_each_entry(pw, &works, pw_list)
if (job->numa_aware) {
int old_node = atomic_read(&last_used_nid);