From e185cdc144ae23993741c8f87007c8b42640b873 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 6 May 2023 11:18:03 +0900 Subject: [PATCH] 4.14-stable patches added patches: ima-allow-fix-uml-builds.patch ipmi-fix-ssif-not-responding-under-certain-cond.patch mips-fw-allow-firmware-to-pass-a-empty-env.patch perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch staging-iio-resolver-ads1210-fix-config-mode.patch usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch --- queue-4.14/ima-allow-fix-uml-builds.patch | 51 +++++++++++++ ...if-not-responding-under-certain-cond.patch | 73 +++++++++++++++++++ ...w-allow-firmware-to-pass-a-empty-env.patch | 35 +++++++++ ...-sysconf-__sc_thread_stack_min_value.patch | 49 +++++++++++++ queue-4.14/series | 6 ++ ...iio-resolver-ads1210-fix-config-mode.patch | 37 ++++++++++ ...3-fix-runtime-pm-imbalance-on-unbind.patch | 34 +++++++++ 7 files changed, 285 insertions(+) create mode 100644 queue-4.14/ima-allow-fix-uml-builds.patch create mode 100644 queue-4.14/ipmi-fix-ssif-not-responding-under-certain-cond.patch create mode 100644 queue-4.14/mips-fw-allow-firmware-to-pass-a-empty-env.patch create mode 100644 queue-4.14/perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch create mode 100644 queue-4.14/staging-iio-resolver-ads1210-fix-config-mode.patch create mode 100644 queue-4.14/usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch diff --git a/queue-4.14/ima-allow-fix-uml-builds.patch b/queue-4.14/ima-allow-fix-uml-builds.patch new file mode 100644 index 00000000000..675d2e9f168 --- /dev/null +++ b/queue-4.14/ima-allow-fix-uml-builds.patch @@ -0,0 +1,51 @@ +From 644f17412f5acf01a19af9d04a921937a2bc86c6 Mon Sep 17 00:00:00 2001 +From: Randy Dunlap +Date: Thu, 23 Feb 2023 19:27:03 -0800 +Subject: IMA: allow/fix UML builds + +From: Randy Dunlap + +commit 644f17412f5acf01a19af9d04a921937a2bc86c6 upstream. + +UML supports HAS_IOMEM since 0bbadafdc49d (um: allow disabling +NO_IOMEM). + +Current IMA build on UML fails on allmodconfig (with TCG_TPM=m): + +ld: security/integrity/ima/ima_queue.o: in function `ima_add_template_entry': +ima_queue.c:(.text+0x2d9): undefined reference to `tpm_pcr_extend' +ld: security/integrity/ima/ima_init.o: in function `ima_init': +ima_init.c:(.init.text+0x43f): undefined reference to `tpm_default_chip' +ld: security/integrity/ima/ima_crypto.o: in function `ima_calc_boot_aggregate_tfm': +ima_crypto.c:(.text+0x1044): undefined reference to `tpm_pcr_read' +ld: ima_crypto.c:(.text+0x10d8): undefined reference to `tpm_pcr_read' + +Modify the IMA Kconfig entry so that it selects TCG_TPM if HAS_IOMEM +is set, regardless of the UML Kconfig setting. +This updates TCG_TPM from =m to =y and fixes the linker errors. + +Fixes: f4a0391dfa91 ("ima: fix Kconfig dependencies") +Cc: Stable # v5.14+ +Signed-off-by: Randy Dunlap +Cc: Fabio Estevam +Cc: Richard Weinberger +Cc: Anton Ivanov +Cc: Johannes Berg +Cc: linux-um@lists.infradead.org +Signed-off-by: Mimi Zohar +Signed-off-by: Greg Kroah-Hartman +--- + security/integrity/ima/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/security/integrity/ima/Kconfig ++++ b/security/integrity/ima/Kconfig +@@ -8,7 +8,7 @@ config IMA + select CRYPTO_MD5 + select CRYPTO_SHA1 + select CRYPTO_HASH_INFO +- select TCG_TPM if HAS_IOMEM && !UML ++ select TCG_TPM if HAS_IOMEM + select TCG_TIS if TCG_TPM && X86 + select TCG_CRB if TCG_TPM && ACPI + select TCG_IBMVTPM if TCG_TPM && PPC_PSERIES diff --git a/queue-4.14/ipmi-fix-ssif-not-responding-under-certain-cond.patch b/queue-4.14/ipmi-fix-ssif-not-responding-under-certain-cond.patch new file mode 100644 index 00000000000..443b84a2888 --- /dev/null +++ b/queue-4.14/ipmi-fix-ssif-not-responding-under-certain-cond.patch @@ -0,0 +1,73 @@ +From 6d2555cde2918409b0331560e66f84a0ad4849c6 Mon Sep 17 00:00:00 2001 +From: Zhang Yuchen +Date: Wed, 12 Apr 2023 15:49:07 +0800 +Subject: ipmi: fix SSIF not responding under certain cond. + +From: Zhang Yuchen + +commit 6d2555cde2918409b0331560e66f84a0ad4849c6 upstream. + +The ipmi communication is not restored after a specific version of BMC is +upgraded on our server. +The ipmi driver does not respond after printing the following log: + + ipmi_ssif: Invalid response getting flags: 1c 1 + +I found that after entering this branch, ssif_info->ssif_state always +holds SSIF_GETTING_FLAGS and never return to IDLE. + +As a result, the driver cannot be loaded, because the driver status is +checked during the unload process and must be IDLE in shutdown_ssif(): + + while (ssif_info->ssif_state != SSIF_IDLE) + schedule_timeout(1); + +The process trigger this problem is: + +1. One msg timeout and next msg start send, and call +ssif_set_need_watch(). + +2. ssif_set_need_watch()->watch_timeout()->start_flag_fetch() change +ssif_state to SSIF_GETTING_FLAGS. + +3. In msg_done_handler() ssif_state == SSIF_GETTING_FLAGS, if an error +message is received, the second branch does not modify the ssif_state. + +4. All retry action need IS_SSIF_IDLE() == True. Include retry action in +watch_timeout(), msg_done_handler(). Sending msg does not work either. +SSIF_IDLE is also checked in start_next_msg(). + +5. The only thing that can be triggered in the SSIF driver is +watch_timeout(), after destory_user(), this timer will stop too. + +So, if enter this branch, the ssif_state will remain SSIF_GETTING_FLAGS +and can't send msg, no timer started, can't unload. + +We did a comparative test before and after adding this patch, and the +result is effective. + +Fixes: 259307074bfc ("ipmi: Add SMBus interface driver (SSIF)") + +Cc: stable@vger.kernel.org +Signed-off-by: Zhang Yuchen +Message-Id: <20230412074907.80046-1-zhangyuchen.lcr@bytedance.com> +Signed-off-by: Corey Minyard +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/ipmi/ipmi_ssif.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/char/ipmi/ipmi_ssif.c ++++ b/drivers/char/ipmi/ipmi_ssif.c +@@ -787,9 +787,9 @@ static void msg_done_handler(struct ssif + } else if (data[0] != (IPMI_NETFN_APP_REQUEST | 1) << 2 + || data[1] != IPMI_GET_MSG_FLAGS_CMD) { + /* +- * Don't abort here, maybe it was a queued +- * response to a previous command. ++ * Recv error response, give up. + */ ++ ssif_info->ssif_state = SSIF_IDLE; + ipmi_ssif_unlock_cond(ssif_info, flags); + pr_warn(PFX "Invalid response getting flags: %x %x\n", + data[0], data[1]); diff --git a/queue-4.14/mips-fw-allow-firmware-to-pass-a-empty-env.patch b/queue-4.14/mips-fw-allow-firmware-to-pass-a-empty-env.patch new file mode 100644 index 00000000000..43f29e931ab --- /dev/null +++ b/queue-4.14/mips-fw-allow-firmware-to-pass-a-empty-env.patch @@ -0,0 +1,35 @@ +From ee1809ed7bc456a72dc8410b475b73021a3a68d5 Mon Sep 17 00:00:00 2001 +From: Jiaxun Yang +Date: Tue, 11 Apr 2023 12:14:26 +0100 +Subject: MIPS: fw: Allow firmware to pass a empty env + +From: Jiaxun Yang + +commit ee1809ed7bc456a72dc8410b475b73021a3a68d5 upstream. + +fw_getenv will use env entry to determine style of env, +however it is legal for firmware to just pass a empty list. + +Check if first entry exist before running strchr to avoid +null pointer dereference. + +Cc: stable@vger.kernel.org +Link: https://github.com/clbr/n64bootloader/issues/5 +Signed-off-by: Jiaxun Yang +Signed-off-by: Thomas Bogendoerfer +Signed-off-by: Greg Kroah-Hartman +--- + arch/mips/fw/lib/cmdline.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/fw/lib/cmdline.c ++++ b/arch/mips/fw/lib/cmdline.c +@@ -51,7 +51,7 @@ char *fw_getenv(char *envname) + { + char *result = NULL; + +- if (_fw_envp != NULL) { ++ if (_fw_envp != NULL && fw_envp(0) != NULL) { + /* + * Return a pointer to the given environment variable. + * YAMON uses "name", "value" pairs, while U-Boot uses diff --git a/queue-4.14/perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch b/queue-4.14/perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch new file mode 100644 index 00000000000..ca88558e6b3 --- /dev/null +++ b/queue-4.14/perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch @@ -0,0 +1,49 @@ +From d08c84e01afa7a7eee6badab25d5420fa847f783 Mon Sep 17 00:00:00 2001 +From: Arnaldo Carvalho de Melo +Date: Wed, 14 Jul 2021 13:06:38 -0300 +Subject: perf sched: Cast PTHREAD_STACK_MIN to int as it may turn into sysconf(__SC_THREAD_STACK_MIN_VALUE) + +From: Arnaldo Carvalho de Melo + +commit d08c84e01afa7a7eee6badab25d5420fa847f783 upstream. + +In fedora rawhide the PTHREAD_STACK_MIN define may end up expanded to a +sysconf() call, and that will return 'long int', breaking the build: + + 45 fedora:rawhide : FAIL gcc version 11.1.1 20210623 (Red Hat 11.1.1-6) (GCC) + builtin-sched.c: In function 'create_tasks': + /git/perf-5.14.0-rc1/tools/include/linux/kernel.h:43:24: error: comparison of distinct pointer types lacks a cast [-Werror] + 43 | (void) (&_max1 == &_max2); \ + | ^~ + builtin-sched.c:673:34: note: in expansion of macro 'max' + 673 | (size_t) max(16 * 1024, PTHREAD_STACK_MIN)); + | ^~~ + cc1: all warnings being treated as errors + + $ grep __sysconf /usr/include/*/*.h + /usr/include/bits/pthread_stack_min-dynamic.h:extern long int __sysconf (int __name) __THROW; + /usr/include/bits/pthread_stack_min-dynamic.h:# define PTHREAD_STACK_MIN __sysconf (__SC_THREAD_STACK_MIN_VALUE) + /usr/include/bits/time.h:extern long int __sysconf (int); + /usr/include/bits/time.h:# define CLK_TCK ((__clock_t) __sysconf (2)) /* 2 is _SC_CLK_TCK */ + $ + +So cast it to int to cope with that. + +Signed-off-by: Arnaldo Carvalho de Melo +Cc: Guenter Roeck +Signed-off-by: Greg Kroah-Hartman +--- + tools/perf/builtin-sched.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/tools/perf/builtin-sched.c ++++ b/tools/perf/builtin-sched.c +@@ -655,7 +655,7 @@ static void create_tasks(struct perf_sch + err = pthread_attr_init(&attr); + BUG_ON(err); + err = pthread_attr_setstacksize(&attr, +- (size_t) max(16 * 1024, PTHREAD_STACK_MIN)); ++ (size_t) max(16 * 1024, (int)PTHREAD_STACK_MIN)); + BUG_ON(err); + err = pthread_mutex_lock(&sched->start_work_mutex); + BUG_ON(err); diff --git a/queue-4.14/series b/queue-4.14/series index 2346d42f567..3b6ad505b3a 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -2,3 +2,9 @@ wifi-brcmfmac-slab-out-of-bounds-read-in-brcmf_get_assoc_ies.patch bluetooth-perform-careful-capability-checks-in-hci_sock_ioctl.patch usb-serial-option-add-unisoc-vendor-and-tozed-lt70c-product.patch iio-adc-palmas_gpadc-fix-null-dereference-on-rmmod.patch +ima-allow-fix-uml-builds.patch +usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch +perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch +staging-iio-resolver-ads1210-fix-config-mode.patch +mips-fw-allow-firmware-to-pass-a-empty-env.patch +ipmi-fix-ssif-not-responding-under-certain-cond.patch diff --git a/queue-4.14/staging-iio-resolver-ads1210-fix-config-mode.patch b/queue-4.14/staging-iio-resolver-ads1210-fix-config-mode.patch new file mode 100644 index 00000000000..128f4f6756d --- /dev/null +++ b/queue-4.14/staging-iio-resolver-ads1210-fix-config-mode.patch @@ -0,0 +1,37 @@ +From 16313403d873ff17a587818b61f84c8cb4971cef Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nuno=20S=C3=A1?= +Date: Mon, 27 Mar 2023 16:54:14 +0200 +Subject: staging: iio: resolver: ads1210: fix config mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Nuno Sá + +commit 16313403d873ff17a587818b61f84c8cb4971cef upstream. + +As stated in the device datasheet [1], bits a0 and a1 have to be set to +1 for the configuration mode. + +[1]: https://www.analog.com/media/en/technical-documentation/data-sheets/ad2s1210.pdf + +Fixes: b19e9ad5e2cb9 ("staging:iio:resolver:ad2s1210 general driver cleanup") +Cc: stable +Signed-off-by: Nuno Sá +Link: https://lore.kernel.org/r/20230327145414.1505537-1-nuno.sa@analog.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/staging/iio/resolver/ad2s1210.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/staging/iio/resolver/ad2s1210.c ++++ b/drivers/staging/iio/resolver/ad2s1210.c +@@ -96,7 +96,7 @@ struct ad2s1210_state { + static const int ad2s1210_mode_vals[4][2] = { + [MOD_POS] = { 0, 0 }, + [MOD_VEL] = { 0, 1 }, +- [MOD_CONFIG] = { 1, 0 }, ++ [MOD_CONFIG] = { 1, 1 }, + }; + + static inline void ad2s1210_set_mode(enum ad2s1210_mode mode, diff --git a/queue-4.14/usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch b/queue-4.14/usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch new file mode 100644 index 00000000000..0f8fc3471d8 --- /dev/null +++ b/queue-4.14/usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch @@ -0,0 +1,34 @@ +From 44d257e9012ee8040e41d224d0e5bfb5ef5427ea Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 4 Apr 2023 09:25:15 +0200 +Subject: USB: dwc3: fix runtime pm imbalance on unbind + +From: Johan Hovold + +commit 44d257e9012ee8040e41d224d0e5bfb5ef5427ea upstream. + +Make sure to balance the runtime PM usage count on driver unbind by +adding back the pm_runtime_allow() call that had been erroneously +removed. + +Fixes: 266d0493900a ("usb: dwc3: core: don't trigger runtime pm when remove driver") +Cc: stable@vger.kernel.org # 5.9 +Cc: Li Jun +Acked-by: Thinh Nguyen +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20230404072524.19014-3-johan+linaro@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/core.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -1348,6 +1348,7 @@ static int dwc3_remove(struct platform_d + dwc3_core_exit(dwc); + dwc3_ulpi_exit(dwc); + ++ pm_runtime_allow(&pdev->dev); + pm_runtime_disable(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_set_suspended(&pdev->dev); -- 2.47.3