Commit 428ffb71 authored by Li Zefan's avatar Li Zefan Committed by Takashi Iwai

ALSA: us122l: fix missing unlock in usb_stream_hwdep_vm_fault()

Should unlock us122l->mutex before returning VM_FAULT_SIGBUS.
Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8825e8e8
...@@ -118,12 +118,11 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area, ...@@ -118,12 +118,11 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
void *vaddr; void *vaddr;
struct us122l *us122l = area->vm_private_data; struct us122l *us122l = area->vm_private_data;
struct usb_stream *s; struct usb_stream *s;
int vm_f = VM_FAULT_SIGBUS;
mutex_lock(&us122l->mutex); mutex_lock(&us122l->mutex);
s = us122l->sk.s; s = us122l->sk.s;
if (!s) if (!s)
goto out; goto unlock;
offset = vmf->pgoff << PAGE_SHIFT; offset = vmf->pgoff << PAGE_SHIFT;
if (offset < PAGE_ALIGN(s->read_size)) if (offset < PAGE_ALIGN(s->read_size))
...@@ -131,7 +130,7 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area, ...@@ -131,7 +130,7 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
else { else {
offset -= PAGE_ALIGN(s->read_size); offset -= PAGE_ALIGN(s->read_size);
if (offset >= PAGE_ALIGN(s->write_size)) if (offset >= PAGE_ALIGN(s->write_size))
goto out; goto unlock;
vaddr = us122l->sk.write_page + offset; vaddr = us122l->sk.write_page + offset;
} }
...@@ -141,9 +140,11 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area, ...@@ -141,9 +140,11 @@ static int usb_stream_hwdep_vm_fault(struct vm_area_struct *area,
mutex_unlock(&us122l->mutex); mutex_unlock(&us122l->mutex);
vmf->page = page; vmf->page = page;
vm_f = 0;
out: return 0;
return vm_f; unlock:
mutex_unlock(&us122l->mutex);
return VM_FAULT_SIGBUS;
} }
static void usb_stream_hwdep_vm_close(struct vm_area_struct *area) static void usb_stream_hwdep_vm_close(struct vm_area_struct *area)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment