Skip to contentSkip to conversation

snd-usb-caiaq: Locking bug fixes

PATCH New Mark Hills 2 participants 5 messages Oct 24, 2009 – Oct 26, 2009

Subsystems (2)
lore
Share & tools
lore

Mark Hills

author
#0 lore raw

Hi Takashi, I'll follow up this mail with 3 revised patches for inclusion. They fix a significant bug; Daniel has ack'd them and asked that they go into -rc if possible.

Thanks,

Signature · 1 line
Mark
author
#1 lore raw

PATCH 1/3 snd-usb-caiaq: Missing lock around use of buffer positions

Fix a race which causes snd_pcm_update_hw_ptr_pos() to report a bug.

---
 sound/usb/caiaq/audio.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
sound/usb/caiaq/audio.c +9 -3
index 121af06..e76017c 100644
@@ -269,16 +269,22 @@ snd_usb_caiaq_pcm_pointer(struct snd_pcm_substream *sub)
 {
 	int index = sub->number;
 	struct snd_usb_caiaqdev *dev = snd_pcm_substream_chip(sub);
+	snd_pcm_uframes_t ptr;
+
+	spin_lock(&dev->spinlock);
 
 	if (dev->input_panic || dev->output_panic)
-		return SNDRV_PCM_POS_XRUN;
+		ptr = SNDRV_PCM_POS_XRUN;
 
 	if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		return bytes_to_frames(sub->runtime,
+		ptr = bytes_to_frames(sub->runtime,
 					dev->audio_out_buf_pos[index]);
 	else
-		return bytes_to_frames(sub->runtime,
+		ptr = bytes_to_frames(sub->runtime,
 					dev->audio_in_buf_pos[index]);
+
+	spin_unlock(&dev->spinlock);
+	return ptr;
 }
 
 /* operators for both playback and capture */
Signature · 1 line
1.6.4.4
author
#2 lore raw

PATCH 2/3 snd-usb-caiaq: Lock on stream start/unpause

Fix a bug which can result in white noise from the driver after stream start or unpause.

---
 sound/usb/caiaq/audio.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
sound/usb/caiaq/audio.c +4 -0
index e76017c..86b2c3b 100644
@@ -62,10 +62,14 @@ static void
 activate_substream(struct snd_usb_caiaqdev *dev,
 	           struct snd_pcm_substream *sub)
 {
+	spin_lock(&dev->spinlock);
+
 	if (sub->stream == SNDRV_PCM_STREAM_PLAYBACK)
 		dev->sub_playback[sub->number] = sub;
 	else
 		dev->sub_capture[sub->number] = sub;
+
+	spin_unlock(&dev->spinlock);
 }
 
 static void
Signature · 1 line
1.6.4.4
author
#3 lore raw

PATCH 3/3 snd-usb-caiaq: Bump version number to 1.3.20

---
 sound/usb/caiaq/device.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/usb/caiaq/device.c +1 -1
index 83e6c13..a3f02dd 100644
@@ -35,7 +35,7 @@
 #include "input.h"
 
 MODULE_AUTHOR("Daniel Mack <[email protected]>");
-MODULE_DESCRIPTION("caiaq USB audio, version 1.3.19");
+MODULE_DESCRIPTION("caiaq USB audio, version 1.3.20");
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
 			 "{Native Instruments, RigKontrol3},"
Signature · 1 line
1.6.4.4
#4 lore raw
In reply to Mark Hills

At Sat, 24 Oct 2009 12:58:45 +0100 (BST),

Quoted 4 lines · Mark Hills

Hi Takashi, I'll follow up this mail with 3 revised patches for inclusion. They fix a significant bug; Daniel has ack'd them and asked that they go into -rc if possible.

Thanks. I've been off until the next Thursday at least, so will check and merge soon after I back to work.

thanks,

Takashi