kernel_samsung_a53x/drivers/reset
Geert Uytterhoeven 631205f094 reset: Fix crash when freeing non-existent optional resets
[ Upstream commit 4a6756f56bcf8e64c87144a626ce53aea4899c0e ]

When obtaining one or more optional resets, non-existent resets are
stored as NULL pointers, and all related error and cleanup paths need to
take this into account.

Currently only reset_control_put() and reset_control_bulk_put()
get this right.  All of __reset_control_bulk_get(),
of_reset_control_array_get(), and reset_control_array_put() lack the
proper checking, causing NULL pointer dereferences on failure or
release.

Fix this by moving the existing check from reset_control_bulk_put() to
__reset_control_put_internal(), so it applies to all callers.
The double check in reset_control_put() doesn't hurt.

Fixes: 17c82e206d2a3cd8 ("reset: Add APIs to manage array of resets")
Fixes: 48d71395896d54ee ("reset: Add reset_control_bulk API")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/2440edae7ca8534628cdbaf559ded288f2998178.1701276806.git.geert+renesas@glider.be
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 12:11:58 +01:00
..
hisilicon Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sti Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tegra Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
core.c reset: Fix crash when freeing non-existent optional resets 2024-11-18 12:11:58 +01:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-a10sr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-ath79.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-axs10x.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-berlin.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-brcmstb-rescal.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-brcmstb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-hsdk.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-imx7.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-intel-gw.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-lantiq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-lpc18xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-meson-audio-arb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-meson.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-npcm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-oxnas.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-pistachio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-qcom-aoss.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-qcom-pdc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-raspberrypi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-scmi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-simple.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-socfpga.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-stm32mp1.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-sunxi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-ti-sci.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-ti-syscon.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-uniphier-glue.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-uniphier.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-zynq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
reset-zynqmp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00