]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
lib: cpu_rmap: Fix potential use-after-free in irq_cpu_rmap_release()
authorBen Hutchings <ben@decadent.org.uk>
Fri, 2 Jun 2023 18:28:15 +0000 (20:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2023 08:57:13 +0000 (10:57 +0200)
commit53f16fa73f71abfcac67e71a5513653b8db28b76
treef073467401597908891b3fbb4ece92abe47e2895
parent3cc54473badeb4cdb3798a079480114f0738432f
lib: cpu_rmap: Fix potential use-after-free in irq_cpu_rmap_release()

[ Upstream commit 7c5d4801ecf0564c860033d89726b99723c55146 ]

irq_cpu_rmap_release() calls cpu_rmap_put(), which may free the rmap.
So we need to clear the pointer to our glue structure in rmap before
doing that, not after.

Fixes: 4e0473f1060a ("lib: cpu_rmap: Avoid use after free on rmap->obj array entries")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/ZHo0vwquhOy3FaXc@decadent.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
lib/cpu_rmap.c