From: Greg Kroah-Hartman Date: Fri, 10 Mar 2023 13:27:22 +0000 (+0100) Subject: 5.15-stable patches X-Git-Tag: v6.1.17~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c5fec4707cac8e78a9024658af04db8ff2e973c1;p=thirdparty%2Fkernel%2Fstable-queue.git 5.15-stable patches added patches: usb-gadget-uvc-fix-missing-mutex_unlock-if-kstrtou8-fails.patch --- diff --git a/queue-5.15/series b/queue-5.15/series index e478910b7d6..412d772b7fb 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -133,3 +133,4 @@ scsi-mpt3sas-don-t-change-dma-mask-while-reallocating-pools.patch scsi-mpt3sas-re-do-lost-mpt3sas-dma-mask-fix.patch scsi-mpt3sas-remove-usage-of-dma_get_required_mask-api.patch malidp-fix-null-vs-is_err-checking.patch +usb-gadget-uvc-fix-missing-mutex_unlock-if-kstrtou8-fails.patch diff --git a/queue-5.15/usb-gadget-uvc-fix-missing-mutex_unlock-if-kstrtou8-fails.patch b/queue-5.15/usb-gadget-uvc-fix-missing-mutex_unlock-if-kstrtou8-fails.patch new file mode 100644 index 00000000000..4bb2dd37062 --- /dev/null +++ b/queue-5.15/usb-gadget-uvc-fix-missing-mutex_unlock-if-kstrtou8-fails.patch @@ -0,0 +1,45 @@ +From 7ebb605d2283fb2647b4fa82030307ce00bee436 Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Mon, 13 Feb 2023 15:09:26 +0800 +Subject: usb: gadget: uvc: fix missing mutex_unlock() if kstrtou8() fails + +From: Yang Yingliang + +commit 7ebb605d2283fb2647b4fa82030307ce00bee436 upstream. + +If kstrtou8() fails, the mutex_unlock() is missed, move kstrtou8() +before mutex_lock() to fix it up. + +Fixes: 0525210c9840 ("usb: gadget: uvc: Allow definition of XUs in configfs") +Fixes: b3c839bd8a07 ("usb: gadget: uvc: Make bSourceID read/write") +Signed-off-by: Yang Yingliang +Link: https://lore.kernel.org/r/20230213070926.776447-1-yangyingliang@huawei.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/gadget/function/uvc_configfs.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/usb/gadget/function/uvc_configfs.c ++++ b/drivers/usb/gadget/function/uvc_configfs.c +@@ -546,6 +546,10 @@ static ssize_t uvcg_default_output_b_sou + 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_sou + 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);