Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ALSA: wavefront: Clear substream pointers on close
@ 2025-11-06  2:24 Junrui Luo
  2025-11-06 10:03 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Junrui Luo @ 2025-11-06  2:24 UTC (permalink / raw)
  To: perex, tiwai; +Cc: linux-sound, linux-kernel, stable, Junrui Luo, Yuhao Jiang

Clear substream pointers in close functions to avoid leaving dangling
pointers, helping to improve code safety and
prevents potential issues.

Reported-by: Yuhao Jiang <danisjiang@gmail.com>
Reported-by: Junrui Luo <moonafterrain@outlook.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
---
 sound/isa/wavefront/wavefront_midi.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c
index 1250ecba659a..69d87c4cafae 100644
--- a/sound/isa/wavefront/wavefront_midi.c
+++ b/sound/isa/wavefront/wavefront_midi.c
@@ -278,6 +278,7 @@ static int snd_wavefront_midi_input_close(struct snd_rawmidi_substream *substrea
 	        return -EIO;
 
 	guard(spinlock_irqsave)(&midi->open);
+	midi->substream_input[mpu] = NULL;
 	midi->mode[mpu] &= ~MPU401_MODE_INPUT;
 
 	return 0;
@@ -300,6 +301,7 @@ static int snd_wavefront_midi_output_close(struct snd_rawmidi_substream *substre
 	        return -EIO;
 
 	guard(spinlock_irqsave)(&midi->open);
+	midi->substream_output[mpu] = NULL;
 	midi->mode[mpu] &= ~MPU401_MODE_OUTPUT;
 	return 0;
 }
-- 
2.51.1.dirty


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: wavefront: Clear substream pointers on close
  2025-11-06  2:24 [PATCH] ALSA: wavefront: Clear substream pointers on close Junrui Luo
@ 2025-11-06 10:03 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2025-11-06 10:03 UTC (permalink / raw)
  To: Junrui Luo; +Cc: perex, tiwai, linux-sound, linux-kernel, stable, Yuhao Jiang

On Thu, 06 Nov 2025 03:24:57 +0100,
Junrui Luo wrote:
> 
> Clear substream pointers in close functions to avoid leaving dangling
> pointers, helping to improve code safety and
> prevents potential issues.
> 
> Reported-by: Yuhao Jiang <danisjiang@gmail.com>
> Reported-by: Junrui Luo <moonafterrain@outlook.com>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Junrui Luo <moonafterrain@outlook.com>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-06 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-06  2:24 [PATCH] ALSA: wavefront: Clear substream pointers on close Junrui Luo
2025-11-06 10:03 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox