Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp4350782ybg; Mon, 8 Jun 2020 05:50:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCxKi7lfcM8fYNYXLBLXVjUnPWpRyuXGE9CYjN7rsH4HSPugrGFJEdDWpKZ6v64CxJcw3p X-Received: by 2002:a17:907:9d8:: with SMTP id bx24mr20235355ejc.517.1591620654983; Mon, 08 Jun 2020 05:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591620654; cv=none; d=google.com; s=arc-20160816; b=lXHxhkBGKkQxPJecJaF1apVDECYy/Sn9BQ93ZOzzZWNHLGfhQbu3gxTCzA+Fh6N+u4 4DW73ybI7QsmhGn5sTwfeF4kqnkNOv6qYyZf+R5Crb3qSzXuvxdCNP79Ld1rpk+5onc/ dzWXFdixwStO1H4Vk7USCbY2OO/t0wA6C/jI75wpy4npeMSSTy8MG6loocIstvEC4AYu Go44FQwam+In8IwgpGrmqcMHzHd6FQrYF0PW4CkVEWJ3VrHasjKCQKJBNCb1XA3qcl0z ye8bN/Xd7CGzmv/QqcxSw3LlFYGD7TqHJjW2G7Mv4WtetQWlkfDvsrkb2u88EDtnKgW6 c4eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date; bh=EA4otRWqFkCogQF09AeZDVuhT7EvSnjvl3FY03N1+AE=; b=s+u6jbRP+RMI9se8+j6P9Jn7gOie0kS/nhRnhTF0GooJUFZAX2/bII0Sv5C6k1/3oR bTKmTSTMnk6iaretVj4APTavht9iaYuEzyuFheHbzsucd5Kr0Tocb6pt0DeDnqfyf/nk 5FQboeRNWKR+e55K9rIvRJzeRNM+9HnzQXJPNrDk878Zd9oLkl38bsZtIeKgRCHprgCK C0306o7xMWAgVRfGzvq3h0AuZnkMxQs3gcKYwwGgORpfD8yqyk8qoy/VaiGM1/MWLYDi YFqT9t/+NKEVjEIh6VxxsZPm4KrXK8USmolKGAsdjF3OXvAi3CekaJiOsZ3yv49kAuLH 7H5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a24si8741413ejs.603.2020.06.08.05.50.31; Mon, 08 Jun 2020 05:50:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729175AbgFHMsn (ORCPT + 99 others); Mon, 8 Jun 2020 08:48:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:50576 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727003AbgFHMsl (ORCPT ); Mon, 8 Jun 2020 08:48:41 -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 24660AD7D; Mon, 8 Jun 2020 12:48:44 +0000 (UTC) Date: Mon, 08 Jun 2020 14:48:40 +0200 Message-ID: From: Takashi Iwai To: =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] ALSA: pcm: disallow linking stream to itself In-Reply-To: References: 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 08 Jun 2020 12:06:32 +0200, Michał Mirosław wrote: > > 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 Thanks for the fix. Just a minor point: > @@ -2166,6 +2166,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 = -EDEADLK; We've never used this error code, hence it may confuse the user-space side. I'd use a more standard -EINVAL instead; the error is basically an invalid argument, after all. thanks, Takashi