Skip to content

Commit b17a830

Browse files
Dan Carpentermehmetb0
authored andcommitted
sh: intc: Fix use-after-free bug in register_intc_controller()
[ Upstream commit 63e72e5 ] In the error handling for this function, d is freed without ever removing it from intc_list which would lead to a use after free. To fix this, let's only add it to the list after everything has succeeded. Fixes: 2dcec7a ("sh: intc: set_irq_wake() support") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Signed-off-by: Sasha Levin <sashal@kernel.org> CVE-2024-53165 (cherry picked from commit 6ba6e19912570b2ad68298be0be1dc779014a303 linux-6.11.y) Signed-off-by: Bethany Jamison <bethany.jamison@canonical.com> Acked-by: Stewart Hore <stewart.hore@canonical.com> Acked-by: Koichiro Den <koichiro.den@canonical.com> Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
1 parent bfbfd7c commit b17a830

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/sh/intc/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ int __init register_intc_controller(struct intc_desc *desc)
209209
goto err0;
210210

211211
INIT_LIST_HEAD(&d->list);
212-
list_add_tail(&d->list, &intc_list);
213212

214213
raw_spin_lock_init(&d->lock);
215214
INIT_RADIX_TREE(&d->tree, GFP_ATOMIC);
@@ -369,6 +368,7 @@ int __init register_intc_controller(struct intc_desc *desc)
369368

370369
d->skip_suspend = desc->skip_syscore_suspend;
371370

371+
list_add_tail(&d->list, &intc_list);
372372
nr_intc_controllers++;
373373

374374
return 0;

0 commit comments

Comments
 (0)