--- /dev/null
+From 8ae44ae170b0716a7a02454405f8358cee0231bd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 Dec 2021 20:30:18 +0100
+Subject: PM: sleep: Fix error handling in dpm_prepare()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+[ Upstream commit 544e737dea5ad1a457f25dbddf68761ff25e028b ]
+
+Commit 2aa36604e824 ("PM: sleep: Avoid calling put_device() under
+dpm_list_mtx") forgot to update the while () loop termination
+condition to also break the loop if error is nonzero, which
+causes the loop to become infinite if device_prepare() returns
+an error for one device.
+
+Add the missing !error check.
+
+Fixes: 2aa36604e824 ("PM: sleep: Avoid calling put_device() under dpm_list_mtx")
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reported-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
+Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
+Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
+Cc: All applicable <stable@vger.kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/base/power/main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
+index c493e48e420f..fbc57c4fcdd0 100644
+--- a/drivers/base/power/main.c
++++ b/drivers/base/power/main.c
+@@ -1897,7 +1897,7 @@ int dpm_prepare(pm_message_t state)
+ device_block_probing();
+
+ mutex_lock(&dpm_list_mtx);
+- while (!list_empty(&dpm_list)) {
++ while (!list_empty(&dpm_list) && !error) {
+ struct device *dev = to_device(dpm_list.next);
+
+ get_device(dev);
+--
+2.43.0
+
hid-apple-add-support-for-the-2021-magic-keyboard.patch
hid-apple-add-2021-magic-keyboard-fn-key-mapping.patch
bonding-remove-print-in-bond_verify_device_path.patch
+uapi-stddef.h-fix-__declare_flex_array-for-c.patch
+pm-sleep-fix-error-handling-in-dpm_prepare.patch
--- /dev/null
+From 4cbf4b17744121807951dd3e36aa7080fd092433 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 12 Sep 2023 19:22:24 +0300
+Subject: uapi: stddef.h: Fix __DECLARE_FLEX_ARRAY for C++
+
+From: Alexey Dobriyan <adobriyan@gmail.com>
+
+[ Upstream commit 32a4ec211d4164e667d9d0b807fadf02053cd2e9 ]
+
+__DECLARE_FLEX_ARRAY(T, member) macro expands to
+
+ struct {
+ struct {} __empty_member;
+ T member[];
+ };
+
+which is subtly wrong in C++ because sizeof(struct{}) is 1 not 0,
+changing UAPI structures layouts.
+
+This can be fixed by expanding to
+
+ T member[];
+
+Now g++ doesn't like "T member[]" either, throwing errors on
+the following code:
+
+ struct S {
+ union {
+ T1 member1[];
+ T2 member2[];
+ };
+ };
+
+or
+
+ struct S {
+ T member[];
+ };
+
+Use "T member[0];" which seems to work and does the right thing wrt
+structure layout.
+
+Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
+Fixes: 3080ea5553cc ("stddef: Introduce DECLARE_FLEX_ARRAY() helper")
+Link: https://lore.kernel.org/r/97242381-f1ec-4a4a-9472-1a464f575657@p183
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/uapi/linux/stddef.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/include/uapi/linux/stddef.h b/include/uapi/linux/stddef.h
+index 7837ba4fe728..46c7bab501cb 100644
+--- a/include/uapi/linux/stddef.h
++++ b/include/uapi/linux/stddef.h
+@@ -29,6 +29,11 @@
+ struct TAG { MEMBERS } ATTRS NAME; \
+ }
+
++#ifdef __cplusplus
++/* sizeof(struct{}) is 1 in C++, not 0, can't use C version of the macro. */
++#define __DECLARE_FLEX_ARRAY(T, member) \
++ T member[0]
++#else
+ /**
+ * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union
+ *
+@@ -45,3 +50,5 @@
+ TYPE NAME[]; \
+ }
+ #endif
++
++#endif
+--
+2.43.0
+