Skip to content

Commit 7c5d480

Browse files
bwhackskuba-moo
authored andcommitted
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: 4e0473f ("lib: cpu_rmap: Avoid use after free on rmap->obj array entries") Signed-off-by: Ben Hutchings <[email protected]> Reviewed-by: Simon Horman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 44f8baa commit 7c5d480

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/cpu_rmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ static void irq_cpu_rmap_release(struct kref *ref)
280280
struct irq_glue *glue =
281281
container_of(ref, struct irq_glue, notify.kref);
282282

283-
cpu_rmap_put(glue->rmap);
284283
glue->rmap->obj[glue->index] = NULL;
284+
cpu_rmap_put(glue->rmap);
285285
kfree(glue);
286286
}
287287

0 commit comments

Comments
 (0)