mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 08:42:10 +00:00
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: 4e0473f106
("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>
This commit is contained in:
parent
44f8baaf23
commit
7c5d4801ec
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user