From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 044B1C433E0 for ; Mon, 15 Jun 2020 15:40:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D24A8206D7 for ; Mon, 15 Jun 2020 15:40:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729303AbgFOPkC (ORCPT ); Mon, 15 Jun 2020 11:40:02 -0400 Received: from mx2.suse.de ([195.135.220.15]:34746 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728477AbgFOPkB (ORCPT ); Mon, 15 Jun 2020 11:40:01 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C0695AD0D; Mon, 15 Jun 2020 15:40:04 +0000 (UTC) Date: Mon, 15 Jun 2020 17:40:00 +0200 Message-ID: From: Takashi Iwai To: Cc: mirq-linux@rere.qmqm.pl, Subject: Re: FAILED: patch "[PATCH] ALSA: pcm: disallow linking stream to itself" failed to apply to 4.19-stable tree In-Reply-To: <1592233511148188@kroah.com> References: <1592233511148188@kroah.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Mon, 15 Jun 2020 17:05:11 +0200, wrote: > > > The patch below does not apply to the 4.19-stable tree. > If someone wants it applied there, or to any other stable or longterm > tree, then please email the backport, including the original git commit > id to . It should be trivial to adapt this change to older branches. I'll post it short later. thanks, Takashi > > thanks, > > greg k-h > > ------------------ original commit in Linus's tree ------------------ > > >From 951e2736f4b11b58dc44d41964fa17c3527d882a Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= > Date: Mon, 8 Jun 2020 18:50:39 +0200 > Subject: [PATCH] ALSA: pcm: disallow linking stream to itself > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > Prevent SNDRV_PCM_IOCTL_LINK linking stream to itself - the code > can't handle it. Fixed commit is not where bug was introduced, but > changes the context significantly. > > Cc: stable@vger.kernel.org > Fixes: 0888c321de70 ("pcm_native: switch to fdget()/fdput()") > Signed-off-by: Michał Mirosław > Link: https://lore.kernel.org/r/89c4a2487609a0ed6af3ecf01cc972bdc59a7a2d.1591634956.git.mirq-linux@rere.qmqm.pl > Signed-off-by: Takashi Iwai > > 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; >