]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.2-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Apr 2023 15:36:31 +0000 (17:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Apr 2023 15:36:31 +0000 (17:36 +0200)
added patches:
pwm-zero-initialize-the-pwm_state-passed-to-driver-s-.get_state.patch
revert-acpica-events-support-fixed-pcie-wake-event.patch
revert-userfaultfd-don-t-fail-on-unrecognized-features.patch

queue-6.2/pwm-zero-initialize-the-pwm_state-passed-to-driver-s-.get_state.patch [new file with mode: 0644]
queue-6.2/revert-acpica-events-support-fixed-pcie-wake-event.patch [new file with mode: 0644]
queue-6.2/revert-userfaultfd-don-t-fail-on-unrecognized-features.patch [new file with mode: 0644]
queue-6.2/series

diff --git a/queue-6.2/pwm-zero-initialize-the-pwm_state-passed-to-driver-s-.get_state.patch b/queue-6.2/pwm-zero-initialize-the-pwm_state-passed-to-driver-s-.get_state.patch
new file mode 100644 (file)
index 0000000..6339836
--- /dev/null
@@ -0,0 +1,62 @@
+From 1271a7b98e7989ba6bb978e14403fc84efe16e13 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>
+Date: Wed, 22 Mar 2023 22:45:45 +0100
+Subject: pwm: Zero-initialize the pwm_state passed to driver's .get_state()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+
+commit 1271a7b98e7989ba6bb978e14403fc84efe16e13 upstream.
+
+This is just to ensure that .usage_power is properly initialized and
+doesn't contain random stack data. The other members of struct pwm_state
+should get a value assigned in a successful call to .get_state(). So in
+the absence of bugs in driver implementations, this is only a safe-guard
+and no fix.
+
+Reported-by: Munehisa Kamata <kamatam@amazon.com>
+Link: https://lore.kernel.org/r/20230310214004.2619480-1-u.kleine-koenig@pengutronix.de
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/pwm/core.c |   12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/drivers/pwm/core.c
++++ b/drivers/pwm/core.c
+@@ -115,7 +115,14 @@ static int pwm_device_request(struct pwm
+       }
+       if (pwm->chip->ops->get_state) {
+-              struct pwm_state state;
++              /*
++               * Zero-initialize state because most drivers are unaware of
++               * .usage_power. The other members of state are supposed to be
++               * set by lowlevel drivers. We still initialize the whole
++               * structure for simplicity even though this might paper over
++               * faulty implementations of .get_state().
++               */
++              struct pwm_state state = { 0, };
+               err = pwm->chip->ops->get_state(pwm->chip, pwm, &state);
+               trace_pwm_get(pwm, &state, err);
+@@ -448,7 +455,7 @@ static void pwm_apply_state_debug(struct
+ {
+       struct pwm_state *last = &pwm->last;
+       struct pwm_chip *chip = pwm->chip;
+-      struct pwm_state s1, s2;
++      struct pwm_state s1 = { 0 }, s2 = { 0 };
+       int err;
+       if (!IS_ENABLED(CONFIG_PWM_DEBUG))
+@@ -530,6 +537,7 @@ static void pwm_apply_state_debug(struct
+               return;
+       }
++      *last = (struct pwm_state){ 0 };
+       err = chip->ops->get_state(chip, pwm, last);
+       trace_pwm_get(pwm, last, err);
+       if (err)
diff --git a/queue-6.2/revert-acpica-events-support-fixed-pcie-wake-event.patch b/queue-6.2/revert-acpica-events-support-fixed-pcie-wake-event.patch
new file mode 100644 (file)
index 0000000..02a2266
--- /dev/null
@@ -0,0 +1,112 @@
+From 8e41e0a575664d26bb87e012c39435c4c3914ed9 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Fri, 21 Apr 2023 13:39:10 -0700
+Subject: Revert "ACPICA: Events: Support fixed PCIe wake event"
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 8e41e0a575664d26bb87e012c39435c4c3914ed9 upstream.
+
+This reverts commit 5c62d5aab8752e5ee7bfbe75ed6060db1c787f98.
+
+This broke wake-on-lan for multiple people, and for much too long.
+
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=217069
+Link: https://lore.kernel.org/all/754225a2-95a9-2c36-1886-7da1a78308c2@loongson.cn/
+Link: https://github.com/acpica/acpica/pull/866
+Cc: Rafael J. Wysocki <rafael@kernel.org>
+Cc: Jianmin Lv <lvjianmin@loongson.cn>
+Cc: Huacai Chen <chenhuacai@loongson.cn>
+Cc: Bob Moore <robert.moore@intel.com>
+Cc: stable@kernel.org # 6.2
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/acpi/acpica/evevent.c  |   11 -----------
+ drivers/acpi/acpica/hwsleep.c  |   14 --------------
+ drivers/acpi/acpica/utglobal.c |    4 ----
+ include/acpi/actypes.h         |    3 +--
+ 4 files changed, 1 insertion(+), 31 deletions(-)
+
+--- a/drivers/acpi/acpica/evevent.c
++++ b/drivers/acpi/acpica/evevent.c
+@@ -142,9 +142,6 @@ static acpi_status acpi_ev_fixed_event_i
+                       status =
+                           acpi_write_bit_register(acpi_gbl_fixed_event_info
+                                                   [i].enable_register_id,
+-                                                  (i ==
+-                                                   ACPI_EVENT_PCIE_WAKE) ?
+-                                                  ACPI_ENABLE_EVENT :
+                                                   ACPI_DISABLE_EVENT);
+                       if (ACPI_FAILURE(status)) {
+                               return (status);
+@@ -188,11 +185,6 @@ u32 acpi_ev_fixed_event_detect(void)
+               return (int_status);
+       }
+-      if (fixed_enable & ACPI_BITMASK_PCIEXP_WAKE_DISABLE)
+-              fixed_enable &= ~ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
+-      else
+-              fixed_enable |= ACPI_BITMASK_PCIEXP_WAKE_DISABLE;
+-
+       ACPI_DEBUG_PRINT((ACPI_DB_INTERRUPTS,
+                         "Fixed Event Block: Enable %08X Status %08X\n",
+                         fixed_enable, fixed_status));
+@@ -258,9 +250,6 @@ static u32 acpi_ev_fixed_event_dispatch(
+       if (!acpi_gbl_fixed_event_handlers[event].handler) {
+               (void)acpi_write_bit_register(acpi_gbl_fixed_event_info[event].
+                                             enable_register_id,
+-                                            (event ==
+-                                             ACPI_EVENT_PCIE_WAKE) ?
+-                                            ACPI_ENABLE_EVENT :
+                                             ACPI_DISABLE_EVENT);
+               ACPI_ERROR((AE_INFO,
+--- a/drivers/acpi/acpica/hwsleep.c
++++ b/drivers/acpi/acpica/hwsleep.c
+@@ -311,20 +311,6 @@ acpi_status acpi_hw_legacy_wake(u8 sleep
+                                   [ACPI_EVENT_SLEEP_BUTTON].
+                                   status_register_id, ACPI_CLEAR_STATUS);
+-      /* Enable pcie wake event if support */
+-      if ((acpi_gbl_FADT.flags & ACPI_FADT_PCI_EXPRESS_WAKE)) {
+-              (void)
+-                  acpi_write_bit_register(acpi_gbl_fixed_event_info
+-                                          [ACPI_EVENT_PCIE_WAKE].
+-                                          enable_register_id,
+-                                          ACPI_DISABLE_EVENT);
+-              (void)
+-                  acpi_write_bit_register(acpi_gbl_fixed_event_info
+-                                          [ACPI_EVENT_PCIE_WAKE].
+-                                          status_register_id,
+-                                          ACPI_CLEAR_STATUS);
+-      }
+-
+       acpi_hw_execute_sleep_method(METHOD_PATHNAME__SST, ACPI_SST_WORKING);
+       return_ACPI_STATUS(status);
+ }
+--- a/drivers/acpi/acpica/utglobal.c
++++ b/drivers/acpi/acpica/utglobal.c
+@@ -186,10 +186,6 @@ struct acpi_fixed_event_info acpi_gbl_fi
+                                       ACPI_BITREG_RT_CLOCK_ENABLE,
+                                       ACPI_BITMASK_RT_CLOCK_STATUS,
+                                       ACPI_BITMASK_RT_CLOCK_ENABLE},
+-      /* ACPI_EVENT_PCIE_WAKE     */ {ACPI_BITREG_PCIEXP_WAKE_STATUS,
+-                                      ACPI_BITREG_PCIEXP_WAKE_DISABLE,
+-                                      ACPI_BITMASK_PCIEXP_WAKE_STATUS,
+-                                      ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
+ };
+ #endif                                /* !ACPI_REDUCED_HARDWARE */
+--- a/include/acpi/actypes.h
++++ b/include/acpi/actypes.h
+@@ -723,8 +723,7 @@ typedef u32 acpi_event_type;
+ #define ACPI_EVENT_POWER_BUTTON         2
+ #define ACPI_EVENT_SLEEP_BUTTON         3
+ #define ACPI_EVENT_RTC                  4
+-#define ACPI_EVENT_PCIE_WAKE            5
+-#define ACPI_EVENT_MAX                  5
++#define ACPI_EVENT_MAX                  4
+ #define ACPI_NUM_FIXED_EVENTS           ACPI_EVENT_MAX + 1
+ /*
diff --git a/queue-6.2/revert-userfaultfd-don-t-fail-on-unrecognized-features.patch b/queue-6.2/revert-userfaultfd-don-t-fail-on-unrecognized-features.patch
new file mode 100644 (file)
index 0000000..e074ff9
--- /dev/null
@@ -0,0 +1,56 @@
+From 2ff559f31a5d50c31a3f9d849f8af90dc36c7105 Mon Sep 17 00:00:00 2001
+From: Peter Xu <peterx@redhat.com>
+Date: Wed, 12 Apr 2023 12:38:52 -0400
+Subject: Revert "userfaultfd: don't fail on unrecognized features"
+
+From: Peter Xu <peterx@redhat.com>
+
+commit 2ff559f31a5d50c31a3f9d849f8af90dc36c7105 upstream.
+
+This is a proposal to revert commit 914eedcb9ba0ff53c33808.
+
+I found this when writing a simple UFFDIO_API test to be the first unit
+test in this set.  Two things breaks with the commit:
+
+  - UFFDIO_API check was lost and missing.  According to man page, the
+  kernel should reject ioctl(UFFDIO_API) if uffdio_api.api != 0xaa.  This
+  check is needed if the api version will be extended in the future, or
+  user app won't be able to identify which is a new kernel.
+
+  - Feature flags checks were removed, which means UFFDIO_API with a
+  feature that does not exist will also succeed.  According to the man
+  page, we should (and it makes sense) to reject ioctl(UFFDIO_API) if
+  unknown features passed in.
+
+Link: https://lore.kernel.org/r/20220722201513.1624158-1-axelrasmussen@google.com
+Link: https://lkml.kernel.org/r/20230412163922.327282-2-peterx@redhat.com
+Fixes: 914eedcb9ba0 ("userfaultfd: don't fail on unrecognized features")
+Signed-off-by: Peter Xu <peterx@redhat.com>
+Acked-by: David Hildenbrand <david@redhat.com>
+Cc: Axel Rasmussen <axelrasmussen@google.com>
+Cc: Dmitry Safonov <0x7f454c46@gmail.com>
+Cc: Mike Kravetz <mike.kravetz@oracle.com>
+Cc: Mike Rapoport (IBM) <rppt@kernel.org>
+Cc: Zach O'Keefe <zokeefe@google.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/userfaultfd.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/fs/userfaultfd.c
++++ b/fs/userfaultfd.c
+@@ -1966,8 +1966,10 @@ static int userfaultfd_api(struct userfa
+       ret = -EFAULT;
+       if (copy_from_user(&uffdio_api, buf, sizeof(uffdio_api)))
+               goto out;
+-      /* Ignore unsupported features (userspace built against newer kernel) */
+-      features = uffdio_api.features & UFFD_API_FEATURES;
++      features = uffdio_api.features;
++      ret = -EINVAL;
++      if (uffdio_api.api != UFFD_API || (features & ~UFFD_API_FEATURES))
++              goto err_out;
+       ret = -EPERM;
+       if ((features & UFFD_FEATURE_EVENT_FORK) && !capable(CAP_SYS_PTRACE))
+               goto err_out;
index 647523f1322f295660fe21ca9586b34d43773e51..e7112d4d24103961e87b306cfc27ece709940988 100644 (file)
@@ -51,3 +51,6 @@ xen-netback-use-same-error-messages-for-same-errors.patch
 platform-x86-gigabyte-wmi-add-support-for-x570s-aoru.patch
 platform-x86-asus-nb-wmi-add-quirk_asus_tablet_mode-.patch
 mtd-spi-nor-fix-memory-leak-when-using-debugfs_looku.patch
+pwm-zero-initialize-the-pwm_state-passed-to-driver-s-.get_state.patch
+revert-userfaultfd-don-t-fail-on-unrecognized-features.patch
+revert-acpica-events-support-fixed-pcie-wake-event.patch