[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Include patch fixing SNDRV_PCM_IOCTL_SW_PARAMS ioctl on src/pcm/pcm_hw.c



Package: alsa-libs
Severity: normal
Version: 1.2.9-1
Tags: patch

Howdy, ALSA team!

I had some unrelated software (src:direwolf) break on me, which turns
out is a bug in ALSA.

Commit 2115cdb4dc314d66e92a9e04413bcedc543da007 (first part of 1.2.9
AFAICT) introduced a change to src/pcm/pcm_hw.c where sw_params is
passed by value rather than as a pointer in the ioctl call. Whoopsies.

This means for users of specific hardware (I am one such person!), ALSA
was returnning bad address (well, ALSA was returning the kernel being
grumpy) which horked writing audio to ALSA.

I took the attached patch from the upstream repo
(commit a5d8af8e4ef02340531092ea388dd1b668182409) and rebuilt alsa-libs.
This fixes the issue that presented with my hardware, and I was able to
transmit normally.

Thanks to Dan Cross for the fix

  paultag

-- 
  ⢀⣴⠾⠻⢶⣦⠀               Paul Tagliamonte <paultag>
  ⣾⠁⢠⠒⠀⣿⡁  https://people.debian.org/~paultag | https://pault.ag/
  ⢿⡄⠘⠷⠚⠋        Debian, the universal operating system.
  ⠈⠳⣄⠀⠀  4096R / FEF2 EB20 16E6 A856 B98C  E820 2DCD 6B5D E858 ADF3
From a5d8af8e4ef02340531092ea388dd1b668182409 Mon Sep 17 00:00:00 2001
From: Dan Cross <crossd@gmail.com>
Date: Wed, 14 Jun 2023 21:09:10 +0000
Subject: [PATCH] pcm: fix minor bug in ioctl

Commit 2115cdb added a new call to the `SNDRV_PCM_IOCTL_SW_PARAMS`
ioctl on line 675 of src/pcm/pcm_hw.c, but passed the `sw_params`
argument by value; this should be passed by pointer.

I ran across this in the context of the direwolf software modem
for amateur radio; debugging details are in
https://groups.io/g/direwolf/message/8286

Fixes #329

Signed-off-by: Dan Cross <cross@gmail.com>
---
 src/pcm/pcm_hw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c
index b468a071..f488023a 100644
--- a/src/pcm/pcm_hw.c
+++ b/src/pcm/pcm_hw.c
@@ -672,7 +672,7 @@ static int snd_pcm_hw_prepare(snd_pcm_t *pcm)
 
        if (hw->prepare_reset_sw_params) {
                snd_pcm_sw_params_current_no_lock(pcm, &sw_params);
-               if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params) < 0) {
+               if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, &sw_params) < 0) {
                        err = -errno;
                        SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
                        return err;

Attachment: signature.asc
Description: PGP signature


Reply to: