mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-16 04:04:06 +00:00
usb: gadget: uvc: fix missing mutex_unlock() if kstrtou8() fails
commit7ebb605d22
upstream. If kstrtou8() fails, the mutex_unlock() is missed, move kstrtou8() before mutex_lock() to fix it up. Fixes:0525210c98
("usb: gadget: uvc: Allow definition of XUs in configfs") Fixes:b3c839bd8a
("usb: gadget: uvc: Make bSourceID read/write") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230213070926.776447-1-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
99b7bf04b1
commit
4e8bfc6b1e
1 changed files with 4 additions and 4 deletions
|
@ -546,6 +546,10 @@ static ssize_t uvcg_default_output_b_source_id_store(struct config_item *item,
|
|||
int result;
|
||||
u8 num;
|
||||
|
||||
result = kstrtou8(page, 0, &num);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
mutex_lock(su_mutex); /* for navigating configfs hierarchy */
|
||||
|
||||
opts_item = group->cg_item.ci_parent->ci_parent->
|
||||
|
@ -553,10 +557,6 @@ static ssize_t uvcg_default_output_b_source_id_store(struct config_item *item,
|
|||
opts = to_f_uvc_opts(opts_item);
|
||||
cd = &opts->uvc_output_terminal;
|
||||
|
||||
result = kstrtou8(page, 0, &num);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
mutex_lock(&opts->lock);
|
||||
cd->bSourceID = num;
|
||||
mutex_unlock(&opts->lock);
|
||||
|
|
Loading…
Add table
Reference in a new issue