]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ALSA: sb: Don't allow changing the DMA mode during operations
authorTakashi Iwai <tiwai@suse.de>
Tue, 10 Jun 2025 06:43:19 +0000 (08:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Jul 2025 13:57:46 +0000 (15:57 +0200)
[ Upstream commit ed29e073ba93f2d52832804cabdd831d5d357d33 ]

When a PCM stream is already running, one shouldn't change the DMA
mode via kcontrol, which may screw up the hardware.  Return -EBUSY
instead.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=218185
Link: https://patch.msgid.link/20250610064322.26787-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/isa/sb/sb16_main.c

index a9b87e159b2d11c67416ad9447999e46f46bd768..5efbd0a41312b47023d40af61541e95ba6c00a70 100644 (file)
@@ -703,6 +703,9 @@ static int snd_sb16_dma_control_put(struct snd_kcontrol *kcontrol, struct snd_ct
        unsigned char nval, oval;
        int change;
        
+       if (chip->mode & (SB_MODE_PLAYBACK | SB_MODE_CAPTURE))
+               return -EBUSY;
+
        nval = ucontrol->value.enumerated.item[0];
        if (nval > 2)
                return -EINVAL;