From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796299772; b=TQ4CP/yntMTfcbFFGtuPxoBXlPXR8tjRQH0YBSpHf9q6Lbnq7DEtqip1WsLn4SukdBGS UsB+WQkEdS/9bIQQQQrfI9P4ZYPtO/kQTUb4ZlZCvEwH4aMPaCEArTcsXI5lbzWdXIC+5 a+JFIXH0DEKpqkbEFU0d0KB/3GZINNacssmYSGz71pVmh5apSlttixqKm3Iwl/2naaKYq lS+uj3W08MQwkoIvIqIV2ZPFac6UFqdG4eoZ0zgLVIh0IG9zPNIz9kEMCMK/xQi4JiDvM d7wpSR8w2iaRtoIrgDVB2SSO6ms9PNjw7DUmD/wfW1hsR279dMizY7VCwmryNaJEIqA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796299772; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=4gCjOfCz2eZCy4iEBkiQO3Sf4HuaSb5OKZRsTMr515g=; b=xYmz23D89Dqxqmhf9Ce+hiAUMr3/yPCCLfuUYaZTk2QlNz8I+Z+4xsTwEmIQttL0Rehj 2fdBZYHzbfzYEgygmH0DqDciUZOrS4K5fcC8hckSYI8T7VqbKUNZwbHYh9JZYLUgBQt+P 6+sUaqB0JmL7cMB/+XZ2kuRKAwpwOtL/mMVvnBq315s3HzWslAwJlcmyI7SxM1C0ZBnAw 15AOB5wsNDusTFFBs8YK6l6Wh3rQElvR8BaRFMQmVzoXL4LmDwx0YAIZfZHZCQ7eQ1f+Z +fikVii6sNce+Wux3GZQ7MCCZJxXX5QcZeYWGv1IT0OtpEgvf85C0KAhhRgM8uogFoQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="Sj+/olZv"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6E3A4606A337 for ; Thu, 3 Dec 2026 12:09:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Sj+/olZv Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0FFE1F00893; Thu, 3 Dec 2026 12:09:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796299772; bh=4gCjOfCz2eZCy4iEBkiQO3Sf4HuaSb5OKZRsTMr515g=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=Sj+/olZvZc/OjfB0ZTbSIid0kLry2PG/H9xhJP3Hpp/L8+sYZ+fs1vEI+3EWkQ0// v/I+JDRRyntv/3SnDBZgGhh+JQKLL4r9IU27zMjsd7xhEtPVtmuFdFhsV3gMEhzIjT 8cTiPGdUzl3xPJs04lQ0/4WHt5nbb9Ds74mBNx8rLJBAvECI8fewdAKuKLGW9z0OZ4 mvtpCfv9KEWSSFF01pbD6Up9eEawdDps+obqYD3aHl4U68sxuSoyQbaYvTdrBVsmaV d/HNLIZzy0gSANxuErdcDqG/5aCaxRauIWBZEiyd1i7Zrt8UlRN1ioejUJxUbI+HvT MMW0C9jjG8POA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 1/3] ALSA: pcm: Avoid forcibly changing to OPEN state at hw_params errors Reply-To: sashiko-reviews@lists.linux.dev To: "Takashi Iwai" , linux-sound@vger.kernel.org In-Reply-To: <20261203113424.1222171-2-tiwai@suse.de> References: <20261203113424.1222171-1-tiwai@suse.de> <20261203113424.1222171-2-tiwai@suse.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 12:09:31 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] ALSA: pcm: snd_pcm_oss_make_ready() lock gap causes spurious -EBADFD -- commit 9db40700c95711b404818acc9c231037d80cf17a Author: Takashi Iwai ALSA: pcm: Avoid forcibly changing to OPEN state at hw_params errors This commit skips the state reset and buffer release on snd_pcm_hw_params() errors when the substream buffer is mmapped, and adds a runtime->oss.params check in snd_pcm_oss_prepare() to catch failed hw_params calls. Link: https://lore.kernel.org/20261202140117.1164633-1-ahmedabdelmoumen05@g= mail.com > diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c > index 3c2ac8966d5e3..35a5fa67d6f9b 100644 > --- a/sound/core/oss/pcm_oss.c > +++ b/sound/core/oss/pcm_oss.c > @@ -1146,6 +1146,10 @@ static int snd_pcm_oss_prepare(struct snd_pcm_subs= tream *substream) > int err; > struct snd_pcm_runtime *runtime =3D substream->runtime; > =20 > + /* previous hw_params failed? */ > + if (runtime->oss.params) > + return -EBADFD; > + > err =3D snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_PREPARE, NULL); > if (err < 0) { > pcm_dbg(substream->pcm, [Severity: Medium] Can a concurrent valid parameter-change ioctl set runtime->oss.params here and cause snd_pcm_oss_prepare() to return a spurious -EBADFD? snd_pcm_oss_make_ready() drops runtime->oss.params_lock between snd_pcm_oss_change_params() and snd_pcm_oss_prepare(), so a concurrent ioctl such as snd_pcm_oss_set_rate() can set runtime->oss.params =3D 1 in that window: CPU0 CPU1 snd_pcm_oss_make_ready() snd_pcm_oss_change_params() /* drops params_lock */ snd_pcm_oss_set_rate() lock_params(runtime) runtime->oss.params =3D 1 unlock(&runtime->oss.params_lock) lock(&runtime->oss.params_lock) snd_pcm_oss_prepare() if (runtime->oss.params) return -EBADFD; <-- spurious error Callers of snd_pcm_oss_make_ready() such as SNDCTL_DSP_SETTRIGGER then fail with -EBADFD instead of applying the updated parameters, and in snd_pcm_oss_poll() this aborts capture retrigger after need_input_retrigger() has already cleared runtime->oss.trigger. Checking (runtime->oss.params || runtime->oss.prepare) and acquiring runtime->oss.params_lock once in snd_pcm_oss_make_ready() to call snd_pcm_oss_make_ready_locked() would close the window and apply concurrent parameter updates cleanly. Separately, the commit message misspells snd_pcm_oss_make_ready() as snd_pcm_make_ready() and snd_pcm_oss_change_params() as snd_pcm_oss_change_param(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203113424.1222= 171-1-tiwai@suse.de?part=3D1