From: Sasha Levin Date: Tue, 10 May 2022 00:57:02 +0000 (-0400) Subject: Fixes for 4.19 X-Git-Tag: v4.9.313~33 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7dff9f4728189e5a29e74d76ec10d2d153ba517a;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/hwmon-adt7470-fix-warning-on-module-removal.patch-23920 b/queue-4.19/hwmon-adt7470-fix-warning-on-module-removal.patch-23920 new file mode 100644 index 00000000000..951ba59a9b9 --- /dev/null +++ b/queue-4.19/hwmon-adt7470-fix-warning-on-module-removal.patch-23920 @@ -0,0 +1,49 @@ +From 9405929714bd8d8b913096bf8dbd23eb3b97527f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Apr 2022 12:13:12 +0200 +Subject: hwmon: (adt7470) Fix warning on module removal + +From: Armin Wolf + +[ Upstream commit 7b2666ce445c700b8dcee994da44ddcf050a0842 ] + +When removing the adt7470 module, a warning might be printed: + +do not call blocking ops when !TASK_RUNNING; state=1 +set at [] adt7470_update_thread+0x7b/0x130 [adt7470] + +This happens because adt7470_update_thread() can leave the kthread in +TASK_INTERRUPTIBLE state when the kthread is being stopped before +the call of set_current_state(). Since kthread_exit() might sleep in +exit_signals(), the warning is printed. +Fix that by using schedule_timeout_interruptible() and removing +the call of set_current_state(). +This causes TASK_INTERRUPTIBLE to be set after kthread_should_stop() +which might cause the kthread to exit. + +Reported-by: Zheyu Ma +Fixes: 93cacfd41f82 (hwmon: (adt7470) Allow faster removal) +Signed-off-by: Armin Wolf +Tested-by: Zheyu Ma +Link: https://lore.kernel.org/r/20220407101312.13331-1-W_Armin@gmx.de +Signed-off-by: Guenter Roeck +Signed-off-by: Sasha Levin +--- + drivers/hwmon/adt7470.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c +index 6876e3817850..22350c705ab3 100644 +--- a/drivers/hwmon/adt7470.c ++++ b/drivers/hwmon/adt7470.c +@@ -31,6 +31,7 @@ + #include + #include + #include ++#include + #include + #include + #include +-- +2.35.1 + diff --git a/queue-4.19/kvm-x86-cpuid-only-provide-cpuid-leaf-0xa-if-host-ha.patch b/queue-4.19/kvm-x86-cpuid-only-provide-cpuid-leaf-0xa-if-host-ha.patch new file mode 100644 index 00000000000..3ae0309dfed --- /dev/null +++ b/queue-4.19/kvm-x86-cpuid-only-provide-cpuid-leaf-0xa-if-host-ha.patch @@ -0,0 +1,54 @@ +From f5d3cca808d2cd400aa612f98dd51775d6499e94 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Apr 2022 17:01:49 +0530 +Subject: kvm: x86/cpuid: Only provide CPUID leaf 0xA if host has architectural + PMU + +From: Sandipan Das + +[ Upstream commit 5a1bde46f98b893cda6122b00e94c0c40a6ead3c ] + +On some x86 processors, CPUID leaf 0xA provides information +on Architectural Performance Monitoring features. It +advertises a PMU version which Qemu uses to determine the +availability of additional MSRs to manage the PMCs. + +Upon receiving a KVM_GET_SUPPORTED_CPUID ioctl request for +the same, the kernel constructs return values based on the +x86_pmu_capability irrespective of the vendor. + +This leaf and the additional MSRs are not supported on AMD +and Hygon processors. If AMD PerfMonV2 is detected, the PMU +version is set to 2 and guest startup breaks because of an +attempt to access a non-existent MSR. Return zeros to avoid +this. + +Fixes: a6c06ed1a60a ("KVM: Expose the architectural performance monitoring CPUID leaf") +Reported-by: Vasant Hegde +Signed-off-by: Sandipan Das +Message-Id: <3fef83d9c2b2f7516e8ff50d60851f29a4bcb716.1651058600.git.sandipan.das@amd.com> +Signed-off-by: Paolo Bonzini +Signed-off-by: Sasha Levin +--- + arch/x86/kvm/cpuid.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c +index 097eef712cdc..0489ffc3dfe5 100644 +--- a/arch/x86/kvm/cpuid.c ++++ b/arch/x86/kvm/cpuid.c +@@ -532,6 +532,11 @@ static inline int __do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function, + union cpuid10_eax eax; + union cpuid10_edx edx; + ++ if (!static_cpu_has(X86_FEATURE_ARCH_PERFMON)) { ++ entry->eax = entry->ebx = entry->ecx = entry->edx = 0; ++ break; ++ } ++ + perf_get_x86_pmu_capability(&cap); + + /* +-- +2.35.1 + diff --git a/queue-4.19/nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-do.patch b/queue-4.19/nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-do.patch new file mode 100644 index 00000000000..3a8d60fc489 --- /dev/null +++ b/queue-4.19/nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-do.patch @@ -0,0 +1,70 @@ +From 5fac379a2acd53149359847192889908c132cc46 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 May 2022 13:58:47 +0800 +Subject: NFC: netlink: fix sleep in atomic bug when firmware download timeout + +From: Duoming Zhou + +[ Upstream commit 4071bf121d59944d5cd2238de0642f3d7995a997 ] + +There are sleep in atomic bug that could cause kernel panic during +firmware download process. The root cause is that nlmsg_new with +GFP_KERNEL parameter is called in fw_dnld_timeout which is a timer +handler. The call trace is shown below: + +BUG: sleeping function called from invalid context at include/linux/sched/mm.h:265 +Call Trace: +kmem_cache_alloc_node +__alloc_skb +nfc_genl_fw_download_done +call_timer_fn +__run_timers.part.0 +run_timer_softirq +__do_softirq +... + +The nlmsg_new with GFP_KERNEL parameter may sleep during memory +allocation process, and the timer handler is run as the result of +a "software interrupt" that should not call any other function +that could sleep. + +This patch changes allocation mode of netlink message from GFP_KERNEL +to GFP_ATOMIC in order to prevent sleep in atomic bug. The GFP_ATOMIC +flag makes memory allocation operation could be used in atomic context. + +Fixes: 9674da8759df ("NFC: Add firmware upload netlink command") +Fixes: 9ea7187c53f6 ("NFC: netlink: Rename CMD_FW_UPLOAD to CMD_FW_DOWNLOAD") +Signed-off-by: Duoming Zhou +Reviewed-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20220504055847.38026-1-duoming@zju.edu.cn +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + net/nfc/netlink.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c +index 39fb01ee9222..c88a32b8d15e 100644 +--- a/net/nfc/netlink.c ++++ b/net/nfc/netlink.c +@@ -553,7 +553,7 @@ int nfc_genl_se_connectivity(struct nfc_dev *dev, u8 se_idx) + struct sk_buff *msg; + void *hdr; + +- msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); ++ msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_ATOMIC); + if (!msg) + return -ENOMEM; + +@@ -573,7 +573,7 @@ int nfc_genl_se_connectivity(struct nfc_dev *dev, u8 se_idx) + + genlmsg_end(msg, hdr); + +- genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); ++ genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_ATOMIC); + + return 0; + +-- +2.35.1 + diff --git a/queue-4.19/series b/queue-4.19/series index a99233eaa61..00507e39a83 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -78,3 +78,6 @@ selftests-mirror_gre_bridge_1q-avoid-changing-pvid-while-interface-is-operationa smsc911x-allow-using-irq0.patch btrfs-always-log-symlinks-in-full-mode.patch net-igmp-respect-rcu-rules-in-ip_mc_source-and-ip_mc_msfilter.patch +hwmon-adt7470-fix-warning-on-module-removal.patch-23920 +kvm-x86-cpuid-only-provide-cpuid-leaf-0xa-if-host-ha.patch +nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-do.patch