From 662e01dc2fc8cfab00d0789b300920cd050a0554 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 6 May 2023 11:18:06 +0900 Subject: [PATCH] 5.4-stable patches added patches: ima-allow-fix-uml-builds.patch ipmi-fix-ssif-not-responding-under-certain-cond.patch ipmi-ssif-add-send_retries-increment.patch kheaders-use-array-declaration-instead-of-char.patch mips-fw-allow-firmware-to-pass-a-empty-env.patch pci-pciehp-fix-ab-ba-deadlock-between-reset_lock-and-device_lock.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-probe-errors.patch usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch xhci-fix-debugfs-register-accesses-while-suspended.patch --- queue-5.4/ima-allow-fix-uml-builds.patch | 51 +++++ ...if-not-responding-under-certain-cond.patch | 73 +++++++ ...ipmi-ssif-add-send_retries-increment.patch | 34 ++++ ...se-array-declaration-instead-of-char.patch | 80 ++++++++ ...w-allow-firmware-to-pass-a-empty-env.patch | 35 ++++ ...k-between-reset_lock-and-device_lock.patch | 178 ++++++++++++++++++ ...-sysconf-__sc_thread_stack_min_value.patch | 49 +++++ queue-5.4/series | 11 ++ ...iio-resolver-ads1210-fix-config-mode.patch | 37 ++++ ...runtime-pm-imbalance-on-probe-errors.patch | 57 ++++++ ...3-fix-runtime-pm-imbalance-on-unbind.patch | 34 ++++ ...fs-register-accesses-while-suspended.patch | 33 ++++ 12 files changed, 672 insertions(+) create mode 100644 queue-5.4/ima-allow-fix-uml-builds.patch create mode 100644 queue-5.4/ipmi-fix-ssif-not-responding-under-certain-cond.patch create mode 100644 queue-5.4/ipmi-ssif-add-send_retries-increment.patch create mode 100644 queue-5.4/kheaders-use-array-declaration-instead-of-char.patch create mode 100644 queue-5.4/mips-fw-allow-firmware-to-pass-a-empty-env.patch create mode 100644 queue-5.4/pci-pciehp-fix-ab-ba-deadlock-between-reset_lock-and-device_lock.patch create mode 100644 queue-5.4/perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch create mode 100644 queue-5.4/staging-iio-resolver-ads1210-fix-config-mode.patch create mode 100644 queue-5.4/usb-dwc3-fix-runtime-pm-imbalance-on-probe-errors.patch create mode 100644 queue-5.4/usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch create mode 100644 queue-5.4/xhci-fix-debugfs-register-accesses-while-suspended.patch diff --git a/queue-5.4/ima-allow-fix-uml-builds.patch b/queue-5.4/ima-allow-fix-uml-builds.patch new file mode 100644 index 00000000000..b2c8eaffec5 --- /dev/null +++ b/queue-5.4/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_HMAC + 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-5.4/ipmi-fix-ssif-not-responding-under-certain-cond.patch b/queue-5.4/ipmi-fix-ssif-not-responding-under-certain-cond.patch new file mode 100644 index 00000000000..c6812ded922 --- /dev/null +++ b/queue-5.4/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 +@@ -791,9 +791,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); + dev_warn(&ssif_info->client->dev, + "Invalid response getting flags: %x %x\n", diff --git a/queue-5.4/ipmi-ssif-add-send_retries-increment.patch b/queue-5.4/ipmi-ssif-add-send_retries-increment.patch new file mode 100644 index 00000000000..84e57fdeecb --- /dev/null +++ b/queue-5.4/ipmi-ssif-add-send_retries-increment.patch @@ -0,0 +1,34 @@ +From 6ce7995a43febe693d4894033c6e29314970646a Mon Sep 17 00:00:00 2001 +From: Corey Minyard +Date: Tue, 4 Apr 2023 12:09:14 +0000 +Subject: ipmi:ssif: Add send_retries increment + +From: Corey Minyard + +commit 6ce7995a43febe693d4894033c6e29314970646a upstream. + +A recent change removed an increment of send_retries, re-add it. + +Fixes: 95767ed78a18 ipmi:ssif: resend_msg() cannot fail +Reported-by: Pavel Machek +Cc: stable@vger.kernel.org +Signed-off-by: Corey Minyard +Signed-off-by: Greg Kroah-Hartman +--- + drivers/char/ipmi/ipmi_ssif.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/char/ipmi/ipmi_ssif.c ++++ b/drivers/char/ipmi/ipmi_ssif.c +@@ -562,8 +562,10 @@ static void retry_timeout(struct timer_l + + if (waiting) + start_get(ssif_info); +- if (resend) ++ if (resend) { + start_resend(ssif_info); ++ ssif_inc_stat(ssif_info, send_retries); ++ } + } + + static void watch_timeout(struct timer_list *t) diff --git a/queue-5.4/kheaders-use-array-declaration-instead-of-char.patch b/queue-5.4/kheaders-use-array-declaration-instead-of-char.patch new file mode 100644 index 00000000000..95dabb388c2 --- /dev/null +++ b/queue-5.4/kheaders-use-array-declaration-instead-of-char.patch @@ -0,0 +1,80 @@ +From b69edab47f1da8edd8e7bfdf8c70f51a2a5d89fb Mon Sep 17 00:00:00 2001 +From: Kees Cook +Date: Thu, 2 Mar 2023 14:49:50 -0800 +Subject: kheaders: Use array declaration instead of char + +From: Kees Cook + +commit b69edab47f1da8edd8e7bfdf8c70f51a2a5d89fb upstream. + +Under CONFIG_FORTIFY_SOURCE, memcpy() will check the size of destination +and source buffers. Defining kernel_headers_data as "char" would trip +this check. Since these addresses are treated as byte arrays, define +them as arrays (as done everywhere else). + +This was seen with: + + $ cat /sys/kernel/kheaders.tar.xz >> /dev/null + + detected buffer overflow in memcpy + kernel BUG at lib/string_helpers.c:1027! + ... + RIP: 0010:fortify_panic+0xf/0x20 + [...] + Call Trace: + + ikheaders_read+0x45/0x50 [kheaders] + kernfs_fop_read_iter+0x1a4/0x2f0 + ... + +Reported-by: Jakub Kicinski +Link: https://lore.kernel.org/bpf/20230302112130.6e402a98@kernel.org/ +Acked-by: Joel Fernandes (Google) +Reviewed-by: Alexander Lobakin +Tested-by: Jakub Kicinski +Fixes: 43d8ce9d65a5 ("Provide in-kernel headers to make extending kernel easier") +Cc: stable@vger.kernel.org +Signed-off-by: Kees Cook +Link: https://lore.kernel.org/r/20230302224946.never.243-kees@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + kernel/kheaders.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/kernel/kheaders.c b/kernel/kheaders.c +index 8f69772af77b..42163c9e94e5 100644 +--- a/kernel/kheaders.c ++++ b/kernel/kheaders.c +@@ -26,15 +26,15 @@ asm ( + " .popsection \n" + ); + +-extern char kernel_headers_data; +-extern char kernel_headers_data_end; ++extern char kernel_headers_data[]; ++extern char kernel_headers_data_end[]; + + static ssize_t + ikheaders_read(struct file *file, struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t len) + { +- memcpy(buf, &kernel_headers_data + off, len); ++ memcpy(buf, &kernel_headers_data[off], len); + return len; + } + +@@ -48,8 +48,8 @@ static struct bin_attribute kheaders_attr __ro_after_init = { + + static int __init ikheaders_init(void) + { +- kheaders_attr.size = (&kernel_headers_data_end - +- &kernel_headers_data); ++ kheaders_attr.size = (kernel_headers_data_end - ++ kernel_headers_data); + return sysfs_create_bin_file(kernel_kobj, &kheaders_attr); + } + +-- +2.40.1 + diff --git a/queue-5.4/mips-fw-allow-firmware-to-pass-a-empty-env.patch b/queue-5.4/mips-fw-allow-firmware-to-pass-a-empty-env.patch new file mode 100644 index 00000000000..43f29e931ab --- /dev/null +++ b/queue-5.4/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-5.4/pci-pciehp-fix-ab-ba-deadlock-between-reset_lock-and-device_lock.patch b/queue-5.4/pci-pciehp-fix-ab-ba-deadlock-between-reset_lock-and-device_lock.patch new file mode 100644 index 00000000000..38ef98435ef --- /dev/null +++ b/queue-5.4/pci-pciehp-fix-ab-ba-deadlock-between-reset_lock-and-device_lock.patch @@ -0,0 +1,178 @@ +From f5eff5591b8f9c5effd25c92c758a127765f74c1 Mon Sep 17 00:00:00 2001 +From: Lukas Wunner +Date: Tue, 11 Apr 2023 08:21:02 +0200 +Subject: PCI: pciehp: Fix AB-BA deadlock between reset_lock and device_lock + +From: Lukas Wunner + +commit f5eff5591b8f9c5effd25c92c758a127765f74c1 upstream. + +In 2013, commits + + 2e35afaefe64 ("PCI: pciehp: Add reset_slot() method") + 608c388122c7 ("PCI: Add slot reset option to pci_dev_reset()") + +amended PCIe hotplug to mask Presence Detect Changed events during a +Secondary Bus Reset. The reset thus no longer causes gratuitous slot +bringdown and bringup. + +However the commits neglected to serialize reset with code paths reading +slot registers. For instance, a slot bringup due to an earlier hotplug +event may see the Presence Detect State bit cleared during a concurrent +Secondary Bus Reset. + +In 2018, commit + + 5b3f7b7d062b ("PCI: pciehp: Avoid slot access during reset") + +retrofitted the missing locking. It introduced a reset_lock which +serializes a Secondary Bus Reset with other parts of pciehp. + +Unfortunately the locking turns out to be overzealous: reset_lock is +held for the entire enumeration and de-enumeration of hotplugged devices, +including driver binding and unbinding. + +Driver binding and unbinding acquires device_lock while the reset_lock +of the ancestral hotplug port is held. A concurrent Secondary Bus Reset +acquires the ancestral reset_lock while already holding the device_lock. +The asymmetric locking order in the two code paths can lead to AB-BA +deadlocks. + +Michael Haeuptle reports such deadlocks on simultaneous hot-removal and +vfio release (the latter implies a Secondary Bus Reset): + + pciehp_ist() # down_read(reset_lock) + pciehp_handle_presence_or_link_change() + pciehp_disable_slot() + __pciehp_disable_slot() + remove_board() + pciehp_unconfigure_device() + pci_stop_and_remove_bus_device() + pci_stop_bus_device() + pci_stop_dev() + device_release_driver() + device_release_driver_internal() + __device_driver_lock() # device_lock() + + SYS_munmap() + vfio_device_fops_release() + vfio_device_group_close() + vfio_device_close() + vfio_device_last_close() + vfio_pci_core_close_device() + vfio_pci_core_disable() # device_lock() + __pci_reset_function_locked() + pci_reset_bus_function() + pci_dev_reset_slot_function() + pci_reset_hotplug_slot() + pciehp_reset_slot() # down_write(reset_lock) + +Ian May reports the same deadlock on simultaneous hot-removal and an +AER-induced Secondary Bus Reset: + + aer_recover_work_func() + pcie_do_recovery() + aer_root_reset() + pci_bus_error_reset() + pci_slot_reset() + pci_slot_lock() # device_lock() + pci_reset_hotplug_slot() + pciehp_reset_slot() # down_write(reset_lock) + +Fix by releasing the reset_lock during driver binding and unbinding, +thereby splitting and shrinking the critical section. + +Driver binding and unbinding is protected by the device_lock() and thus +serialized with a Secondary Bus Reset. There's no need to additionally +protect it with the reset_lock. However, pciehp does not bind and +unbind devices directly, but rather invokes PCI core functions which +also perform certain enumeration and de-enumeration steps. + +The reset_lock's purpose is to protect slot registers, not enumeration +and de-enumeration of hotplugged devices. That would arguably be the +job of the PCI core, not the PCIe hotplug driver. After all, an +AER-induced Secondary Bus Reset may as well happen during boot-time +enumeration of the PCI hierarchy and there's no locking to prevent that +either. + +Exempting *de-enumeration* from the reset_lock is relatively harmless: +A concurrent Secondary Bus Reset may foil config space accesses such as +PME interrupt disablement. But if the device is physically gone, those +accesses are pointless anyway. If the device is physically present and +only logically removed through an Attention Button press or the sysfs +"power" attribute, PME interrupts as well as DMA cannot come through +because pciehp_unconfigure_device() disables INTx and Bus Master bits. +That's still protected by the reset_lock in the present commit. + +Exempting *enumeration* from the reset_lock also has limited impact: +The exempted call to pci_bus_add_device() may perform device accesses +through pcibios_bus_add_device() and pci_fixup_device() which are now +no longer protected from a concurrent Secondary Bus Reset. Otherwise +there should be no impact. + +In essence, the present commit seeks to fix the AB-BA deadlocks while +still retaining a best-effort reset protection for enumeration and +de-enumeration of hotplugged devices -- until a general solution is +implemented in the PCI core. + +Link: https://lore.kernel.org/linux-pci/CS1PR8401MB0728FC6FDAB8A35C22BD90EC95F10@CS1PR8401MB0728.NAMPRD84.PROD.OUTLOOK.COM +Link: https://lore.kernel.org/linux-pci/20200615143250.438252-1-ian.may@canonical.com +Link: https://lore.kernel.org/linux-pci/ce878dab-c0c4-5bd0-a725-9805a075682d@amd.com +Link: https://lore.kernel.org/linux-pci/ed831249-384a-6d35-0831-70af191e9bce@huawei.com +Link: https://bugzilla.kernel.org/show_bug.cgi?id=215590 +Fixes: 5b3f7b7d062b ("PCI: pciehp: Avoid slot access during reset") +Link: https://lore.kernel.org/r/fef2b2e9edf245c049a8c5b94743c0f74ff5008a.1681191902.git.lukas@wunner.de +Reported-by: Michael Haeuptle +Reported-by: Ian May +Reported-by: Andrey Grodzovsky +Reported-by: Rahul Kumar +Reported-by: Jialin Zhang +Tested-by: Anatoli Antonovitch +Signed-off-by: Lukas Wunner +Signed-off-by: Bjorn Helgaas +Cc: stable@vger.kernel.org # v4.19+ +Cc: Dan Stein +Cc: Ashok Raj +Cc: Alex Michon +Cc: Xiongfeng Wang +Cc: Alex Williamson +Cc: Mika Westerberg +Cc: Sathyanarayanan Kuppuswamy +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pci/hotplug/pciehp_pci.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +--- a/drivers/pci/hotplug/pciehp_pci.c ++++ b/drivers/pci/hotplug/pciehp_pci.c +@@ -63,7 +63,14 @@ int pciehp_configure_device(struct contr + + pci_assign_unassigned_bridge_resources(bridge); + pcie_bus_configure_settings(parent); ++ ++ /* ++ * Release reset_lock during driver binding ++ * to avoid AB-BA deadlock with device_lock. ++ */ ++ up_read(&ctrl->reset_lock); + pci_bus_add_devices(parent); ++ down_read_nested(&ctrl->reset_lock, ctrl->depth); + + out: + pci_unlock_rescan_remove(); +@@ -104,7 +111,15 @@ void pciehp_unconfigure_device(struct co + list_for_each_entry_safe_reverse(dev, temp, &parent->devices, + bus_list) { + pci_dev_get(dev); ++ ++ /* ++ * Release reset_lock during driver unbinding ++ * to avoid AB-BA deadlock with device_lock. ++ */ ++ up_read(&ctrl->reset_lock); + pci_stop_and_remove_bus_device(dev); ++ down_read_nested(&ctrl->reset_lock, ctrl->depth); ++ + /* + * Ensure that no new Requests will be generated from + * the device. diff --git a/queue-5.4/perf-sched-cast-pthread_stack_min-to-int-as-it-may-turn-into-sysconf-__sc_thread_stack_min_value.patch b/queue-5.4/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..500fd216c34 --- /dev/null +++ b/queue-5.4/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 +@@ -666,7 +666,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-5.4/series b/queue-5.4/series index 4a90c704659..73563056be5 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -6,3 +6,14 @@ usb-serial-option-add-unisoc-vendor-and-tozed-lt70c-product.patch iio-adc-palmas_gpadc-fix-null-dereference-on-rmmod.patch asoc-intel-bytcr_rt5640-add-quirk-for-the-acer-iconi.patch asm-generic-io.h-suppress-endianness-warnings-for-re.patch +pci-pciehp-fix-ab-ba-deadlock-between-reset_lock-and-device_lock.patch +ima-allow-fix-uml-builds.patch +usb-dwc3-fix-runtime-pm-imbalance-on-probe-errors.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 +xhci-fix-debugfs-register-accesses-while-suspended.patch +mips-fw-allow-firmware-to-pass-a-empty-env.patch +ipmi-ssif-add-send_retries-increment.patch +ipmi-fix-ssif-not-responding-under-certain-cond.patch +kheaders-use-array-declaration-instead-of-char.patch diff --git a/queue-5.4/staging-iio-resolver-ads1210-fix-config-mode.patch b/queue-5.4/staging-iio-resolver-ads1210-fix-config-mode.patch new file mode 100644 index 00000000000..6f853d0c46c --- /dev/null +++ b/queue-5.4/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 +@@ -101,7 +101,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-5.4/usb-dwc3-fix-runtime-pm-imbalance-on-probe-errors.patch b/queue-5.4/usb-dwc3-fix-runtime-pm-imbalance-on-probe-errors.patch new file mode 100644 index 00000000000..cef13ca93be --- /dev/null +++ b/queue-5.4/usb-dwc3-fix-runtime-pm-imbalance-on-probe-errors.patch @@ -0,0 +1,57 @@ +From 9a8ad10c9f2e0925ff26308ec6756b93fc2f4977 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 4 Apr 2023 09:25:14 +0200 +Subject: USB: dwc3: fix runtime pm imbalance on probe errors + +From: Johan Hovold + +commit 9a8ad10c9f2e0925ff26308ec6756b93fc2f4977 upstream. + +Make sure not to suspend the device when probe fails to avoid disabling +clocks and phys multiple times. + +Fixes: 328082376aea ("usb: dwc3: fix runtime PM in error path") +Cc: stable@vger.kernel.org # 4.8 +Cc: Roger Quadros +Acked-by: Thinh Nguyen +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20230404072524.19014-2-johan+linaro@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/dwc3/core.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +--- a/drivers/usb/dwc3/core.c ++++ b/drivers/usb/dwc3/core.c +@@ -1496,13 +1496,11 @@ static int dwc3_probe(struct platform_de + + spin_lock_init(&dwc->lock); + ++ pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_use_autosuspend(dev); + pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY); + pm_runtime_enable(dev); +- ret = pm_runtime_get_sync(dev); +- if (ret < 0) +- goto err1; + + pm_runtime_forbid(dev); + +@@ -1562,12 +1560,10 @@ err3: + dwc3_free_event_buffers(dwc); + + err2: +- pm_runtime_allow(&pdev->dev); +- +-err1: +- pm_runtime_put_sync(&pdev->dev); +- pm_runtime_disable(&pdev->dev); +- ++ pm_runtime_allow(dev); ++ pm_runtime_disable(dev); ++ pm_runtime_set_suspended(dev); ++ pm_runtime_put_noidle(dev); + disable_clks: + clk_bulk_disable_unprepare(dwc->num_clks, dwc->clks); + assert_reset: diff --git a/queue-5.4/usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch b/queue-5.4/usb-dwc3-fix-runtime-pm-imbalance-on-unbind.patch new file mode 100644 index 00000000000..ed130e04c1c --- /dev/null +++ b/queue-5.4/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 +@@ -1584,6 +1584,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); diff --git a/queue-5.4/xhci-fix-debugfs-register-accesses-while-suspended.patch b/queue-5.4/xhci-fix-debugfs-register-accesses-while-suspended.patch new file mode 100644 index 00000000000..08d9821c0f9 --- /dev/null +++ b/queue-5.4/xhci-fix-debugfs-register-accesses-while-suspended.patch @@ -0,0 +1,33 @@ +From 735baf1b23458f71a8b15cb924af22c9ff9cd125 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Wed, 5 Apr 2023 11:03:42 +0200 +Subject: xhci: fix debugfs register accesses while suspended + +From: Johan Hovold + +commit 735baf1b23458f71a8b15cb924af22c9ff9cd125 upstream. + +Wire up the debugfs regset device pointer so that the controller is +resumed before accessing registers to avoid crashing or locking up if it +happens to be runtime suspended. + +Fixes: 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver") +Cc: stable@vger.kernel.org # 4.15: 30332eeefec8: debugfs: regset32: Add Runtime PM support +Cc: stable@vger.kernel.org # 4.15 +Signed-off-by: Johan Hovold +Link: https://lore.kernel.org/r/20230405090342.7363-1-johan+linaro@kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/xhci-debugfs.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/usb/host/xhci-debugfs.c ++++ b/drivers/usb/host/xhci-debugfs.c +@@ -132,6 +132,7 @@ static void xhci_debugfs_regset(struct x + regset->regs = regs; + regset->nregs = nregs; + regset->base = hcd->regs + base; ++ regset->dev = hcd->self.controller; + + debugfs_create_regset32((const char *)rgs->name, 0444, parent, regset); + } -- 2.47.3