From df7378c418af1dbff6bc295110835a17b84d3af4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 23 Dec 2020 12:36:42 +0100 Subject: [PATCH] 4.9-stable patches added patches: arm-dts-exynos-fix-roles-of-usb-3.0-ports-on-odroid-xu.patch arm-dts-exynos-fix-usb-3.0-pins-supply-being-turned-off-on-odroid-xu.patch arm-dts-exynos-fix-usb-3.0-vbus-control-and-over-current-pins-on-exynos5410.patch soc-tegra-fuse-fix-index-bug-in-get_process_id.patch usb-chipidea-ci_hdrc_imx-pass-disable_device_streaming-flag-to-imx6ul.patch usb-gadget-f_acm-add-support-for-superspeed-plus.patch usb-gadget-f_fs-re-use-ss-descriptors-for-superspeedplus.patch usb-gadget-f_midi-setup-superspeed-plus-descriptors.patch usb-gadget-f_rndis-fix-bitrate-for-superspeed-and-above.patch usb-serial-option-add-interface-number-sanity-check-to-flag-handling.patch --- ...-roles-of-usb-3.0-ports-on-odroid-xu.patch | 40 +++++++++ ...supply-being-turned-off-on-odroid-xu.patch | 38 ++++++++ ...-and-over-current-pins-on-exynos5410.patch | 89 +++++++++++++++++++ queue-4.9/series | 10 +++ ...fuse-fix-index-bug-in-get_process_id.patch | 33 +++++++ ...able_device_streaming-flag-to-imx6ul.patch | 38 ++++++++ ..._acm-add-support-for-superspeed-plus.patch | 35 ++++++++ ...se-ss-descriptors-for-superspeedplus.patch | 69 ++++++++++++++ ...di-setup-superspeed-plus-descriptors.patch | 38 ++++++++ ...fix-bitrate-for-superspeed-and-above.patch | 40 +++++++++ ...number-sanity-check-to-flag-handling.patch | 85 ++++++++++++++++++ 11 files changed, 515 insertions(+) create mode 100644 queue-4.9/arm-dts-exynos-fix-roles-of-usb-3.0-ports-on-odroid-xu.patch create mode 100644 queue-4.9/arm-dts-exynos-fix-usb-3.0-pins-supply-being-turned-off-on-odroid-xu.patch create mode 100644 queue-4.9/arm-dts-exynos-fix-usb-3.0-vbus-control-and-over-current-pins-on-exynos5410.patch create mode 100644 queue-4.9/soc-tegra-fuse-fix-index-bug-in-get_process_id.patch create mode 100644 queue-4.9/usb-chipidea-ci_hdrc_imx-pass-disable_device_streaming-flag-to-imx6ul.patch create mode 100644 queue-4.9/usb-gadget-f_acm-add-support-for-superspeed-plus.patch create mode 100644 queue-4.9/usb-gadget-f_fs-re-use-ss-descriptors-for-superspeedplus.patch create mode 100644 queue-4.9/usb-gadget-f_midi-setup-superspeed-plus-descriptors.patch create mode 100644 queue-4.9/usb-gadget-f_rndis-fix-bitrate-for-superspeed-and-above.patch create mode 100644 queue-4.9/usb-serial-option-add-interface-number-sanity-check-to-flag-handling.patch diff --git a/queue-4.9/arm-dts-exynos-fix-roles-of-usb-3.0-ports-on-odroid-xu.patch b/queue-4.9/arm-dts-exynos-fix-roles-of-usb-3.0-ports-on-odroid-xu.patch new file mode 100644 index 00000000000..4a07dede5e6 --- /dev/null +++ b/queue-4.9/arm-dts-exynos-fix-roles-of-usb-3.0-ports-on-odroid-xu.patch @@ -0,0 +1,40 @@ +From ecc1ff532b499d20304a4f682247137025814c34 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Thu, 15 Oct 2020 20:20:41 +0200 +Subject: ARM: dts: exynos: fix roles of USB 3.0 ports on Odroid XU + +From: Krzysztof Kozlowski + +commit ecc1ff532b499d20304a4f682247137025814c34 upstream. + +On Odroid XU board the USB3-0 port is a microUSB and USB3-1 port is USB +type A (host). The roles were copied from Odroid XU3 (Exynos5422) +design which has it reversed. + +Fixes: 8149afe4dbf9 ("ARM: dts: exynos: Add initial support for Odroid XU board") +Signed-off-by: Krzysztof Kozlowski +Cc: +Link: https://lore.kernel.org/r/20201015182044.480562-1-krzk@kernel.org +Tested-by: Gabriel Ribba Esteva +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/boot/dts/exynos5410-odroidxu.dts | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/arm/boot/dts/exynos5410-odroidxu.dts ++++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts +@@ -560,11 +560,11 @@ + }; + + &usbdrd_dwc3_0 { +- dr_mode = "host"; ++ dr_mode = "peripheral"; + }; + + &usbdrd_dwc3_1 { +- dr_mode = "peripheral"; ++ dr_mode = "host"; + }; + + &usbdrd3_0 { diff --git a/queue-4.9/arm-dts-exynos-fix-usb-3.0-pins-supply-being-turned-off-on-odroid-xu.patch b/queue-4.9/arm-dts-exynos-fix-usb-3.0-pins-supply-being-turned-off-on-odroid-xu.patch new file mode 100644 index 00000000000..a588fe4f058 --- /dev/null +++ b/queue-4.9/arm-dts-exynos-fix-usb-3.0-pins-supply-being-turned-off-on-odroid-xu.patch @@ -0,0 +1,38 @@ +From bd7e7ff56feea7810df900fb09c9741d259861d9 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Thu, 15 Oct 2020 20:20:43 +0200 +Subject: ARM: dts: exynos: fix USB 3.0 pins supply being turned off on Odroid XU + +From: Krzysztof Kozlowski + +commit bd7e7ff56feea7810df900fb09c9741d259861d9 upstream. + +On Odroid XU LDO12 and LDO15 supplies the power to USB 3.0 blocks but +the GPK GPIO pins are supplied by LDO7 (VDDQ_LCD). LDO7 also supplies +GPJ GPIO pins. + +The Exynos pinctrl driver does not take any supplies, so to have entire +GPIO block always available, make the regulator always on. + +Fixes: 88644b4c750b ("ARM: dts: exynos: Configure PWM, usb3503, PMIC and thermal on Odroid XU board") +Signed-off-by: Krzysztof Kozlowski +Cc: +Link: https://lore.kernel.org/r/20201015182044.480562-3-krzk@kernel.org +Tested-by: Gabriel Ribba Esteva +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/boot/dts/exynos5410-odroidxu.dts | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/arch/arm/boot/dts/exynos5410-odroidxu.dts ++++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts +@@ -271,6 +271,8 @@ + regulator-name = "vddq_lcd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; ++ /* Supplies also GPK and GPJ */ ++ regulator-always-on; + }; + + ldo8_reg: LDO8 { diff --git a/queue-4.9/arm-dts-exynos-fix-usb-3.0-vbus-control-and-over-current-pins-on-exynos5410.patch b/queue-4.9/arm-dts-exynos-fix-usb-3.0-vbus-control-and-over-current-pins-on-exynos5410.patch new file mode 100644 index 00000000000..90e25c4680e --- /dev/null +++ b/queue-4.9/arm-dts-exynos-fix-usb-3.0-vbus-control-and-over-current-pins-on-exynos5410.patch @@ -0,0 +1,89 @@ +From 3d992fd8f4e0f09c980726308d2f2725587b32d6 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Thu, 15 Oct 2020 20:20:42 +0200 +Subject: ARM: dts: exynos: fix USB 3.0 VBUS control and over-current pins on Exynos5410 + +From: Krzysztof Kozlowski + +commit 3d992fd8f4e0f09c980726308d2f2725587b32d6 upstream. + +The VBUS control (PWREN) and over-current pins of USB 3.0 DWC3 +controllers are on Exynos5410 regular GPIOs. This is different than for +example on Exynos5422 where these are special ETC pins with proper reset +values (pulls, functions). + +Therefore these pins should be configured to enable proper USB 3.0 +peripheral and host modes. This also fixes over-current warning: + + [ 6.024658] usb usb4-port1: over-current condition + [ 6.028271] usb usb3-port1: over-current condition + +Fixes: cb0896562228 ("ARM: dts: exynos: Add USB to Exynos5410") +Signed-off-by: Krzysztof Kozlowski +Cc: +Link: https://lore.kernel.org/r/20201015182044.480562-2-krzk@kernel.org +Tested-by: Gabriel Ribba Esteva +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/boot/dts/exynos5410-pinctrl.dtsi | 28 ++++++++++++++++++++++++++++ + arch/arm/boot/dts/exynos5410.dtsi | 4 ++++ + 2 files changed, 32 insertions(+) + +--- a/arch/arm/boot/dts/exynos5410-pinctrl.dtsi ++++ b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi +@@ -563,6 +563,34 @@ + interrupt-controller; + #interrupt-cells = <2>; + }; ++ ++ usb3_1_oc: usb3-1-oc { ++ samsung,pins = "gpk2-4", "gpk2-5"; ++ samsung,pin-function = ; ++ samsung,pin-pud = ; ++ samsung,pin-drv = ; ++ }; ++ ++ usb3_1_vbusctrl: usb3-1-vbusctrl { ++ samsung,pins = "gpk2-6", "gpk2-7"; ++ samsung,pin-function = ; ++ samsung,pin-pud = ; ++ samsung,pin-drv = ; ++ }; ++ ++ usb3_0_oc: usb3-0-oc { ++ samsung,pins = "gpk3-0", "gpk3-1"; ++ samsung,pin-function = ; ++ samsung,pin-pud = ; ++ samsung,pin-drv = ; ++ }; ++ ++ usb3_0_vbusctrl: usb3-0-vbusctrl { ++ samsung,pins = "gpk3-2", "gpk3-3"; ++ samsung,pin-function = ; ++ samsung,pin-pud = ; ++ samsung,pin-drv = ; ++ }; + }; + + &pinctrl_2 { +--- a/arch/arm/boot/dts/exynos5410.dtsi ++++ b/arch/arm/boot/dts/exynos5410.dtsi +@@ -314,6 +314,8 @@ + &usbdrd3_0 { + clocks = <&clock CLK_USBD300>; + clock-names = "usbdrd30"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb3_0_oc>, <&usb3_0_vbusctrl>; + }; + + &usbdrd_phy0 { +@@ -325,6 +327,8 @@ + &usbdrd3_1 { + clocks = <&clock CLK_USBD301>; + clock-names = "usbdrd30"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb3_1_oc>, <&usb3_1_vbusctrl>; + }; + + &usbdrd_dwc3_1 { diff --git a/queue-4.9/series b/queue-4.9/series index 82882c05b4c..b4c6cf01b59 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -32,3 +32,13 @@ kernel-cpu-add-arch-override-for-clear_tasks_mm_cpum.patch drm-tegra-sor-disable-clocks-on-error-in-tegra_sor_i.patch scsi-mpt3sas-increase-iocinit-request-timeout-to-30s.patch dm-table-remove-bug_on-in_interrupt.patch +soc-tegra-fuse-fix-index-bug-in-get_process_id.patch +usb-serial-option-add-interface-number-sanity-check-to-flag-handling.patch +usb-gadget-f_acm-add-support-for-superspeed-plus.patch +usb-gadget-f_midi-setup-superspeed-plus-descriptors.patch +usb-gadget-f_rndis-fix-bitrate-for-superspeed-and-above.patch +usb-gadget-f_fs-re-use-ss-descriptors-for-superspeedplus.patch +usb-chipidea-ci_hdrc_imx-pass-disable_device_streaming-flag-to-imx6ul.patch +arm-dts-exynos-fix-roles-of-usb-3.0-ports-on-odroid-xu.patch +arm-dts-exynos-fix-usb-3.0-vbus-control-and-over-current-pins-on-exynos5410.patch +arm-dts-exynos-fix-usb-3.0-pins-supply-being-turned-off-on-odroid-xu.patch diff --git a/queue-4.9/soc-tegra-fuse-fix-index-bug-in-get_process_id.patch b/queue-4.9/soc-tegra-fuse-fix-index-bug-in-get_process_id.patch new file mode 100644 index 00000000000..613c5bca883 --- /dev/null +++ b/queue-4.9/soc-tegra-fuse-fix-index-bug-in-get_process_id.patch @@ -0,0 +1,33 @@ +From b9ce9b0f83b536a4ac7de7567a265d28d13e5bea Mon Sep 17 00:00:00 2001 +From: Nicolin Chen +Date: Wed, 18 Nov 2020 20:44:57 -0800 +Subject: soc/tegra: fuse: Fix index bug in get_process_id + +From: Nicolin Chen + +commit b9ce9b0f83b536a4ac7de7567a265d28d13e5bea upstream. + +This patch simply fixes a bug of referencing speedos[num] in every +for-loop iteration in get_process_id function. + +Fixes: 0dc5a0d83675 ("soc/tegra: fuse: Add Tegra210 support") +Cc: +Signed-off-by: Nicolin Chen +Signed-off-by: Thierry Reding +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/soc/tegra/fuse/speedo-tegra210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/soc/tegra/fuse/speedo-tegra210.c ++++ b/drivers/soc/tegra/fuse/speedo-tegra210.c +@@ -105,7 +105,7 @@ static int get_process_id(int value, con + unsigned int i; + + for (i = 0; i < num; i++) +- if (value < speedos[num]) ++ if (value < speedos[i]) + return i; + + return -EINVAL; diff --git a/queue-4.9/usb-chipidea-ci_hdrc_imx-pass-disable_device_streaming-flag-to-imx6ul.patch b/queue-4.9/usb-chipidea-ci_hdrc_imx-pass-disable_device_streaming-flag-to-imx6ul.patch new file mode 100644 index 00000000000..4eef20d88e6 --- /dev/null +++ b/queue-4.9/usb-chipidea-ci_hdrc_imx-pass-disable_device_streaming-flag-to-imx6ul.patch @@ -0,0 +1,38 @@ +From c7721e15f434920145c376e8fe77e1c079fc3726 Mon Sep 17 00:00:00 2001 +From: Fabio Estevam +Date: Mon, 7 Dec 2020 10:09:09 +0800 +Subject: usb: chipidea: ci_hdrc_imx: Pass DISABLE_DEVICE_STREAMING flag to imx6ul + +From: Fabio Estevam + +commit c7721e15f434920145c376e8fe77e1c079fc3726 upstream. + +According to the i.MX6UL Errata document: +https://www.nxp.com/docs/en/errata/IMX6ULCE.pdf + +ERR007881 also affects i.MX6UL, so pass the +CI_HDRC_DISABLE_DEVICE_STREAMING flag to workaround the issue. + +Fixes: 52fe568e5d71 ("usb: chipidea: imx: add imx6ul usb support") +Cc: +Signed-off-by: Fabio Estevam +Signed-off-by: Peter Chen +Link: https://lore.kernel.org/r/20201207020909.22483-2-peter.chen@kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/chipidea/ci_hdrc_imx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/usb/chipidea/ci_hdrc_imx.c ++++ b/drivers/usb/chipidea/ci_hdrc_imx.c +@@ -63,7 +63,8 @@ static const struct ci_hdrc_imx_platform + + static const struct ci_hdrc_imx_platform_flag imx6ul_usb_data = { + .flags = CI_HDRC_SUPPORTS_RUNTIME_PM | +- CI_HDRC_TURN_VBUS_EARLY_ON, ++ CI_HDRC_TURN_VBUS_EARLY_ON | ++ CI_HDRC_DISABLE_DEVICE_STREAMING, + }; + + static const struct ci_hdrc_imx_platform_flag imx7d_usb_data = { diff --git a/queue-4.9/usb-gadget-f_acm-add-support-for-superspeed-plus.patch b/queue-4.9/usb-gadget-f_acm-add-support-for-superspeed-plus.patch new file mode 100644 index 00000000000..91185fb8c0b --- /dev/null +++ b/queue-4.9/usb-gadget-f_acm-add-support-for-superspeed-plus.patch @@ -0,0 +1,35 @@ +From 3ee05c20656782387aa9eb010fdb9bb16982ac3f Mon Sep 17 00:00:00 2001 +From: "taehyun.cho" +Date: Fri, 27 Nov 2020 15:05:56 +0100 +Subject: USB: gadget: f_acm: add support for SuperSpeed Plus + +From: taehyun.cho + +commit 3ee05c20656782387aa9eb010fdb9bb16982ac3f upstream. + +Setup the SuperSpeed Plus descriptors for f_acm. This allows the gadget +to work properly without crashing at SuperSpeed rates. + +Cc: Felipe Balbi +Cc: stable +Signed-off-by: taehyun.cho +Signed-off-by: Will McVicker +Reviewed-by: Peter Chen +Link: https://lore.kernel.org/r/20201127140559.381351-3-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/function/f_acm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/usb/gadget/function/f_acm.c ++++ b/drivers/usb/gadget/function/f_acm.c +@@ -687,7 +687,7 @@ acm_bind(struct usb_configuration *c, st + acm_ss_out_desc.bEndpointAddress = acm_fs_out_desc.bEndpointAddress; + + status = usb_assign_descriptors(f, acm_fs_function, acm_hs_function, +- acm_ss_function, NULL); ++ acm_ss_function, acm_ss_function); + if (status) + goto fail; + diff --git a/queue-4.9/usb-gadget-f_fs-re-use-ss-descriptors-for-superspeedplus.patch b/queue-4.9/usb-gadget-f_fs-re-use-ss-descriptors-for-superspeedplus.patch new file mode 100644 index 00000000000..534a041f164 --- /dev/null +++ b/queue-4.9/usb-gadget-f_fs-re-use-ss-descriptors-for-superspeedplus.patch @@ -0,0 +1,69 @@ +From a353397b0d5dfa3c99b372505db3378fc919c6c6 Mon Sep 17 00:00:00 2001 +From: Jack Pham +Date: Tue, 27 Oct 2020 16:07:31 -0700 +Subject: usb: gadget: f_fs: Re-use SS descriptors for SuperSpeedPlus + +From: Jack Pham + +commit a353397b0d5dfa3c99b372505db3378fc919c6c6 upstream. + +In many cases a function that supports SuperSpeed can very well +operate in SuperSpeedPlus, if a gadget controller supports it, +as the endpoint descriptors (and companion descriptors) are +generally identical and can be re-used. This is true for two +commonly used functions: Android's ADB and MTP. So we can simply +assign the usb_function's ssp_descriptors array to point to its +ss_descriptors, if available. Similarly, we need to allow an +epfile's ioctl for FUNCTIONFS_ENDPOINT_DESC to correctly +return the corresponding SuperSpeed endpoint descriptor in case +the connected speed is SuperSpeedPlus as well. + +The only exception is if a function wants to implement an +Isochronous endpoint capable of transferring more than 48KB per +service interval when operating at greater than USB 3.1 Gen1 +speed, in which case it would require an additional SuperSpeedPlus +Isochronous Endpoint Companion descriptor to be returned as part +of the Configuration Descriptor. Support for that would need +to be separately added to the userspace-facing FunctionFS API +which may not be a trivial task--likely a new descriptor format +(v3?) may need to be devised to allow for separate SS and SSP +descriptors to be supplied. + +Signed-off-by: Jack Pham +Cc: stable +Link: https://lore.kernel.org/r/20201027230731.9073-1-jackp@codeaurora.org +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/function/f_fs.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/usb/gadget/function/f_fs.c ++++ b/drivers/usb/gadget/function/f_fs.c +@@ -1228,6 +1228,7 @@ static long ffs_epfile_ioctl(struct file + + switch (epfile->ffs->gadget->speed) { + case USB_SPEED_SUPER: ++ case USB_SPEED_SUPER_PLUS: + desc_idx = 2; + break; + case USB_SPEED_HIGH: +@@ -3067,7 +3068,8 @@ static int _ffs_func_bind(struct usb_con + } + + if (likely(super)) { +- func->function.ss_descriptors = vla_ptr(vlabuf, d, ss_descs); ++ func->function.ss_descriptors = func->function.ssp_descriptors = ++ vla_ptr(vlabuf, d, ss_descs); + ss_len = ffs_do_descs(ffs->ss_descs_count, + vla_ptr(vlabuf, d, raw_descs) + fs_len + hs_len, + d_raw_descs__sz - fs_len - hs_len, +@@ -3507,6 +3509,7 @@ static void ffs_func_unbind(struct usb_c + func->function.fs_descriptors = NULL; + func->function.hs_descriptors = NULL; + func->function.ss_descriptors = NULL; ++ func->function.ssp_descriptors = NULL; + func->interfaces_nums = NULL; + + ffs_event_add(ffs, FUNCTIONFS_UNBIND); diff --git a/queue-4.9/usb-gadget-f_midi-setup-superspeed-plus-descriptors.patch b/queue-4.9/usb-gadget-f_midi-setup-superspeed-plus-descriptors.patch new file mode 100644 index 00000000000..f409a8d97d6 --- /dev/null +++ b/queue-4.9/usb-gadget-f_midi-setup-superspeed-plus-descriptors.patch @@ -0,0 +1,38 @@ +From 457a902ba1a73b7720666b21ca038cd19764db18 Mon Sep 17 00:00:00 2001 +From: Will McVicker +Date: Fri, 27 Nov 2020 15:05:57 +0100 +Subject: USB: gadget: f_midi: setup SuperSpeed Plus descriptors + +From: Will McVicker + +commit 457a902ba1a73b7720666b21ca038cd19764db18 upstream. + +Needed for SuperSpeed Plus support for f_midi. This allows the +gadget to work properly without crashing at SuperSpeed rates. + +Cc: Felipe Balbi +Cc: stable +Signed-off-by: Will McVicker +Reviewed-by: Peter Chen +Link: https://lore.kernel.org/r/20201127140559.381351-4-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/function/f_midi.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/usb/gadget/function/f_midi.c ++++ b/drivers/usb/gadget/function/f_midi.c +@@ -1008,6 +1008,12 @@ static int f_midi_bind(struct usb_config + f->hs_descriptors = usb_copy_descriptors(midi_function); + if (!f->hs_descriptors) + goto fail_f_midi; ++ ++ if (gadget_is_superspeed_plus(c->cdev->gadget)) { ++ f->ssp_descriptors = usb_copy_descriptors(midi_function); ++ if (!f->ssp_descriptors) ++ goto fail_f_midi; ++ } + } + + kfree(midi_function); diff --git a/queue-4.9/usb-gadget-f_rndis-fix-bitrate-for-superspeed-and-above.patch b/queue-4.9/usb-gadget-f_rndis-fix-bitrate-for-superspeed-and-above.patch new file mode 100644 index 00000000000..552acfe3928 --- /dev/null +++ b/queue-4.9/usb-gadget-f_rndis-fix-bitrate-for-superspeed-and-above.patch @@ -0,0 +1,40 @@ +From b00f444f9add39b64d1943fa75538a1ebd54a290 Mon Sep 17 00:00:00 2001 +From: Will McVicker +Date: Fri, 27 Nov 2020 15:05:55 +0100 +Subject: USB: gadget: f_rndis: fix bitrate for SuperSpeed and above + +From: Will McVicker + +commit b00f444f9add39b64d1943fa75538a1ebd54a290 upstream. + +Align the SuperSpeed Plus bitrate for f_rndis to match f_ncm's ncm_bitrate +defined by commit 1650113888fe ("usb: gadget: f_ncm: add SuperSpeed descriptors +for CDC NCM"). + +Cc: Felipe Balbi +Cc: EJ Hsu +Cc: Peter Chen +Cc: stable +Signed-off-by: Will McVicker +Reviewed-by: Peter Chen +Link: https://lore.kernel.org/r/20201127140559.381351-2-gregkh@linuxfoundation.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/gadget/function/f_rndis.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/usb/gadget/function/f_rndis.c ++++ b/drivers/usb/gadget/function/f_rndis.c +@@ -91,8 +91,10 @@ static inline struct f_rndis *func_to_rn + /* peak (theoretical) bulk transfer rate in bits-per-second */ + static unsigned int bitrate(struct usb_gadget *g) + { ++ if (gadget_is_superspeed(g) && g->speed >= USB_SPEED_SUPER_PLUS) ++ return 4250000000U; + if (gadget_is_superspeed(g) && g->speed == USB_SPEED_SUPER) +- return 13 * 1024 * 8 * 1000 * 8; ++ return 3750000000U; + else if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH) + return 13 * 512 * 8 * 1000 * 8; + else diff --git a/queue-4.9/usb-serial-option-add-interface-number-sanity-check-to-flag-handling.patch b/queue-4.9/usb-serial-option-add-interface-number-sanity-check-to-flag-handling.patch new file mode 100644 index 00000000000..c7f8d367e78 --- /dev/null +++ b/queue-4.9/usb-serial-option-add-interface-number-sanity-check-to-flag-handling.patch @@ -0,0 +1,85 @@ +From a251963f76fa0226d0fdf0c4f989496f18d9ae7f Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 9 Dec 2020 11:42:21 +0100 +Subject: USB: serial: option: add interface-number sanity check to flag handling + +From: Johan Hovold + +commit a251963f76fa0226d0fdf0c4f989496f18d9ae7f upstream. + +Add an interface-number sanity check before testing the device flags to +avoid relying on undefined behaviour when left shifting in case a device +uses an interface number greater than or equal to BITS_PER_LONG (i.e. 64 +or 32). + +Reported-by: syzbot+8881b478dad0a7971f79@syzkaller.appspotmail.com +Fixes: c3a65808f04a ("USB: serial: option: reimplement interface masking") +Cc: stable@vger.kernel.org +Reviewed-by: Greg Kroah-Hartman +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/option.c | 23 +++++++++++++++++++++-- + 1 file changed, 21 insertions(+), 2 deletions(-) + +--- a/drivers/usb/serial/option.c ++++ b/drivers/usb/serial/option.c +@@ -563,6 +563,9 @@ static void option_instat_callback(struc + + /* Device flags */ + ++/* Highest interface number which can be used with NCTRL() and RSVD() */ ++#define FLAG_IFNUM_MAX 7 ++ + /* Interface does not support modem-control requests */ + #define NCTRL(ifnum) ((BIT(ifnum) & 0xff) << 8) + +@@ -2086,6 +2089,14 @@ static struct usb_serial_driver * const + + module_usb_serial_driver(serial_drivers, option_ids); + ++static bool iface_is_reserved(unsigned long device_flags, u8 ifnum) ++{ ++ if (ifnum > FLAG_IFNUM_MAX) ++ return false; ++ ++ return device_flags & RSVD(ifnum); ++} ++ + static int option_probe(struct usb_serial *serial, + const struct usb_device_id *id) + { +@@ -2103,7 +2114,7 @@ static int option_probe(struct usb_seria + * the same class/subclass/protocol as the serial interfaces. Look at + * the Windows driver .INF files for reserved interface numbers. + */ +- if (device_flags & RSVD(iface_desc->bInterfaceNumber)) ++ if (iface_is_reserved(device_flags, iface_desc->bInterfaceNumber)) + return -ENODEV; + /* + * Don't bind network interface on Samsung GT-B3730, it is handled by +@@ -2120,6 +2131,14 @@ static int option_probe(struct usb_seria + return 0; + } + ++static bool iface_no_modem_control(unsigned long device_flags, u8 ifnum) ++{ ++ if (ifnum > FLAG_IFNUM_MAX) ++ return false; ++ ++ return device_flags & NCTRL(ifnum); ++} ++ + static int option_attach(struct usb_serial *serial) + { + struct usb_interface_descriptor *iface_desc; +@@ -2135,7 +2154,7 @@ static int option_attach(struct usb_seri + + iface_desc = &serial->interface->cur_altsetting->desc; + +- if (!(device_flags & NCTRL(iface_desc->bInterfaceNumber))) ++ if (!iface_no_modem_control(device_flags, iface_desc->bInterfaceNumber)) + data->use_send_setup = 1; + + if (device_flags & ZLP) -- 2.47.3