Skip to contentSkip to conversation

ASoC: sdw_utils: fix double put_device() on aggregated amps

PATCH In review [email protected] 2 participants 2 messages Aug 18

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: sdw_utils: fix double put_device() on aggregated amps

From: Jack Yu <[email protected]>

In aggregation mode with two identical amplifiers,
a stress test that repeatedly triggers card unbind/rebind can hit a NULL pointer dereference during the exit path. ctx->amp_dev1 / ctx->amp_dev2 are single shared resources, so the release must be safe against being called more than once. Clear each pointer after put_device() so a second invocation becomes a no-op, this could address NULL pointer dereference issue.

---
 sound/soc/sdw_utils/soc_sdw_rt_amp.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/sdw_utils/soc_sdw_rt_amp.c +2 -0
index 4e9b08cb653d..81d2cbac0ea3 100644
@@ -252,11 +252,13 @@ int asoc_sdw_rt_amp_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai
 	if (ctx->amp_dev1) {
 		device_remove_software_node(ctx->amp_dev1);
 		put_device(ctx->amp_dev1);
+		ctx->amp_dev1 = NULL;
 	}
 
 	if (ctx->amp_dev2) {
 		device_remove_software_node(ctx->amp_dev2);
 		put_device(ctx->amp_dev2);
+		ctx->amp_dev2 = NULL;
 	}
 
 	return 0;
Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 1 line · On Tue, 18 Aug 2026 10:30:18 +0800, [email protected] wrote:

ASoC: sdw_utils: fix double put_device() on aggregated amps

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.3

Thanks!

[1/1] ASoC: sdw_utils: fix double put_device() on aggregated amps

      https://git.kernel.org/broonie/sound/c/046173b98de3

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark