* [PATCH] ALSA: rawmidi: Return the error from snd_rawmidi_input_params()
@ 2026-09-02 12:50 HyeongJun An
2026-09-02 13:31 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: HyeongJun An @ 2026-09-02 12:50 UTC (permalink / raw)
To: perex, tiwai; +Cc: linux-sound, linux-kernel, stable, HyeongJun An
The snd_rawmidi_input_params() computes err for the three invalid mode
combinations and for resize_runtime_buffer(), applies the new framing
and clock type only when err is zero, and then returns 0 anyway. A
caller that asked for parameters the kernel rejected is told the change
succeeded, and the substream keeps its old buffer.
The open_mutex conversion turned the early returns into assignments.
It handled the output sibling correctly, which still returns err, and
left this one behind.
Fixes: 94b98194b62e ("ALSA: rawmidi: Take open_mutex around parameter changes")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-5
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
---
Reproduced on 6.17.0-35-generic with snd-virmidi:
INPUT buffer_size=0 -> ret 0, errno 0
INPUT avail_min=0 -> ret 0, errno 0
OUTPUT buffer_size=0 -> ret -1, EINVAL
The same rejected parameters report success on the input stream and
failure on the output stream.
sound/core/rawmidi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index bf504e27f73e..f9cef3c61861 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -782,7 +782,7 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,
substream->framing = framing;
substream->clock_type = clock_type;
}
- return 0;
+ return err;
}
EXPORT_SYMBOL(snd_rawmidi_input_params);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: rawmidi: Return the error from snd_rawmidi_input_params()
2026-09-02 12:50 [PATCH] ALSA: rawmidi: Return the error from snd_rawmidi_input_params() HyeongJun An
@ 2026-09-02 13:31 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-09-02 13:31 UTC (permalink / raw)
To: HyeongJun An; +Cc: perex, tiwai, linux-sound, linux-kernel, stable
On Wed, 02 Sep 2026 14:50:58 +0200,
HyeongJun An wrote:
>
> The snd_rawmidi_input_params() computes err for the three invalid mode
> combinations and for resize_runtime_buffer(), applies the new framing
> and clock type only when err is zero, and then returns 0 anyway. A
> caller that asked for parameters the kernel rejected is told the change
> succeeded, and the substream keeps its old buffer.
>
> The open_mutex conversion turned the early returns into assignments.
> It handled the output sibling correctly, which still returns err, and
> left this one behind.
>
> Fixes: 94b98194b62e ("ALSA: rawmidi: Take open_mutex around parameter changes")
> Cc: stable@vger.kernel.org
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-02 13:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-02 12:50 [PATCH] ALSA: rawmidi: Return the error from snd_rawmidi_input_params() HyeongJun An
2026-09-02 13:31 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox