Skip to content

Commit e5e9a77

Browse files
tiwaigregkh
authored andcommitted
ALSA: pcm: Check PCM state at xfern compat ioctl
commit f13876e upstream. Since snd_pcm_ioctl_xfern_compat() has no PCM state check, it may go further and hit the sanity check pcm_sanity_check() when the ioctl is called right after open. It may eventually spew a kernel warning, as triggered by syzbot, depending on kconfig. The lack of PCM state check there was just an oversight. Although it's no real crash, the spurious kernel warning is annoying, so let's add the proper check. Reported-by: [email protected] Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 5f6e6d0 commit e5e9a77

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sound/core/pcm_compat.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,8 @@ static int snd_pcm_ioctl_xfern_compat(struct snd_pcm_substream *substream,
423423
return -ENOTTY;
424424
if (substream->stream != dir)
425425
return -EINVAL;
426+
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN)
427+
return -EBADFD;
426428

427429
if ((ch = substream->runtime->channels) > 128)
428430
return -EINVAL;

0 commit comments

Comments
 (0)