]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
padata: set cpu_index of unused CPUs to -1
authorMathias Krause <minipli@googlemail.com>
Fri, 8 Sep 2017 18:57:09 +0000 (20:57 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 May 2020 20:19:12 +0000 (21:19 +0100)
commitb094ba4b6794c2ede4a1e00fd927df604aaba960
tree4853f1fa92b23149d3a019383028818bd0d553fa
parent51cc7091b3cb99ea5a2f2837c310e73e2a9d9b01
padata: set cpu_index of unused CPUs to -1

commit 1bd845bcb41d5b7f83745e0cb99273eb376f2ec5 upstream.

The parallel queue per-cpu data structure gets initialized only for CPUs
in the 'pcpu' CPU mask set. This is not sufficient as the reorder timer
may run on a different CPU and might wrongly decide it's the target CPU
for the next reorder item as per-cpu memory gets memset(0) and we might
be waiting for the first CPU in cpumask.pcpu, i.e. cpu_index 0.

Make the '__this_cpu_read(pd->pqueue->cpu_index) == next_queue->cpu_index'
compare in padata_get_next() fail in this case by initializing the
cpu_index member of all per-cpu parallel queues. Use -1 for unused ones.

Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
kernel/padata.c