diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2023-06-02 20:28:15 +0200 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2023-06-07 21:25:00 -0700 |
commit | 7c5d4801ecf0564c860033d89726b99723c55146 (patch) | |
tree | a522694ee94a491f48f2b09bbd967e7b5c3aeef4 | |
parent | 44f8baaf230c655c249467ca415b570deca8df77 (diff) | |
download | linux-stable-7c5d4801ecf0564c860033d89726b99723c55146.tar.gz linux-stable-7c5d4801ecf0564c860033d89726b99723c55146.tar.bz2 linux-stable-7c5d4801ecf0564c860033d89726b99723c55146.zip |
lib: cpu_rmap: Fix potential use-after-free in irq_cpu_rmap_release()
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>
-rw-r--r-- | lib/cpu_rmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/cpu_rmap.c b/lib/cpu_rmap.c index 73c1636b927b..4c348670da31 100644 --- a/lib/cpu_rmap.c +++ b/lib/cpu_rmap.c @@ -280,8 +280,8 @@ static void irq_cpu_rmap_release(struct kref *ref) struct irq_glue *glue = container_of(ref, struct irq_glue, notify.kref); - cpu_rmap_put(glue->rmap); glue->rmap->obj[glue->index] = NULL; + cpu_rmap_put(glue->rmap); kfree(glue); } |