]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Sep 2023 12:30:11 +0000 (14:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Sep 2023 12:30:11 +0000 (14:30 +0200)
added patches:
btrfs-compare-the-correct-fsid-metadata_uuid-in-btrfs_validate_super.patch
btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch
btrfs-use-the-correct-superblock-to-compare-fsid-in-btrfs_validate_super.patch
drm-amd-display-enable-cursor-degamma-for-dcn3-drm-legacy-gamma.patch
drm-amd-display-prevent-potential-division-by-zero-errors.patch
mips-fix-config_cpu_daddi_workarounds-modules_install-regression.patch
mtd-rawnand-brcmnand-fix-crash-during-the-panic_write.patch
mtd-rawnand-brcmnand-fix-potential-false-time-out-warning.patch
mtd-rawnand-brcmnand-fix-potential-out-of-bounds-access-in-oob-write.patch
perf-hists-browser-fix-hierarchy-mode-header.patch
perf-hists-browser-fix-the-number-of-entries-for-e-key.patch
perf-tools-handle-old-data-in-perf_record_attr.patch

13 files changed:
queue-5.15/btrfs-compare-the-correct-fsid-metadata_uuid-in-btrfs_validate_super.patch [new file with mode: 0644]
queue-5.15/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch [new file with mode: 0644]
queue-5.15/btrfs-use-the-correct-superblock-to-compare-fsid-in-btrfs_validate_super.patch [new file with mode: 0644]
queue-5.15/drm-amd-display-enable-cursor-degamma-for-dcn3-drm-legacy-gamma.patch [new file with mode: 0644]
queue-5.15/drm-amd-display-prevent-potential-division-by-zero-errors.patch [new file with mode: 0644]
queue-5.15/mips-fix-config_cpu_daddi_workarounds-modules_install-regression.patch [new file with mode: 0644]
queue-5.15/mtd-rawnand-brcmnand-fix-crash-during-the-panic_write.patch [new file with mode: 0644]
queue-5.15/mtd-rawnand-brcmnand-fix-potential-false-time-out-warning.patch [new file with mode: 0644]
queue-5.15/mtd-rawnand-brcmnand-fix-potential-out-of-bounds-access-in-oob-write.patch [new file with mode: 0644]
queue-5.15/perf-hists-browser-fix-hierarchy-mode-header.patch [new file with mode: 0644]
queue-5.15/perf-hists-browser-fix-the-number-of-entries-for-e-key.patch [new file with mode: 0644]
queue-5.15/perf-tools-handle-old-data-in-perf_record_attr.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/btrfs-compare-the-correct-fsid-metadata_uuid-in-btrfs_validate_super.patch b/queue-5.15/btrfs-compare-the-correct-fsid-metadata_uuid-in-btrfs_validate_super.patch
new file mode 100644 (file)
index 0000000..3c1970e
--- /dev/null
@@ -0,0 +1,61 @@
+From 6bfe3959b0e7a526f5c64747801a8613f002f05a Mon Sep 17 00:00:00 2001
+From: Anand Jain <anand.jain@oracle.com>
+Date: Mon, 31 Jul 2023 19:16:35 +0800
+Subject: btrfs: compare the correct fsid/metadata_uuid in btrfs_validate_super
+
+From: Anand Jain <anand.jain@oracle.com>
+
+commit 6bfe3959b0e7a526f5c64747801a8613f002f05a upstream.
+
+The function btrfs_validate_super() should verify the metadata_uuid in
+the provided superblock argument. Because, all its callers expect it to
+do that.
+
+Such as in the following stacks:
+
+  write_all_supers()
+   sb = fs_info->super_for_commit;
+   btrfs_validate_write_super(.., sb)
+     btrfs_validate_super(.., sb, ..)
+
+  scrub_one_super()
+       btrfs_validate_super(.., sb, ..)
+
+And
+   check_dev_super()
+       btrfs_validate_super(.., sb, ..)
+
+However, it currently verifies the fs_info::super_copy::metadata_uuid
+instead.  Fix this using the correct metadata_uuid in the superblock
+argument.
+
+CC: stable@vger.kernel.org # 5.4+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
+Signed-off-by: Anand Jain <anand.jain@oracle.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/disk-io.c |    8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/fs/btrfs/disk-io.c
++++ b/fs/btrfs/disk-io.c
+@@ -2605,13 +2605,11 @@ int btrfs_validate_super(struct btrfs_fs
+               ret = -EINVAL;
+       }
+-      if (btrfs_fs_incompat(fs_info, METADATA_UUID) &&
+-          memcmp(fs_info->fs_devices->metadata_uuid,
+-                 fs_info->super_copy->metadata_uuid, BTRFS_FSID_SIZE)) {
++      if (memcmp(fs_info->fs_devices->metadata_uuid, btrfs_sb_fsid_ptr(sb),
++                 BTRFS_FSID_SIZE) != 0) {
+               btrfs_err(fs_info,
+ "superblock metadata_uuid doesn't match metadata uuid of fs_devices: %pU != %pU",
+-                      fs_info->super_copy->metadata_uuid,
+-                      fs_info->fs_devices->metadata_uuid);
++                        btrfs_sb_fsid_ptr(sb), fs_info->fs_devices->metadata_uuid);
+               ret = -EINVAL;
+       }
diff --git a/queue-5.15/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch b/queue-5.15/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch
new file mode 100644 (file)
index 0000000..33183e7
--- /dev/null
@@ -0,0 +1,43 @@
+From 4490e803e1fe9fab8db5025e44e23b55df54078b Mon Sep 17 00:00:00 2001
+From: Filipe Manana <fdmanana@suse.com>
+Date: Wed, 26 Jul 2023 16:56:57 +0100
+Subject: btrfs: don't start transaction when joining with TRANS_JOIN_NOSTART
+
+From: Filipe Manana <fdmanana@suse.com>
+
+commit 4490e803e1fe9fab8db5025e44e23b55df54078b upstream.
+
+When joining a transaction with TRANS_JOIN_NOSTART, if we don't find a
+running transaction we end up creating one. This goes against the purpose
+of TRANS_JOIN_NOSTART which is to join a running transaction if its state
+is at or below the state TRANS_STATE_COMMIT_START, otherwise return an
+-ENOENT error and don't start a new transaction. So fix this to not create
+a new transaction if there's no running transaction at or below that
+state.
+
+CC: stable@vger.kernel.org # 4.14+
+Fixes: a6d155d2e363 ("Btrfs: fix deadlock between fiemap and transaction commits")
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/btrfs/transaction.c |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/fs/btrfs/transaction.c
++++ b/fs/btrfs/transaction.c
+@@ -311,10 +311,11 @@ loop:
+       spin_unlock(&fs_info->trans_lock);
+       /*
+-       * If we are ATTACH, we just want to catch the current transaction,
+-       * and commit it. If there is no transaction, just return ENOENT.
++       * If we are ATTACH or TRANS_JOIN_NOSTART, we just want to catch the
++       * current transaction, and commit it. If there is no transaction, just
++       * return ENOENT.
+        */
+-      if (type == TRANS_ATTACH)
++      if (type == TRANS_ATTACH || type == TRANS_JOIN_NOSTART)
+               return -ENOENT;
+       /*
diff --git a/queue-5.15/btrfs-use-the-correct-superblock-to-compare-fsid-in-btrfs_validate_super.patch b/queue-5.15/btrfs-use-the-correct-superblock-to-compare-fsid-in-btrfs_validate_super.patch
new file mode 100644 (file)
index 0000000..0325765
--- /dev/null
@@ -0,0 +1,57 @@
+From d167aa76dc0683828588c25767da07fb549e4f48 Mon Sep 17 00:00:00 2001
+From: Anand Jain <anand.jain@oracle.com>
+Date: Mon, 31 Jul 2023 19:16:34 +0800
+Subject: btrfs: use the correct superblock to compare fsid in btrfs_validate_super
+
+From: Anand Jain <anand.jain@oracle.com>
+
+commit d167aa76dc0683828588c25767da07fb549e4f48 upstream.
+
+The function btrfs_validate_super() should verify the fsid in the provided
+superblock argument. Because, all its callers expect it to do that.
+
+Such as in the following stack:
+
+   write_all_supers()
+       sb = fs_info->super_for_commit;
+       btrfs_validate_write_super(.., sb)
+         btrfs_validate_super(.., sb, ..)
+
+   scrub_one_super()
+       btrfs_validate_super(.., sb, ..)
+
+And
+   check_dev_super()
+       btrfs_validate_super(.., sb, ..)
+
+However, it currently verifies the fs_info::super_copy::fsid instead,
+which is not correct.  Fix this using the correct fsid in the superblock
+argument.
+
+CC: stable@vger.kernel.org # 5.4+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
+Signed-off-by: Anand Jain <anand.jain@oracle.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/disk-io.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/fs/btrfs/disk-io.c
++++ b/fs/btrfs/disk-io.c
+@@ -2598,11 +2598,10 @@ int btrfs_validate_super(struct btrfs_fs
+               ret = -EINVAL;
+       }
+-      if (memcmp(fs_info->fs_devices->fsid, fs_info->super_copy->fsid,
+-                 BTRFS_FSID_SIZE)) {
++      if (memcmp(fs_info->fs_devices->fsid, sb->fsid, BTRFS_FSID_SIZE) != 0) {
+               btrfs_err(fs_info,
+               "superblock fsid doesn't match fsid of fs_devices: %pU != %pU",
+-                      fs_info->super_copy->fsid, fs_info->fs_devices->fsid);
++                        sb->fsid, fs_info->fs_devices->fsid);
+               ret = -EINVAL;
+       }
diff --git a/queue-5.15/drm-amd-display-enable-cursor-degamma-for-dcn3-drm-legacy-gamma.patch b/queue-5.15/drm-amd-display-enable-cursor-degamma-for-dcn3-drm-legacy-gamma.patch
new file mode 100644 (file)
index 0000000..884d11c
--- /dev/null
@@ -0,0 +1,49 @@
+From 57a943ebfcdb4a97fbb409640234bdb44bfa1953 Mon Sep 17 00:00:00 2001
+From: Melissa Wen <mwen@igalia.com>
+Date: Thu, 31 Aug 2023 15:12:28 -0100
+Subject: drm/amd/display: enable cursor degamma for DCN3+ DRM legacy gamma
+
+From: Melissa Wen <mwen@igalia.com>
+
+commit 57a943ebfcdb4a97fbb409640234bdb44bfa1953 upstream.
+
+For DRM legacy gamma, AMD display manager applies implicit sRGB degamma
+using a pre-defined sRGB transfer function. It works fine for DCN2
+family where degamma ROM and custom curves go to the same color block.
+But, on DCN3+, degamma is split into two blocks: degamma ROM for
+pre-defined TFs and `gamma correction` for user/custom curves and
+degamma ROM settings doesn't apply to cursor plane. To get DRM legacy
+gamma working as expected, enable cursor degamma ROM for implict sRGB
+degamma on HW with this configuration.
+
+Cc: stable@vger.kernel.org
+Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2803
+Fixes: 96b020e2163f ("drm/amd/display: check attr flag before set cursor degamma on DCN3+")
+Signed-off-by: Melissa Wen <mwen@igalia.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
+index 2198df96ed6f..cc74dd69acf2 100644
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
+@@ -1269,6 +1269,13 @@ void amdgpu_dm_plane_handle_cursor_update(struct drm_plane *plane,
+       attributes.rotation_angle    = 0;
+       attributes.attribute_flags.value = 0;
++      /* Enable cursor degamma ROM on DCN3+ for implicit sRGB degamma in DRM
++       * legacy gamma setup.
++       */
++      if (crtc_state->cm_is_degamma_srgb &&
++          adev->dm.dc->caps.color.dpp.gamma_corr)
++              attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA = 1;
++
+       attributes.pitch = afb->base.pitches[0] / afb->base.format->cpp[0];
+       if (crtc_state->stream) {
+-- 
+2.42.0
+
diff --git a/queue-5.15/drm-amd-display-prevent-potential-division-by-zero-errors.patch b/queue-5.15/drm-amd-display-prevent-potential-division-by-zero-errors.patch
new file mode 100644 (file)
index 0000000..31d91cd
--- /dev/null
@@ -0,0 +1,50 @@
+From 07e388aab042774f284a2ad75a70a194517cdad4 Mon Sep 17 00:00:00 2001
+From: Hamza Mahfooz <hamza.mahfooz@amd.com>
+Date: Tue, 5 Sep 2023 13:27:22 -0400
+Subject: drm/amd/display: prevent potential division by zero errors
+
+From: Hamza Mahfooz <hamza.mahfooz@amd.com>
+
+commit 07e388aab042774f284a2ad75a70a194517cdad4 upstream.
+
+There are two places in apply_below_the_range() where it's possible for
+a divide by zero error to occur. So, to fix this make sure the divisor
+is non-zero before attempting the computation in both cases.
+
+Cc: stable@vger.kernel.org
+Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2637
+Fixes: a463b263032f ("drm/amd/display: Fix frames_to_insert math")
+Fixes: ded6119e825a ("drm/amd/display: Reinstate LFC optimization")
+Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
+Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/display/modules/freesync/freesync.c |    9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
++++ b/drivers/gpu/drm/amd/display/modules/freesync/freesync.c
+@@ -327,7 +327,9 @@ static void apply_below_the_range(struct
+                *  - Delta for CEIL: delta_from_mid_point_in_us_1
+                *  - Delta for FLOOR: delta_from_mid_point_in_us_2
+                */
+-              if ((last_render_time_in_us / mid_point_frames_ceil) < in_out_vrr->min_duration_in_us) {
++              if (mid_point_frames_ceil &&
++                  (last_render_time_in_us / mid_point_frames_ceil) <
++                  in_out_vrr->min_duration_in_us) {
+                       /* Check for out of range.
+                        * If using CEIL produces a value that is out of range,
+                        * then we are forced to use FLOOR.
+@@ -374,8 +376,9 @@ static void apply_below_the_range(struct
+               /* Either we've calculated the number of frames to insert,
+                * or we need to insert min duration frames
+                */
+-              if (last_render_time_in_us / frames_to_insert <
+-                              in_out_vrr->min_duration_in_us){
++              if (frames_to_insert &&
++                  (last_render_time_in_us / frames_to_insert) <
++                  in_out_vrr->min_duration_in_us){
+                       frames_to_insert -= (frames_to_insert > 1) ?
+                                       1 : 0;
+               }
diff --git a/queue-5.15/mips-fix-config_cpu_daddi_workarounds-modules_install-regression.patch b/queue-5.15/mips-fix-config_cpu_daddi_workarounds-modules_install-regression.patch
new file mode 100644 (file)
index 0000000..25ee9e9
--- /dev/null
@@ -0,0 +1,48 @@
+From a79a404e6c2241ebc528b9ebf4c0832457b498c3 Mon Sep 17 00:00:00 2001
+From: "Maciej W. Rozycki" <macro@orcam.me.uk>
+Date: Tue, 18 Jul 2023 15:37:18 +0100
+Subject: MIPS: Fix CONFIG_CPU_DADDI_WORKAROUNDS `modules_install' regression
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Maciej W. Rozycki <macro@orcam.me.uk>
+
+commit a79a404e6c2241ebc528b9ebf4c0832457b498c3 upstream.
+
+Remove a build-time check for the presence of the GCC `-msym32' option.
+This option has been there since GCC 4.1.0, which is below the minimum
+required as at commit 805b2e1d427a ("kbuild: include Makefile.compiler
+only when compiler is needed"), when an error message:
+
+arch/mips/Makefile:306: *** CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32.  Stop.
+
+started to trigger for the `modules_install' target with configurations
+such as `decstation_64_defconfig' that set CONFIG_CPU_DADDI_WORKAROUNDS,
+because said commit has made `cc-option-yn' an undefined function for
+non-build targets.
+
+Reported-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
+Signed-off-by: Maciej W. Rozycki <macro@orcam.me.uk>
+Fixes: 805b2e1d427a ("kbuild: include Makefile.compiler only when compiler is needed")
+Cc: stable@vger.kernel.org # v5.13+
+Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/mips/Makefile |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/Makefile
++++ b/arch/mips/Makefile
+@@ -279,8 +279,8 @@ ifdef CONFIG_64BIT
+     endif
+   endif
+-  ifeq ($(KBUILD_SYM32)$(call cc-option-yn,-msym32), yy)
+-    cflags-y += -msym32 -DKBUILD_64BIT_SYM32
++  ifeq ($(KBUILD_SYM32), y)
++    cflags-$(KBUILD_SYM32) += -msym32 -DKBUILD_64BIT_SYM32
+   else
+     ifeq ($(CONFIG_CPU_DADDI_WORKAROUNDS), y)
+       $(error CONFIG_CPU_DADDI_WORKAROUNDS unsupported without -msym32)
diff --git a/queue-5.15/mtd-rawnand-brcmnand-fix-crash-during-the-panic_write.patch b/queue-5.15/mtd-rawnand-brcmnand-fix-crash-during-the-panic_write.patch
new file mode 100644 (file)
index 0000000..0722577
--- /dev/null
@@ -0,0 +1,47 @@
+From e66dd317194daae0475fe9e5577c80aa97f16cb9 Mon Sep 17 00:00:00 2001
+From: William Zhang <william.zhang@broadcom.com>
+Date: Thu, 6 Jul 2023 11:29:07 -0700
+Subject: mtd: rawnand: brcmnand: Fix crash during the panic_write
+
+From: William Zhang <william.zhang@broadcom.com>
+
+commit e66dd317194daae0475fe9e5577c80aa97f16cb9 upstream.
+
+When executing a NAND command within the panic write path, wait for any
+pending command instead of calling BUG_ON to avoid crashing while
+already crashing.
+
+Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
+Signed-off-by: William Zhang <william.zhang@broadcom.com>
+Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
+Reviewed-by: Kursad Oney <kursad.oney@broadcom.com>
+Reviewed-by: Kamal Dasu <kamal.dasu@broadcom.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20230706182909.79151-4-william.zhang@broadcom.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/brcmnand/brcmnand.c |   12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+@@ -1563,7 +1563,17 @@ static void brcmnand_send_cmd(struct brc
+       dev_dbg(ctrl->dev, "send native cmd %d addr 0x%llx\n", cmd, cmd_addr);
+-      BUG_ON(ctrl->cmd_pending != 0);
++      /*
++       * If we came here through _panic_write and there is a pending
++       * command, try to wait for it. If it times out, rather than
++       * hitting BUG_ON, just return so we don't crash while crashing.
++       */
++      if (oops_in_progress) {
++              if (ctrl->cmd_pending &&
++                      bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0))
++                      return;
++      } else
++              BUG_ON(ctrl->cmd_pending != 0);
+       ctrl->cmd_pending = cmd;
+       ret = bcmnand_ctrl_poll_status(ctrl, NAND_CTRL_RDY, NAND_CTRL_RDY, 0);
diff --git a/queue-5.15/mtd-rawnand-brcmnand-fix-potential-false-time-out-warning.patch b/queue-5.15/mtd-rawnand-brcmnand-fix-potential-false-time-out-warning.patch
new file mode 100644 (file)
index 0000000..e3d4620
--- /dev/null
@@ -0,0 +1,42 @@
+From 9cc0a598b944816f2968baf2631757f22721b996 Mon Sep 17 00:00:00 2001
+From: William Zhang <william.zhang@broadcom.com>
+Date: Thu, 6 Jul 2023 11:29:06 -0700
+Subject: mtd: rawnand: brcmnand: Fix potential false time out warning
+
+From: William Zhang <william.zhang@broadcom.com>
+
+commit 9cc0a598b944816f2968baf2631757f22721b996 upstream.
+
+If system is busy during the command status polling function, the driver
+may not get the chance to poll the status register till the end of time
+out and return the premature status.  Do a final check after time out
+happens to ensure reading the correct status.
+
+Fixes: 9d2ee0a60b8b ("mtd: nand: brcmnand: Check flash #WP pin status before nand erase/program")
+Signed-off-by: William Zhang <william.zhang@broadcom.com>
+Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20230706182909.79151-3-william.zhang@broadcom.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/brcmnand/brcmnand.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+@@ -1043,6 +1043,14 @@ static int bcmnand_ctrl_poll_status(stru
+               cpu_relax();
+       } while (time_after(limit, jiffies));
++      /*
++       * do a final check after time out in case the CPU was busy and the driver
++       * did not get enough time to perform the polling to avoid false alarms
++       */
++      val = brcmnand_read_reg(ctrl, BRCMNAND_INTFC_STATUS);
++      if ((val & mask) == expected_val)
++              return 0;
++
+       dev_warn(ctrl->dev, "timeout on status poll (expected %x got %x)\n",
+                expected_val, val & mask);
diff --git a/queue-5.15/mtd-rawnand-brcmnand-fix-potential-out-of-bounds-access-in-oob-write.patch b/queue-5.15/mtd-rawnand-brcmnand-fix-potential-out-of-bounds-access-in-oob-write.patch
new file mode 100644 (file)
index 0000000..34b7a18
--- /dev/null
@@ -0,0 +1,64 @@
+From 5d53244186c9ac58cb88d76a0958ca55b83a15cd Mon Sep 17 00:00:00 2001
+From: William Zhang <william.zhang@broadcom.com>
+Date: Thu, 6 Jul 2023 11:29:08 -0700
+Subject: mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob write
+
+From: William Zhang <william.zhang@broadcom.com>
+
+commit 5d53244186c9ac58cb88d76a0958ca55b83a15cd upstream.
+
+When the oob buffer length is not in multiple of words, the oob write
+function does out-of-bounds read on the oob source buffer at the last
+iteration. Fix that by always checking length limit on the oob buffer
+read and fill with 0xff when reaching the end of the buffer to the oob
+registers.
+
+Fixes: 27c5b17cd1b1 ("mtd: nand: add NAND driver "library" for Broadcom STB NAND controller")
+Signed-off-by: William Zhang <william.zhang@broadcom.com>
+Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/linux-mtd/20230706182909.79151-5-william.zhang@broadcom.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mtd/nand/raw/brcmnand/brcmnand.c |   18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+@@ -1432,19 +1432,33 @@ static int write_oob_to_regs(struct brcm
+                            const u8 *oob, int sas, int sector_1k)
+ {
+       int tbytes = sas << sector_1k;
+-      int j;
++      int j, k = 0;
++      u32 last = 0xffffffff;
++      u8 *plast = (u8 *)&last;
+       /* Adjust OOB values for 1K sector size */
+       if (sector_1k && (i & 0x01))
+               tbytes = max(0, tbytes - (int)ctrl->max_oob);
+       tbytes = min_t(int, tbytes, ctrl->max_oob);
+-      for (j = 0; j < tbytes; j += 4)
++      /*
++       * tbytes may not be multiple of words. Make sure we don't read out of
++       * the boundary and stop at last word.
++       */
++      for (j = 0; (j + 3) < tbytes; j += 4)
+               oob_reg_write(ctrl, j,
+                               (oob[j + 0] << 24) |
+                               (oob[j + 1] << 16) |
+                               (oob[j + 2] <<  8) |
+                               (oob[j + 3] <<  0));
++
++      /* handle the remaing bytes */
++      while (j < tbytes)
++              plast[k++] = oob[j++];
++
++      if (tbytes & 0x3)
++              oob_reg_write(ctrl, (tbytes & ~0x3), (__force u32)cpu_to_be32(last));
++
+       return tbytes;
+ }
diff --git a/queue-5.15/perf-hists-browser-fix-hierarchy-mode-header.patch b/queue-5.15/perf-hists-browser-fix-hierarchy-mode-header.patch
new file mode 100644 (file)
index 0000000..429a228
--- /dev/null
@@ -0,0 +1,43 @@
+From e2cabf2a44791f01c21f8d5189b946926e34142e Mon Sep 17 00:00:00 2001
+From: Namhyung Kim <namhyung@kernel.org>
+Date: Mon, 31 Jul 2023 02:49:32 -0700
+Subject: perf hists browser: Fix hierarchy mode header
+
+From: Namhyung Kim <namhyung@kernel.org>
+
+commit e2cabf2a44791f01c21f8d5189b946926e34142e upstream.
+
+The commit ef9ff6017e3c4593 ("perf ui browser: Move the extra title
+lines from the hists browser") introduced ui_browser__gotorc_title() to
+help moving non-title lines easily.  But it missed to update the title
+for the hierarchy mode so it won't print the header line on TUI at all.
+
+  $ perf report --hierarchy
+
+Fixes: ef9ff6017e3c4593 ("perf ui browser: Move the extra title lines from the hists browser")
+Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20230731094934.1616495-1-namhyung@kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/perf/ui/browsers/hists.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/tools/perf/ui/browsers/hists.c
++++ b/tools/perf/ui/browsers/hists.c
+@@ -1779,7 +1779,7 @@ static void hists_browser__hierarchy_hea
+       hists_browser__scnprintf_hierarchy_headers(browser, headers,
+                                                  sizeof(headers));
+-      ui_browser__gotorc(&browser->b, 0, 0);
++      ui_browser__gotorc_title(&browser->b, 0, 0);
+       ui_browser__set_color(&browser->b, HE_COLORSET_ROOT);
+       ui_browser__write_nstring(&browser->b, headers, browser->b.width + 1);
+ }
diff --git a/queue-5.15/perf-hists-browser-fix-the-number-of-entries-for-e-key.patch b/queue-5.15/perf-hists-browser-fix-the-number-of-entries-for-e-key.patch
new file mode 100644 (file)
index 0000000..07b764b
--- /dev/null
@@ -0,0 +1,150 @@
+From f6b8436bede3e80226e8b2100279c4450c73806a Mon Sep 17 00:00:00 2001
+From: Namhyung Kim <namhyung@kernel.org>
+Date: Mon, 31 Jul 2023 02:49:33 -0700
+Subject: perf hists browser: Fix the number of entries for 'e' key
+
+From: Namhyung Kim <namhyung@kernel.org>
+
+commit f6b8436bede3e80226e8b2100279c4450c73806a upstream.
+
+The 'e' key is to toggle expand/collapse the selected entry only.  But
+the current code has a bug that it only increases the number of entries
+by 1 in the hierarchy mode so users cannot move under the current entry
+after the key stroke.  This is due to a wrong assumption in the
+hist_entry__set_folding().
+
+The commit b33f922651011eff ("perf hists browser: Put hist_entry folding
+logic into single function") factored out the code, but actually it
+should be handled separately.  The hist_browser__set_folding() is to
+update fold state for each entry so it needs to traverse all (child)
+entries regardless of the current fold state.  So it increases the
+number of entries by 1.
+
+But the hist_entry__set_folding() only cares the currently selected
+entry and its all children.  So it should count all unfolded child
+entries.  This code is implemented in hist_browser__toggle_fold()
+already so we can just call it.
+
+Fixes: b33f922651011eff ("perf hists browser: Put hist_entry folding logic into single function")
+Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20230731094934.1616495-2-namhyung@kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/perf/ui/browsers/hists.c |   58 ++++++++++++++++-------------------------
+ 1 file changed, 24 insertions(+), 34 deletions(-)
+
+--- a/tools/perf/ui/browsers/hists.c
++++ b/tools/perf/ui/browsers/hists.c
+@@ -407,11 +407,6 @@ static bool hist_browser__selection_has_
+       return container_of(ms, struct callchain_list, ms)->has_children;
+ }
+-static bool hist_browser__he_selection_unfolded(struct hist_browser *browser)
+-{
+-      return browser->he_selection ? browser->he_selection->unfolded : false;
+-}
+-
+ static bool hist_browser__selection_unfolded(struct hist_browser *browser)
+ {
+       struct hist_entry *he = browser->he_selection;
+@@ -584,8 +579,8 @@ static int hierarchy_set_folding(struct
+       return n;
+ }
+-static void __hist_entry__set_folding(struct hist_entry *he,
+-                                    struct hist_browser *hb, bool unfold)
++static void hist_entry__set_folding(struct hist_entry *he,
++                                  struct hist_browser *hb, bool unfold)
+ {
+       hist_entry__init_have_children(he);
+       he->unfolded = unfold ? he->has_children : false;
+@@ -603,34 +598,12 @@ static void __hist_entry__set_folding(st
+               he->nr_rows = 0;
+ }
+-static void hist_entry__set_folding(struct hist_entry *he,
+-                                  struct hist_browser *browser, bool unfold)
+-{
+-      double percent;
+-
+-      percent = hist_entry__get_percent_limit(he);
+-      if (he->filtered || percent < browser->min_pcnt)
+-              return;
+-
+-      __hist_entry__set_folding(he, browser, unfold);
+-
+-      if (!he->depth || unfold)
+-              browser->nr_hierarchy_entries++;
+-      if (he->leaf)
+-              browser->nr_callchain_rows += he->nr_rows;
+-      else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) {
+-              browser->nr_hierarchy_entries++;
+-              he->has_no_entry = true;
+-              he->nr_rows = 1;
+-      } else
+-              he->has_no_entry = false;
+-}
+-
+ static void
+ __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
+ {
+       struct rb_node *nd;
+       struct hist_entry *he;
++      double percent;
+       nd = rb_first_cached(&browser->hists->entries);
+       while (nd) {
+@@ -640,6 +613,21 @@ __hist_browser__set_folding(struct hist_
+               nd = __rb_hierarchy_next(nd, HMD_FORCE_CHILD);
+               hist_entry__set_folding(he, browser, unfold);
++
++              percent = hist_entry__get_percent_limit(he);
++              if (he->filtered || percent < browser->min_pcnt)
++                      continue;
++
++              if (!he->depth || unfold)
++                      browser->nr_hierarchy_entries++;
++              if (he->leaf)
++                      browser->nr_callchain_rows += he->nr_rows;
++              else if (unfold && !hist_entry__has_hierarchy_children(he, browser->min_pcnt)) {
++                      browser->nr_hierarchy_entries++;
++                      he->has_no_entry = true;
++                      he->nr_rows = 1;
++              } else
++                      he->has_no_entry = false;
+       }
+ }
+@@ -659,8 +647,10 @@ static void hist_browser__set_folding_se
+       if (!browser->he_selection)
+               return;
+-      hist_entry__set_folding(browser->he_selection, browser, unfold);
+-      browser->b.nr_entries = hist_browser__nr_entries(browser);
++      if (unfold == browser->he_selection->unfolded)
++              return;
++
++      hist_browser__toggle_fold(browser);
+ }
+ static void ui_browser__warn_lost_events(struct ui_browser *browser)
+@@ -732,8 +722,8 @@ static int hist_browser__handle_hotkey(s
+               hist_browser__set_folding(browser, true);
+               break;
+       case 'e':
+-              /* Expand the selected entry. */
+-              hist_browser__set_folding_selected(browser, !hist_browser__he_selection_unfolded(browser));
++              /* Toggle expand/collapse the selected entry. */
++              hist_browser__toggle_fold(browser);
+               break;
+       case 'H':
+               browser->show_headers = !browser->show_headers;
diff --git a/queue-5.15/perf-tools-handle-old-data-in-perf_record_attr.patch b/queue-5.15/perf-tools-handle-old-data-in-perf_record_attr.patch
new file mode 100644 (file)
index 0000000..206abe3
--- /dev/null
@@ -0,0 +1,90 @@
+From 9bf63282ea77a531ea58acb42fb3f40d2d1e4497 Mon Sep 17 00:00:00 2001
+From: Namhyung Kim <namhyung@kernel.org>
+Date: Fri, 25 Aug 2023 08:25:49 -0700
+Subject: perf tools: Handle old data in PERF_RECORD_ATTR
+
+From: Namhyung Kim <namhyung@kernel.org>
+
+commit 9bf63282ea77a531ea58acb42fb3f40d2d1e4497 upstream.
+
+The PERF_RECORD_ATTR is used for a pipe mode to describe an event with
+attribute and IDs.  The ID table comes after the attr and it calculate
+size of the table using the total record size and the attr size.
+
+  n_ids = (total_record_size - end_of_the_attr_field) / sizeof(u64)
+
+This is fine for most use cases, but sometimes it saves the pipe output
+in a file and then process it later.  And it becomes a problem if there
+is a change in attr size between the record and report.
+
+  $ perf record -o- > perf-pipe.data  # old version
+  $ perf report -i- < perf-pipe.data  # new version
+
+For example, if the attr size is 128 and it has 4 IDs, then it would
+save them in 168 byte like below:
+
+   8 byte: perf event header { .type = PERF_RECORD_ATTR, .size = 168 },
+ 128 byte: perf event attr { .size = 128, ... },
+  32 byte: event IDs [] = { 1234, 1235, 1236, 1237 },
+
+But when report later, it thinks the attr size is 136 then it only read
+the last 3 entries as ID.
+
+   8 byte: perf event header { .type = PERF_RECORD_ATTR, .size = 168 },
+ 136 byte: perf event attr { .size = 136, ... },
+  24 byte: event IDs [] = { 1235, 1236, 1237 },  // 1234 is missing
+
+So it should use the recorded version of the attr.  The attr has the
+size field already then it should honor the size when reading data.
+
+Fixes: 2c46dbb517a10b18 ("perf: Convert perf header attrs into attr events")
+Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Tom Zanussi <zanussi@kernel.org>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20230825152552.112913-1-namhyung@kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ tools/perf/util/header.c |   11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+--- a/tools/perf/util/header.c
++++ b/tools/perf/util/header.c
+@@ -4200,7 +4200,8 @@ int perf_event__process_attr(struct perf
+                            union perf_event *event,
+                            struct evlist **pevlist)
+ {
+-      u32 i, ids, n_ids;
++      u32 i, n_ids;
++      u64 *ids;
+       struct evsel *evsel;
+       struct evlist *evlist = *pevlist;
+@@ -4216,9 +4217,8 @@ int perf_event__process_attr(struct perf
+       evlist__add(evlist, evsel);
+-      ids = event->header.size;
+-      ids -= (void *)&event->attr.id - (void *)event;
+-      n_ids = ids / sizeof(u64);
++      n_ids = event->header.size - sizeof(event->header) - event->attr.attr.size;
++      n_ids = n_ids / sizeof(u64);
+       /*
+        * We don't have the cpu and thread maps on the header, so
+        * for allocating the perf_sample_id table we fake 1 cpu and
+@@ -4227,8 +4227,9 @@ int perf_event__process_attr(struct perf
+       if (perf_evsel__alloc_id(&evsel->core, 1, n_ids))
+               return -ENOMEM;
++      ids = (void *)&event->attr.attr + event->attr.attr.size;
+       for (i = 0; i < n_ids; i++) {
+-              perf_evlist__id_add(&evlist->core, &evsel->core, 0, i, event->attr.id[i]);
++              perf_evlist__id_add(&evlist->core, &evsel->core, 0, i, ids[i]);
+       }
+       return 0;
index 546a1a7964506a23f4be4fdafc77e9c1a73dbe4a..80ba1c4b1e39d902333a4a9156b7cd725138032a 100644 (file)
@@ -473,3 +473,15 @@ ata-pata_ftide010-add-missing-module_description.patch
 fuse-nlookup-missing-decrement-in-fuse_direntplus_link.patch
 btrfs-fix-start-transaction-qgroup-rsv-double-free.patch
 btrfs-free-qgroup-rsv-on-io-failure.patch
+btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch
+btrfs-use-the-correct-superblock-to-compare-fsid-in-btrfs_validate_super.patch
+btrfs-compare-the-correct-fsid-metadata_uuid-in-btrfs_validate_super.patch
+mtd-rawnand-brcmnand-fix-crash-during-the-panic_write.patch
+mtd-rawnand-brcmnand-fix-potential-out-of-bounds-access-in-oob-write.patch
+mtd-rawnand-brcmnand-fix-potential-false-time-out-warning.patch
+drm-amd-display-prevent-potential-division-by-zero-errors.patch
+mips-fix-config_cpu_daddi_workarounds-modules_install-regression.patch
+perf-hists-browser-fix-hierarchy-mode-header.patch
+perf-tools-handle-old-data-in-perf_record_attr.patch
+perf-hists-browser-fix-the-number-of-entries-for-e-key.patch
+drm-amd-display-enable-cursor-degamma-for-dcn3-drm-legacy-gamma.patch