Skip to contentSkip to conversation

ALSA: us122l: fix missing unlock in usb_stream_hwdep_vm_fault()

PATCH Applied Li Zefan 2 participants 2 messages Oct 15, 2008 Sound

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 ALSA: us122l: fix missing unlock in usb_stream_hwdep_vm_fault()

Should unlock us122l->mutex before returning VM_FAULT_SIGBUS.

---
 sound/usb/usx2y/us122l.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
sound/usb/usx2y/us122l.c +7 -6
index b441fe2..c2515b6 100644
@@ -118,12 +118,11 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
 	void *vaddr;
 	struct us122l *us122l = area->vm_private_data;
 	struct usb_stream *s;
-	int vm_f = VM_FAULT_SIGBUS;
 
 	mutex_lock(&us122l->mutex);
 	s = us122l->sk.s;
 	if (!s)
-		goto out;
+		goto unlock;
 
 	offset = vmf->pgoff << PAGE_SHIFT;
 	if (offset < PAGE_ALIGN(s->read_size))
@@ -131,7 +130,7 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
 	else {
 		offset -= PAGE_ALIGN(s->read_size);
 		if (offset >= PAGE_ALIGN(s->write_size))
-			goto out;
+			goto unlock;
 
 		vaddr = us122l->sk.write_page + offset;
 	}
@@ -141,9 +140,11 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
 	mutex_unlock(&us122l->mutex);
 
 	vmf->page = page;
-	vm_f = 0;
-out:
-	return vm_f;
+
+	return 0;
+unlock:
+	mutex_unlock(&us122l->mutex);
+	return VM_FAULT_SIGBUS;
 }
 
 static void usb_stream_hwdep_vm_close(struct vm_area_struct *area)
Signature · 1 line
1.5.4.rc3
Applied
#1 lore raw

At Wed, 15 Oct 2008 10:07:23 +0800,

Quoted 4 lines · Li Zefan

Should unlock us122l->mutex before returning VM_FAULT_SIGBUS.

Thanks, applied now.
Will be included in the next pull request.

Takashi

Quoted 55 lines
---
 sound/usb/usx2y/us122l.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
sound/usb/usx2y/us122l.c +7 -6
index b441fe2..c2515b6 100644
@@ -118,12 +118,11 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
 	void *vaddr;
 	struct us122l *us122l = area->vm_private_data;
 	struct usb_stream *s;
-	int vm_f = VM_FAULT_SIGBUS;
 
 	mutex_lock(&us122l->mutex);
 	s = us122l->sk.s;
 	if (!s)
-		goto out;
+		goto unlock;
 
 	offset = vmf->pgoff << PAGE_SHIFT;
 	if (offset < PAGE_ALIGN(s->read_size))
@@ -131,7 +130,7 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
 	else {
 		offset -= PAGE_ALIGN(s->read_size);
 		if (offset >= PAGE_ALIGN(s->write_size))
-			goto out;
+			goto unlock;
 
 		vaddr = us122l->sk.write_page + offset;
 	}
@@ -141,9 +140,11 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
 	mutex_unlock(&us122l->mutex);
 
 	vmf->page = page;
-	vm_f = 0;
-out:
-	return vm_f;
+
+	return 0;
+unlock:
+	mutex_unlock(&us122l->mutex);
+	return VM_FAULT_SIGBUS;
 }
 
 static void usb_stream_hwdep_vm_close(struct vm_area_struct *area)
Signature · 7 lines
1.5.4.rc3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/