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=1796381432; b=MjTHS91kKtTTY30hrjOmf3v9f8jY7G2t3tMyNAAtt079ei/5nG3fnxM6FN6Q3VOn9pMh qxcsVsUt8z8SDNZLqQgc/4pOodIbS6vWfy2PZ49/rhwu1bkm3ZnrvyODkE4pe/V4S0tkF xGl0JaezLGkGNRl5Y4E7hUwdt99x6DJDTMjChLsYTcfqZSwgqjehVOcypz8j/QstK4CoO QrUrQEmWAtwMRP/zHGSXuR2dgTWrveRcWJ5cBSOc+/33sVgMvRSh4Fjke3+k6miJ/gdNp NMESK1cQQvscL/SysmgiBxlwrsFTaI2fevlKKYBY+K6pSrjbdZGU/Fpce4fFHr108GQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381432; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=GFzTZeQDmGxkiPQAeeM84w6T3bOtvELKglQEATfvWmw=; b=faEJhygKCwJig2fy3sV+xhxd70EVMzOJ5KFH5xCk83AqZxpPEbFtlg1nGLLBxiv7qI2P 4NwEcFebA3KhHSqIgnHKS97pT4MMN/l7tv2gcRJjdMMwAmySW39NKAWxv6DdrlZ0Ggeyk yLIGpKnQFgNWsJRj04VxvIMb5qUZ5t1KHpNnx9CnSoqo8v5Bl6VrdeerqNluqHjCsbuDj Xyf9b9TrdpMGVsaVxQGNVN/Dcqk09H6LyAhOBPhMxqP7zF9LP21dTdIK6bttYfcoJXNd5 AstM2PerBN7otM2dBgRYWP2aiR80EREhrxkTJRgsR5JuVFfJTS/Z4VGDgRl0tAcopJw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=D2KMnTha; 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 ED06B606A32C; Fri, 4 Dec 2026 10:50:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=D2KMnTha Received: by smtp.kernel.org (Postfix) with ESMTPSA id 663A01F000CE; Fri, 4 Dec 2026 10:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381431; bh=GFzTZeQDmGxkiPQAeeM84w6T3bOtvELKglQEATfvWmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=D2KMnThaIbS7B+UpmnPIqijok9PMHUZ16BMoZO1T7vDv9Em48nto2LCddFKtBOG7A 5JMgS5oD9xe3s0YDjkMV+1pyy89GG+mqQ2F5PucHByCiYYXMJr/9mNJHT1X36g7T52 NC1YAzM9+qIuzE5TCXJAJJXndhRIi+irGulFXGNw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hengyu Liang , Takashi Iwai Subject: [PATCH 7.3 699/742] ALSA: pcm: oss: Refine slave hw_params after setting format Date: Fri, 4 Dec 2026 19:09:23 +0900 Message-ID: <20261204100653.619240120@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hengyu Liang commit ddea524e437eae0d5581482a90565b4c1e6d4b24 upstream. Commit 93d7d38fa61d ("ALSA: aloop: add DSD formats") added DSD_U8 to the formats of snd-aloop. Before that, its narrowest format had 16 bits. However, snd_pcm_oss_change_params_locked() sets the slave format with _snd_pcm_hw_param_set(), which does not refine the parameters, while the access, rate and channels before it are set with refining helpers. snd_pcm_oss_period_size() then reads a buffer size maximum that is still computed for the narrowest format, now DSD_U8, so the OSS period doubles. With the default U8 client format, the doubled period no longer fits in the format plugin, and snd_pcm_plugin_alloc() returns -ENOMEM. As of now, an OSS program that asks snd-aloop for 8 channels at 192 kHz gets ENOMEM from SNDCTL_DSP_SPEED and from every later ioctl on the same file. The issue can be reproduced with this program, where card 1 is snd-aloop: #include #include #include #include int main(void) { int fd = open("/dev/dsp1", O_WRONLY | O_NONBLOCK); int ch = 8, rate = 192000, blk = 0; ioctl(fd, SNDCTL_DSP_CHANNELS, &ch); if (ioctl(fd, SNDCTL_DSP_SPEED, &rate) < 0) perror("SNDCTL_DSP_SPEED"); if (ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &blk) < 0) perror("SNDCTL_DSP_GETBLKSIZE"); printf("block size %d\n", blk); return 0; } Before that commit, it prints "block size 65536". After that commit, the result is: SNDCTL_DSP_SPEED: Cannot allocate memory SNDCTL_DSP_GETBLKSIZE: Cannot allocate memory block size 0 This patch will set the format with snd_pcm_hw_param_set(), which refines the parameters, as is done for the channels just before. Fixes: 93d7d38fa61d ("ALSA: aloop: add DSD formats") Cc: Signed-off-by: Hengyu Liang Link: https://patch.msgid.link/20261125181005.3683575-1-hengyul@cs.unc.edu Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/core/oss/pcm_oss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -921,7 +921,8 @@ static int snd_pcm_oss_change_params_loc goto failure; } format_found: - err = _snd_pcm_hw_param_set(sparams, SNDRV_PCM_HW_PARAM_FORMAT, sformat, 0); + err = snd_pcm_hw_param_set(substream, sparams, + SNDRV_PCM_HW_PARAM_FORMAT, sformat, 0); if (err < 0) goto failure;