Skip to contentSkip to conversation

sound: pcm_oss, fix locking typo

PATCH Applied Jiri Slaby 2 participants 3 messages Mar 11, 2009 – Mar 12, 2009 Sound

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/2 sound: pcm_oss, fix locking typo

s/mutex_lock/mutex_unlock/ on 2 fail paths in snd_pcm_oss_proc_write. Probably a typo, lock should be unlocked when leaving the function.

Cc Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
---
 sound/core/oss/pcm_oss.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/core/oss/pcm_oss.c +2 -2
index ddf83c8..dda000b 100644
@@ -2887,7 +2887,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry,
 			setup = kmalloc(sizeof(*setup), GFP_KERNEL);
 			if (! setup) {
 				buffer->error = -ENOMEM;
-				mutex_lock(&pstr->oss.setup_mutex);
+				mutex_unlock(&pstr->oss.setup_mutex);
 				return;
 			}
 			if (pstr->oss.setup_list == NULL)
@@ -2901,7 +2901,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry,
 			if (! template.task_name) {
 				kfree(setup);
 				buffer->error = -ENOMEM;
-				mutex_lock(&pstr->oss.setup_mutex);
+				mutex_unlock(&pstr->oss.setup_mutex);
 				return;
 			}
 		}
Signature · 2 lines
1.6.2
caught by stanse
author
#1 lore raw

PATCH 2/2 sound: mixart, fix lock imbalance

There is an omitted unlock in one snd_mixart_hw_params fail path. Fix it.

Cc Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
---
 sound/pci/mixart/mixart.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
sound/pci/mixart/mixart.c +1 -0
index a593686..82bc5b9 100644
@@ -607,6 +607,7 @@ static int snd_mixart_hw_params(struct snd_pcm_substream *subs,
 	/* set the format to the board */
 	err = mixart_set_format(stream, format);
 	if(err < 0) {
+		mutex_unlock(&mgr->setup_mutex);
 		return err;
 	}
 
Signature · 2 lines
1.6.2
caught by stanse
Applied
#2 lore raw
In reply to Jiri Slaby

At Wed, 11 Mar 2009 20:11:40 +0100,

Quoted 5 lines · Jiri Slaby

s/mutex_lock/mutex_unlock/ on 2 fail paths in snd_pcm_oss_proc_write. Probably a typo, lock should be unlocked when leaving the function.

Thanks, applied both patches now.

Takashi

Quoted 32 lines
Cc Jaroslav Kysela <[email protected]>
Cc Takashi Iwai <[email protected]>
---
 sound/core/oss/pcm_oss.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/core/oss/pcm_oss.c +2 -2
index ddf83c8..dda000b 100644
@@ -2887,7 +2887,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry,
 			setup = kmalloc(sizeof(*setup), GFP_KERNEL);
 			if (! setup) {
 				buffer->error = -ENOMEM;
-				mutex_lock(&pstr->oss.setup_mutex);
+				mutex_unlock(&pstr->oss.setup_mutex);
 				return;
 			}
 			if (pstr->oss.setup_list == NULL)
@@ -2901,7 +2901,7 @@ static void snd_pcm_oss_proc_write(struct snd_info_entry *entry,
 			if (! template.task_name) {
 				kfree(setup);
 				buffer->error = -ENOMEM;
-				mutex_lock(&pstr->oss.setup_mutex);
+				mutex_unlock(&pstr->oss.setup_mutex);
 				return;
 			}
 		}
Signature · 2 lines
1.6.2
caught by stanse