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=1796389983; b=zuVE9FKxmU8AlZj2Y4OXEhFPKJz6j5gyLihZGBU8eTBdb7Y/Xp/LMmcY1RmrYpmsYKew uY67fT8cT4SH1rQx8k+dqhHFwRf2si/Os5Bx6KfH3I/wZnAqB6cLCQ5FaFFdBVP6mmhTY mAUvH7/8ga+qi93zzHpHSW1CSk739rcE2pt5A+P13kvOeW3OrXbxvOuKR5JG5XAGnipeS UoVSCrKHJaYmM4Dkrpn+nEOvzsXcW1heP//tTzbxgC/6I6quEAvnXpI+hoGIvHUDtkXzn WgwNQYsDHSxsayLq8BJf/uju1ahL0qXEixO2krn7VXi5fb6HxlOhP5y0+v+Y2heMfZQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796389983; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=qxcJQsfcqzvbP3o3YQd0ooy0cAuzj0q3yPepExqIPU4=; b=hbwWt45YVyQpGOmtA9MA2b5e2OzLIkrYytzmquJ1pEPPPUO7czZAYMNKsBebvSvWeAP9 Ea3R+24oX9nwFh8J5KAikcu2fpLY3UHGLrmdzMsGU8WIdRG+AxSryjldTFhJQZFguVihk 3BejUpvckTQNj5vmerUYJqnwhjx1bGaiYngsx3D3C8mDWEthbIZZxIRsN5qFFWA//qqQo MPInXn04/GvHtncVhycZ35IeMAHIH0nubpwVP9wfGvmBYPRp35sJ8zTlBkiioLzfuwO68 KBcEOJ9RLX40Aa3yoY3Z6lcmZGKNtTmmfkOSNJRi4WhaXzmK9PX8HaS+ohff0Kpzlyw== 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=N2nowzS6; 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 AF70B606A32C for ; Fri, 4 Dec 2026 13:13:03 +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=N2nowzS6 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B74201F0092C; Fri, 4 Dec 2026 13:13:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796389983; bh=qxcJQsfcqzvbP3o3YQd0ooy0cAuzj0q3yPepExqIPU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N2nowzS6Arud8t2cb4cZ4I5Nn7YyygxBqPjZ3CnJQq9ho7tVeQGCudaORqaUnQoZ2 YxpZSF03xCFYgYIdq0oO8KB1EiGbCEMGGhNG2ogpIWLOyNr4zpoOnDJctbB7zImXw+ BwzVlAys7+Ajg/F7JSlEdK5/mlZu498ek32ixhKV0owjVCoXX1zZHHxSEcp6yWhzZL Rvw3iWbGIbXdegFeuOaIDcgfmAm0eWyx7eHD4LrHPKg/wBAI0YdRMwbHv3Hc5/F9M5 xxoxocBKqB0Z8xVKvNHd0IRqOFKCIZdHcc33oKnXwN8Gk7DV6u+h2nDgzjx8tKuSHw ex0TCsY5wcr5g== From: Sasha Levin To: stable@vger.kernel.org Cc: Hengyu Liang , Takashi Iwai , Sasha Levin Subject: [PATCH 6.18.y 2/2] ALSA: pcm: oss: Refine slave hw_params after setting format Date: Fri, 4 Dec 2026 08:13:00 -0500 Message-ID: <20261204131254.3092090-2-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261204131254.3092090-1-sashal@kernel.org> References: <2026120327-nectar-tux-33da@gregkh> <20261204131254.3092090-1-sashal@kernel.org> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Hengyu Liang [ Upstream commit ddea524e437eae0d5581482a90565b4c1e6d4b24 ] 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: Sasha Levin --- sound/core/oss/pcm_oss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 0822572679eff..802d99936d942 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -919,7 +919,8 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) 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; -- 2.53.0