]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Sep 2023 12:29:46 +0000 (14:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 16 Sep 2023 12:29:46 +0000 (14:29 +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
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-tools-handle-old-data-in-perf_record_attr.patch

queue-5.4/btrfs-compare-the-correct-fsid-metadata_uuid-in-btrfs_validate_super.patch [new file with mode: 0644]
queue-5.4/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch [new file with mode: 0644]
queue-5.4/btrfs-use-the-correct-superblock-to-compare-fsid-in-btrfs_validate_super.patch [new file with mode: 0644]
queue-5.4/mtd-rawnand-brcmnand-fix-crash-during-the-panic_write.patch [new file with mode: 0644]
queue-5.4/mtd-rawnand-brcmnand-fix-potential-false-time-out-warning.patch [new file with mode: 0644]
queue-5.4/mtd-rawnand-brcmnand-fix-potential-out-of-bounds-access-in-oob-write.patch [new file with mode: 0644]
queue-5.4/perf-hists-browser-fix-hierarchy-mode-header.patch [new file with mode: 0644]
queue-5.4/perf-tools-handle-old-data-in-perf_record_attr.patch [new file with mode: 0644]
queue-5.4/series

diff --git a/queue-5.4/btrfs-compare-the-correct-fsid-metadata_uuid-in-btrfs_validate_super.patch b/queue-5.4/btrfs-compare-the-correct-fsid-metadata_uuid-in-btrfs_validate_super.patch
new file mode 100644 (file)
index 0000000..830d5d9
--- /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
+@@ -2487,13 +2487,11 @@ static int validate_super(struct btrfs_f
+               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.4/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch b/queue-5.4/btrfs-don-t-start-transaction-when-joining-with-trans_join_nostart.patch
new file mode 100644 (file)
index 0000000..591e402
--- /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
+@@ -190,10 +190,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.4/btrfs-use-the-correct-superblock-to-compare-fsid-in-btrfs_validate_super.patch b/queue-5.4/btrfs-use-the-correct-superblock-to-compare-fsid-in-btrfs_validate_super.patch
new file mode 100644 (file)
index 0000000..a7d5f54
--- /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
+@@ -2480,11 +2480,10 @@ static int validate_super(struct btrfs_f
+               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.4/mtd-rawnand-brcmnand-fix-crash-during-the-panic_write.patch b/queue-5.4/mtd-rawnand-brcmnand-fix-crash-during-the-panic_write.patch
new file mode 100644 (file)
index 0000000..f53dae0
--- /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
+@@ -1331,7 +1331,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.4/mtd-rawnand-brcmnand-fix-potential-false-time-out-warning.patch b/queue-5.4/mtd-rawnand-brcmnand-fix-potential-false-time-out-warning.patch
new file mode 100644 (file)
index 0000000..aa0cccf
--- /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
+@@ -891,6 +891,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.4/mtd-rawnand-brcmnand-fix-potential-out-of-bounds-access-in-oob-write.patch b/queue-5.4/mtd-rawnand-brcmnand-fix-potential-out-of-bounds-access-in-oob-write.patch
new file mode 100644 (file)
index 0000000..2897bf0
--- /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
+@@ -1273,19 +1273,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.4/perf-hists-browser-fix-hierarchy-mode-header.patch b/queue-5.4/perf-hists-browser-fix-hierarchy-mode-header.patch
new file mode 100644 (file)
index 0000000..11af9c9
--- /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
+@@ -1718,7 +1718,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.4/perf-tools-handle-old-data-in-perf_record_attr.patch b/queue-5.4/perf-tools-handle-old-data-in-perf_record_attr.patch
new file mode 100644 (file)
index 0000000..83ad17a
--- /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
+@@ -3720,7 +3720,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;
+@@ -3736,9 +3737,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
+@@ -3747,8 +3747,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 d5eda1292e16f9d841df5f5039193788a5e1f2f2..c53cf5a731aa976190d10b2d4159e1537086c22b 100644 (file)
@@ -280,3 +280,11 @@ sh-boards-fix-ceu-buffer-size-passed-to-dma_declare_.patch
 ata-sata_gemini-add-missing-module_description.patch
 ata-pata_ftide010-add-missing-module_description.patch
 fuse-nlookup-missing-decrement-in-fuse_direntplus_link.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
+perf-hists-browser-fix-hierarchy-mode-header.patch
+perf-tools-handle-old-data-in-perf_record_attr.patch