All of lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: hengyul@cs.unc.edu,stable@vger.kernel.org,tiwai@suse.de
Cc: <stable@vger.kernel.org>
Subject: FAILED: patch "[PATCH] ALSA: pcm: oss: Refine slave hw_params after setting format" failed to apply to 6.12-stable tree
Date: Thu, 03 Dec 2026 04:44:27 +0100	[thread overview]
Message-ID: <2026120327-shelf-earwig-cafa@gregkh> (raw)


The patch below does not apply to the 6.12-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 <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x ddea524e437eae0d5581482a90565b4c1e6d4b24
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120327-shelf-earwig-cafa@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From ddea524e437eae0d5581482a90565b4c1e6d4b24 Mon Sep 17 00:00:00 2001
From: Hengyu Liang <hengyul@cs.unc.edu>
Date: Wed, 25 Nov 2026 13:10:05 -0500
Subject: [PATCH] ALSA: pcm: oss: Refine slave hw_params after setting format

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 <fcntl.h>
    #include <stdio.h>
    #include <sys/ioctl.h>
    #include <sys/soundcard.h>

    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: <stable@vger.kernel.org>
Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
Link: https://patch.msgid.link/20261125181005.3683575-1-hengyul@cs.unc.edu
Signed-off-by: Takashi Iwai <tiwai@suse.de>

diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 66162caa45d4..3c2ac8966d5e 100644
--- 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_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;
 


             reply	other threads:[~2026-12-03  4:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  3:44 gregkh [this message]
2026-12-04 13:25 ` [PATCH 6.12.y 1/2] ALSA: oss: Drop __force casts Sasha Levin
2026-12-04 13:25   ` [PATCH 6.12.y 2/2] ALSA: pcm: oss: Refine slave hw_params after setting format Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2026120327-shelf-earwig-cafa@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=hengyul@cs.unc.edu \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.