padata: Fix list iterator in padata_do_serial()
authorDaniel Jordan <daniel.m.jordan@oracle.com>
Thu, 17 Nov 2022 01:28:04 +0000 (20:28 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:24 +0000 (13:14 +0100)
commit26c0f7e1ac9249b4876affd6db020c745bc877b0
tree311c6218cc56531a1edc7957bcd464bf9ff54a75
parent17afa98bccec4f52203508b3f49b5f948c6fd6ac
padata: Fix list iterator in padata_do_serial()

[ Upstream commit 57ddfecc72a6c9941d159543e1c0c0a74fe9afdd ]

list_for_each_entry_reverse() assumes that the iterated list is nonempty
and that every list_head is embedded in the same type, but its use in
padata_do_serial() breaks both rules.

This doesn't cause any issues now because padata_priv and padata_list
happen to have their list fields at the same offset, but we really
shouldn't be relying on that.

Fixes: bfde23ce200e ("padata: unbind parallel jobs from specific CPUs")
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/padata.c