Skip to content

Commit

Permalink
ALSA: us122l: fix missing unlock in usb_stream_hwdep_vm_fault()
Browse files Browse the repository at this point in the history
Should unlock us122l->mutex before returning VM_FAULT_SIGBUS.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Li Zefan authored and Takashi Iwai committed Oct 15, 2008
1 parent 8825e8e commit 428ffb7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions sound/usb/usx2y/us122l.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,19 @@ 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))
vaddr = (char *)s + offset;
else {
offset -= PAGE_ALIGN(s->read_size);
if (offset >= PAGE_ALIGN(s->write_size))
goto out;
goto unlock;

vaddr = us122l->sk.write_page + offset;
}
Expand All @@ -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)
Expand Down

0 comments on commit 428ffb7

Please sign in to comment.