diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index c08732998a42..eeab8850ed76 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -2176,6 +2176,12 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) } pcm_file = f.file->private_data; substream1 = pcm_file->substream; + + if (substream == substream1) { + res = -EINVAL; + goto _badf; + } + group = kzalloc(sizeof(*group), GFP_KERNEL); if (!group) { res = -ENOMEM;