]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.17
authorSasha Levin <sashal@kernel.org>
Mon, 13 Jun 2022 05:20:44 +0000 (01:20 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 13 Jun 2022 05:20:44 +0000 (01:20 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.17/platform-x86-barco-p50-gpio-add-check-for-platform_d.patch [new file with mode: 0644]
queue-5.17/platform-x86-hp-wmi-fix-hp_wmi_read_int-reporting-er.patch [new file with mode: 0644]
queue-5.17/platform-x86-hp-wmi-use-zero-insize-parameter-only-w.patch [new file with mode: 0644]
queue-5.17/scripts-gdb-change-kernel-config-dumping-method.patch [new file with mode: 0644]
queue-5.17/series
queue-5.17/vringh-fix-loop-descriptors-check-in-the-indirect-ca.patch [new file with mode: 0644]

diff --git a/queue-5.17/platform-x86-barco-p50-gpio-add-check-for-platform_d.patch b/queue-5.17/platform-x86-barco-p50-gpio-add-check-for-platform_d.patch
new file mode 100644 (file)
index 0000000..70a258b
--- /dev/null
@@ -0,0 +1,46 @@
+From cfd61bc512cbf17c11ec30ddc317417846a642b3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 26 May 2022 17:03:45 +0800
+Subject: platform/x86: barco-p50-gpio: Add check for platform_driver_register
+
+From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
+
+[ Upstream commit 011881b80ebe773914b59905bce0f5e0ef93e7ba ]
+
+As platform_driver_register() could fail, it should be better
+to deal with the return value in order to maintain the code
+consisitency.
+
+Fixes: 86af1d02d458 ("platform/x86: Support for EC-connected GPIOs for identify LED/button on Barco P50 board")
+Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
+Acked-by: Peter Korsgaard <peter.korsgaard@barco.com>
+Link: https://lore.kernel.org/r/20220526090345.1444172-1-jiasheng@iscas.ac.cn
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/barco-p50-gpio.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/platform/x86/barco-p50-gpio.c b/drivers/platform/x86/barco-p50-gpio.c
+index f5c72e33f9ae..f8b796820ef4 100644
+--- a/drivers/platform/x86/barco-p50-gpio.c
++++ b/drivers/platform/x86/barco-p50-gpio.c
+@@ -406,11 +406,14 @@ MODULE_DEVICE_TABLE(dmi, dmi_ids);
+ static int __init p50_module_init(void)
+ {
+       struct resource res = DEFINE_RES_IO(P50_GPIO_IO_PORT_BASE, P50_PORT_CMD + 1);
++      int ret;
+       if (!dmi_first_match(dmi_ids))
+               return -ENODEV;
+-      platform_driver_register(&p50_gpio_driver);
++      ret = platform_driver_register(&p50_gpio_driver);
++      if (ret)
++              return ret;
+       gpio_pdev = platform_device_register_simple(DRIVER_NAME, PLATFORM_DEVID_NONE, &res, 1);
+       if (IS_ERR(gpio_pdev)) {
+-- 
+2.35.1
+
diff --git a/queue-5.17/platform-x86-hp-wmi-fix-hp_wmi_read_int-reporting-er.patch b/queue-5.17/platform-x86-hp-wmi-fix-hp_wmi_read_int-reporting-er.patch
new file mode 100644 (file)
index 0000000..98012b7
--- /dev/null
@@ -0,0 +1,53 @@
+From cc620c752802585076c701c667e284bd87646b0f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 10 Mar 2022 15:08:50 -0600
+Subject: platform/x86: hp-wmi: Fix hp_wmi_read_int() reporting error (0x05)
+
+From: Jorge Lopez <jorge.lopez2@hp.com>
+
+[ Upstream commit 12b19f14a21a2ee6348825d95b642ef2cd16794f ]
+
+The purpose of this patch is to introduce a fix to hp_wmi_read_int()
+and eliminate failure error (0x05). Several WMI queries leverage
+hp_wmi_read_int() to read their data and were failing with error 0x05.
+
+HPWMI_DISPLAY_QUERY
+HPWMI_HDDTEMP_QUERY
+HPWMI_ALS_QUERY
+HPWMI_HARDWARE_QUERY
+HPWMI_WIRELESS_QUERY
+HPWMI_POSTCODEERROR_QUERY
+
+The failure occurs because hp_wmi_read_int() calls
+hp_wmi_perform_query() with input parameter of size greater than zero.
+Invoking those WMI commands with an input buffer size greater than
+zero causes the command to be rejected and error 0x05 be returned.
+
+All changes were validated on a HP ZBook Workstation notebook,
+HP EliteBook x360, and HP EliteBook 850 G8.
+
+Signed-off-by: Jorge Lopez <jorge.lopez2@hp.com>
+Link: https://lore.kernel.org/r/20220310210853.28367-2-jorge.lopez2@hp.com
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/hp-wmi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
+index 88f0bfd6ecf1..29ae35d15a41 100644
+--- a/drivers/platform/x86/hp-wmi.c
++++ b/drivers/platform/x86/hp-wmi.c
+@@ -347,7 +347,7 @@ static int hp_wmi_read_int(int query)
+       int val = 0, ret;
+       ret = hp_wmi_perform_query(query, HPWMI_READ, &val,
+-                                 sizeof(val), sizeof(val));
++                                 0, sizeof(val));
+       if (ret)
+               return ret < 0 ? ret : -EINVAL;
+-- 
+2.35.1
+
diff --git a/queue-5.17/platform-x86-hp-wmi-use-zero-insize-parameter-only-w.patch b/queue-5.17/platform-x86-hp-wmi-use-zero-insize-parameter-only-w.patch
new file mode 100644 (file)
index 0000000..e211a14
--- /dev/null
@@ -0,0 +1,138 @@
+From e1dc2a46411c11985e08db209e2073c9b5986dc9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 9 Jun 2022 00:58:43 +0530
+Subject: platform/x86: hp-wmi: Use zero insize parameter only when supported
+
+From: Bedant Patnaik <bedant.patnaik@gmail.com>
+
+[ Upstream commit 65f936f3535950d2643eac5bf34a735a0e428cdd ]
+
+commit be9d73e64957 ("platform/x86: hp-wmi: Fix 0x05 error code reported by
+several WMI calls") and commit 12b19f14a21a ("platform/x86: hp-wmi: Fix
+hp_wmi_read_int() reporting error (0x05)") cause ACPI BIOS Error (bug):
+Attempt to CreateField of length zero (20211217/dsopcode-133) because of
+the ACPI method HWMC, which unconditionally creates a Field of
+size (insize*8) bits:
+       CreateField (Arg1, 0x80, (Local5 * 0x08), DAIN)
+In cases where args->insize = 0, the Field size is 0, resulting in
+an error.
+
+Fix this by using zero insize only if 0x5 error code is returned
+
+Tested on Omen 15 AMD (2020) board ID: 8786.
+
+Fixes: be9d73e64957 ("platform/x86: hp-wmi: Fix 0x05 error code reported by several WMI calls")
+Signed-off-by: Bedant Patnaik <bedant.patnaik@gmail.com>
+Tested-by: Jorge Lopez <jorge.lopez2@hp.com>
+Link: https://lore.kernel.org/r/41be46743d21c78741232a47bbb5f1cdbcc3d21e.camel@gmail.com
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/hp-wmi.c | 23 +++++++++++++++--------
+ 1 file changed, 15 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c
+index 29ae35d15a41..c573bfd9ab0e 100644
+--- a/drivers/platform/x86/hp-wmi.c
++++ b/drivers/platform/x86/hp-wmi.c
+@@ -38,6 +38,7 @@ MODULE_ALIAS("wmi:5FB7F034-2C63-45e9-BE91-3D44E2C707E4");
+ #define HPWMI_EVENT_GUID "95F24279-4D7B-4334-9387-ACCDC67EF61C"
+ #define HPWMI_BIOS_GUID "5FB7F034-2C63-45e9-BE91-3D44E2C707E4"
+ #define HP_OMEN_EC_THERMAL_PROFILE_OFFSET 0x95
++#define zero_if_sup(tmp) (zero_insize_support?0:sizeof(tmp)) // use when zero insize is required
+ /* DMI board names of devices that should use the omen specific path for
+  * thermal profiles.
+@@ -200,6 +201,7 @@ static struct input_dev *hp_wmi_input_dev;
+ static struct platform_device *hp_wmi_platform_dev;
+ static struct platform_profile_handler platform_profile_handler;
+ static bool platform_profile_support;
++static bool zero_insize_support;
+ static struct rfkill *wifi_rfkill;
+ static struct rfkill *bluetooth_rfkill;
+@@ -347,7 +349,7 @@ static int hp_wmi_read_int(int query)
+       int val = 0, ret;
+       ret = hp_wmi_perform_query(query, HPWMI_READ, &val,
+-                                 0, sizeof(val));
++                                 zero_if_sup(val), sizeof(val));
+       if (ret)
+               return ret < 0 ? ret : -EINVAL;
+@@ -383,7 +385,8 @@ static int hp_wmi_get_tablet_mode(void)
+               return -ENODEV;
+       ret = hp_wmi_perform_query(HPWMI_SYSTEM_DEVICE_MODE, HPWMI_READ,
+-                                 system_device_mode, 0, sizeof(system_device_mode));
++                                 system_device_mode, zero_if_sup(system_device_mode),
++                                 sizeof(system_device_mode));
+       if (ret < 0)
+               return ret;
+@@ -449,7 +452,7 @@ static int hp_wmi_fan_speed_max_get(void)
+       int val = 0, ret;
+       ret = hp_wmi_perform_query(HPWMI_FAN_SPEED_MAX_GET_QUERY, HPWMI_GM,
+-                                 &val, 0, sizeof(val));
++                                 &val, zero_if_sup(val), sizeof(val));
+       if (ret)
+               return ret < 0 ? ret : -EINVAL;
+@@ -461,7 +464,7 @@ static int __init hp_wmi_bios_2008_later(void)
+ {
+       int state = 0;
+       int ret = hp_wmi_perform_query(HPWMI_FEATURE_QUERY, HPWMI_READ, &state,
+-                                     0, sizeof(state));
++                                     zero_if_sup(state), sizeof(state));
+       if (!ret)
+               return 1;
+@@ -472,7 +475,7 @@ static int __init hp_wmi_bios_2009_later(void)
+ {
+       u8 state[128];
+       int ret = hp_wmi_perform_query(HPWMI_FEATURE2_QUERY, HPWMI_READ, &state,
+-                                     0, sizeof(state));
++                                     zero_if_sup(state), sizeof(state));
+       if (!ret)
+               return 1;
+@@ -550,7 +553,7 @@ static int hp_wmi_rfkill2_refresh(void)
+       int err, i;
+       err = hp_wmi_perform_query(HPWMI_WIRELESS2_QUERY, HPWMI_READ, &state,
+-                                 0, sizeof(state));
++                                 zero_if_sup(state), sizeof(state));
+       if (err)
+               return err;
+@@ -952,7 +955,7 @@ static int __init hp_wmi_rfkill2_setup(struct platform_device *device)
+       int err, i;
+       err = hp_wmi_perform_query(HPWMI_WIRELESS2_QUERY, HPWMI_READ, &state,
+-                                 0, sizeof(state));
++                                 zero_if_sup(state), sizeof(state));
+       if (err)
+               return err < 0 ? err : -EINVAL;
+@@ -1410,11 +1413,15 @@ static int __init hp_wmi_init(void)
+ {
+       int event_capable = wmi_has_guid(HPWMI_EVENT_GUID);
+       int bios_capable = wmi_has_guid(HPWMI_BIOS_GUID);
+-      int err;
++      int err, tmp = 0;
+       if (!bios_capable && !event_capable)
+               return -ENODEV;
++      if (hp_wmi_perform_query(HPWMI_HARDWARE_QUERY, HPWMI_READ, &tmp,
++                               sizeof(tmp), sizeof(tmp)) == HPWMI_RET_INVALID_PARAMETERS)
++              zero_insize_support = true;
++
+       if (event_capable) {
+               err = hp_wmi_input_setup();
+               if (err)
+-- 
+2.35.1
+
diff --git a/queue-5.17/scripts-gdb-change-kernel-config-dumping-method.patch b/queue-5.17/scripts-gdb-change-kernel-config-dumping-method.patch
new file mode 100644 (file)
index 0000000..8820d66
--- /dev/null
@@ -0,0 +1,43 @@
+From 4c025ab9362086f345d5467d1f428ec05d9ca26e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 10 Jun 2022 15:14:57 +0800
+Subject: scripts/gdb: change kernel config dumping method
+
+From: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
+
+[ Upstream commit 1f7a6cf6b07c74a17343c2559cd5f5018a245961 ]
+
+MAGIC_START("IKCFG_ST") and MAGIC_END("IKCFG_ED") are moved out
+from the kernel_config_data variable.
+
+Thus, we parse kernel_config_data directly instead of considering
+offset of MAGIC_START and MAGIC_END.
+
+Fixes: 13610aa908dc ("kernel/configs: use .incbin directive to embed config_data.gz")
+Signed-off-by: Kuan-Ying Lee <Kuan-Ying.Lee@mediatek.com>
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/gdb/linux/config.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/scripts/gdb/linux/config.py b/scripts/gdb/linux/config.py
+index 90e1565b1967..8843ab3cbadd 100644
+--- a/scripts/gdb/linux/config.py
++++ b/scripts/gdb/linux/config.py
+@@ -24,9 +24,9 @@ class LxConfigDump(gdb.Command):
+             filename = arg
+         try:
+-            py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8")
+-            py_config_size = gdb.parse_and_eval(
+-                    "sizeof(kernel_config_data) - 1 - 8 * 2")
++            py_config_ptr = gdb.parse_and_eval("&kernel_config_data")
++            py_config_ptr_end = gdb.parse_and_eval("&kernel_config_data_end")
++            py_config_size = py_config_ptr_end - py_config_ptr
+         except gdb.error as e:
+             raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?")
+-- 
+2.35.1
+
index 93759117357a453a2f9b5f229a3635103edaff71..99bcf1f372e5ecd78177f3a8cbb9ddfac3803303 100644 (file)
@@ -250,3 +250,8 @@ s390-gmap-voluntarily-schedule-during-key-setting.patch
 cifs-version-operations-for-smb20-unneeded-when-lega.patch
 drm-amd-pm-use-bitmap_-from-to-_arr32-where-appropri.patch
 nodemask-fix-return-values-to-be-unsigned.patch
+vringh-fix-loop-descriptors-check-in-the-indirect-ca.patch
+platform-x86-barco-p50-gpio-add-check-for-platform_d.patch
+scripts-gdb-change-kernel-config-dumping-method.patch
+platform-x86-hp-wmi-fix-hp_wmi_read_int-reporting-er.patch
+platform-x86-hp-wmi-use-zero-insize-parameter-only-w.patch
diff --git a/queue-5.17/vringh-fix-loop-descriptors-check-in-the-indirect-ca.patch b/queue-5.17/vringh-fix-loop-descriptors-check-in-the-indirect-ca.patch
new file mode 100644 (file)
index 0000000..493bd52
--- /dev/null
@@ -0,0 +1,63 @@
+From e99aef5ecf079599597191849048e5aff3065d4c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 5 May 2022 18:09:10 +0800
+Subject: vringh: Fix loop descriptors check in the indirect cases
+
+From: Xie Yongji <xieyongji@bytedance.com>
+
+[ Upstream commit dbd29e0752286af74243cf891accf472b2f3edd8 ]
+
+We should use size of descriptor chain to test loop condition
+in the indirect case. And another statistical count is also introduced
+for indirect descriptors to avoid conflict with the statistical count
+of direct descriptors.
+
+Fixes: f87d0fbb5798 ("vringh: host-side implementation of virtio rings.")
+Signed-off-by: Xie Yongji <xieyongji@bytedance.com>
+Signed-off-by: Fam Zheng <fam.zheng@bytedance.com>
+Message-Id: <20220505100910.137-1-xieyongji@bytedance.com>
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Acked-by: Jason Wang <jasowang@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/vhost/vringh.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/vhost/vringh.c b/drivers/vhost/vringh.c
+index 14e2043d7685..eab55accf381 100644
+--- a/drivers/vhost/vringh.c
++++ b/drivers/vhost/vringh.c
+@@ -292,7 +292,7 @@ __vringh_iov(struct vringh *vrh, u16 i,
+            int (*copy)(const struct vringh *vrh,
+                        void *dst, const void *src, size_t len))
+ {
+-      int err, count = 0, up_next, desc_max;
++      int err, count = 0, indirect_count = 0, up_next, desc_max;
+       struct vring_desc desc, *descs;
+       struct vringh_range range = { -1ULL, 0 }, slowrange;
+       bool slow = false;
+@@ -349,7 +349,12 @@ __vringh_iov(struct vringh *vrh, u16 i,
+                       continue;
+               }
+-              if (count++ == vrh->vring.num) {
++              if (up_next == -1)
++                      count++;
++              else
++                      indirect_count++;
++
++              if (count > vrh->vring.num || indirect_count > desc_max) {
+                       vringh_bad("Descriptor loop in %p", descs);
+                       err = -ELOOP;
+                       goto fail;
+@@ -411,6 +416,7 @@ __vringh_iov(struct vringh *vrh, u16 i,
+                               i = return_from_indirect(vrh, &up_next,
+                                                        &descs, &desc_max);
+                               slow = false;
++                              indirect_count = 0;
+                       } else
+                               break;
+               }
+-- 
+2.35.1
+