]> git.hungrycats.org Git - linux/commit
ASoC: mediatek: mt8365-afe-pcm: fix possible NULL-pointer dereferences in mt8365_afe_...
authorTuo Li <islituo@gmail.com>
Thu, 28 May 2026 06:41:06 +0000 (14:41 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 8 Jun 2026 18:02:00 +0000 (19:02 +0100)
commitb8948ac26efc395264a47f9a743889065adb5cff
treec3f502ed596c96df4092710a0b46996c7ec82a5d
parent2592387f026b618acffd795bc7c5592485b5f6f0
ASoC: mediatek: mt8365-afe-pcm: fix possible NULL-pointer dereferences in mt8365_afe_suspend()

mt8365_afe_suspend() allocates the register backup buffer with
devm_kcalloc(), but does not check for allocation failure before using the
returned pointer. This may lead to a NULL pointer dereference when
accessing afe->reg_back_up[i].

Add the missing NULL check and return -ENOMEM on allocation failure after
disabling the main clock.

Also propagate the return value of mt8365_afe_suspend() in
mt8365_afe_dev_runtime_suspend() so that the suspended state is not updated
when suspend fails.

Signed-off-by: Tuo Li <islituo@gmail.com>
Link: https://patch.msgid.link/20260528064107.470824-1-islituo@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/mt8365/mt8365-afe-pcm.c