]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Aug 2024 10:08:09 +0000 (12:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Aug 2024 10:08:09 +0000 (12:08 +0200)
added patches:
acpi-ec-evaluate-_reg-outside-the-ec-scope-more-carefully.patch
acpica-add-a-depth-argument-to-acpi_execute_reg_methods.patch
alsa-hda-tas2781-fix-wrong-calibrated-data-order.patch
alsa-usb-audio-add-delay-quirk-for-vivo-usb-c-xe710-headset.patch
alsa-usb-audio-support-yamaha-p-125-quirk-entry.patch
arm64-acpi-numa-initialize-all-values-of-acpi_early_node_map-to-numa_no_node.patch
bitmap-introduce-generic-optimized-bitmap_size.patch
btrfs-tree-checker-add-dev-extent-item-checks.patch
btrfs-tree-checker-reject-btrfs_ft_unknown-dir-type.patch
btrfs-zoned-properly-take-lock-to-read-update-block-group-s-zoned-variables.patch
char-xillybus-check-usb-endpoints-when-probing-device.patch
char-xillybus-don-t-destroy-workqueue-from-work-item-running-on-it.patch
char-xillybus-refine-workqueue-handling.patch
dm-persistent-data-fix-memory-allocation-failure.patch
dm-resume-don-t-return-einval-when-signalled.patch
drm-amdgpu-actually-check-flags-for-all-context-ops.patch
fix-bitmap-corruption-on-close_range-with-close_range_unshare.patch
fs-netfs-fscache_cookie-add-missing-n_accesses-check.patch
i2c-qcom-geni-add-missing-geni_icc_disable-in-geni_i2c_runtime_resume.patch
i2c-tegra-do-not-mark-acpi-devices-as-irq-safe.patch
kvm-s390-fix-validity-interception-issue-when-gisa-is-switched-off.patch
memcg_write_event_control-fix-a-user-triggerable-oops.patch
mm-memory-failure-use-raw_spinlock_t-in-struct-memory_failure_cpu.patch
net-mana-fix-doorbell-out-of-order-violation-and-avoid-unnecessary-doorbell-rings.patch
net-mana-fix-rx-buf-alloc_size-alignment-and-atomic-op-panic.patch
riscv-change-xip-s-kernel_map.size-to-be-size-of-the-entire-kernel.patch
rtla-osnoise-prevent-null-dereference-in-error-handling.patch
s390-dasd-fix-error-recovery-leading-to-data-corruption-on-ese-devices.patch
selinux-add-the-processing-of-the-failure-of-avc_add_xperms_decision.patch
selinux-fix-potential-counting-error-in-avc_add_xperms_decision.patch
thunderbolt-mark-xdomain-as-unplugged-when-router-is-removed.patch
vfs-don-t-evict-inode-under-the-inode-lru-traversing-context.patch
wifi-brcmfmac-cfg80211-handle-ssid-based-pmksa-deletion.patch
xhci-fix-panther-point-null-pointer-deref-at-full-speed-re-enumeration.patch

35 files changed:
queue-6.6/acpi-ec-evaluate-_reg-outside-the-ec-scope-more-carefully.patch [new file with mode: 0644]
queue-6.6/acpica-add-a-depth-argument-to-acpi_execute_reg_methods.patch [new file with mode: 0644]
queue-6.6/alsa-hda-tas2781-fix-wrong-calibrated-data-order.patch [new file with mode: 0644]
queue-6.6/alsa-usb-audio-add-delay-quirk-for-vivo-usb-c-xe710-headset.patch [new file with mode: 0644]
queue-6.6/alsa-usb-audio-support-yamaha-p-125-quirk-entry.patch [new file with mode: 0644]
queue-6.6/arm64-acpi-numa-initialize-all-values-of-acpi_early_node_map-to-numa_no_node.patch [new file with mode: 0644]
queue-6.6/bitmap-introduce-generic-optimized-bitmap_size.patch [new file with mode: 0644]
queue-6.6/btrfs-tree-checker-add-dev-extent-item-checks.patch [new file with mode: 0644]
queue-6.6/btrfs-tree-checker-reject-btrfs_ft_unknown-dir-type.patch [new file with mode: 0644]
queue-6.6/btrfs-zoned-properly-take-lock-to-read-update-block-group-s-zoned-variables.patch [new file with mode: 0644]
queue-6.6/char-xillybus-check-usb-endpoints-when-probing-device.patch [new file with mode: 0644]
queue-6.6/char-xillybus-don-t-destroy-workqueue-from-work-item-running-on-it.patch [new file with mode: 0644]
queue-6.6/char-xillybus-refine-workqueue-handling.patch [new file with mode: 0644]
queue-6.6/dm-persistent-data-fix-memory-allocation-failure.patch [new file with mode: 0644]
queue-6.6/dm-resume-don-t-return-einval-when-signalled.patch [new file with mode: 0644]
queue-6.6/drm-amdgpu-actually-check-flags-for-all-context-ops.patch [new file with mode: 0644]
queue-6.6/fix-bitmap-corruption-on-close_range-with-close_range_unshare.patch [new file with mode: 0644]
queue-6.6/fs-netfs-fscache_cookie-add-missing-n_accesses-check.patch [new file with mode: 0644]
queue-6.6/i2c-qcom-geni-add-missing-geni_icc_disable-in-geni_i2c_runtime_resume.patch [new file with mode: 0644]
queue-6.6/i2c-tegra-do-not-mark-acpi-devices-as-irq-safe.patch [new file with mode: 0644]
queue-6.6/kvm-s390-fix-validity-interception-issue-when-gisa-is-switched-off.patch [new file with mode: 0644]
queue-6.6/memcg_write_event_control-fix-a-user-triggerable-oops.patch [new file with mode: 0644]
queue-6.6/mm-memory-failure-use-raw_spinlock_t-in-struct-memory_failure_cpu.patch [new file with mode: 0644]
queue-6.6/net-mana-fix-doorbell-out-of-order-violation-and-avoid-unnecessary-doorbell-rings.patch [new file with mode: 0644]
queue-6.6/net-mana-fix-rx-buf-alloc_size-alignment-and-atomic-op-panic.patch [new file with mode: 0644]
queue-6.6/riscv-change-xip-s-kernel_map.size-to-be-size-of-the-entire-kernel.patch [new file with mode: 0644]
queue-6.6/rtla-osnoise-prevent-null-dereference-in-error-handling.patch [new file with mode: 0644]
queue-6.6/s390-dasd-fix-error-recovery-leading-to-data-corruption-on-ese-devices.patch [new file with mode: 0644]
queue-6.6/selinux-add-the-processing-of-the-failure-of-avc_add_xperms_decision.patch [new file with mode: 0644]
queue-6.6/selinux-fix-potential-counting-error-in-avc_add_xperms_decision.patch [new file with mode: 0644]
queue-6.6/series
queue-6.6/thunderbolt-mark-xdomain-as-unplugged-when-router-is-removed.patch [new file with mode: 0644]
queue-6.6/vfs-don-t-evict-inode-under-the-inode-lru-traversing-context.patch [new file with mode: 0644]
queue-6.6/wifi-brcmfmac-cfg80211-handle-ssid-based-pmksa-deletion.patch [new file with mode: 0644]
queue-6.6/xhci-fix-panther-point-null-pointer-deref-at-full-speed-re-enumeration.patch [new file with mode: 0644]

diff --git a/queue-6.6/acpi-ec-evaluate-_reg-outside-the-ec-scope-more-carefully.patch b/queue-6.6/acpi-ec-evaluate-_reg-outside-the-ec-scope-more-carefully.patch
new file mode 100644 (file)
index 0000000..0dad4fa
--- /dev/null
@@ -0,0 +1,103 @@
+From 71bf41b8e913ec9fc91f0d39ab8fb320229ec604 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Mon, 12 Aug 2024 15:16:21 +0200
+Subject: ACPI: EC: Evaluate _REG outside the EC scope more carefully
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit 71bf41b8e913ec9fc91f0d39ab8fb320229ec604 upstream.
+
+Commit 60fa6ae6e6d0 ("ACPI: EC: Install address space handler at the
+namespace root") caused _REG methods for EC operation regions outside
+the EC device scope to be evaluated which on some systems leads to the
+evaluation of _REG methods in the scopes of device objects representing
+devices that are not present and not functional according to the _STA
+return values. Some of those device objects represent EC "alternatives"
+and if _REG is evaluated for their operation regions, the platform
+firmware may be confused and the platform may start to behave
+incorrectly.
+
+To avoid this problem, only evaluate _REG for EC operation regions
+located in the scopes of device objects representing known-to-be-present
+devices.
+
+For this purpose, partially revert commit 60fa6ae6e6d0 and trigger the
+evaluation of _REG for EC operation regions from acpi_bus_attach() for
+the known-valid devices.
+
+Fixes: 60fa6ae6e6d0 ("ACPI: EC: Install address space handler at the namespace root")
+Link: https://lore.kernel.org/linux-acpi/1f76b7e2-1928-4598-8037-28a1785c2d13@redhat.com
+Link: https://bugzilla.redhat.com/show_bug.cgi?id=2298938
+Link: https://bugzilla.redhat.com/show_bug.cgi?id=2302253
+Reported-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Cc: All applicable <stable@vger.kernel.org>
+Link: https://patch.msgid.link/23612351.6Emhk5qWAg@rjwysocki.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/acpi/ec.c       |   11 +++++++++--
+ drivers/acpi/internal.h |    1 +
+ drivers/acpi/scan.c     |    2 ++
+ 3 files changed, 12 insertions(+), 2 deletions(-)
+
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -1487,12 +1487,13 @@ static bool install_gpio_irq_event_handl
+ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device,
+                              bool call_reg)
+ {
+-      acpi_handle scope_handle = ec == first_ec ? ACPI_ROOT_OBJECT : ec->handle;
+       acpi_status status;
+       acpi_ec_start(ec, false);
+       if (!test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) {
++              acpi_handle scope_handle = ec == first_ec ? ACPI_ROOT_OBJECT : ec->handle;
++
+               acpi_ec_enter_noirq(ec);
+               status = acpi_install_address_space_handler_no_reg(scope_handle,
+                                                                  ACPI_ADR_SPACE_EC,
+@@ -1506,7 +1507,7 @@ static int ec_install_handlers(struct ac
+       }
+       if (call_reg && !test_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags)) {
+-              acpi_execute_reg_methods(scope_handle, ACPI_UINT32_MAX, ACPI_ADR_SPACE_EC);
++              acpi_execute_reg_methods(ec->handle, ACPI_UINT32_MAX, ACPI_ADR_SPACE_EC);
+               set_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags);
+       }
+@@ -1721,6 +1722,12 @@ static void acpi_ec_remove(struct acpi_d
+       }
+ }
++void acpi_ec_register_opregions(struct acpi_device *adev)
++{
++      if (first_ec && first_ec->handle != adev->handle)
++              acpi_execute_reg_methods(adev->handle, 1, ACPI_ADR_SPACE_EC);
++}
++
+ static acpi_status
+ ec_parse_io_ports(struct acpi_resource *resource, void *context)
+ {
+--- a/drivers/acpi/internal.h
++++ b/drivers/acpi/internal.h
+@@ -204,6 +204,7 @@ int acpi_ec_add_query_handler(struct acp
+                             acpi_handle handle, acpi_ec_query_func func,
+                             void *data);
+ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit);
++void acpi_ec_register_opregions(struct acpi_device *adev);
+ #ifdef CONFIG_PM_SLEEP
+ void acpi_ec_flush_work(void);
+--- a/drivers/acpi/scan.c
++++ b/drivers/acpi/scan.c
+@@ -2198,6 +2198,8 @@ static int acpi_bus_attach(struct acpi_d
+       if (device->handler)
+               goto ok;
++      acpi_ec_register_opregions(device);
++
+       if (!device->flags.initialized) {
+               device->flags.power_manageable =
+                       device->power.states[ACPI_STATE_D0].flags.valid;
diff --git a/queue-6.6/acpica-add-a-depth-argument-to-acpi_execute_reg_methods.patch b/queue-6.6/acpica-add-a-depth-argument-to-acpi_execute_reg_methods.patch
new file mode 100644 (file)
index 0000000..e43edae
--- /dev/null
@@ -0,0 +1,135 @@
+From cdf65d73e001fde600b18d7e45afadf559425ce5 Mon Sep 17 00:00:00 2001
+From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
+Date: Mon, 12 Aug 2024 15:11:42 +0200
+Subject: ACPICA: Add a depth argument to acpi_execute_reg_methods()
+
+From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+
+commit cdf65d73e001fde600b18d7e45afadf559425ce5 upstream.
+
+A subsequent change will need to pass a depth argument to
+acpi_execute_reg_methods(), so prepare that function for it.
+
+No intentional functional changes.
+
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Cc: All applicable <stable@vger.kernel.org>
+Link: https://patch.msgid.link/8451567.NyiUUSuA9g@rjwysocki.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/acpi/acpica/acevents.h |    2 +-
+ drivers/acpi/acpica/evregion.c |    6 ++++--
+ drivers/acpi/acpica/evxfregn.c |   10 +++++++---
+ drivers/acpi/ec.c              |    2 +-
+ include/acpi/acpixf.h          |    1 +
+ 5 files changed, 14 insertions(+), 7 deletions(-)
+
+--- a/drivers/acpi/acpica/acevents.h
++++ b/drivers/acpi/acpica/acevents.h
+@@ -188,7 +188,7 @@ acpi_ev_detach_region(union acpi_operand
+                     u8 acpi_ns_is_locked);
+ void
+-acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
++acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, u32 max_depth,
+                           acpi_adr_space_type space_id, u32 function);
+ acpi_status
+--- a/drivers/acpi/acpica/evregion.c
++++ b/drivers/acpi/acpica/evregion.c
+@@ -65,6 +65,7 @@ acpi_status acpi_ev_initialize_op_region
+                                               acpi_gbl_default_address_spaces
+                                               [i])) {
+                       acpi_ev_execute_reg_methods(acpi_gbl_root_node,
++                                                  ACPI_UINT32_MAX,
+                                                   acpi_gbl_default_address_spaces
+                                                   [i], ACPI_REG_CONNECT);
+               }
+@@ -672,6 +673,7 @@ cleanup1:
+  * FUNCTION:    acpi_ev_execute_reg_methods
+  *
+  * PARAMETERS:  node            - Namespace node for the device
++ *              max_depth       - Depth to which search for _REG
+  *              space_id        - The address space ID
+  *              function        - Passed to _REG: On (1) or Off (0)
+  *
+@@ -683,7 +685,7 @@ cleanup1:
+  ******************************************************************************/
+ void
+-acpi_ev_execute_reg_methods(struct acpi_namespace_node *node,
++acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, u32 max_depth,
+                           acpi_adr_space_type space_id, u32 function)
+ {
+       struct acpi_reg_walk_info info;
+@@ -717,7 +719,7 @@ acpi_ev_execute_reg_methods(struct acpi_
+        * regions and _REG methods. (i.e. handlers must be installed for all
+        * regions of this Space ID before we can run any _REG methods)
+        */
+-      (void)acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, ACPI_UINT32_MAX,
++      (void)acpi_ns_walk_namespace(ACPI_TYPE_ANY, node, max_depth,
+                                    ACPI_NS_WALK_UNLOCK, acpi_ev_reg_run, NULL,
+                                    &info, NULL);
+--- a/drivers/acpi/acpica/evxfregn.c
++++ b/drivers/acpi/acpica/evxfregn.c
+@@ -85,7 +85,8 @@ acpi_install_address_space_handler_inter
+       /* Run all _REG methods for this address space */
+       if (run_reg) {
+-              acpi_ev_execute_reg_methods(node, space_id, ACPI_REG_CONNECT);
++              acpi_ev_execute_reg_methods(node, ACPI_UINT32_MAX, space_id,
++                                          ACPI_REG_CONNECT);
+       }
+ unlock_and_exit:
+@@ -263,6 +264,7 @@ ACPI_EXPORT_SYMBOL(acpi_remove_address_s
+  * FUNCTION:    acpi_execute_reg_methods
+  *
+  * PARAMETERS:  device          - Handle for the device
++ *              max_depth       - Depth to which search for _REG
+  *              space_id        - The address space ID
+  *
+  * RETURN:      Status
+@@ -271,7 +273,8 @@ ACPI_EXPORT_SYMBOL(acpi_remove_address_s
+  *
+  ******************************************************************************/
+ acpi_status
+-acpi_execute_reg_methods(acpi_handle device, acpi_adr_space_type space_id)
++acpi_execute_reg_methods(acpi_handle device, u32 max_depth,
++                       acpi_adr_space_type space_id)
+ {
+       struct acpi_namespace_node *node;
+       acpi_status status;
+@@ -296,7 +299,8 @@ acpi_execute_reg_methods(acpi_handle dev
+               /* Run all _REG methods for this address space */
+-              acpi_ev_execute_reg_methods(node, space_id, ACPI_REG_CONNECT);
++              acpi_ev_execute_reg_methods(node, max_depth, space_id,
++                                          ACPI_REG_CONNECT);
+       } else {
+               status = AE_BAD_PARAMETER;
+       }
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -1506,7 +1506,7 @@ static int ec_install_handlers(struct ac
+       }
+       if (call_reg && !test_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags)) {
+-              acpi_execute_reg_methods(scope_handle, ACPI_ADR_SPACE_EC);
++              acpi_execute_reg_methods(scope_handle, ACPI_UINT32_MAX, ACPI_ADR_SPACE_EC);
+               set_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags);
+       }
+--- a/include/acpi/acpixf.h
++++ b/include/acpi/acpixf.h
+@@ -660,6 +660,7 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+                            void *context))
+ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
+                           acpi_execute_reg_methods(acpi_handle device,
++                                                   u32 nax_depth,
+                                                    acpi_adr_space_type
+                                                    space_id))
+ ACPI_EXTERNAL_RETURN_STATUS(acpi_status
diff --git a/queue-6.6/alsa-hda-tas2781-fix-wrong-calibrated-data-order.patch b/queue-6.6/alsa-hda-tas2781-fix-wrong-calibrated-data-order.patch
new file mode 100644 (file)
index 0000000..b502a10
--- /dev/null
@@ -0,0 +1,66 @@
+From 3beddef84d90590270465a907de1cfe2539ac70d Mon Sep 17 00:00:00 2001
+From: Baojun Xu <baojun.xu@ti.com>
+Date: Tue, 13 Aug 2024 12:37:48 +0800
+Subject: ALSA: hda/tas2781: fix wrong calibrated data order
+
+From: Baojun Xu <baojun.xu@ti.com>
+
+commit 3beddef84d90590270465a907de1cfe2539ac70d upstream.
+
+Wrong calibration data order cause sound too low in some device.
+Fix wrong calibrated data order, add calibration data converssion
+by get_unaligned_be32() after reading from UEFI.
+
+Fixes: 5be27f1e3ec9 ("ALSA: hda/tas2781: Add tas2781 HDA driver")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Baojun Xu <baojun.xu@ti.com>
+Link: https://patch.msgid.link/20240813043749.108-1-shenghao-ding@ti.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/tas2781_hda_i2c.c |   14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+--- a/sound/pci/hda/tas2781_hda_i2c.c
++++ b/sound/pci/hda/tas2781_hda_i2c.c
+@@ -2,10 +2,12 @@
+ //
+ // TAS2781 HDA I2C driver
+ //
+-// Copyright 2023 Texas Instruments, Inc.
++// Copyright 2023 - 2024 Texas Instruments, Inc.
+ //
+ // Author: Shenghao Ding <shenghao-ding@ti.com>
++// Current maintainer: Baojun Xu <baojun.xu@ti.com>
++#include <asm/unaligned.h>
+ #include <linux/acpi.h>
+ #include <linux/crc8.h>
+ #include <linux/crc32.h>
+@@ -425,20 +427,22 @@ static void tas2781_apply_calib(struct t
+       static const unsigned char rgno_array[CALIB_MAX] = {
+               0x74, 0x0c, 0x14, 0x70, 0x7c,
+       };
+-      unsigned char *data;
++      int offset = 0;
+       int i, j, rc;
++      __be32 data;
+       for (i = 0; i < tas_priv->ndev; i++) {
+-              data = tas_priv->cali_data.data +
+-                      i * TASDEVICE_SPEAKER_CALIBRATION_SIZE;
+               for (j = 0; j < CALIB_MAX; j++) {
++                      data = get_unaligned_be32(
++                              &tas_priv->cali_data.data[offset]);
+                       rc = tasdevice_dev_bulk_write(tas_priv, i,
+                               TASDEVICE_REG(0, page_array[j], rgno_array[j]),
+-                              &(data[4 * j]), 4);
++                              (unsigned char *)&data, 4);
+                       if (rc < 0)
+                               dev_err(tas_priv->dev,
+                                       "chn %d calib %d bulk_wr err = %d\n",
+                                       i, j, rc);
++                      offset += 4;
+               }
+       }
+ }
diff --git a/queue-6.6/alsa-usb-audio-add-delay-quirk-for-vivo-usb-c-xe710-headset.patch b/queue-6.6/alsa-usb-audio-add-delay-quirk-for-vivo-usb-c-xe710-headset.patch
new file mode 100644 (file)
index 0000000..5d3c9e8
--- /dev/null
@@ -0,0 +1,32 @@
+From 004eb8ba776ccd3e296ea6f78f7ae7985b12824e Mon Sep 17 00:00:00 2001
+From: Lianqin Hu <hulianqin@vivo.com>
+Date: Sun, 11 Aug 2024 08:30:11 +0000
+Subject: ALSA: usb-audio: Add delay quirk for VIVO USB-C-XE710 HEADSET
+
+From: Lianqin Hu <hulianqin@vivo.com>
+
+commit 004eb8ba776ccd3e296ea6f78f7ae7985b12824e upstream.
+
+Audio control requests that sets sampling frequency sometimes fail on
+this card. Adding delay between control messages eliminates that problem.
+
+Signed-off-by: Lianqin Hu <hulianqin@vivo.com>
+Cc: <stable@vger.kernel.org>
+Link: https://patch.msgid.link/TYUPR06MB6217FF67076AF3E49E12C877D2842@TYUPR06MB6217.apcprd06.prod.outlook.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/quirks.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -2181,6 +2181,8 @@ static const struct usb_audio_quirk_flag
+                  QUIRK_FLAG_GENERIC_IMPLICIT_FB),
+       DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */
+                  QUIRK_FLAG_GENERIC_IMPLICIT_FB),
++      DEVICE_FLG(0x2d95, 0x8021, /* VIVO USB-C-XE710 HEADSET */
++                 QUIRK_FLAG_CTL_MSG_DELAY_1M),
+       DEVICE_FLG(0x30be, 0x0101, /* Schiit Hel */
+                  QUIRK_FLAG_IGNORE_CTL_ERROR),
+       DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */
diff --git a/queue-6.6/alsa-usb-audio-support-yamaha-p-125-quirk-entry.patch b/queue-6.6/alsa-usb-audio-support-yamaha-p-125-quirk-entry.patch
new file mode 100644 (file)
index 0000000..21d1842
--- /dev/null
@@ -0,0 +1,33 @@
+From c286f204ce6ba7b48e3dcba53eda7df8eaa64dd9 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= <soyjuanarbol@gmail.com>
+Date: Tue, 13 Aug 2024 11:10:53 -0500
+Subject: ALSA: usb-audio: Support Yamaha P-125 quirk entry
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Juan José Arboleda <soyjuanarbol@gmail.com>
+
+commit c286f204ce6ba7b48e3dcba53eda7df8eaa64dd9 upstream.
+
+This patch adds a USB quirk for the Yamaha P-125 digital piano.
+
+Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
+Cc: <stable@vger.kernel.org>
+Link: https://patch.msgid.link/20240813161053.70256-1-soyjuanarbol@gmail.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/usb/quirks-table.h |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/usb/quirks-table.h
++++ b/sound/usb/quirks-table.h
+@@ -273,6 +273,7 @@ YAMAHA_DEVICE(0x105a, NULL),
+ YAMAHA_DEVICE(0x105b, NULL),
+ YAMAHA_DEVICE(0x105c, NULL),
+ YAMAHA_DEVICE(0x105d, NULL),
++YAMAHA_DEVICE(0x1718, "P-125"),
+ {
+       USB_DEVICE(0x0499, 0x1503),
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
diff --git a/queue-6.6/arm64-acpi-numa-initialize-all-values-of-acpi_early_node_map-to-numa_no_node.patch b/queue-6.6/arm64-acpi-numa-initialize-all-values-of-acpi_early_node_map-to-numa_no_node.patch
new file mode 100644 (file)
index 0000000..6d20bbd
--- /dev/null
@@ -0,0 +1,42 @@
+From a21dcf0ea8566ebbe011c79d6ed08cdfea771de3 Mon Sep 17 00:00:00 2001
+From: Haibo Xu <haibo1.xu@intel.com>
+Date: Mon, 5 Aug 2024 11:30:24 +0800
+Subject: arm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
+
+From: Haibo Xu <haibo1.xu@intel.com>
+
+commit a21dcf0ea8566ebbe011c79d6ed08cdfea771de3 upstream.
+
+Currently, only acpi_early_node_map[0] was initialized to NUMA_NO_NODE.
+To ensure all the values were properly initialized, switch to initialize
+all of them to NUMA_NO_NODE.
+
+Fixes: e18962491696 ("arm64: numa: rework ACPI NUMA initialization")
+Cc: <stable@vger.kernel.org> # 4.19.x
+Reported-by: Andrew Jones <ajones@ventanamicro.com>
+Suggested-by: Andrew Jones <ajones@ventanamicro.com>
+Signed-off-by: Haibo Xu <haibo1.xu@intel.com>
+Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
+Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
+Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
+Acked-by: Catalin Marinas <catalin.marinas@arm.com>
+Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
+Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
+Link: https://lore.kernel.org/r/853d7f74aa243f6f5999e203246f0d1ae92d2b61.1722828421.git.haibo1.xu@intel.com
+Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm64/kernel/acpi_numa.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/kernel/acpi_numa.c
++++ b/arch/arm64/kernel/acpi_numa.c
+@@ -27,7 +27,7 @@
+ #include <asm/numa.h>
+-static int acpi_early_node_map[NR_CPUS] __initdata = { NUMA_NO_NODE };
++static int acpi_early_node_map[NR_CPUS] __initdata = { [0 ... NR_CPUS - 1] = NUMA_NO_NODE };
+ int __init acpi_numa_get_nid(unsigned int cpu)
+ {
diff --git a/queue-6.6/bitmap-introduce-generic-optimized-bitmap_size.patch b/queue-6.6/bitmap-introduce-generic-optimized-bitmap_size.patch
new file mode 100644 (file)
index 0000000..88cb287
--- /dev/null
@@ -0,0 +1,169 @@
+From a37fbe666c016fd89e4460d0ebfcea05baba46dc Mon Sep 17 00:00:00 2001
+From: Alexander Lobakin <aleksander.lobakin@intel.com>
+Date: Wed, 27 Mar 2024 16:23:49 +0100
+Subject: bitmap: introduce generic optimized bitmap_size()
+
+From: Alexander Lobakin <aleksander.lobakin@intel.com>
+
+commit a37fbe666c016fd89e4460d0ebfcea05baba46dc upstream.
+
+The number of times yet another open coded
+`BITS_TO_LONGS(nbits) * sizeof(long)` can be spotted is huge.
+Some generic helper is long overdue.
+
+Add one, bitmap_size(), but with one detail.
+BITS_TO_LONGS() uses DIV_ROUND_UP(). The latter works well when both
+divident and divisor are compile-time constants or when the divisor
+is not a pow-of-2. When it is however, the compilers sometimes tend
+to generate suboptimal code (GCC 13):
+
+48 83 c0 3f            add    $0x3f,%rax
+48 c1 e8 06            shr    $0x6,%rax
+48 8d 14 c5 00 00 00 00        lea    0x0(,%rax,8),%rdx
+
+%BITS_PER_LONG is always a pow-2 (either 32 or 64), but GCC still does
+full division of `nbits + 63` by it and then multiplication by 8.
+Instead of BITS_TO_LONGS(), use ALIGN() and then divide by 8. GCC:
+
+8d 50 3f               lea    0x3f(%rax),%edx
+c1 ea 03               shr    $0x3,%edx
+81 e2 f8 ff ff 1f      and    $0x1ffffff8,%edx
+
+Now it shifts `nbits + 63` by 3 positions (IOW performs fast division
+by 8) and then masks bits[2:0]. bloat-o-meter:
+
+add/remove: 0/0 grow/shrink: 20/133 up/down: 156/-773 (-617)
+
+Clang does it better and generates the same code before/after starting
+from -O1, except that with the ALIGN() approach it uses %edx and thus
+still saves some bytes:
+
+add/remove: 0/0 grow/shrink: 9/133 up/down: 18/-538 (-520)
+
+Note that we can't expand DIV_ROUND_UP() by adding a check and using
+this approach there, as it's used in array declarations where
+expressions are not allowed.
+Add this helper to tools/ as well.
+
+Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
+Acked-by: Yury Norov <yury.norov@gmail.com>
+Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-clone-metadata.c |    5 -----
+ drivers/s390/cio/idset.c       |    2 +-
+ include/linux/bitmap.h         |    8 +++++---
+ include/linux/cpumask.h        |    2 +-
+ lib/math/prime_numbers.c       |    2 --
+ tools/include/linux/bitmap.h   |    7 ++++---
+ 6 files changed, 11 insertions(+), 15 deletions(-)
+
+--- a/drivers/md/dm-clone-metadata.c
++++ b/drivers/md/dm-clone-metadata.c
+@@ -465,11 +465,6 @@ static void __destroy_persistent_data_st
+ /*---------------------------------------------------------------------------*/
+-static size_t bitmap_size(unsigned long nr_bits)
+-{
+-      return BITS_TO_LONGS(nr_bits) * sizeof(long);
+-}
+-
+ static int __dirty_map_init(struct dirty_map *dmap, unsigned long nr_words,
+                           unsigned long nr_regions)
+ {
+--- a/drivers/s390/cio/idset.c
++++ b/drivers/s390/cio/idset.c
+@@ -18,7 +18,7 @@ struct idset {
+ static inline unsigned long bitmap_size(int num_ssid, int num_id)
+ {
+-      return BITS_TO_LONGS(num_ssid * num_id) * sizeof(unsigned long);
++      return bitmap_size(size_mul(num_ssid, num_id));
+ }
+ static struct idset *idset_new(int num_ssid, int num_id)
+--- a/include/linux/bitmap.h
++++ b/include/linux/bitmap.h
+@@ -237,9 +237,11 @@ extern int bitmap_print_list_to_buf(char
+ #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
+ #define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
++#define bitmap_size(nbits)    (ALIGN(nbits, BITS_PER_LONG) / BITS_PER_BYTE)
++
+ static inline void bitmap_zero(unsigned long *dst, unsigned int nbits)
+ {
+-      unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
++      unsigned int len = bitmap_size(nbits);
+       if (small_const_nbits(nbits))
+               *dst = 0;
+@@ -249,7 +251,7 @@ static inline void bitmap_zero(unsigned
+ static inline void bitmap_fill(unsigned long *dst, unsigned int nbits)
+ {
+-      unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
++      unsigned int len = bitmap_size(nbits);
+       if (small_const_nbits(nbits))
+               *dst = ~0UL;
+@@ -260,7 +262,7 @@ static inline void bitmap_fill(unsigned
+ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
+                       unsigned int nbits)
+ {
+-      unsigned int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
++      unsigned int len = bitmap_size(nbits);
+       if (small_const_nbits(nbits))
+               *dst = *src;
+--- a/include/linux/cpumask.h
++++ b/include/linux/cpumask.h
+@@ -821,7 +821,7 @@ static inline int cpulist_parse(const ch
+  */
+ static inline unsigned int cpumask_size(void)
+ {
+-      return BITS_TO_LONGS(large_cpumask_bits) * sizeof(long);
++      return bitmap_size(large_cpumask_bits);
+ }
+ /*
+--- a/lib/math/prime_numbers.c
++++ b/lib/math/prime_numbers.c
+@@ -6,8 +6,6 @@
+ #include <linux/prime_numbers.h>
+ #include <linux/slab.h>
+-#define bitmap_size(nbits) (BITS_TO_LONGS(nbits) * sizeof(unsigned long))
+-
+ struct primes {
+       struct rcu_head rcu;
+       unsigned long last, sz;
+--- a/tools/include/linux/bitmap.h
++++ b/tools/include/linux/bitmap.h
+@@ -25,13 +25,14 @@ bool __bitmap_intersects(const unsigned
+ #define BITMAP_FIRST_WORD_MASK(start) (~0UL << ((start) & (BITS_PER_LONG - 1)))
+ #define BITMAP_LAST_WORD_MASK(nbits) (~0UL >> (-(nbits) & (BITS_PER_LONG - 1)))
++#define bitmap_size(nbits)    (ALIGN(nbits, BITS_PER_LONG) / BITS_PER_BYTE)
++
+ static inline void bitmap_zero(unsigned long *dst, unsigned int nbits)
+ {
+       if (small_const_nbits(nbits))
+               *dst = 0UL;
+       else {
+-              int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
+-              memset(dst, 0, len);
++              memset(dst, 0, bitmap_size(nbits));
+       }
+ }
+@@ -83,7 +84,7 @@ static inline void bitmap_or(unsigned lo
+  */
+ static inline unsigned long *bitmap_zalloc(int nbits)
+ {
+-      return calloc(1, BITS_TO_LONGS(nbits) * sizeof(unsigned long));
++      return calloc(1, bitmap_size(nbits));
+ }
+ /*
diff --git a/queue-6.6/btrfs-tree-checker-add-dev-extent-item-checks.patch b/queue-6.6/btrfs-tree-checker-add-dev-extent-item-checks.patch
new file mode 100644 (file)
index 0000000..be57509
--- /dev/null
@@ -0,0 +1,162 @@
+From 008e2512dc5696ab2dc5bf264e98a9fe9ceb830e Mon Sep 17 00:00:00 2001
+From: Qu Wenruo <wqu@suse.com>
+Date: Sun, 11 Aug 2024 15:00:22 +0930
+Subject: btrfs: tree-checker: add dev extent item checks
+
+From: Qu Wenruo <wqu@suse.com>
+
+commit 008e2512dc5696ab2dc5bf264e98a9fe9ceb830e upstream.
+
+[REPORT]
+There is a corruption report that btrfs refused to mount a fs that has
+overlapping dev extents:
+
+  BTRFS error (device sdc): dev extent devid 4 physical offset 14263979671552 overlap with previous dev extent end 14263980982272
+  BTRFS error (device sdc): failed to verify dev extents against chunks: -117
+  BTRFS error (device sdc): open_ctree failed
+
+[CAUSE]
+The direct cause is very obvious, there is a bad dev extent item with
+incorrect length.
+
+With btrfs check reporting two overlapping extents, the second one shows
+some clue on the cause:
+
+  ERROR: dev extent devid 4 offset 14263979671552 len 6488064 overlap with previous dev extent end 14263980982272
+  ERROR: dev extent devid 13 offset 2257707008000 len 6488064 overlap with previous dev extent end 2257707270144
+  ERROR: errors found in extent allocation tree or chunk allocation
+
+The second one looks like a bitflip happened during new chunk
+allocation:
+hex(2257707008000) = 0x20da9d30000
+hex(2257707270144) = 0x20da9d70000
+diff               = 0x00000040000
+
+So it looks like a bitflip happened during new dev extent allocation,
+resulting the second overlap.
+
+Currently we only do the dev-extent verification at mount time, but if the
+corruption is caused by memory bitflip, we really want to catch it before
+writing the corruption to the storage.
+
+Furthermore the dev extent items has the following key definition:
+
+       (<device id> DEV_EXTENT <physical offset>)
+
+Thus we can not just rely on the generic key order check to make sure
+there is no overlapping.
+
+[ENHANCEMENT]
+Introduce dedicated dev extent checks, including:
+
+- Fixed member checks
+  * chunk_tree should always be BTRFS_CHUNK_TREE_OBJECTID (3)
+  * chunk_objectid should always be
+    BTRFS_FIRST_CHUNK_CHUNK_TREE_OBJECTID (256)
+
+- Alignment checks
+  * chunk_offset should be aligned to sectorsize
+  * length should be aligned to sectorsize
+  * key.offset should be aligned to sectorsize
+
+- Overlap checks
+  If the previous key is also a dev-extent item, with the same
+  device id, make sure we do not overlap with the previous dev extent.
+
+Reported: Stefan N <stefannnau@gmail.com>
+Link: https://lore.kernel.org/linux-btrfs/CA+W5K0rSO3koYTo=nzxxTm1-Pdu1HYgVxEpgJ=aGc7d=E8mGEg@mail.gmail.com/
+CC: stable@vger.kernel.org # 5.10+
+Reviewed-by: Anand Jain <anand.jain@oracle.com>
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/tree-checker.c |   69 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 69 insertions(+)
+
+--- a/fs/btrfs/tree-checker.c
++++ b/fs/btrfs/tree-checker.c
+@@ -1671,6 +1671,72 @@ static int check_inode_ref(struct extent
+       return 0;
+ }
++static int check_dev_extent_item(const struct extent_buffer *leaf,
++                               const struct btrfs_key *key,
++                               int slot,
++                               struct btrfs_key *prev_key)
++{
++      struct btrfs_dev_extent *de;
++      const u32 sectorsize = leaf->fs_info->sectorsize;
++
++      de = btrfs_item_ptr(leaf, slot, struct btrfs_dev_extent);
++      /* Basic fixed member checks. */
++      if (unlikely(btrfs_dev_extent_chunk_tree(leaf, de) !=
++                   BTRFS_CHUNK_TREE_OBJECTID)) {
++              generic_err(leaf, slot,
++                          "invalid dev extent chunk tree id, has %llu expect %llu",
++                          btrfs_dev_extent_chunk_tree(leaf, de),
++                          BTRFS_CHUNK_TREE_OBJECTID);
++              return -EUCLEAN;
++      }
++      if (unlikely(btrfs_dev_extent_chunk_objectid(leaf, de) !=
++                   BTRFS_FIRST_CHUNK_TREE_OBJECTID)) {
++              generic_err(leaf, slot,
++                          "invalid dev extent chunk objectid, has %llu expect %llu",
++                          btrfs_dev_extent_chunk_objectid(leaf, de),
++                          BTRFS_FIRST_CHUNK_TREE_OBJECTID);
++              return -EUCLEAN;
++      }
++      /* Alignment check. */
++      if (unlikely(!IS_ALIGNED(key->offset, sectorsize))) {
++              generic_err(leaf, slot,
++                          "invalid dev extent key.offset, has %llu not aligned to %u",
++                          key->offset, sectorsize);
++              return -EUCLEAN;
++      }
++      if (unlikely(!IS_ALIGNED(btrfs_dev_extent_chunk_offset(leaf, de),
++                               sectorsize))) {
++              generic_err(leaf, slot,
++                          "invalid dev extent chunk offset, has %llu not aligned to %u",
++                          btrfs_dev_extent_chunk_objectid(leaf, de),
++                          sectorsize);
++              return -EUCLEAN;
++      }
++      if (unlikely(!IS_ALIGNED(btrfs_dev_extent_length(leaf, de),
++                               sectorsize))) {
++              generic_err(leaf, slot,
++                          "invalid dev extent length, has %llu not aligned to %u",
++                          btrfs_dev_extent_length(leaf, de), sectorsize);
++              return -EUCLEAN;
++      }
++      /* Overlap check with previous dev extent. */
++      if (slot && prev_key->objectid == key->objectid &&
++          prev_key->type == key->type) {
++              struct btrfs_dev_extent *prev_de;
++              u64 prev_len;
++
++              prev_de = btrfs_item_ptr(leaf, slot - 1, struct btrfs_dev_extent);
++              prev_len = btrfs_dev_extent_length(leaf, prev_de);
++              if (unlikely(prev_key->offset + prev_len > key->offset)) {
++                      generic_err(leaf, slot,
++              "dev extent overlap, prev offset %llu len %llu current offset %llu",
++                                  prev_key->objectid, prev_len, key->offset);
++                      return -EUCLEAN;
++              }
++      }
++      return 0;
++}
++
+ /*
+  * Common point to switch the item-specific validation.
+  */
+@@ -1707,6 +1773,9 @@ static enum btrfs_tree_block_status chec
+       case BTRFS_DEV_ITEM_KEY:
+               ret = check_dev_item(leaf, key, slot);
+               break;
++      case BTRFS_DEV_EXTENT_KEY:
++              ret = check_dev_extent_item(leaf, key, slot, prev_key);
++              break;
+       case BTRFS_INODE_ITEM_KEY:
+               ret = check_inode_item(leaf, key, slot);
+               break;
diff --git a/queue-6.6/btrfs-tree-checker-reject-btrfs_ft_unknown-dir-type.patch b/queue-6.6/btrfs-tree-checker-reject-btrfs_ft_unknown-dir-type.patch
new file mode 100644 (file)
index 0000000..686c8d8
--- /dev/null
@@ -0,0 +1,58 @@
+From 31723c9542dba1681cc3720571fdf12ffe0eddd9 Mon Sep 17 00:00:00 2001
+From: Qu Wenruo <wqu@suse.com>
+Date: Mon, 12 Aug 2024 08:52:44 +0930
+Subject: btrfs: tree-checker: reject BTRFS_FT_UNKNOWN dir type
+
+From: Qu Wenruo <wqu@suse.com>
+
+commit 31723c9542dba1681cc3720571fdf12ffe0eddd9 upstream.
+
+[REPORT]
+There is a bug report that kernel is rejecting a mismatching inode mode
+and its dir item:
+
+  [ 1881.553937] BTRFS critical (device dm-0): inode mode mismatch with
+  dir: inode mode=040700 btrfs type=2 dir type=0
+
+[CAUSE]
+It looks like the inode mode is correct, while the dir item type
+0 is BTRFS_FT_UNKNOWN, which should not be generated by btrfs at all.
+
+This may be caused by a memory bit flip.
+
+[ENHANCEMENT]
+Although tree-checker is not able to do any cross-leaf verification, for
+this particular case we can at least reject any dir type with
+BTRFS_FT_UNKNOWN.
+
+So here we enhance the dir type check from [0, BTRFS_FT_MAX), to
+(0, BTRFS_FT_MAX).
+Although the existing corruption can not be fixed just by such enhanced
+checking, it should prevent the same 0x2->0x0 bitflip for dir type to
+reach disk in the future.
+
+Reported-by: Kota <nospam@kota.moe>
+Link: https://lore.kernel.org/linux-btrfs/CACsxjPYnQF9ZF-0OhH16dAx50=BXXOcP74MxBc3BG+xae4vTTw@mail.gmail.com/
+CC: stable@vger.kernel.org # 5.4+
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/tree-checker.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/fs/btrfs/tree-checker.c
++++ b/fs/btrfs/tree-checker.c
+@@ -548,9 +548,10 @@ static int check_dir_item(struct extent_
+               /* dir type check */
+               dir_type = btrfs_dir_ftype(leaf, di);
+-              if (unlikely(dir_type >= BTRFS_FT_MAX)) {
++              if (unlikely(dir_type <= BTRFS_FT_UNKNOWN ||
++                           dir_type >= BTRFS_FT_MAX)) {
+                       dir_item_err(leaf, slot,
+-                      "invalid dir item type, have %u expect [0, %u)",
++                      "invalid dir item type, have %u expect (0, %u)",
+                               dir_type, BTRFS_FT_MAX);
+                       return -EUCLEAN;
+               }
diff --git a/queue-6.6/btrfs-zoned-properly-take-lock-to-read-update-block-group-s-zoned-variables.patch b/queue-6.6/btrfs-zoned-properly-take-lock-to-read-update-block-group-s-zoned-variables.patch
new file mode 100644 (file)
index 0000000..916fc88
--- /dev/null
@@ -0,0 +1,82 @@
+From e30729d4bd4001881be4d1ad4332a5d4985398f8 Mon Sep 17 00:00:00 2001
+From: Naohiro Aota <naohiro.aota@wdc.com>
+Date: Thu, 1 Aug 2024 16:47:52 +0900
+Subject: btrfs: zoned: properly take lock to read/update block group's zoned variables
+
+From: Naohiro Aota <naohiro.aota@wdc.com>
+
+commit e30729d4bd4001881be4d1ad4332a5d4985398f8 upstream.
+
+__btrfs_add_free_space_zoned() references and modifies bg's alloc_offset,
+ro, and zone_unusable, but without taking the lock. It is mostly safe
+because they monotonically increase (at least for now) and this function is
+mostly called by a transaction commit, which is serialized by itself.
+
+Still, taking the lock is a safer and correct option and I'm going to add a
+change to reset zone_unusable while a block group is still alive. So, add
+locking around the operations.
+
+Fixes: 169e0da91a21 ("btrfs: zoned: track unusable bytes for zones")
+CC: stable@vger.kernel.org # 5.15+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/free-space-cache.c |   14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+--- a/fs/btrfs/free-space-cache.c
++++ b/fs/btrfs/free-space-cache.c
+@@ -2696,15 +2696,16 @@ static int __btrfs_add_free_space_zoned(
+       u64 offset = bytenr - block_group->start;
+       u64 to_free, to_unusable;
+       int bg_reclaim_threshold = 0;
+-      bool initial = ((size == block_group->length) && (block_group->alloc_offset == 0));
++      bool initial;
+       u64 reclaimable_unusable;
+-      WARN_ON(!initial && offset + size > block_group->zone_capacity);
++      spin_lock(&block_group->lock);
++      initial = ((size == block_group->length) && (block_group->alloc_offset == 0));
++      WARN_ON(!initial && offset + size > block_group->zone_capacity);
+       if (!initial)
+               bg_reclaim_threshold = READ_ONCE(sinfo->bg_reclaim_threshold);
+-      spin_lock(&ctl->tree_lock);
+       if (!used)
+               to_free = size;
+       else if (initial)
+@@ -2717,7 +2718,9 @@ static int __btrfs_add_free_space_zoned(
+               to_free = offset + size - block_group->alloc_offset;
+       to_unusable = size - to_free;
++      spin_lock(&ctl->tree_lock);
+       ctl->free_space += to_free;
++      spin_unlock(&ctl->tree_lock);
+       /*
+        * If the block group is read-only, we should account freed space into
+        * bytes_readonly.
+@@ -2726,11 +2729,8 @@ static int __btrfs_add_free_space_zoned(
+               block_group->zone_unusable += to_unusable;
+               WARN_ON(block_group->zone_unusable > block_group->length);
+       }
+-      spin_unlock(&ctl->tree_lock);
+       if (!used) {
+-              spin_lock(&block_group->lock);
+               block_group->alloc_offset -= size;
+-              spin_unlock(&block_group->lock);
+       }
+       reclaimable_unusable = block_group->zone_unusable -
+@@ -2744,6 +2744,8 @@ static int __btrfs_add_free_space_zoned(
+               btrfs_mark_bg_to_reclaim(block_group);
+       }
++      spin_unlock(&block_group->lock);
++
+       return 0;
+ }
diff --git a/queue-6.6/char-xillybus-check-usb-endpoints-when-probing-device.patch b/queue-6.6/char-xillybus-check-usb-endpoints-when-probing-device.patch
new file mode 100644 (file)
index 0000000..393ff94
--- /dev/null
@@ -0,0 +1,93 @@
+From 2374bf7558de915edc6ec8cb10ec3291dfab9594 Mon Sep 17 00:00:00 2001
+From: Eli Billauer <eli.billauer@gmail.com>
+Date: Fri, 16 Aug 2024 10:02:00 +0300
+Subject: char: xillybus: Check USB endpoints when probing device
+
+From: Eli Billauer <eli.billauer@gmail.com>
+
+commit 2374bf7558de915edc6ec8cb10ec3291dfab9594 upstream.
+
+Ensure, as the driver probes the device, that all endpoints that the
+driver may attempt to access exist and are of the correct type.
+
+All XillyUSB devices must have a Bulk IN and Bulk OUT endpoint at
+address 1. This is verified in xillyusb_setup_base_eps().
+
+On top of that, a XillyUSB device may have additional Bulk OUT
+endpoints. The information about these endpoints' addresses is deduced
+from a data structure (the IDT) that the driver fetches from the device
+while probing it. These endpoints are checked in setup_channels().
+
+A XillyUSB device never has more than one IN endpoint, as all data
+towards the host is multiplexed in this single Bulk IN endpoint. This is
+why setup_channels() only checks OUT endpoints.
+
+Reported-by: syzbot+eac39cba052f2e750dbe@syzkaller.appspotmail.com
+Cc: stable <stable@kernel.org>
+Closes: https://lore.kernel.org/all/0000000000001d44a6061f7a54ee@google.com/T/
+Fixes: a53d1202aef1 ("char: xillybus: Add driver for XillyUSB (Xillybus variant for USB)").
+Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
+Link: https://lore.kernel.org/r/20240816070200.50695-2-eli.billauer@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/char/xillybus/xillyusb.c |   22 ++++++++++++++++++++--
+ 1 file changed, 20 insertions(+), 2 deletions(-)
+
+--- a/drivers/char/xillybus/xillyusb.c
++++ b/drivers/char/xillybus/xillyusb.c
+@@ -1903,6 +1903,13 @@ static const struct file_operations xill
+ static int xillyusb_setup_base_eps(struct xillyusb_dev *xdev)
+ {
++      struct usb_device *udev = xdev->udev;
++
++      /* Verify that device has the two fundamental bulk in/out endpoints */
++      if (usb_pipe_type_check(udev, usb_sndbulkpipe(udev, MSG_EP_NUM)) ||
++          usb_pipe_type_check(udev, usb_rcvbulkpipe(udev, IN_EP_NUM)))
++              return -ENODEV;
++
+       xdev->msg_ep = endpoint_alloc(xdev, MSG_EP_NUM | USB_DIR_OUT,
+                                     bulk_out_work, 1, 2);
+       if (!xdev->msg_ep)
+@@ -1932,14 +1939,15 @@ static int setup_channels(struct xillyus
+                         __le16 *chandesc,
+                         int num_channels)
+ {
+-      struct xillyusb_channel *chan;
++      struct usb_device *udev = xdev->udev;
++      struct xillyusb_channel *chan, *new_channels;
+       int i;
+       chan = kcalloc(num_channels, sizeof(*chan), GFP_KERNEL);
+       if (!chan)
+               return -ENOMEM;
+-      xdev->channels = chan;
++      new_channels = chan;
+       for (i = 0; i < num_channels; i++, chan++) {
+               unsigned int in_desc = le16_to_cpu(*chandesc++);
+@@ -1968,6 +1976,15 @@ static int setup_channels(struct xillyus
+                */
+               if ((out_desc & 0x80) && i < 14) { /* Entry is valid */
++                      if (usb_pipe_type_check(udev,
++                                              usb_sndbulkpipe(udev, i + 2))) {
++                              dev_err(xdev->dev,
++                                      "Missing BULK OUT endpoint %d\n",
++                                      i + 2);
++                              kfree(new_channels);
++                              return -ENODEV;
++                      }
++
+                       chan->writable = 1;
+                       chan->out_synchronous = !!(out_desc & 0x40);
+                       chan->out_seekable = !!(out_desc & 0x20);
+@@ -1977,6 +1994,7 @@ static int setup_channels(struct xillyus
+               }
+       }
++      xdev->channels = new_channels;
+       return 0;
+ }
diff --git a/queue-6.6/char-xillybus-don-t-destroy-workqueue-from-work-item-running-on-it.patch b/queue-6.6/char-xillybus-don-t-destroy-workqueue-from-work-item-running-on-it.patch
new file mode 100644 (file)
index 0000000..79c860c
--- /dev/null
@@ -0,0 +1,83 @@
+From ccbde4b128ef9c73d14d0d7817d68ef795f6d131 Mon Sep 17 00:00:00 2001
+From: Eli Billauer <eli.billauer@gmail.com>
+Date: Thu, 1 Aug 2024 15:11:26 +0300
+Subject: char: xillybus: Don't destroy workqueue from work item running on it
+
+From: Eli Billauer <eli.billauer@gmail.com>
+
+commit ccbde4b128ef9c73d14d0d7817d68ef795f6d131 upstream.
+
+Triggered by a kref decrement, destroy_workqueue() may be called from
+within a work item for destroying its own workqueue. This illegal
+situation is averted by adding a module-global workqueue for exclusive
+use of the offending work item. Other work items continue to be queued
+on per-device workqueues to ensure performance.
+
+Reported-by: syzbot+91dbdfecdd3287734d8e@syzkaller.appspotmail.com
+Cc: stable <stable@kernel.org>
+Closes: https://lore.kernel.org/lkml/0000000000000ab25a061e1dfe9f@google.com/
+Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
+Link: https://lore.kernel.org/r/20240801121126.60183-1-eli.billauer@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/char/xillybus/xillyusb.c |   16 +++++++++++-----
+ 1 file changed, 11 insertions(+), 5 deletions(-)
+
+--- a/drivers/char/xillybus/xillyusb.c
++++ b/drivers/char/xillybus/xillyusb.c
+@@ -50,6 +50,7 @@ MODULE_LICENSE("GPL v2");
+ static const char xillyname[] = "xillyusb";
+ static unsigned int fifo_buf_order;
++static struct workqueue_struct *wakeup_wq;
+ #define USB_VENDOR_ID_XILINX          0x03fd
+ #define USB_VENDOR_ID_ALTERA          0x09fb
+@@ -569,10 +570,6 @@ static void cleanup_dev(struct kref *kre
+  * errors if executed. The mechanism relies on that xdev->error is assigned
+  * a non-zero value by report_io_error() prior to queueing wakeup_all(),
+  * which prevents bulk_in_work() from calling process_bulk_in().
+- *
+- * The fact that wakeup_all() and bulk_in_work() are queued on the same
+- * workqueue makes their concurrent execution very unlikely, however the
+- * kernel's API doesn't seem to ensure this strictly.
+  */
+ static void wakeup_all(struct work_struct *work)
+@@ -627,7 +624,7 @@ static void report_io_error(struct xilly
+       if (do_once) {
+               kref_get(&xdev->kref); /* xdev is used by work item */
+-              queue_work(xdev->workq, &xdev->wakeup_workitem);
++              queue_work(wakeup_wq, &xdev->wakeup_workitem);
+       }
+ }
+@@ -2258,6 +2255,10 @@ static int __init xillyusb_init(void)
+ {
+       int rc = 0;
++      wakeup_wq = alloc_workqueue(xillyname, 0, 0);
++      if (!wakeup_wq)
++              return -ENOMEM;
++
+       if (LOG2_INITIAL_FIFO_BUF_SIZE > PAGE_SHIFT)
+               fifo_buf_order = LOG2_INITIAL_FIFO_BUF_SIZE - PAGE_SHIFT;
+       else
+@@ -2265,11 +2266,16 @@ static int __init xillyusb_init(void)
+       rc = usb_register(&xillyusb_driver);
++      if (rc)
++              destroy_workqueue(wakeup_wq);
++
+       return rc;
+ }
+ static void __exit xillyusb_exit(void)
+ {
++      destroy_workqueue(wakeup_wq);
++
+       usb_deregister(&xillyusb_driver);
+ }
diff --git a/queue-6.6/char-xillybus-refine-workqueue-handling.patch b/queue-6.6/char-xillybus-refine-workqueue-handling.patch
new file mode 100644 (file)
index 0000000..cc782a3
--- /dev/null
@@ -0,0 +1,52 @@
+From ad899c301c880766cc709aad277991b3ab671b66 Mon Sep 17 00:00:00 2001
+From: Eli Billauer <eli.billauer@gmail.com>
+Date: Fri, 16 Aug 2024 10:01:59 +0300
+Subject: char: xillybus: Refine workqueue handling
+
+From: Eli Billauer <eli.billauer@gmail.com>
+
+commit ad899c301c880766cc709aad277991b3ab671b66 upstream.
+
+As the wakeup work item now runs on a separate workqueue, it needs to be
+flushed separately along with flushing the device's workqueue.
+
+Also, move the destroy_workqueue() call to the end of the exit method,
+so that deinitialization is done in the opposite order of
+initialization.
+
+Fixes: ccbde4b128ef ("char: xillybus: Don't destroy workqueue from work item running on it")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
+Link: https://lore.kernel.org/r/20240816070200.50695-1-eli.billauer@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/char/xillybus/xillyusb.c |    8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/char/xillybus/xillyusb.c
++++ b/drivers/char/xillybus/xillyusb.c
+@@ -2093,9 +2093,11 @@ static int xillyusb_discovery(struct usb
+        * just after responding with the IDT, there is no reason for any
+        * work item to be running now. To be sure that xdev->channels
+        * is updated on anything that might run in parallel, flush the
+-       * workqueue, which rarely does anything.
++       * device's workqueue and the wakeup work item. This rarely
++       * does anything.
+        */
+       flush_workqueue(xdev->workq);
++      flush_work(&xdev->wakeup_workitem);
+       xdev->num_channels = num_channels;
+@@ -2274,9 +2276,9 @@ static int __init xillyusb_init(void)
+ static void __exit xillyusb_exit(void)
+ {
+-      destroy_workqueue(wakeup_wq);
+-
+       usb_deregister(&xillyusb_driver);
++
++      destroy_workqueue(wakeup_wq);
+ }
+ module_init(xillyusb_init);
diff --git a/queue-6.6/dm-persistent-data-fix-memory-allocation-failure.patch b/queue-6.6/dm-persistent-data-fix-memory-allocation-failure.patch
new file mode 100644 (file)
index 0000000..3b5c8a3
--- /dev/null
@@ -0,0 +1,45 @@
+From faada2174c08662ae98b439c69efe3e79382c538 Mon Sep 17 00:00:00 2001
+From: Mikulas Patocka <mpatocka@redhat.com>
+Date: Tue, 13 Aug 2024 16:35:14 +0200
+Subject: dm persistent data: fix memory allocation failure
+
+From: Mikulas Patocka <mpatocka@redhat.com>
+
+commit faada2174c08662ae98b439c69efe3e79382c538 upstream.
+
+kmalloc is unreliable when allocating more than 8 pages of memory. It may
+fail when there is plenty of free memory but the memory is fragmented.
+Zdenek Kabelac observed such failure in his tests.
+
+This commit changes kmalloc to kvmalloc - kvmalloc will fall back to
+vmalloc if the large allocation fails.
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Reported-by: Zdenek Kabelac <zkabelac@redhat.com>
+Reviewed-by: Mike Snitzer <snitzer@kernel.org>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/persistent-data/dm-space-map-metadata.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/md/persistent-data/dm-space-map-metadata.c
++++ b/drivers/md/persistent-data/dm-space-map-metadata.c
+@@ -277,7 +277,7 @@ static void sm_metadata_destroy(struct d
+ {
+       struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);
+-      kfree(smm);
++      kvfree(smm);
+ }
+ static int sm_metadata_get_nr_blocks(struct dm_space_map *sm, dm_block_t *count)
+@@ -772,7 +772,7 @@ struct dm_space_map *dm_sm_metadata_init
+ {
+       struct sm_metadata *smm;
+-      smm = kmalloc(sizeof(*smm), GFP_KERNEL);
++      smm = kvmalloc(sizeof(*smm), GFP_KERNEL);
+       if (!smm)
+               return ERR_PTR(-ENOMEM);
diff --git a/queue-6.6/dm-resume-don-t-return-einval-when-signalled.patch b/queue-6.6/dm-resume-don-t-return-einval-when-signalled.patch
new file mode 100644 (file)
index 0000000..486f013
--- /dev/null
@@ -0,0 +1,60 @@
+From 7a636b4f03af9d541205f69e373672e7b2b60a8a Mon Sep 17 00:00:00 2001
+From: Khazhismel Kumykov <khazhy@google.com>
+Date: Tue, 13 Aug 2024 12:39:52 +0200
+Subject: dm resume: don't return EINVAL when signalled
+
+From: Khazhismel Kumykov <khazhy@google.com>
+
+commit 7a636b4f03af9d541205f69e373672e7b2b60a8a upstream.
+
+If the dm_resume method is called on a device that is not suspended, the
+method will suspend the device briefly, before resuming it (so that the
+table will be swapped).
+
+However, there was a bug that the return value of dm_suspended_md was not
+checked. dm_suspended_md may return an error when it is interrupted by a
+signal. In this case, do_resume would call dm_swap_table, which would
+return -EINVAL.
+
+This commit fixes the logic, so that error returned by dm_suspend is
+checked and the resume operation is undone.
+
+Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/md/dm-ioctl.c |   22 ++++++++++++++++++++--
+ 1 file changed, 20 insertions(+), 2 deletions(-)
+
+--- a/drivers/md/dm-ioctl.c
++++ b/drivers/md/dm-ioctl.c
+@@ -1181,8 +1181,26 @@ static int do_resume(struct dm_ioctl *pa
+                       suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG;
+               if (param->flags & DM_NOFLUSH_FLAG)
+                       suspend_flags |= DM_SUSPEND_NOFLUSH_FLAG;
+-              if (!dm_suspended_md(md))
+-                      dm_suspend(md, suspend_flags);
++              if (!dm_suspended_md(md)) {
++                      r = dm_suspend(md, suspend_flags);
++                      if (r) {
++                              down_write(&_hash_lock);
++                              hc = dm_get_mdptr(md);
++                              if (hc && !hc->new_map) {
++                                      hc->new_map = new_map;
++                                      new_map = NULL;
++                              } else {
++                                      r = -ENXIO;
++                              }
++                              up_write(&_hash_lock);
++                              if (new_map) {
++                                      dm_sync_table(md);
++                                      dm_table_destroy(new_map);
++                              }
++                              dm_put(md);
++                              return r;
++                      }
++              }
+               old_size = dm_get_size(md);
+               old_map = dm_swap_table(md, new_map);
diff --git a/queue-6.6/drm-amdgpu-actually-check-flags-for-all-context-ops.patch b/queue-6.6/drm-amdgpu-actually-check-flags-for-all-context-ops.patch
new file mode 100644 (file)
index 0000000..04e011e
--- /dev/null
@@ -0,0 +1,50 @@
+From 0573a1e2ea7e35bff08944a40f1adf2bb35cea61 Mon Sep 17 00:00:00 2001
+From: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
+Date: Tue, 6 Aug 2024 22:27:32 +0200
+Subject: drm/amdgpu: Actually check flags for all context ops.
+
+From: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
+
+commit 0573a1e2ea7e35bff08944a40f1adf2bb35cea61 upstream.
+
+Missing validation ...
+
+Checked libdrm and it clears all the structs, so we should be
+safe to just check everything.
+
+Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit c6b86421f1f9ddf9d706f2453159813ee39d0cf9)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+@@ -684,16 +684,24 @@ int amdgpu_ctx_ioctl(struct drm_device *
+       switch (args->in.op) {
+       case AMDGPU_CTX_OP_ALLOC_CTX:
++              if (args->in.flags)
++                      return -EINVAL;
+               r = amdgpu_ctx_alloc(adev, fpriv, filp, priority, &id);
+               args->out.alloc.ctx_id = id;
+               break;
+       case AMDGPU_CTX_OP_FREE_CTX:
++              if (args->in.flags)
++                      return -EINVAL;
+               r = amdgpu_ctx_free(fpriv, id);
+               break;
+       case AMDGPU_CTX_OP_QUERY_STATE:
++              if (args->in.flags)
++                      return -EINVAL;
+               r = amdgpu_ctx_query(adev, fpriv, id, &args->out);
+               break;
+       case AMDGPU_CTX_OP_QUERY_STATE2:
++              if (args->in.flags)
++                      return -EINVAL;
+               r = amdgpu_ctx_query2(adev, fpriv, id, &args->out);
+               break;
+       case AMDGPU_CTX_OP_GET_STABLE_PSTATE:
diff --git a/queue-6.6/fix-bitmap-corruption-on-close_range-with-close_range_unshare.patch b/queue-6.6/fix-bitmap-corruption-on-close_range-with-close_range_unshare.patch
new file mode 100644 (file)
index 0000000..fb3996b
--- /dev/null
@@ -0,0 +1,184 @@
+From 9a2fa1472083580b6c66bdaf291f591e1170123a Mon Sep 17 00:00:00 2001
+From: Al Viro <viro@zeniv.linux.org.uk>
+Date: Sat, 3 Aug 2024 18:02:00 -0400
+Subject: fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE
+
+From: Al Viro <viro@zeniv.linux.org.uk>
+
+commit 9a2fa1472083580b6c66bdaf291f591e1170123a upstream.
+
+copy_fd_bitmaps(new, old, count) is expected to copy the first
+count/BITS_PER_LONG bits from old->full_fds_bits[] and fill
+the rest with zeroes.  What it does is copying enough words
+(BITS_TO_LONGS(count/BITS_PER_LONG)), then memsets the rest.
+That works fine, *if* all bits past the cutoff point are
+clear.  Otherwise we are risking garbage from the last word
+we'd copied.
+
+For most of the callers that is true - expand_fdtable() has
+count equal to old->max_fds, so there's no open descriptors
+past count, let alone fully occupied words in ->open_fds[],
+which is what bits in ->full_fds_bits[] correspond to.
+
+The other caller (dup_fd()) passes sane_fdtable_size(old_fdt, max_fds),
+which is the smallest multiple of BITS_PER_LONG that covers all
+opened descriptors below max_fds.  In the common case (copying on
+fork()) max_fds is ~0U, so all opened descriptors will be below
+it and we are fine, by the same reasons why the call in expand_fdtable()
+is safe.
+
+Unfortunately, there is a case where max_fds is less than that
+and where we might, indeed, end up with junk in ->full_fds_bits[] -
+close_range(from, to, CLOSE_RANGE_UNSHARE) with
+       * descriptor table being currently shared
+       * 'to' being above the current capacity of descriptor table
+       * 'from' being just under some chunk of opened descriptors.
+In that case we end up with observably wrong behaviour - e.g. spawn
+a child with CLONE_FILES, get all descriptors in range 0..127 open,
+then close_range(64, ~0U, CLOSE_RANGE_UNSHARE) and watch dup(0) ending
+up with descriptor #128, despite #64 being observably not open.
+
+The minimally invasive fix would be to deal with that in dup_fd().
+If this proves to add measurable overhead, we can go that way, but
+let's try to fix copy_fd_bitmaps() first.
+
+* new helper: bitmap_copy_and_expand(to, from, bits_to_copy, size).
+* make copy_fd_bitmaps() take the bitmap size in words, rather than
+bits; it's 'count' argument is always a multiple of BITS_PER_LONG,
+so we are not losing any information, and that way we can use the
+same helper for all three bitmaps - compiler will see that count
+is a multiple of BITS_PER_LONG for the large ones, so it'll generate
+plain memcpy()+memset().
+
+Reproducer added to tools/testing/selftests/core/close_range_test.c
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/file.c                                       |   28 ++++++++-----------
+ include/linux/bitmap.h                          |   12 ++++++++
+ tools/testing/selftests/core/close_range_test.c |   35 ++++++++++++++++++++++++
+ 3 files changed, 59 insertions(+), 16 deletions(-)
+
+--- a/fs/file.c
++++ b/fs/file.c
+@@ -46,27 +46,23 @@ static void free_fdtable_rcu(struct rcu_
+ #define BITBIT_NR(nr) BITS_TO_LONGS(BITS_TO_LONGS(nr))
+ #define BITBIT_SIZE(nr)       (BITBIT_NR(nr) * sizeof(long))
++#define fdt_words(fdt) ((fdt)->max_fds / BITS_PER_LONG) // words in ->open_fds
+ /*
+  * Copy 'count' fd bits from the old table to the new table and clear the extra
+  * space if any.  This does not copy the file pointers.  Called with the files
+  * spinlock held for write.
+  */
+-static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,
+-                          unsigned int count)
++static inline void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,
++                          unsigned int copy_words)
+ {
+-      unsigned int cpy, set;
++      unsigned int nwords = fdt_words(nfdt);
+-      cpy = count / BITS_PER_BYTE;
+-      set = (nfdt->max_fds - count) / BITS_PER_BYTE;
+-      memcpy(nfdt->open_fds, ofdt->open_fds, cpy);
+-      memset((char *)nfdt->open_fds + cpy, 0, set);
+-      memcpy(nfdt->close_on_exec, ofdt->close_on_exec, cpy);
+-      memset((char *)nfdt->close_on_exec + cpy, 0, set);
+-
+-      cpy = BITBIT_SIZE(count);
+-      set = BITBIT_SIZE(nfdt->max_fds) - cpy;
+-      memcpy(nfdt->full_fds_bits, ofdt->full_fds_bits, cpy);
+-      memset((char *)nfdt->full_fds_bits + cpy, 0, set);
++      bitmap_copy_and_extend(nfdt->open_fds, ofdt->open_fds,
++                      copy_words * BITS_PER_LONG, nwords * BITS_PER_LONG);
++      bitmap_copy_and_extend(nfdt->close_on_exec, ofdt->close_on_exec,
++                      copy_words * BITS_PER_LONG, nwords * BITS_PER_LONG);
++      bitmap_copy_and_extend(nfdt->full_fds_bits, ofdt->full_fds_bits,
++                      copy_words, nwords);
+ }
+ /*
+@@ -84,7 +80,7 @@ static void copy_fdtable(struct fdtable
+       memcpy(nfdt->fd, ofdt->fd, cpy);
+       memset((char *)nfdt->fd + cpy, 0, set);
+-      copy_fd_bitmaps(nfdt, ofdt, ofdt->max_fds);
++      copy_fd_bitmaps(nfdt, ofdt, fdt_words(ofdt));
+ }
+ /*
+@@ -374,7 +370,7 @@ struct files_struct *dup_fd(struct files
+               open_files = sane_fdtable_size(old_fdt, max_fds);
+       }
+-      copy_fd_bitmaps(new_fdt, old_fdt, open_files);
++      copy_fd_bitmaps(new_fdt, old_fdt, open_files / BITS_PER_LONG);
+       old_fds = old_fdt->fd;
+       new_fds = new_fdt->fd;
+--- a/include/linux/bitmap.h
++++ b/include/linux/bitmap.h
+@@ -281,6 +281,18 @@ static inline void bitmap_copy_clear_tai
+               dst[nbits / BITS_PER_LONG] &= BITMAP_LAST_WORD_MASK(nbits);
+ }
++static inline void bitmap_copy_and_extend(unsigned long *to,
++                                        const unsigned long *from,
++                                        unsigned int count, unsigned int size)
++{
++      unsigned int copy = BITS_TO_LONGS(count);
++
++      memcpy(to, from, copy * sizeof(long));
++      if (count % BITS_PER_LONG)
++              to[copy - 1] &= BITMAP_LAST_WORD_MASK(count);
++      memset(to + copy, 0, bitmap_size(size) - copy * sizeof(long));
++}
++
+ /*
+  * On 32-bit systems bitmaps are represented as u32 arrays internally. On LE64
+  * machines the order of hi and lo parts of numbers match the bitmap structure.
+--- a/tools/testing/selftests/core/close_range_test.c
++++ b/tools/testing/selftests/core/close_range_test.c
+@@ -563,4 +563,39 @@ TEST(close_range_cloexec_unshare_syzbot)
+       EXPECT_EQ(close(fd3), 0);
+ }
++TEST(close_range_bitmap_corruption)
++{
++      pid_t pid;
++      int status;
++      struct __clone_args args = {
++              .flags = CLONE_FILES,
++              .exit_signal = SIGCHLD,
++      };
++
++      /* get the first 128 descriptors open */
++      for (int i = 2; i < 128; i++)
++              EXPECT_GE(dup2(0, i), 0);
++
++      /* get descriptor table shared */
++      pid = sys_clone3(&args, sizeof(args));
++      ASSERT_GE(pid, 0);
++
++      if (pid == 0) {
++              /* unshare and truncate descriptor table down to 64 */
++              if (sys_close_range(64, ~0U, CLOSE_RANGE_UNSHARE))
++                      exit(EXIT_FAILURE);
++
++              ASSERT_EQ(fcntl(64, F_GETFD), -1);
++              /* ... and verify that the range 64..127 is not
++                 stuck "fully used" according to secondary bitmap */
++              EXPECT_EQ(dup(0), 64)
++                      exit(EXIT_FAILURE);
++              exit(EXIT_SUCCESS);
++      }
++
++      EXPECT_EQ(waitpid(pid, &status, 0), pid);
++      EXPECT_EQ(true, WIFEXITED(status));
++      EXPECT_EQ(0, WEXITSTATUS(status));
++}
++
+ TEST_HARNESS_MAIN
diff --git a/queue-6.6/fs-netfs-fscache_cookie-add-missing-n_accesses-check.patch b/queue-6.6/fs-netfs-fscache_cookie-add-missing-n_accesses-check.patch
new file mode 100644 (file)
index 0000000..03a6f2e
--- /dev/null
@@ -0,0 +1,114 @@
+From f71aa06398aabc2e3eaac25acdf3d62e0094ba70 Mon Sep 17 00:00:00 2001
+From: Max Kellermann <max.kellermann@ionos.com>
+Date: Mon, 29 Jul 2024 17:19:30 +0100
+Subject: fs/netfs/fscache_cookie: add missing "n_accesses" check
+
+From: Max Kellermann <max.kellermann@ionos.com>
+
+commit f71aa06398aabc2e3eaac25acdf3d62e0094ba70 upstream.
+
+This fixes a NULL pointer dereference bug due to a data race which
+looks like this:
+
+  BUG: kernel NULL pointer dereference, address: 0000000000000008
+  #PF: supervisor read access in kernel mode
+  #PF: error_code(0x0000) - not-present page
+  PGD 0 P4D 0
+  Oops: 0000 [#1] SMP PTI
+  CPU: 33 PID: 16573 Comm: kworker/u97:799 Not tainted 6.8.7-cm4all1-hp+ #43
+  Hardware name: HP ProLiant DL380 Gen9/ProLiant DL380 Gen9, BIOS P89 10/17/2018
+  Workqueue: events_unbound netfs_rreq_write_to_cache_work
+  RIP: 0010:cachefiles_prepare_write+0x30/0xa0
+  Code: 57 41 56 45 89 ce 41 55 49 89 cd 41 54 49 89 d4 55 53 48 89 fb 48 83 ec 08 48 8b 47 08 48 83 7f 10 00 48 89 34 24 48 8b 68 20 <48> 8b 45 08 4c 8b 38 74 45 49 8b 7f 50 e8 4e a9 b0 ff 48 8b 73 10
+  RSP: 0018:ffffb4e78113bde0 EFLAGS: 00010286
+  RAX: ffff976126be6d10 RBX: ffff97615cdb8438 RCX: 0000000000020000
+  RDX: ffff97605e6c4c68 RSI: ffff97605e6c4c60 RDI: ffff97615cdb8438
+  RBP: 0000000000000000 R08: 0000000000278333 R09: 0000000000000001
+  R10: ffff97605e6c4600 R11: 0000000000000001 R12: ffff97605e6c4c68
+  R13: 0000000000020000 R14: 0000000000000001 R15: ffff976064fe2c00
+  FS:  0000000000000000(0000) GS:ffff9776dfd40000(0000) knlGS:0000000000000000
+  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+  CR2: 0000000000000008 CR3: 000000005942c002 CR4: 00000000001706f0
+  Call Trace:
+   <TASK>
+   ? __die+0x1f/0x70
+   ? page_fault_oops+0x15d/0x440
+   ? search_module_extables+0xe/0x40
+   ? fixup_exception+0x22/0x2f0
+   ? exc_page_fault+0x5f/0x100
+   ? asm_exc_page_fault+0x22/0x30
+   ? cachefiles_prepare_write+0x30/0xa0
+   netfs_rreq_write_to_cache_work+0x135/0x2e0
+   process_one_work+0x137/0x2c0
+   worker_thread+0x2e9/0x400
+   ? __pfx_worker_thread+0x10/0x10
+   kthread+0xcc/0x100
+   ? __pfx_kthread+0x10/0x10
+   ret_from_fork+0x30/0x50
+   ? __pfx_kthread+0x10/0x10
+   ret_from_fork_asm+0x1b/0x30
+   </TASK>
+  Modules linked in:
+  CR2: 0000000000000008
+  ---[ end trace 0000000000000000 ]---
+
+This happened because fscache_cookie_state_machine() was slow and was
+still running while another process invoked fscache_unuse_cookie();
+this led to a fscache_cookie_lru_do_one() call, setting the
+FSCACHE_COOKIE_DO_LRU_DISCARD flag, which was picked up by
+fscache_cookie_state_machine(), withdrawing the cookie via
+cachefiles_withdraw_cookie(), clearing cookie->cache_priv.
+
+At the same time, yet another process invoked
+cachefiles_prepare_write(), which found a NULL pointer in this code
+line:
+
+  struct cachefiles_object *object = cachefiles_cres_object(cres);
+
+The next line crashes, obviously:
+
+  struct cachefiles_cache *cache = object->volume->cache;
+
+During cachefiles_prepare_write(), the "n_accesses" counter is
+non-zero (via fscache_begin_operation()).  The cookie must not be
+withdrawn until it drops to zero.
+
+The counter is checked by fscache_cookie_state_machine() before
+switching to FSCACHE_COOKIE_STATE_RELINQUISHING and
+FSCACHE_COOKIE_STATE_WITHDRAWING (in "case
+FSCACHE_COOKIE_STATE_FAILED"), but not for
+FSCACHE_COOKIE_STATE_LRU_DISCARDING ("case
+FSCACHE_COOKIE_STATE_ACTIVE").
+
+This patch adds the missing check.  With a non-zero access counter,
+the function returns and the next fscache_end_cookie_access() call
+will queue another fscache_cookie_state_machine() call to handle the
+still-pending FSCACHE_COOKIE_DO_LRU_DISCARD.
+
+Fixes: 12bb21a29c19 ("fscache: Implement cookie user counting and resource pinning")
+Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
+Signed-off-by: David Howells <dhowells@redhat.com>
+Link: https://lore.kernel.org/r/20240729162002.3436763-2-dhowells@redhat.com
+cc: Jeff Layton <jlayton@kernel.org>
+cc: netfs@lists.linux.dev
+cc: linux-fsdevel@vger.kernel.org
+cc: stable@vger.kernel.org
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/fscache/cookie.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/fs/fscache/cookie.c
++++ b/fs/fscache/cookie.c
+@@ -741,6 +741,10 @@ again_locked:
+                       spin_lock(&cookie->lock);
+               }
+               if (test_bit(FSCACHE_COOKIE_DO_LRU_DISCARD, &cookie->flags)) {
++                      if (atomic_read(&cookie->n_accesses) != 0)
++                              /* still being accessed: postpone it */
++                              break;
++
+                       __fscache_set_cookie_state(cookie,
+                                                  FSCACHE_COOKIE_STATE_LRU_DISCARDING);
+                       wake = true;
diff --git a/queue-6.6/i2c-qcom-geni-add-missing-geni_icc_disable-in-geni_i2c_runtime_resume.patch b/queue-6.6/i2c-qcom-geni-add-missing-geni_icc_disable-in-geni_i2c_runtime_resume.patch
new file mode 100644 (file)
index 0000000..4c4a0b3
--- /dev/null
@@ -0,0 +1,39 @@
+From 4e91fa1ef3ce6290b4c598e54b5eb6cf134fbec8 Mon Sep 17 00:00:00 2001
+From: Andi Shyti <andi.shyti@kernel.org>
+Date: Mon, 12 Aug 2024 21:40:28 +0200
+Subject: i2c: qcom-geni: Add missing geni_icc_disable in geni_i2c_runtime_resume
+
+From: Andi Shyti <andi.shyti@kernel.org>
+
+commit 4e91fa1ef3ce6290b4c598e54b5eb6cf134fbec8 upstream.
+
+Add the missing geni_icc_disable() call before returning in the
+geni_i2c_runtime_resume() function.
+
+Commit 9ba48db9f77c ("i2c: qcom-geni: Add missing
+geni_icc_disable in geni_i2c_runtime_resume") by Gaosheng missed
+disabling the interconnect in one case.
+
+Fixes: bf225ed357c6 ("i2c: i2c-qcom-geni: Add interconnect support")
+Cc: Gaosheng Cui <cuigaosheng1@huawei.com>
+Cc: stable@vger.kernel.org # v5.9+
+Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-qcom-geni.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/i2c/busses/i2c-qcom-geni.c
++++ b/drivers/i2c/busses/i2c-qcom-geni.c
+@@ -987,8 +987,10 @@ static int __maybe_unused geni_i2c_runti
+               return ret;
+       ret = clk_prepare_enable(gi2c->core_clk);
+-      if (ret)
++      if (ret) {
++              geni_icc_disable(&gi2c->se);
+               return ret;
++      }
+       ret = geni_se_resources_on(&gi2c->se);
+       if (ret) {
diff --git a/queue-6.6/i2c-tegra-do-not-mark-acpi-devices-as-irq-safe.patch b/queue-6.6/i2c-tegra-do-not-mark-acpi-devices-as-irq-safe.patch
new file mode 100644 (file)
index 0000000..845aec1
--- /dev/null
@@ -0,0 +1,58 @@
+From 14d069d92951a3e150c0a81f2ca3b93e54da913b Mon Sep 17 00:00:00 2001
+From: Breno Leitao <leitao@debian.org>
+Date: Tue, 13 Aug 2024 09:12:53 -0700
+Subject: i2c: tegra: Do not mark ACPI devices as irq safe
+
+From: Breno Leitao <leitao@debian.org>
+
+commit 14d069d92951a3e150c0a81f2ca3b93e54da913b upstream.
+
+On ACPI machines, the tegra i2c module encounters an issue due to a
+mutex being called inside a spinlock. This leads to the following bug:
+
+       BUG: sleeping function called from invalid context at kernel/locking/mutex.c:585
+       ...
+
+       Call trace:
+       __might_sleep
+       __mutex_lock_common
+       mutex_lock_nested
+       acpi_subsys_runtime_resume
+       rpm_resume
+       tegra_i2c_xfer
+
+The problem arises because during __pm_runtime_resume(), the spinlock
+&dev->power.lock is acquired before rpm_resume() is called. Later,
+rpm_resume() invokes acpi_subsys_runtime_resume(), which relies on
+mutexes, triggering the error.
+
+To address this issue, devices on ACPI are now marked as not IRQ-safe,
+considering the dependency of acpi_subsys_runtime_resume() on mutexes.
+
+Fixes: bd2fdedbf2ba ("i2c: tegra: Add the ACPI support")
+Cc: <stable@vger.kernel.org> # v5.17+
+Co-developed-by: Michael van der Westhuizen <rmikey@meta.com>
+Signed-off-by: Michael van der Westhuizen <rmikey@meta.com>
+Signed-off-by: Breno Leitao <leitao@debian.org>
+Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-tegra.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/i2c/busses/i2c-tegra.c
++++ b/drivers/i2c/busses/i2c-tegra.c
+@@ -1804,9 +1804,9 @@ static int tegra_i2c_probe(struct platfo
+        * domain.
+        *
+        * VI I2C device shouldn't be marked as IRQ-safe because VI I2C won't
+-       * be used for atomic transfers.
++       * be used for atomic transfers. ACPI device is not IRQ safe also.
+        */
+-      if (!IS_VI(i2c_dev))
++      if (!IS_VI(i2c_dev) && !has_acpi_companion(i2c_dev->dev))
+               pm_runtime_irq_safe(i2c_dev->dev);
+       pm_runtime_enable(i2c_dev->dev);
diff --git a/queue-6.6/kvm-s390-fix-validity-interception-issue-when-gisa-is-switched-off.patch b/queue-6.6/kvm-s390-fix-validity-interception-issue-when-gisa-is-switched-off.patch
new file mode 100644 (file)
index 0000000..8b70eac
--- /dev/null
@@ -0,0 +1,88 @@
+From 5a44bb061d04b0306f2aa8add761d86d152b9377 Mon Sep 17 00:00:00 2001
+From: Michael Mueller <mimu@linux.ibm.com>
+Date: Thu, 1 Aug 2024 14:31:09 +0200
+Subject: KVM: s390: fix validity interception issue when gisa is switched off
+
+From: Michael Mueller <mimu@linux.ibm.com>
+
+commit 5a44bb061d04b0306f2aa8add761d86d152b9377 upstream.
+
+We might run into a SIE validity if gisa has been disabled either via using
+kernel parameter "kvm.use_gisa=0" or by setting the related sysfs
+attribute to N (echo N >/sys/module/kvm/parameters/use_gisa).
+
+The validity is caused by an invalid value in the SIE control block's
+gisa designation. That happens because we pass the uninitialized gisa
+origin to virt_to_phys() before writing it to the gisa designation.
+
+To fix this we return 0 in kvm_s390_get_gisa_desc() if the origin is 0.
+kvm_s390_get_gisa_desc() is used to determine which gisa designation to
+set in the SIE control block. A value of 0 in the gisa designation disables
+gisa usage.
+
+The issue surfaces in the host kernel with the following kernel message as
+soon a new kvm guest start is attemted.
+
+kvm: unhandled validity intercept 0x1011
+WARNING: CPU: 0 PID: 781237 at arch/s390/kvm/intercept.c:101 kvm_handle_sie_intercept+0x42e/0x4d0 [kvm]
+Modules linked in: vhost_net tap tun xt_CHECKSUM xt_MASQUERADE xt_conntrack ipt_REJECT xt_tcpudp nft_compat x_tables nf_nat_tftp nf_conntrack_tftp vfio_pci_core irqbypass vhost_vsock vmw_vsock_virtio_transport_common vsock vhost vhost_iotlb kvm nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nf_tables sunrpc mlx5_ib ib_uverbs ib_core mlx5_core uvdevice s390_trng eadm_sch vfio_ccw zcrypt_cex4 mdev vfio_iommu_type1 vfio sch_fq_codel drm i2c_core loop drm_panel_orientation_quirks configfs nfnetlink lcs ctcm fsm dm_service_time ghash_s390 prng chacha_s390 libchacha aes_s390 des_s390 libdes sha3_512_s390 sha3_256_s390 sha512_s390 sha256_s390 sha1_s390 sha_common dm_mirror dm_region_hash dm_log zfcp scsi_transport_fc scsi_dh_rdac scsi_dh_emc scsi_dh_alua pkey zcrypt dm_multipath rng_core autofs4 [last unloaded: vfio_pci]
+CPU: 0 PID: 781237 Comm: CPU 0/KVM Not tainted 6.10.0-08682-gcad9f11498ea #6
+Hardware name: IBM 3931 A01 701 (LPAR)
+Krnl PSW : 0704c00180000000 000003d93deb0122 (kvm_handle_sie_intercept+0x432/0x4d0 [kvm])
+           R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
+Krnl GPRS: 000003d900000027 000003d900000023 0000000000000028 000002cd00000000
+           000002d063a00900 00000359c6daf708 00000000000bebb5 0000000000001eff
+           000002cfd82e9000 000002cfd80bc000 0000000000001011 000003d93deda412
+           000003ff8962df98 000003d93de77ce0 000003d93deb011e 00000359c6daf960
+Krnl Code: 000003d93deb0112: c020fffe7259      larl    %r2,000003d93de7e5c4
+           000003d93deb0118: c0e53fa8beac      brasl   %r14,000003d9bd3c7e70
+          #000003d93deb011e: af000000          mc      0,0
+          >000003d93deb0122: a728ffea          lhi     %r2,-22
+           000003d93deb0126: a7f4fe24          brc     15,000003d93deafd6e
+           000003d93deb012a: 9101f0b0          tm      176(%r15),1
+           000003d93deb012e: a774fe48          brc     7,000003d93deafdbe
+           000003d93deb0132: 40a0f0ae          sth     %r10,174(%r15)
+Call Trace:
+ [<000003d93deb0122>] kvm_handle_sie_intercept+0x432/0x4d0 [kvm]
+([<000003d93deb011e>] kvm_handle_sie_intercept+0x42e/0x4d0 [kvm])
+ [<000003d93deacc10>] vcpu_post_run+0x1d0/0x3b0 [kvm]
+ [<000003d93deaceda>] __vcpu_run+0xea/0x2d0 [kvm]
+ [<000003d93dead9da>] kvm_arch_vcpu_ioctl_run+0x16a/0x430 [kvm]
+ [<000003d93de93ee0>] kvm_vcpu_ioctl+0x190/0x7c0 [kvm]
+ [<000003d9bd728b4e>] vfs_ioctl+0x2e/0x70
+ [<000003d9bd72a092>] __s390x_sys_ioctl+0xc2/0xd0
+ [<000003d9be0e9222>] __do_syscall+0x1f2/0x2e0
+ [<000003d9be0f9a90>] system_call+0x70/0x98
+Last Breaking-Event-Address:
+ [<000003d9bd3c7f58>] __warn_printk+0xe8/0xf0
+
+Cc: stable@vger.kernel.org
+Reported-by: Christian Borntraeger <borntraeger@linux.ibm.com>
+Fixes: fe0ef0030463 ("KVM: s390: sort out physical vs virtual pointers usage")
+Signed-off-by: Michael Mueller <mimu@linux.ibm.com>
+Tested-by: Christian Borntraeger <borntraeger@linux.ibm.com>
+Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
+Link: https://lore.kernel.org/r/20240801123109.2782155-1-mimu@linux.ibm.com
+Message-ID: <20240801123109.2782155-1-mimu@linux.ibm.com>
+Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/s390/kvm/kvm-s390.h |    7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/arch/s390/kvm/kvm-s390.h
++++ b/arch/s390/kvm/kvm-s390.h
+@@ -249,7 +249,12 @@ static inline unsigned long kvm_s390_get
+ static inline u32 kvm_s390_get_gisa_desc(struct kvm *kvm)
+ {
+-      u32 gd = virt_to_phys(kvm->arch.gisa_int.origin);
++      u32 gd;
++
++      if (!kvm->arch.gisa_int.origin)
++              return 0;
++
++      gd = virt_to_phys(kvm->arch.gisa_int.origin);
+       if (gd && sclp.has_gisaf)
+               gd |= GISA_FORMAT1;
diff --git a/queue-6.6/memcg_write_event_control-fix-a-user-triggerable-oops.patch b/queue-6.6/memcg_write_event_control-fix-a-user-triggerable-oops.patch
new file mode 100644 (file)
index 0000000..025c943
--- /dev/null
@@ -0,0 +1,39 @@
+From 046667c4d3196938e992fba0dfcde570aa85cd0e Mon Sep 17 00:00:00 2001
+From: Al Viro <viro@zeniv.linux.org.uk>
+Date: Sun, 21 Jul 2024 14:45:08 -0400
+Subject: memcg_write_event_control(): fix a user-triggerable oops
+
+From: Al Viro <viro@zeniv.linux.org.uk>
+
+commit 046667c4d3196938e992fba0dfcde570aa85cd0e upstream.
+
+we are *not* guaranteed that anything past the terminating NUL
+is mapped (let alone initialized with anything sane).
+
+Fixes: 0dea116876ee ("cgroup: implement eventfd-based generic API for notifications")
+Cc: stable@vger.kernel.org
+Cc: Andrew Morton <akpm@linux-foundation.org>
+Acked-by: Michal Hocko <mhocko@suse.com>
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/memcontrol.c |    7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/mm/memcontrol.c
++++ b/mm/memcontrol.c
+@@ -4880,9 +4880,12 @@ static ssize_t memcg_write_event_control
+       buf = endp + 1;
+       cfd = simple_strtoul(buf, &endp, 10);
+-      if ((*endp != ' ') && (*endp != '\0'))
++      if (*endp == '\0')
++              buf = endp;
++      else if (*endp == ' ')
++              buf = endp + 1;
++      else
+               return -EINVAL;
+-      buf = endp + 1;
+       event = kzalloc(sizeof(*event), GFP_KERNEL);
+       if (!event)
diff --git a/queue-6.6/mm-memory-failure-use-raw_spinlock_t-in-struct-memory_failure_cpu.patch b/queue-6.6/mm-memory-failure-use-raw_spinlock_t-in-struct-memory_failure_cpu.patch
new file mode 100644 (file)
index 0000000..7169905
--- /dev/null
@@ -0,0 +1,129 @@
+From d75abd0d0bc29e6ebfebbf76d11b4067b35844af Mon Sep 17 00:00:00 2001
+From: Waiman Long <longman@redhat.com>
+Date: Tue, 6 Aug 2024 12:41:07 -0400
+Subject: mm/memory-failure: use raw_spinlock_t in struct memory_failure_cpu
+
+From: Waiman Long <longman@redhat.com>
+
+commit d75abd0d0bc29e6ebfebbf76d11b4067b35844af upstream.
+
+The memory_failure_cpu structure is a per-cpu structure.  Access to its
+content requires the use of get_cpu_var() to lock in the current CPU and
+disable preemption.  The use of a regular spinlock_t for locking purpose
+is fine for a non-RT kernel.
+
+Since the integration of RT spinlock support into the v5.15 kernel, a
+spinlock_t in a RT kernel becomes a sleeping lock and taking a sleeping
+lock in a preemption disabled context is illegal resulting in the
+following kind of warning.
+
+  [12135.732244] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48
+  [12135.732248] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 270076, name: kworker/0:0
+  [12135.732252] preempt_count: 1, expected: 0
+  [12135.732255] RCU nest depth: 2, expected: 2
+    :
+  [12135.732420] Hardware name: Dell Inc. PowerEdge R640/0HG0J8, BIOS 2.10.2 02/24/2021
+  [12135.732423] Workqueue: kacpi_notify acpi_os_execute_deferred
+  [12135.732433] Call Trace:
+  [12135.732436]  <TASK>
+  [12135.732450]  dump_stack_lvl+0x57/0x81
+  [12135.732461]  __might_resched.cold+0xf4/0x12f
+  [12135.732479]  rt_spin_lock+0x4c/0x100
+  [12135.732491]  memory_failure_queue+0x40/0xe0
+  [12135.732503]  ghes_do_memory_failure+0x53/0x390
+  [12135.732516]  ghes_do_proc.constprop.0+0x229/0x3e0
+  [12135.732575]  ghes_proc+0xf9/0x1a0
+  [12135.732591]  ghes_notify_hed+0x6a/0x150
+  [12135.732602]  notifier_call_chain+0x43/0xb0
+  [12135.732626]  blocking_notifier_call_chain+0x43/0x60
+  [12135.732637]  acpi_ev_notify_dispatch+0x47/0x70
+  [12135.732648]  acpi_os_execute_deferred+0x13/0x20
+  [12135.732654]  process_one_work+0x41f/0x500
+  [12135.732695]  worker_thread+0x192/0x360
+  [12135.732715]  kthread+0x111/0x140
+  [12135.732733]  ret_from_fork+0x29/0x50
+  [12135.732779]  </TASK>
+
+Fix it by using a raw_spinlock_t for locking instead.
+
+Also move the pr_err() out of the lock critical section and after
+put_cpu_ptr() to avoid indeterminate latency and the possibility of sleep
+with this call.
+
+[longman@redhat.com: don't hold percpu ref across pr_err(), per Miaohe]
+  Link: https://lkml.kernel.org/r/20240807181130.1122660-1-longman@redhat.com
+Link: https://lkml.kernel.org/r/20240806164107.1044956-1-longman@redhat.com
+Fixes: 0f383b6dc96e ("locking/spinlock: Provide RT variant")
+Signed-off-by: Waiman Long <longman@redhat.com>
+Acked-by: Miaohe Lin <linmiaohe@huawei.com>
+Cc: "Huang, Ying" <ying.huang@intel.com>
+Cc: Juri Lelli <juri.lelli@redhat.com>
+Cc: Len Brown <len.brown@intel.com>
+Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/memory-failure.c |   20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+--- a/mm/memory-failure.c
++++ b/mm/memory-failure.c
+@@ -2395,7 +2395,7 @@ struct memory_failure_entry {
+ struct memory_failure_cpu {
+       DECLARE_KFIFO(fifo, struct memory_failure_entry,
+                     MEMORY_FAILURE_FIFO_SIZE);
+-      spinlock_t lock;
++      raw_spinlock_t lock;
+       struct work_struct work;
+ };
+@@ -2421,20 +2421,22 @@ void memory_failure_queue(unsigned long
+ {
+       struct memory_failure_cpu *mf_cpu;
+       unsigned long proc_flags;
++      bool buffer_overflow;
+       struct memory_failure_entry entry = {
+               .pfn =          pfn,
+               .flags =        flags,
+       };
+       mf_cpu = &get_cpu_var(memory_failure_cpu);
+-      spin_lock_irqsave(&mf_cpu->lock, proc_flags);
+-      if (kfifo_put(&mf_cpu->fifo, entry))
++      raw_spin_lock_irqsave(&mf_cpu->lock, proc_flags);
++      buffer_overflow = !kfifo_put(&mf_cpu->fifo, entry);
++      if (!buffer_overflow)
+               schedule_work_on(smp_processor_id(), &mf_cpu->work);
+-      else
++      raw_spin_unlock_irqrestore(&mf_cpu->lock, proc_flags);
++      put_cpu_var(memory_failure_cpu);
++      if (buffer_overflow)
+               pr_err("buffer overflow when queuing memory failure at %#lx\n",
+                      pfn);
+-      spin_unlock_irqrestore(&mf_cpu->lock, proc_flags);
+-      put_cpu_var(memory_failure_cpu);
+ }
+ EXPORT_SYMBOL_GPL(memory_failure_queue);
+@@ -2447,9 +2449,9 @@ static void memory_failure_work_func(str
+       mf_cpu = container_of(work, struct memory_failure_cpu, work);
+       for (;;) {
+-              spin_lock_irqsave(&mf_cpu->lock, proc_flags);
++              raw_spin_lock_irqsave(&mf_cpu->lock, proc_flags);
+               gotten = kfifo_get(&mf_cpu->fifo, &entry);
+-              spin_unlock_irqrestore(&mf_cpu->lock, proc_flags);
++              raw_spin_unlock_irqrestore(&mf_cpu->lock, proc_flags);
+               if (!gotten)
+                       break;
+               if (entry.flags & MF_SOFT_OFFLINE)
+@@ -2479,7 +2481,7 @@ static int __init memory_failure_init(vo
+       for_each_possible_cpu(cpu) {
+               mf_cpu = &per_cpu(memory_failure_cpu, cpu);
+-              spin_lock_init(&mf_cpu->lock);
++              raw_spin_lock_init(&mf_cpu->lock);
+               INIT_KFIFO(mf_cpu->fifo);
+               INIT_WORK(&mf_cpu->work, memory_failure_work_func);
+       }
diff --git a/queue-6.6/net-mana-fix-doorbell-out-of-order-violation-and-avoid-unnecessary-doorbell-rings.patch b/queue-6.6/net-mana-fix-doorbell-out-of-order-violation-and-avoid-unnecessary-doorbell-rings.patch
new file mode 100644 (file)
index 0000000..41cafe1
--- /dev/null
@@ -0,0 +1,89 @@
+From 58a63729c957621f1990c3494c702711188ca347 Mon Sep 17 00:00:00 2001
+From: Long Li <longli@microsoft.com>
+Date: Fri, 9 Aug 2024 08:58:58 -0700
+Subject: net: mana: Fix doorbell out of order violation and avoid unnecessary doorbell rings
+
+From: Long Li <longli@microsoft.com>
+
+commit 58a63729c957621f1990c3494c702711188ca347 upstream.
+
+After napi_complete_done() is called when NAPI is polling in the current
+process context, another NAPI may be scheduled and start running in
+softirq on another CPU and may ring the doorbell before the current CPU
+does. When combined with unnecessary rings when there is no need to arm
+the CQ, it triggers error paths in the hardware.
+
+This patch fixes this by calling napi_complete_done() after doorbell
+rings. It limits the number of unnecessary rings when there is
+no need to arm. MANA hardware specifies that there must be one doorbell
+ring every 8 CQ wraparounds. This driver guarantees one doorbell ring as
+soon as the number of consumed CQEs exceeds 4 CQ wraparounds. In practical
+workloads, the 4 CQ wraparounds proves to be big enough that it rarely
+exceeds this limit before all the napi weight is consumed.
+
+To implement this, add a per-CQ counter cq->work_done_since_doorbell,
+and make sure the CQ is armed as soon as passing 4 wraparounds of the CQ.
+
+Cc: stable@vger.kernel.org
+Fixes: e1b5683ff62e ("net: mana: Move NAPI from EQ to CQ")
+Reviewed-by: Haiyang Zhang <haiyangz@microsoft.com>
+Signed-off-by: Long Li <longli@microsoft.com>
+Link: https://patch.msgid.link/1723219138-29887-1-git-send-email-longli@linuxonhyperv.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/microsoft/mana/mana_en.c |   22 ++++++++++++++--------
+ include/net/mana/mana.h                       |    1 +
+ 2 files changed, 15 insertions(+), 8 deletions(-)
+
+--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
++++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
+@@ -1778,7 +1778,6 @@ static void mana_poll_rx_cq(struct mana_
+ static int mana_cq_handler(void *context, struct gdma_queue *gdma_queue)
+ {
+       struct mana_cq *cq = context;
+-      u8 arm_bit;
+       int w;
+       WARN_ON_ONCE(cq->gdma_cq != gdma_queue);
+@@ -1789,16 +1788,23 @@ static int mana_cq_handler(void *context
+               mana_poll_tx_cq(cq);
+       w = cq->work_done;
++      cq->work_done_since_doorbell += w;
+-      if (w < cq->budget &&
+-          napi_complete_done(&cq->napi, w)) {
+-              arm_bit = SET_ARM_BIT;
+-      } else {
+-              arm_bit = 0;
++      if (w < cq->budget) {
++              mana_gd_ring_cq(gdma_queue, SET_ARM_BIT);
++              cq->work_done_since_doorbell = 0;
++              napi_complete_done(&cq->napi, w);
++      } else if (cq->work_done_since_doorbell >
++                 cq->gdma_cq->queue_size / COMP_ENTRY_SIZE * 4) {
++              /* MANA hardware requires at least one doorbell ring every 8
++               * wraparounds of CQ even if there is no need to arm the CQ.
++               * This driver rings the doorbell as soon as we have exceeded
++               * 4 wraparounds.
++               */
++              mana_gd_ring_cq(gdma_queue, 0);
++              cq->work_done_since_doorbell = 0;
+       }
+-      mana_gd_ring_cq(gdma_queue, arm_bit);
+-
+       return w;
+ }
+--- a/include/net/mana/mana.h
++++ b/include/net/mana/mana.h
+@@ -274,6 +274,7 @@ struct mana_cq {
+       /* NAPI data */
+       struct napi_struct napi;
+       int work_done;
++      int work_done_since_doorbell;
+       int budget;
+ };
diff --git a/queue-6.6/net-mana-fix-rx-buf-alloc_size-alignment-and-atomic-op-panic.patch b/queue-6.6/net-mana-fix-rx-buf-alloc_size-alignment-and-atomic-op-panic.patch
new file mode 100644 (file)
index 0000000..840470a
--- /dev/null
@@ -0,0 +1,72 @@
+From 32316f676b4ee87c0404d333d248ccf777f739bc Mon Sep 17 00:00:00 2001
+From: Haiyang Zhang <haiyangz@microsoft.com>
+Date: Fri, 9 Aug 2024 14:01:24 -0700
+Subject: net: mana: Fix RX buf alloc_size alignment and atomic op panic
+
+From: Haiyang Zhang <haiyangz@microsoft.com>
+
+commit 32316f676b4ee87c0404d333d248ccf777f739bc upstream.
+
+The MANA driver's RX buffer alloc_size is passed into napi_build_skb() to
+create SKB. skb_shinfo(skb) is located at the end of skb, and its alignment
+is affected by the alloc_size passed into napi_build_skb(). The size needs
+to be aligned properly for better performance and atomic operations.
+Otherwise, on ARM64 CPU, for certain MTU settings like 4000, atomic
+operations may panic on the skb_shinfo(skb)->dataref due to alignment fault.
+
+To fix this bug, add proper alignment to the alloc_size calculation.
+
+Sample panic info:
+[  253.298819] Unable to handle kernel paging request at virtual address ffff000129ba5cce
+[  253.300900] Mem abort info:
+[  253.301760]   ESR = 0x0000000096000021
+[  253.302825]   EC = 0x25: DABT (current EL), IL = 32 bits
+[  253.304268]   SET = 0, FnV = 0
+[  253.305172]   EA = 0, S1PTW = 0
+[  253.306103]   FSC = 0x21: alignment fault
+Call trace:
+ __skb_clone+0xfc/0x198
+ skb_clone+0x78/0xe0
+ raw6_local_deliver+0xfc/0x228
+ ip6_protocol_deliver_rcu+0x80/0x500
+ ip6_input_finish+0x48/0x80
+ ip6_input+0x48/0xc0
+ ip6_sublist_rcv_finish+0x50/0x78
+ ip6_sublist_rcv+0x1cc/0x2b8
+ ipv6_list_rcv+0x100/0x150
+ __netif_receive_skb_list_core+0x180/0x220
+ netif_receive_skb_list_internal+0x198/0x2a8
+ __napi_poll+0x138/0x250
+ net_rx_action+0x148/0x330
+ handle_softirqs+0x12c/0x3a0
+
+Cc: stable@vger.kernel.org
+Fixes: 80f6215b450e ("net: mana: Add support for jumbo frame")
+Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
+Reviewed-by: Long Li <longli@microsoft.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/microsoft/mana/mana_en.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
+index d2f07e179e86..ae717d06e66f 100644
+--- a/drivers/net/ethernet/microsoft/mana/mana_en.c
++++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
+@@ -599,7 +599,11 @@ static void mana_get_rxbuf_cfg(int mtu, u32 *datasize, u32 *alloc_size,
+       else
+               *headroom = XDP_PACKET_HEADROOM;
+-      *alloc_size = mtu + MANA_RXBUF_PAD + *headroom;
++      *alloc_size = SKB_DATA_ALIGN(mtu + MANA_RXBUF_PAD + *headroom);
++
++      /* Using page pool in this case, so alloc_size is PAGE_SIZE */
++      if (*alloc_size < PAGE_SIZE)
++              *alloc_size = PAGE_SIZE;
+       *datasize = mtu + ETH_HLEN;
+ }
+-- 
+2.46.0
+
diff --git a/queue-6.6/riscv-change-xip-s-kernel_map.size-to-be-size-of-the-entire-kernel.patch b/queue-6.6/riscv-change-xip-s-kernel_map.size-to-be-size-of-the-entire-kernel.patch
new file mode 100644 (file)
index 0000000..7af0d31
--- /dev/null
@@ -0,0 +1,50 @@
+From 57d76bc51fd80824bcc0c84a5b5ec944f1b51edd Mon Sep 17 00:00:00 2001
+From: Nam Cao <namcao@linutronix.de>
+Date: Wed, 8 May 2024 21:19:17 +0200
+Subject: riscv: change XIP's kernel_map.size to be size of the entire kernel
+
+From: Nam Cao <namcao@linutronix.de>
+
+commit 57d76bc51fd80824bcc0c84a5b5ec944f1b51edd upstream.
+
+With XIP kernel, kernel_map.size is set to be only the size of data part of
+the kernel. This is inconsistent with "normal" kernel, who sets it to be
+the size of the entire kernel.
+
+More importantly, XIP kernel fails to boot if CONFIG_DEBUG_VIRTUAL is
+enabled, because there are checks on virtual addresses with the assumption
+that kernel_map.size is the size of the entire kernel (these checks are in
+arch/riscv/mm/physaddr.c).
+
+Change XIP's kernel_map.size to be the size of the entire kernel.
+
+Signed-off-by: Nam Cao <namcao@linutronix.de>
+Cc: <stable@vger.kernel.org> # v6.1+
+Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
+Link: https://lore.kernel.org/r/20240508191917.2892064-1-namcao@linutronix.de
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/riscv/mm/init.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/riscv/mm/init.c
++++ b/arch/riscv/mm/init.c
+@@ -912,7 +912,7 @@ static void __init create_kernel_page_ta
+                                  PMD_SIZE, PAGE_KERNEL_EXEC);
+       /* Map the data in RAM */
+-      end_va = kernel_map.virt_addr + XIP_OFFSET + kernel_map.size;
++      end_va = kernel_map.virt_addr + kernel_map.size;
+       for (va = kernel_map.virt_addr + XIP_OFFSET; va < end_va; va += PMD_SIZE)
+               create_pgd_mapping(pgdir, va,
+                                  kernel_map.phys_addr + (va - (kernel_map.virt_addr + XIP_OFFSET)),
+@@ -1081,7 +1081,7 @@ asmlinkage void __init setup_vm(uintptr_
+       phys_ram_base = CONFIG_PHYS_RAM_BASE;
+       kernel_map.phys_addr = (uintptr_t)CONFIG_PHYS_RAM_BASE;
+-      kernel_map.size = (uintptr_t)(&_end) - (uintptr_t)(&_sdata);
++      kernel_map.size = (uintptr_t)(&_end) - (uintptr_t)(&_start);
+       kernel_map.va_kernel_xip_pa_offset = kernel_map.virt_addr - kernel_map.xiprom;
+ #else
diff --git a/queue-6.6/rtla-osnoise-prevent-null-dereference-in-error-handling.patch b/queue-6.6/rtla-osnoise-prevent-null-dereference-in-error-handling.patch
new file mode 100644 (file)
index 0000000..469180b
--- /dev/null
@@ -0,0 +1,52 @@
+From 90574d2a675947858b47008df8d07f75ea50d0d0 Mon Sep 17 00:00:00 2001
+From: Dan Carpenter <dan.carpenter@linaro.org>
+Date: Fri, 9 Aug 2024 15:34:30 +0300
+Subject: rtla/osnoise: Prevent NULL dereference in error handling
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+commit 90574d2a675947858b47008df8d07f75ea50d0d0 upstream.
+
+If the "tool->data" allocation fails then there is no need to call
+osnoise_free_top() and, in fact, doing so will lead to a NULL dereference.
+
+Cc: stable@vger.kernel.org
+Cc: John Kacur <jkacur@redhat.com>
+Cc: "Luis Claudio R. Goncalves" <lgoncalv@redhat.com>
+Cc: Clark Williams <williams@redhat.com>
+Fixes: 1eceb2fc2ca5 ("rtla/osnoise: Add osnoise top mode")
+Link: https://lore.kernel.org/f964ed1f-64d2-4fde-ad3e-708331f8f358@stanley.mountain
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/tracing/rtla/src/osnoise_top.c |   11 ++++-------
+ 1 file changed, 4 insertions(+), 7 deletions(-)
+
+--- a/tools/tracing/rtla/src/osnoise_top.c
++++ b/tools/tracing/rtla/src/osnoise_top.c
+@@ -624,8 +624,10 @@ struct osnoise_tool *osnoise_init_top(st
+               return NULL;
+       tool->data = osnoise_alloc_top(nr_cpus);
+-      if (!tool->data)
+-              goto out_err;
++      if (!tool->data) {
++              osnoise_destroy_tool(tool);
++              return NULL;
++      }
+       tool->params = params;
+@@ -633,11 +635,6 @@ struct osnoise_tool *osnoise_init_top(st
+                                  osnoise_top_handler, NULL);
+       return tool;
+-
+-out_err:
+-      osnoise_free_top(tool->data);
+-      osnoise_destroy_tool(tool);
+-      return NULL;
+ }
+ static int stop_tracing;
diff --git a/queue-6.6/s390-dasd-fix-error-recovery-leading-to-data-corruption-on-ese-devices.patch b/queue-6.6/s390-dasd-fix-error-recovery-leading-to-data-corruption-on-ese-devices.patch
new file mode 100644 (file)
index 0000000..279ba3d
--- /dev/null
@@ -0,0 +1,242 @@
+From 7db4042336580dfd75cb5faa82c12cd51098c90b Mon Sep 17 00:00:00 2001
+From: Stefan Haberland <sth@linux.ibm.com>
+Date: Mon, 12 Aug 2024 14:57:33 +0200
+Subject: s390/dasd: fix error recovery leading to data corruption on ESE devices
+
+From: Stefan Haberland <sth@linux.ibm.com>
+
+commit 7db4042336580dfd75cb5faa82c12cd51098c90b upstream.
+
+Extent Space Efficient (ESE) or thin provisioned volumes need to be
+formatted on demand during usual IO processing.
+
+The dasd_ese_needs_format function checks for error codes that signal
+the non existence of a proper track format.
+
+The check for incorrect length is to imprecise since other error cases
+leading to transport of insufficient data also have this flag set.
+This might lead to data corruption in certain error cases for example
+during a storage server warmstart.
+
+Fix by removing the check for incorrect length and replacing by
+explicitly checking for invalid track format in transport mode.
+
+Also remove the check for file protected since this is not a valid
+ESE handling case.
+
+Cc: stable@vger.kernel.org # 5.3+
+Fixes: 5e2b17e712cf ("s390/dasd: Add dynamic formatting support for ESE volumes")
+Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
+Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
+Link: https://lore.kernel.org/r/20240812125733.126431-3-sth@linux.ibm.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/s390/block/dasd.c          |   36 +++++++++++++++---------
+ drivers/s390/block/dasd_3990_erp.c |   10 +-----
+ drivers/s390/block/dasd_eckd.c     |   55 ++++++++++++++++---------------------
+ drivers/s390/block/dasd_int.h      |    2 -
+ 4 files changed, 50 insertions(+), 53 deletions(-)
+
+--- a/drivers/s390/block/dasd.c
++++ b/drivers/s390/block/dasd.c
+@@ -1599,9 +1599,15 @@ static int dasd_ese_needs_format(struct
+       if (!sense)
+               return 0;
+-      return !!(sense[1] & SNS1_NO_REC_FOUND) ||
+-              !!(sense[1] & SNS1_FILE_PROTECTED) ||
+-              scsw_cstat(&irb->scsw) == SCHN_STAT_INCORR_LEN;
++      if (sense[1] & SNS1_NO_REC_FOUND)
++              return 1;
++
++      if ((sense[1] & SNS1_INV_TRACK_FORMAT) &&
++          scsw_is_tm(&irb->scsw) &&
++          !(sense[2] & SNS2_ENV_DATA_PRESENT))
++              return 1;
++
++      return 0;
+ }
+ static int dasd_ese_oos_cond(u8 *sense)
+@@ -1622,7 +1628,7 @@ void dasd_int_handler(struct ccw_device
+       struct dasd_device *device;
+       unsigned long now;
+       int nrf_suppressed = 0;
+-      int fp_suppressed = 0;
++      int it_suppressed = 0;
+       struct request *req;
+       u8 *sense = NULL;
+       int expires;
+@@ -1677,8 +1683,9 @@ void dasd_int_handler(struct ccw_device
+                */
+               sense = dasd_get_sense(irb);
+               if (sense) {
+-                      fp_suppressed = (sense[1] & SNS1_FILE_PROTECTED) &&
+-                              test_bit(DASD_CQR_SUPPRESS_FP, &cqr->flags);
++                      it_suppressed = (sense[1] & SNS1_INV_TRACK_FORMAT) &&
++                              !(sense[2] & SNS2_ENV_DATA_PRESENT) &&
++                              test_bit(DASD_CQR_SUPPRESS_IT, &cqr->flags);
+                       nrf_suppressed = (sense[1] & SNS1_NO_REC_FOUND) &&
+                               test_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags);
+@@ -1693,7 +1700,7 @@ void dasd_int_handler(struct ccw_device
+                               return;
+                       }
+               }
+-              if (!(fp_suppressed || nrf_suppressed))
++              if (!(it_suppressed || nrf_suppressed))
+                       device->discipline->dump_sense_dbf(device, irb, "int");
+               if (device->features & DASD_FEATURE_ERPLOG)
+@@ -2465,14 +2472,17 @@ retry:
+       rc = 0;
+       list_for_each_entry_safe(cqr, n, ccw_queue, blocklist) {
+               /*
+-               * In some cases the 'File Protected' or 'Incorrect Length'
+-               * error might be expected and error recovery would be
+-               * unnecessary in these cases.  Check if the according suppress
+-               * bit is set.
++               * In some cases certain errors might be expected and
++               * error recovery would be unnecessary in these cases.
++               * Check if the according suppress bit is set.
+                */
+               sense = dasd_get_sense(&cqr->irb);
+-              if (sense && sense[1] & SNS1_FILE_PROTECTED &&
+-                  test_bit(DASD_CQR_SUPPRESS_FP, &cqr->flags))
++              if (sense && (sense[1] & SNS1_INV_TRACK_FORMAT) &&
++                  !(sense[2] & SNS2_ENV_DATA_PRESENT) &&
++                  test_bit(DASD_CQR_SUPPRESS_IT, &cqr->flags))
++                      continue;
++              if (sense && (sense[1] & SNS1_NO_REC_FOUND) &&
++                  test_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags))
+                       continue;
+               if (scsw_cstat(&cqr->irb.scsw) == 0x40 &&
+                   test_bit(DASD_CQR_SUPPRESS_IL, &cqr->flags))
+--- a/drivers/s390/block/dasd_3990_erp.c
++++ b/drivers/s390/block/dasd_3990_erp.c
+@@ -1406,14 +1406,8 @@ dasd_3990_erp_file_prot(struct dasd_ccw_
+       struct dasd_device *device = erp->startdev;
+-      /*
+-       * In some cases the 'File Protected' error might be expected and
+-       * log messages shouldn't be written then.
+-       * Check if the according suppress bit is set.
+-       */
+-      if (!test_bit(DASD_CQR_SUPPRESS_FP, &erp->flags))
+-              dev_err(&device->cdev->dev,
+-                      "Accessing the DASD failed because of a hardware error\n");
++      dev_err(&device->cdev->dev,
++              "Accessing the DASD failed because of a hardware error\n");
+       return dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
+--- a/drivers/s390/block/dasd_eckd.c
++++ b/drivers/s390/block/dasd_eckd.c
+@@ -2289,6 +2289,7 @@ dasd_eckd_analysis_ccw(struct dasd_devic
+       cqr->status = DASD_CQR_FILLED;
+       /* Set flags to suppress output for expected errors */
+       set_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags);
++      set_bit(DASD_CQR_SUPPRESS_IT, &cqr->flags);
+       return cqr;
+ }
+@@ -2570,7 +2571,6 @@ dasd_eckd_build_check_tcw(struct dasd_de
+       cqr->buildclk = get_tod_clock();
+       cqr->status = DASD_CQR_FILLED;
+       /* Set flags to suppress output for expected errors */
+-      set_bit(DASD_CQR_SUPPRESS_FP, &cqr->flags);
+       set_bit(DASD_CQR_SUPPRESS_IL, &cqr->flags);
+       return cqr;
+@@ -4146,8 +4146,6 @@ static struct dasd_ccw_req *dasd_eckd_bu
+       /* Set flags to suppress output for expected errors */
+       if (dasd_eckd_is_ese(basedev)) {
+-              set_bit(DASD_CQR_SUPPRESS_FP, &cqr->flags);
+-              set_bit(DASD_CQR_SUPPRESS_IL, &cqr->flags);
+               set_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags);
+       }
+@@ -4649,9 +4647,8 @@ static struct dasd_ccw_req *dasd_eckd_bu
+       /* Set flags to suppress output for expected errors */
+       if (dasd_eckd_is_ese(basedev)) {
+-              set_bit(DASD_CQR_SUPPRESS_FP, &cqr->flags);
+-              set_bit(DASD_CQR_SUPPRESS_IL, &cqr->flags);
+               set_bit(DASD_CQR_SUPPRESS_NRF, &cqr->flags);
++              set_bit(DASD_CQR_SUPPRESS_IT, &cqr->flags);
+       }
+       return cqr;
+@@ -5820,36 +5817,32 @@ static void dasd_eckd_dump_sense(struct
+ {
+       u8 *sense = dasd_get_sense(irb);
+-      if (scsw_is_tm(&irb->scsw)) {
+-              /*
+-               * In some cases the 'File Protected' or 'Incorrect Length'
+-               * error might be expected and log messages shouldn't be written
+-               * then. Check if the according suppress bit is set.
+-               */
+-              if (sense && (sense[1] & SNS1_FILE_PROTECTED) &&
+-                  test_bit(DASD_CQR_SUPPRESS_FP, &req->flags))
+-                      return;
+-              if (scsw_cstat(&irb->scsw) == 0x40 &&
+-                  test_bit(DASD_CQR_SUPPRESS_IL, &req->flags))
+-                      return;
++      /*
++       * In some cases certain errors might be expected and
++       * log messages shouldn't be written then.
++       * Check if the according suppress bit is set.
++       */
++      if (sense && (sense[1] & SNS1_INV_TRACK_FORMAT) &&
++          !(sense[2] & SNS2_ENV_DATA_PRESENT) &&
++          test_bit(DASD_CQR_SUPPRESS_IT, &req->flags))
++              return;
+-              dasd_eckd_dump_sense_tcw(device, req, irb);
+-      } else {
+-              /*
+-               * In some cases the 'Command Reject' or 'No Record Found'
+-               * error might be expected and log messages shouldn't be
+-               * written then. Check if the according suppress bit is set.
+-               */
+-              if (sense && sense[0] & SNS0_CMD_REJECT &&
+-                  test_bit(DASD_CQR_SUPPRESS_CR, &req->flags))
+-                      return;
++      if (sense && sense[0] & SNS0_CMD_REJECT &&
++          test_bit(DASD_CQR_SUPPRESS_CR, &req->flags))
++              return;
+-              if (sense && sense[1] & SNS1_NO_REC_FOUND &&
+-                  test_bit(DASD_CQR_SUPPRESS_NRF, &req->flags))
+-                      return;
++      if (sense && sense[1] & SNS1_NO_REC_FOUND &&
++          test_bit(DASD_CQR_SUPPRESS_NRF, &req->flags))
++              return;
++      if (scsw_cstat(&irb->scsw) == 0x40 &&
++          test_bit(DASD_CQR_SUPPRESS_IL, &req->flags))
++              return;
++
++      if (scsw_is_tm(&irb->scsw))
++              dasd_eckd_dump_sense_tcw(device, req, irb);
++      else
+               dasd_eckd_dump_sense_ccw(device, req, irb);
+-      }
+ }
+ static int dasd_eckd_reload_device(struct dasd_device *device)
+--- a/drivers/s390/block/dasd_int.h
++++ b/drivers/s390/block/dasd_int.h
+@@ -225,7 +225,7 @@ struct dasd_ccw_req {
+  * The following flags are used to suppress output of certain errors.
+  */
+ #define DASD_CQR_SUPPRESS_NRF 4       /* Suppress 'No Record Found' error */
+-#define DASD_CQR_SUPPRESS_FP  5       /* Suppress 'File Protected' error*/
++#define DASD_CQR_SUPPRESS_IT  5       /* Suppress 'Invalid Track' error*/
+ #define DASD_CQR_SUPPRESS_IL  6       /* Suppress 'Incorrect Length' error */
+ #define DASD_CQR_SUPPRESS_CR  7       /* Suppress 'Command Reject' error */
diff --git a/queue-6.6/selinux-add-the-processing-of-the-failure-of-avc_add_xperms_decision.patch b/queue-6.6/selinux-add-the-processing-of-the-failure-of-avc_add_xperms_decision.patch
new file mode 100644 (file)
index 0000000..894c67c
--- /dev/null
@@ -0,0 +1,39 @@
+From 6dd1e4c045afa6a4ba5d46f044c83bd357c593c2 Mon Sep 17 00:00:00 2001
+From: Zhen Lei <thunder.leizhen@huawei.com>
+Date: Wed, 7 Aug 2024 17:00:56 +0800
+Subject: selinux: add the processing of the failure of avc_add_xperms_decision()
+
+From: Zhen Lei <thunder.leizhen@huawei.com>
+
+commit 6dd1e4c045afa6a4ba5d46f044c83bd357c593c2 upstream.
+
+When avc_add_xperms_decision() fails, the information recorded by the new
+avc node is incomplete. In this case, the new avc node should be released
+instead of replacing the old avc node.
+
+Cc: stable@vger.kernel.org
+Fixes: fa1aa143ac4a ("selinux: extended permissions for ioctls")
+Suggested-by: Stephen Smalley <stephen.smalley.work@gmail.com>
+Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
+Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
+Signed-off-by: Paul Moore <paul@paul-moore.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ security/selinux/avc.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+--- a/security/selinux/avc.c
++++ b/security/selinux/avc.c
+@@ -907,7 +907,11 @@ static int avc_update_node(u32 event, u3
+               node->ae.avd.auditdeny &= ~perms;
+               break;
+       case AVC_CALLBACK_ADD_XPERMS:
+-              avc_add_xperms_decision(node, xpd);
++              rc = avc_add_xperms_decision(node, xpd);
++              if (rc) {
++                      avc_node_kill(node);
++                      goto out_unlock;
++              }
+               break;
+       }
+       avc_node_replace(node, orig);
diff --git a/queue-6.6/selinux-fix-potential-counting-error-in-avc_add_xperms_decision.patch b/queue-6.6/selinux-fix-potential-counting-error-in-avc_add_xperms_decision.patch
new file mode 100644 (file)
index 0000000..cf61a2b
--- /dev/null
@@ -0,0 +1,38 @@
+From 379d9af3f3da2da1bbfa67baf1820c72a080d1f1 Mon Sep 17 00:00:00 2001
+From: Zhen Lei <thunder.leizhen@huawei.com>
+Date: Tue, 6 Aug 2024 14:51:13 +0800
+Subject: selinux: fix potential counting error in avc_add_xperms_decision()
+
+From: Zhen Lei <thunder.leizhen@huawei.com>
+
+commit 379d9af3f3da2da1bbfa67baf1820c72a080d1f1 upstream.
+
+The count increases only when a node is successfully added to
+the linked list.
+
+Cc: stable@vger.kernel.org
+Fixes: fa1aa143ac4a ("selinux: extended permissions for ioctls")
+Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
+Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
+Signed-off-by: Paul Moore <paul@paul-moore.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ security/selinux/avc.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/security/selinux/avc.c
++++ b/security/selinux/avc.c
+@@ -330,12 +330,12 @@ static int avc_add_xperms_decision(struc
+ {
+       struct avc_xperms_decision_node *dest_xpd;
+-      node->ae.xp_node->xp.len++;
+       dest_xpd = avc_xperms_decision_alloc(src->used);
+       if (!dest_xpd)
+               return -ENOMEM;
+       avc_copy_xperms_decision(&dest_xpd->xpd, src);
+       list_add(&dest_xpd->xpd_list, &node->ae.xp_node->xpd_head);
++      node->ae.xp_node->xp.len++;
+       return 0;
+ }
index 7a79915351eaf980e81dee3d66d3167c3c245459..a52309b74d274cec428c4193fefeaeb5b172df8b 100644 (file)
@@ -5,3 +5,37 @@ revert-misc-fastrpc-restrict-untrusted-app-to-attach-to-privileged-pd.patch
 revert-usb-typec-tcpm-clear-pd_event-queue-in-port_reset.patch
 selinux-revert-our-use-of-vma_is_initial_heap.patch
 fuse-initialize-beyond-eof-page-contents-before-setting-uptodate.patch
+char-xillybus-don-t-destroy-workqueue-from-work-item-running-on-it.patch
+char-xillybus-refine-workqueue-handling.patch
+char-xillybus-check-usb-endpoints-when-probing-device.patch
+alsa-usb-audio-add-delay-quirk-for-vivo-usb-c-xe710-headset.patch
+alsa-usb-audio-support-yamaha-p-125-quirk-entry.patch
+xhci-fix-panther-point-null-pointer-deref-at-full-speed-re-enumeration.patch
+thunderbolt-mark-xdomain-as-unplugged-when-router-is-removed.patch
+alsa-hda-tas2781-fix-wrong-calibrated-data-order.patch
+s390-dasd-fix-error-recovery-leading-to-data-corruption-on-ese-devices.patch
+kvm-s390-fix-validity-interception-issue-when-gisa-is-switched-off.patch
+riscv-change-xip-s-kernel_map.size-to-be-size-of-the-entire-kernel.patch
+i2c-tegra-do-not-mark-acpi-devices-as-irq-safe.patch
+acpica-add-a-depth-argument-to-acpi_execute_reg_methods.patch
+acpi-ec-evaluate-_reg-outside-the-ec-scope-more-carefully.patch
+arm64-acpi-numa-initialize-all-values-of-acpi_early_node_map-to-numa_no_node.patch
+dm-resume-don-t-return-einval-when-signalled.patch
+dm-persistent-data-fix-memory-allocation-failure.patch
+vfs-don-t-evict-inode-under-the-inode-lru-traversing-context.patch
+bitmap-introduce-generic-optimized-bitmap_size.patch
+fix-bitmap-corruption-on-close_range-with-close_range_unshare.patch
+i2c-qcom-geni-add-missing-geni_icc_disable-in-geni_i2c_runtime_resume.patch
+rtla-osnoise-prevent-null-dereference-in-error-handling.patch
+net-mana-fix-rx-buf-alloc_size-alignment-and-atomic-op-panic.patch
+net-mana-fix-doorbell-out-of-order-violation-and-avoid-unnecessary-doorbell-rings.patch
+wifi-brcmfmac-cfg80211-handle-ssid-based-pmksa-deletion.patch
+fs-netfs-fscache_cookie-add-missing-n_accesses-check.patch
+selinux-fix-potential-counting-error-in-avc_add_xperms_decision.patch
+selinux-add-the-processing-of-the-failure-of-avc_add_xperms_decision.patch
+mm-memory-failure-use-raw_spinlock_t-in-struct-memory_failure_cpu.patch
+btrfs-tree-checker-reject-btrfs_ft_unknown-dir-type.patch
+btrfs-zoned-properly-take-lock-to-read-update-block-group-s-zoned-variables.patch
+btrfs-tree-checker-add-dev-extent-item-checks.patch
+drm-amdgpu-actually-check-flags-for-all-context-ops.patch
+memcg_write_event_control-fix-a-user-triggerable-oops.patch
diff --git a/queue-6.6/thunderbolt-mark-xdomain-as-unplugged-when-router-is-removed.patch b/queue-6.6/thunderbolt-mark-xdomain-as-unplugged-when-router-is-removed.patch
new file mode 100644 (file)
index 0000000..17b897b
--- /dev/null
@@ -0,0 +1,39 @@
+From e2006140ad2e01a02ed0aff49cc2ae3ceeb11f8d Mon Sep 17 00:00:00 2001
+From: Mika Westerberg <mika.westerberg@linux.intel.com>
+Date: Thu, 13 Jun 2024 15:05:03 +0300
+Subject: thunderbolt: Mark XDomain as unplugged when router is removed
+
+From: Mika Westerberg <mika.westerberg@linux.intel.com>
+
+commit e2006140ad2e01a02ed0aff49cc2ae3ceeb11f8d upstream.
+
+I noticed that when we do discrete host router NVM upgrade and it gets
+hot-removed from the PCIe side as a result of NVM firmware authentication,
+if there is another host connected with enabled paths we hang in tearing
+them down. This is due to fact that the Thunderbolt networking driver
+also tries to cleanup the paths and ends up blocking in
+tb_disconnect_xdomain_paths() waiting for the domain lock.
+
+However, at this point we already cleaned the paths in tb_stop() so
+there is really no need for tb_disconnect_xdomain_paths() to do that
+anymore. Furthermore it already checks if the XDomain is unplugged and
+bails out early so take advantage of that and mark the XDomain as
+unplugged when we remove the parent router.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/thunderbolt/switch.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/thunderbolt/switch.c
++++ b/drivers/thunderbolt/switch.c
+@@ -3159,6 +3159,7 @@ void tb_switch_remove(struct tb_switch *
+                       tb_switch_remove(port->remote->sw);
+                       port->remote = NULL;
+               } else if (port->xdomain) {
++                      port->xdomain->is_unplugged = true;
+                       tb_xdomain_remove(port->xdomain);
+                       port->xdomain = NULL;
+               }
diff --git a/queue-6.6/vfs-don-t-evict-inode-under-the-inode-lru-traversing-context.patch b/queue-6.6/vfs-don-t-evict-inode-under-the-inode-lru-traversing-context.patch
new file mode 100644 (file)
index 0000000..71ee2c1
--- /dev/null
@@ -0,0 +1,215 @@
+From 2a0629834cd82f05d424bbc193374f9a43d1f87d Mon Sep 17 00:00:00 2001
+From: Zhihao Cheng <chengzhihao1@huawei.com>
+Date: Fri, 9 Aug 2024 11:16:28 +0800
+Subject: vfs: Don't evict inode under the inode lru traversing context
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Zhihao Cheng <chengzhihao1@huawei.com>
+
+commit 2a0629834cd82f05d424bbc193374f9a43d1f87d upstream.
+
+The inode reclaiming process(See function prune_icache_sb) collects all
+reclaimable inodes and mark them with I_FREEING flag at first, at that
+time, other processes will be stuck if they try getting these inodes
+(See function find_inode_fast), then the reclaiming process destroy the
+inodes by function dispose_list(). Some filesystems(eg. ext4 with
+ea_inode feature, ubifs with xattr) may do inode lookup in the inode
+evicting callback function, if the inode lookup is operated under the
+inode lru traversing context, deadlock problems may happen.
+
+Case 1: In function ext4_evict_inode(), the ea inode lookup could happen
+        if ea_inode feature is enabled, the lookup process will be stuck
+       under the evicting context like this:
+
+ 1. File A has inode i_reg and an ea inode i_ea
+ 2. getfattr(A, xattr_buf) // i_ea is added into lru // lru->i_ea
+ 3. Then, following three processes running like this:
+
+    PA                              PB
+ echo 2 > /proc/sys/vm/drop_caches
+  shrink_slab
+   prune_dcache_sb
+   // i_reg is added into lru, lru->i_ea->i_reg
+   prune_icache_sb
+    list_lru_walk_one
+     inode_lru_isolate
+      i_ea->i_state |= I_FREEING // set inode state
+     inode_lru_isolate
+      __iget(i_reg)
+      spin_unlock(&i_reg->i_lock)
+      spin_unlock(lru_lock)
+                                     rm file A
+                                      i_reg->nlink = 0
+      iput(i_reg) // i_reg->nlink is 0, do evict
+       ext4_evict_inode
+        ext4_xattr_delete_inode
+         ext4_xattr_inode_dec_ref_all
+          ext4_xattr_inode_iget
+           ext4_iget(i_ea->i_ino)
+            iget_locked
+             find_inode_fast
+              __wait_on_freeing_inode(i_ea) ----→ AA deadlock
+    dispose_list // cannot be executed by prune_icache_sb
+     wake_up_bit(&i_ea->i_state)
+
+Case 2: In deleted inode writing function ubifs_jnl_write_inode(), file
+        deleting process holds BASEHD's wbuf->io_mutex while getting the
+       xattr inode, which could race with inode reclaiming process(The
+        reclaiming process could try locking BASEHD's wbuf->io_mutex in
+       inode evicting function), then an ABBA deadlock problem would
+       happen as following:
+
+ 1. File A has inode ia and a xattr(with inode ixa), regular file B has
+    inode ib and a xattr.
+ 2. getfattr(A, xattr_buf) // ixa is added into lru // lru->ixa
+ 3. Then, following three processes running like this:
+
+        PA                PB                        PC
+                echo 2 > /proc/sys/vm/drop_caches
+                 shrink_slab
+                  prune_dcache_sb
+                  // ib and ia are added into lru, lru->ixa->ib->ia
+                  prune_icache_sb
+                   list_lru_walk_one
+                    inode_lru_isolate
+                     ixa->i_state |= I_FREEING // set inode state
+                    inode_lru_isolate
+                     __iget(ib)
+                     spin_unlock(&ib->i_lock)
+                     spin_unlock(lru_lock)
+                                                   rm file B
+                                                    ib->nlink = 0
+ rm file A
+  iput(ia)
+   ubifs_evict_inode(ia)
+    ubifs_jnl_delete_inode(ia)
+     ubifs_jnl_write_inode(ia)
+      make_reservation(BASEHD) // Lock wbuf->io_mutex
+      ubifs_iget(ixa->i_ino)
+       iget_locked
+        find_inode_fast
+         __wait_on_freeing_inode(ixa)
+          |          iput(ib) // ib->nlink is 0, do evict
+          |           ubifs_evict_inode
+          |            ubifs_jnl_delete_inode(ib)
+          ↓             ubifs_jnl_write_inode
+     ABBA deadlock ←-----make_reservation(BASEHD)
+                   dispose_list // cannot be executed by prune_icache_sb
+                    wake_up_bit(&ixa->i_state)
+
+Fix the possible deadlock by using new inode state flag I_LRU_ISOLATING
+to pin the inode in memory while inode_lru_isolate() reclaims its pages
+instead of using ordinary inode reference. This way inode deletion
+cannot be triggered from inode_lru_isolate() thus avoiding the deadlock.
+evict() is made to wait for I_LRU_ISOLATING to be cleared before
+proceeding with inode cleanup.
+
+Link: https://lore.kernel.org/all/37c29c42-7685-d1f0-067d-63582ffac405@huaweicloud.com/
+Link: https://bugzilla.kernel.org/show_bug.cgi?id=219022
+Fixes: e50e5129f384 ("ext4: xattr-in-inode support")
+Fixes: 7959cf3a7506 ("ubifs: journal: Handle xattrs like files")
+Cc: stable@vger.kernel.org
+Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
+Link: https://lore.kernel.org/r/20240809031628.1069873-1-chengzhihao@huaweicloud.com
+Reviewed-by: Jan Kara <jack@suse.cz>
+Suggested-by: Jan Kara <jack@suse.cz>
+Suggested-by: Mateusz Guzik <mjguzik@gmail.com>
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/inode.c         |   39 +++++++++++++++++++++++++++++++++++++--
+ include/linux/fs.h |    5 +++++
+ 2 files changed, 42 insertions(+), 2 deletions(-)
+
+--- a/fs/inode.c
++++ b/fs/inode.c
+@@ -486,6 +486,39 @@ static void inode_lru_list_del(struct in
+               this_cpu_dec(nr_unused);
+ }
++static void inode_pin_lru_isolating(struct inode *inode)
++{
++      lockdep_assert_held(&inode->i_lock);
++      WARN_ON(inode->i_state & (I_LRU_ISOLATING | I_FREEING | I_WILL_FREE));
++      inode->i_state |= I_LRU_ISOLATING;
++}
++
++static void inode_unpin_lru_isolating(struct inode *inode)
++{
++      spin_lock(&inode->i_lock);
++      WARN_ON(!(inode->i_state & I_LRU_ISOLATING));
++      inode->i_state &= ~I_LRU_ISOLATING;
++      smp_mb();
++      wake_up_bit(&inode->i_state, __I_LRU_ISOLATING);
++      spin_unlock(&inode->i_lock);
++}
++
++static void inode_wait_for_lru_isolating(struct inode *inode)
++{
++      spin_lock(&inode->i_lock);
++      if (inode->i_state & I_LRU_ISOLATING) {
++              DEFINE_WAIT_BIT(wq, &inode->i_state, __I_LRU_ISOLATING);
++              wait_queue_head_t *wqh;
++
++              wqh = bit_waitqueue(&inode->i_state, __I_LRU_ISOLATING);
++              spin_unlock(&inode->i_lock);
++              __wait_on_bit(wqh, &wq, bit_wait, TASK_UNINTERRUPTIBLE);
++              spin_lock(&inode->i_lock);
++              WARN_ON(inode->i_state & I_LRU_ISOLATING);
++      }
++      spin_unlock(&inode->i_lock);
++}
++
+ /**
+  * inode_sb_list_add - add inode to the superblock list of inodes
+  * @inode: inode to add
+@@ -654,6 +687,8 @@ static void evict(struct inode *inode)
+       inode_sb_list_del(inode);
++      inode_wait_for_lru_isolating(inode);
++
+       /*
+        * Wait for flusher thread to be done with the inode so that filesystem
+        * does not start destroying it while writeback is still running. Since
+@@ -842,7 +877,7 @@ static enum lru_status inode_lru_isolate
+        * be under pressure before the cache inside the highmem zone.
+        */
+       if (inode_has_buffers(inode) || !mapping_empty(&inode->i_data)) {
+-              __iget(inode);
++              inode_pin_lru_isolating(inode);
+               spin_unlock(&inode->i_lock);
+               spin_unlock(lru_lock);
+               if (remove_inode_buffers(inode)) {
+@@ -854,7 +889,7 @@ static enum lru_status inode_lru_isolate
+                               __count_vm_events(PGINODESTEAL, reap);
+                       mm_account_reclaimed_pages(reap);
+               }
+-              iput(inode);
++              inode_unpin_lru_isolating(inode);
+               spin_lock(lru_lock);
+               return LRU_RETRY;
+       }
+--- a/include/linux/fs.h
++++ b/include/linux/fs.h
+@@ -2265,6 +2265,9 @@ static inline void kiocb_clone(struct ki
+  *
+  * I_PINNING_FSCACHE_WB       Inode is pinning an fscache object for writeback.
+  *
++ * I_LRU_ISOLATING    Inode is pinned being isolated from LRU without holding
++ *                    i_count.
++ *
+  * Q: What is the difference between I_WILL_FREE and I_FREEING?
+  */
+ #define I_DIRTY_SYNC          (1 << 0)
+@@ -2288,6 +2291,8 @@ static inline void kiocb_clone(struct ki
+ #define I_DONTCACHE           (1 << 16)
+ #define I_SYNC_QUEUED         (1 << 17)
+ #define I_PINNING_FSCACHE_WB  (1 << 18)
++#define __I_LRU_ISOLATING     19
++#define I_LRU_ISOLATING               (1 << __I_LRU_ISOLATING)
+ #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC)
+ #define I_DIRTY (I_DIRTY_INODE | I_DIRTY_PAGES)
diff --git a/queue-6.6/wifi-brcmfmac-cfg80211-handle-ssid-based-pmksa-deletion.patch b/queue-6.6/wifi-brcmfmac-cfg80211-handle-ssid-based-pmksa-deletion.patch
new file mode 100644 (file)
index 0000000..2af91bf
--- /dev/null
@@ -0,0 +1,49 @@
+From 2ad4e1ada8eebafa2d75a4b75eeeca882de6ada1 Mon Sep 17 00:00:00 2001
+From: Janne Grunau <j@jannau.net>
+Date: Sat, 3 Aug 2024 21:52:55 +0200
+Subject: wifi: brcmfmac: cfg80211: Handle SSID based pmksa deletion
+
+From: Janne Grunau <j@jannau.net>
+
+commit 2ad4e1ada8eebafa2d75a4b75eeeca882de6ada1 upstream.
+
+wpa_supplicant 2.11 sends since 1efdba5fdc2c ("Handle PMKSA flush in the
+driver for SAE/OWE offload cases") SSID based PMKSA del commands.
+brcmfmac is not prepared and tries to dereference the NULL bssid and
+pmkid pointers in cfg80211_pmksa. PMKID_V3 operations support SSID based
+updates so copy the SSID.
+
+Fixes: a96202acaea4 ("wifi: brcmfmac: cfg80211: Add support for PMKID_V3 operations")
+Cc: stable@vger.kernel.org # 6.4.x
+Signed-off-by: Janne Grunau <j@jannau.net>
+Reviewed-by: Neal Gompa <neal@gompa.dev>
+Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
+Signed-off-by: Kalle Valo <kvalo@kernel.org>
+Link: https://patch.msgid.link/20240803-brcmfmac_pmksa_del_ssid-v1-1-4e85f19135e1@jannau.net
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c |   13 +++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c
+@@ -4321,9 +4321,16 @@ brcmf_pmksa_v3_op(struct brcmf_if *ifp,
+               /* Single PMK operation */
+               pmk_op->count = cpu_to_le16(1);
+               length += sizeof(struct brcmf_pmksa_v3);
+-              memcpy(pmk_op->pmk[0].bssid, pmksa->bssid, ETH_ALEN);
+-              memcpy(pmk_op->pmk[0].pmkid, pmksa->pmkid, WLAN_PMKID_LEN);
+-              pmk_op->pmk[0].pmkid_len = WLAN_PMKID_LEN;
++              if (pmksa->bssid)
++                      memcpy(pmk_op->pmk[0].bssid, pmksa->bssid, ETH_ALEN);
++              if (pmksa->pmkid) {
++                      memcpy(pmk_op->pmk[0].pmkid, pmksa->pmkid, WLAN_PMKID_LEN);
++                      pmk_op->pmk[0].pmkid_len = WLAN_PMKID_LEN;
++              }
++              if (pmksa->ssid && pmksa->ssid_len) {
++                      memcpy(pmk_op->pmk[0].ssid.SSID, pmksa->ssid, pmksa->ssid_len);
++                      pmk_op->pmk[0].ssid.SSID_len = pmksa->ssid_len;
++              }
+               pmk_op->pmk[0].time_left = cpu_to_le32(alive ? BRCMF_PMKSA_NO_EXPIRY : 0);
+       }
diff --git a/queue-6.6/xhci-fix-panther-point-null-pointer-deref-at-full-speed-re-enumeration.patch b/queue-6.6/xhci-fix-panther-point-null-pointer-deref-at-full-speed-re-enumeration.patch
new file mode 100644 (file)
index 0000000..9f81c82
--- /dev/null
@@ -0,0 +1,82 @@
+From af8e119f52e9c13e556be9e03f27957554a84656 Mon Sep 17 00:00:00 2001
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+Date: Thu, 15 Aug 2024 17:11:17 +0300
+Subject: xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration
+
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+
+commit af8e119f52e9c13e556be9e03f27957554a84656 upstream.
+
+re-enumerating full-speed devices after a failed address device command
+can trigger a NULL pointer dereference.
+
+Full-speed devices may need to reconfigure the endpoint 0 Max Packet Size
+value during enumeration. Usb core calls usb_ep0_reinit() in this case,
+which ends up calling xhci_configure_endpoint().
+
+On Panther point xHC the xhci_configure_endpoint() function will
+additionally check and reserve bandwidth in software. Other hosts do
+this in hardware
+
+If xHC address device command fails then a new xhci_virt_device structure
+is allocated as part of re-enabling the slot, but the bandwidth table
+pointers are not set up properly here.
+This triggers the NULL pointer dereference the next time usb_ep0_reinit()
+is called and xhci_configure_endpoint() tries to check and reserve
+bandwidth
+
+[46710.713538] usb 3-1: new full-speed USB device number 5 using xhci_hcd
+[46710.713699] usb 3-1: Device not responding to setup address.
+[46710.917684] usb 3-1: Device not responding to setup address.
+[46711.125536] usb 3-1: device not accepting address 5, error -71
+[46711.125594] BUG: kernel NULL pointer dereference, address: 0000000000000008
+[46711.125600] #PF: supervisor read access in kernel mode
+[46711.125603] #PF: error_code(0x0000) - not-present page
+[46711.125606] PGD 0 P4D 0
+[46711.125610] Oops: Oops: 0000 [#1] PREEMPT SMP PTI
+[46711.125615] CPU: 1 PID: 25760 Comm: kworker/1:2 Not tainted 6.10.3_2 #1
+[46711.125620] Hardware name: Gigabyte Technology Co., Ltd.
+[46711.125623] Workqueue: usb_hub_wq hub_event [usbcore]
+[46711.125668] RIP: 0010:xhci_reserve_bandwidth (drivers/usb/host/xhci.c
+
+Fix this by making sure bandwidth table pointers are set up correctly
+after a failed address device command, and additionally by avoiding
+checking for bandwidth in cases like this where no actual endpoints are
+added or removed, i.e. only context for default control endpoint 0 is
+evaluated.
+
+Reported-by: Karel Balej <balejk@matfyz.cz>
+Closes: https://lore.kernel.org/linux-usb/D3CKQQAETH47.1MUO22RTCH2O3@matfyz.cz/
+Cc: stable@vger.kernel.org
+Fixes: 651aaf36a7d7 ("usb: xhci: Handle USB transaction error on address command")
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Link: https://lore.kernel.org/r/20240815141117.2702314-2-mathias.nyman@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/usb/host/xhci.c |    8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -2808,7 +2808,7 @@ static int xhci_configure_endpoint(struc
+                               xhci->num_active_eps);
+               return -ENOMEM;
+       }
+-      if ((xhci->quirks & XHCI_SW_BW_CHECKING) &&
++      if ((xhci->quirks & XHCI_SW_BW_CHECKING) && !ctx_change &&
+           xhci_reserve_bandwidth(xhci, virt_dev, command->in_ctx)) {
+               if ((xhci->quirks & XHCI_EP_LIMIT_QUIRK))
+                       xhci_free_host_resources(xhci, ctrl_ctx);
+@@ -4150,8 +4150,10 @@ static int xhci_setup_device(struct usb_
+               mutex_unlock(&xhci->mutex);
+               ret = xhci_disable_slot(xhci, udev->slot_id);
+               xhci_free_virt_device(xhci, udev->slot_id);
+-              if (!ret)
+-                      xhci_alloc_dev(hcd, udev);
++              if (!ret) {
++                      if (xhci_alloc_dev(hcd, udev) == 1)
++                              xhci_setup_addressable_virt_dev(xhci, udev);
++              }
+               kfree(command->completion);
+               kfree(command);
+               return -EPROTO;