Commit a399c81a authored by Ben Hutchings's avatar Ben Hutchings Committed by sanglipeng
Browse files

lib: cpu_rmap: Fix potential use-after-free in irq_cpu_rmap_release()

stable inclusion
from stable-v5.10.184
commit dedd47977ae51cb3726b592de99d99a6c2e145c0
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8IRR2

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=dedd47977ae51cb3726b592de99d99a6c2e145c0



--------------------------------

[ Upstream commit 7c5d4801 ]

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: 4e0473f1 ("lib: cpu_rmap: Avoid use after free on rmap->obj array entries")
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Link: https://lore.kernel.org/r/ZHo0vwquhOy3FaXc@decadent.org.uk


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 90894682
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment