Bug#1041868: Include patch fixing SNDRV_PCM_IOCTL_SW_PARAMS ioctl on src/pcm/pcm_hw.c

2023-07-25 Thread Paul Tagliamonte
severity 1041868 important
thanks

Hey pkg-alsa-devel,

Due to my fat-fingering the submit email, the submission of this bug
never hit the ALSA mailing lists. Apologies for the aggressive (in
wallclock time) ping, but I don't think folks here actually saw this. My
control messages came through but not the bug itself.

After sleeping on it I believe this bug is 'important' not 'normal'
because it renders another bit of software unusable (src:direwolf) even
though alsa works fine most of the time, I've adjusted the severity; but
I'm open to having the severity changed.

I'd very much like to land this patch -- it's very short, and attached
to the bug report. The diff is a single char (although single char
changes tend to be the most conceptually hard to reason about), and the
patch was taken from the upstream repo. I'm worried about this bug
propagating out via derivitives, so I'd love to see if we can apply the
patch attached to the bug.

Here's the tl;dr of the patch:

```src/pcm/pcm_hw.c:
-   if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params) < 0) {
+   if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, _params) < 0) {
```

I believe this was introduced in alsa-lib 1.2.9, so this is only about a
month old -- and I'd love to stop this from spreading out from sid. It's
already pulled into mantic, and I'm not sure where else.

Thank you for maintaining alsa!
  paultag

-- 
  ⢀⣴⠾⠻⢶⣦⠀   Paul Tagliamonte 
  ⣾⠁⢠⠒⠀⣿⡁  https://people.debian.org/~paultag | https://pault.ag/
  ⢿⡄⠘⠷⠚⠋Debian, the universal operating system.
  ⠈⠳⣄⠀⠀  4096R / FEF2 EB20 16E6 A856 B98C  E820 2DCD 6B5D E858 ADF3


signature.asc
Description: PGP signature


Bug#1041868: Include patch fixing SNDRV_PCM_IOCTL_SW_PARAMS ioctl on src/pcm/pcm_hw.c

2023-07-24 Thread Paul Tagliamonte
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 
  ⣾⠁⢠⠒⠀⣿⡁  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 
Date: Wed, 14 Jun 2023 21:09:10 +
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 
---
 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, _params);
-   if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, sw_params) < 0) {
+   if (ioctl(hw->fd, SNDRV_PCM_IOCTL_SW_PARAMS, _params) < 0) {
err = -errno;
SYSMSG("SNDRV_PCM_IOCTL_SW_PARAMS failed (%i)", err);
return err;


signature.asc
Description: PGP signature