summaryrefslogtreecommitdiff
path: root/include/linux/debugobjects.h
diff options
context:
space:
mode:
authorChancel Liu <chancel.liu@nxp.com>2026-09-23 15:13:02 +0900
committerMark Brown <broonie@kernel.org>2026-09-23 14:23:01 +0200
commit57d1e55c7b5a66a8642e3c944d46e3d3bafb28c8 (patch)
tree9eb7470b35104aee1145846443f87ecb9317d83f /include/linux/debugobjects.h
parent5ef6e7ff52db85556ef1fcca393366dfdd6452f9 (diff)
ASoC: codecs: rt5677-spi: Free the DSP context on component remove
component->dev is the underlying SPI bus device, whose devres lifetime follows the physical devices probe/remove rather than the ASoC cards bind/unbind. The rt5677_dsp context allocated in the component probe with devm_kzalloc(component->dev, ...) therefore leaks on every card bind/unbind cycle, and the delayed work initialised there is never cancelled on unbind. Allocate the context with kzalloc() and add a component .remove callback that cancels the copy work, destroys the mutex and frees the context. The exported rt5677_spi_hotword_detected(), called from the rt5677 codec interrupt path, fetches the context via dev_get_drvdata(&g_spi->dev) and dereferences it. Freeing the context on remove would let that callback run concurrently and touch freed memory. Add a dsp_lock that serializes the fetch/use in rt5677_spi_hotword_detected() against clearing the drvdata in the remove callback, so once remove has cleared the pointer the callback either observes NULL and bails out or has already finished. Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Link: https://patch.msgid.link/20260923061305.4041197-19-chancel.liu@oss.nxp.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/linux/debugobjects.h')
0 files changed, 0 insertions, 0 deletions