]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.14
authorSasha Levin <sashal@kernel.org>
Tue, 10 May 2022 00:57:02 +0000 (20:57 -0400)
committerSasha Levin <sashal@kernel.org>
Tue, 10 May 2022 00:57:02 +0000 (20:57 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.14/hwmon-adt7470-fix-warning-on-module-removal.patch-27384 [new file with mode: 0644]
queue-4.14/kvm-x86-cpuid-only-provide-cpuid-leaf-0xa-if-host-ha.patch [new file with mode: 0644]
queue-4.14/nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-do.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/hwmon-adt7470-fix-warning-on-module-removal.patch-27384 b/queue-4.14/hwmon-adt7470-fix-warning-on-module-removal.patch-27384
new file mode 100644 (file)
index 0000000..59b8b7f
--- /dev/null
@@ -0,0 +1,49 @@
+From eb88531a51cb3b05a62719e2092376bb1108aff5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Apr 2022 12:13:12 +0200
+Subject: hwmon: (adt7470) Fix warning on module removal
+
+From: Armin Wolf <W_Armin@gmx.de>
+
+[ 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 [<ffffffffa006052b>] 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 <zheyuma97@gmail.com>
+Fixes: 93cacfd41f82 (hwmon: (adt7470) Allow faster removal)
+Signed-off-by: Armin Wolf <W_Armin@gmx.de>
+Tested-by: Zheyu Ma <zheyuma97@gmail.com>
+Link: https://lore.kernel.org/r/20220407101312.13331-1-W_Armin@gmx.de
+Signed-off-by: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 <linux/delay.h>
+ #include <linux/log2.h>
+ #include <linux/kthread.h>
++#include <linux/sched.h>
+ #include <linux/slab.h>
+ #include <linux/util_macros.h>
+ #include <linux/sched.h>
+-- 
+2.35.1
+
diff --git a/queue-4.14/kvm-x86-cpuid-only-provide-cpuid-leaf-0xa-if-host-ha.patch b/queue-4.14/kvm-x86-cpuid-only-provide-cpuid-leaf-0xa-if-host-ha.patch
new file mode 100644 (file)
index 0000000..071a36a
--- /dev/null
@@ -0,0 +1,54 @@
+From 36183bb46bb6dd8aafd1530535ddcb48dc86d5ef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+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 <sandipan.das@amd.com>
+
+[ 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 <vasant.hegde@amd.com>
+Signed-off-by: Sandipan Das <sandipan.das@amd.com>
+Message-Id: <3fef83d9c2b2f7516e8ff50d60851f29a4bcb716.1651058600.git.sandipan.das@amd.com>
+Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 7e1ab0e0f3f2..fd1eb8600ccf 100644
+--- a/arch/x86/kvm/cpuid.c
++++ b/arch/x86/kvm/cpuid.c
+@@ -517,6 +517,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.14/nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-do.patch b/queue-4.14/nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-do.patch
new file mode 100644 (file)
index 0000000..8936cfb
--- /dev/null
@@ -0,0 +1,70 @@
+From 9e3510559a02578231d6e72715848b45139ce331 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 4 May 2022 13:58:47 +0800
+Subject: NFC: netlink: fix sleep in atomic bug when firmware download timeout
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ 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 <duoming@zju.edu.cn>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Link: https://lore.kernel.org/r/20220504055847.38026-1-duoming@zju.edu.cn
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ 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 0320ae7560ad..c7f28e9e18c4 100644
+--- a/net/nfc/netlink.c
++++ b/net/nfc/netlink.c
+@@ -563,7 +563,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;
+@@ -583,7 +583,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
+
index d2daa9b3b031776bed254ba0506bdeb62fb4dc1f..6e62b4899bea4f3b2b30bbd3bef3bd813efd99f4 100644 (file)
@@ -70,3 +70,6 @@ net-emaclite-add-error-handling-for-of_address_to_resource.patch
 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-27384
+kvm-x86-cpuid-only-provide-cpuid-leaf-0xa-if-host-ha.patch
+nfc-netlink-fix-sleep-in-atomic-bug-when-firmware-do.patch