]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Sep 2024 07:11:32 +0000 (09:11 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Sep 2024 07:11:32 +0000 (09:11 +0200)
added patches:
drm-amd-amdgpu-apply-command-submission-parser-for-jpeg-v1.patch
soundwire-stream-revert-soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch
spi-nxp-fspi-fix-the-kasan-report-out-of-bounds-bug.patch

queue-5.10/drm-amd-amdgpu-apply-command-submission-parser-for-jpeg-v1.patch [new file with mode: 0644]
queue-5.10/series
queue-5.10/soundwire-stream-revert-soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch [new file with mode: 0644]
queue-5.10/spi-nxp-fspi-fix-the-kasan-report-out-of-bounds-bug.patch [new file with mode: 0644]

diff --git a/queue-5.10/drm-amd-amdgpu-apply-command-submission-parser-for-jpeg-v1.patch b/queue-5.10/drm-amd-amdgpu-apply-command-submission-parser-for-jpeg-v1.patch
new file mode 100644 (file)
index 0000000..a608093
--- /dev/null
@@ -0,0 +1,151 @@
+From 8409fb50ce48d66cf9dc5391f03f05c56c430605 Mon Sep 17 00:00:00 2001
+From: "David (Ming Qiang) Wu" <David.Wu3@amd.com>
+Date: Thu, 5 Sep 2024 16:57:28 -0400
+Subject: drm/amd/amdgpu: apply command submission parser for JPEG v1
+
+From: David (Ming Qiang) Wu <David.Wu3@amd.com>
+
+commit 8409fb50ce48d66cf9dc5391f03f05c56c430605 upstream.
+
+Similar to jpeg_v2_dec_ring_parse_cs() but it has different
+register ranges and a few other registers access.
+
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit 3d5adbdf1d01708777f2eda375227cbf7a98b9fe)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c |   76 ++++++++++++++++++++++++++++++++-
+ drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.h |   11 ++++
+ 2 files changed, 86 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.c
+@@ -23,6 +23,7 @@
+ #include "amdgpu.h"
+ #include "amdgpu_jpeg.h"
++#include "amdgpu_cs.h"
+ #include "soc15.h"
+ #include "soc15d.h"
+ #include "vcn_v1_0.h"
+@@ -34,6 +35,9 @@
+ static void jpeg_v1_0_set_dec_ring_funcs(struct amdgpu_device *adev);
+ static void jpeg_v1_0_set_irq_funcs(struct amdgpu_device *adev);
+ static void jpeg_v1_0_ring_begin_use(struct amdgpu_ring *ring);
++static int jpeg_v1_dec_ring_parse_cs(struct amdgpu_cs_parser *parser,
++                                   struct amdgpu_job *job,
++                                   struct amdgpu_ib *ib);
+ static void jpeg_v1_0_decode_ring_patch_wreg(struct amdgpu_ring *ring, uint32_t *ptr, uint32_t reg_offset, uint32_t val)
+ {
+@@ -296,7 +300,10 @@ static void jpeg_v1_0_decode_ring_emit_i
+       amdgpu_ring_write(ring,
+               PACKETJ(SOC15_REG_OFFSET(JPEG, 0, mmUVD_LMI_JRBC_IB_VMID), 0, 0, PACKETJ_TYPE0));
+-      amdgpu_ring_write(ring, (vmid | (vmid << 4)));
++      if (ring->funcs->parse_cs)
++              amdgpu_ring_write(ring, 0);
++      else
++              amdgpu_ring_write(ring, (vmid | (vmid << 4)));
+       amdgpu_ring_write(ring,
+               PACKETJ(SOC15_REG_OFFSET(JPEG, 0, mmUVD_LMI_JPEG_VMID), 0, 0, PACKETJ_TYPE0));
+@@ -548,6 +555,7 @@ static const struct amdgpu_ring_funcs jp
+       .get_rptr = jpeg_v1_0_decode_ring_get_rptr,
+       .get_wptr = jpeg_v1_0_decode_ring_get_wptr,
+       .set_wptr = jpeg_v1_0_decode_ring_set_wptr,
++      .parse_cs = jpeg_v1_dec_ring_parse_cs,
+       .emit_frame_size =
+               6 + 6 + /* hdp invalidate / flush */
+               SOC15_FLUSH_GPU_TLB_NUM_WREG * 6 +
+@@ -606,3 +614,69 @@ static void jpeg_v1_0_ring_begin_use(str
+       vcn_v1_0_set_pg_for_begin_use(ring, set_clocks);
+ }
++
++/**
++ * jpeg_v1_dec_ring_parse_cs - command submission parser
++ *
++ * @parser: Command submission parser context
++ * @job: the job to parse
++ * @ib: the IB to parse
++ *
++ * Parse the command stream, return -EINVAL for invalid packet,
++ * 0 otherwise
++ */
++static int jpeg_v1_dec_ring_parse_cs(struct amdgpu_cs_parser *parser,
++                                   struct amdgpu_job *job,
++                                   struct amdgpu_ib *ib)
++{
++      u32 i, reg, res, cond, type;
++      int ret = 0;
++      struct amdgpu_device *adev = parser->adev;
++
++      for (i = 0; i < ib->length_dw ; i += 2) {
++              reg  = CP_PACKETJ_GET_REG(ib->ptr[i]);
++              res  = CP_PACKETJ_GET_RES(ib->ptr[i]);
++              cond = CP_PACKETJ_GET_COND(ib->ptr[i]);
++              type = CP_PACKETJ_GET_TYPE(ib->ptr[i]);
++
++              if (res || cond != PACKETJ_CONDITION_CHECK0) /* only allow 0 for now */
++                      return -EINVAL;
++
++              if (reg >= JPEG_V1_REG_RANGE_START && reg <= JPEG_V1_REG_RANGE_END)
++                      continue;
++
++              switch (type) {
++              case PACKETJ_TYPE0:
++                      if (reg != JPEG_V1_LMI_JPEG_WRITE_64BIT_BAR_HIGH &&
++                          reg != JPEG_V1_LMI_JPEG_WRITE_64BIT_BAR_LOW &&
++                          reg != JPEG_V1_LMI_JPEG_READ_64BIT_BAR_HIGH &&
++                          reg != JPEG_V1_LMI_JPEG_READ_64BIT_BAR_LOW &&
++                          reg != JPEG_V1_REG_CTX_INDEX &&
++                          reg != JPEG_V1_REG_CTX_DATA) {
++                              ret = -EINVAL;
++                      }
++                      break;
++              case PACKETJ_TYPE1:
++                      if (reg != JPEG_V1_REG_CTX_DATA)
++                              ret = -EINVAL;
++                      break;
++              case PACKETJ_TYPE3:
++                      if (reg != JPEG_V1_REG_SOFT_RESET)
++                              ret = -EINVAL;
++                      break;
++              case PACKETJ_TYPE6:
++                      if (ib->ptr[i] != CP_PACKETJ_NOP)
++                              ret = -EINVAL;
++                      break;
++              default:
++                      ret = -EINVAL;
++              }
++
++              if (ret) {
++                      dev_err(adev->dev, "Invalid packet [0x%08x]!\n", ib->ptr[i]);
++                      break;
++              }
++      }
++
++      return ret;
++}
+--- a/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.h
++++ b/drivers/gpu/drm/amd/amdgpu/jpeg_v1_0.h
+@@ -29,4 +29,15 @@ int jpeg_v1_0_sw_init(void *handle);
+ void jpeg_v1_0_sw_fini(void *handle);
+ void jpeg_v1_0_start(struct amdgpu_device *adev, int mode);
++#define JPEG_V1_REG_RANGE_START       0x8000
++#define JPEG_V1_REG_RANGE_END 0x803f
++
++#define JPEG_V1_LMI_JPEG_WRITE_64BIT_BAR_HIGH 0x8238
++#define JPEG_V1_LMI_JPEG_WRITE_64BIT_BAR_LOW  0x8239
++#define JPEG_V1_LMI_JPEG_READ_64BIT_BAR_HIGH  0x825a
++#define JPEG_V1_LMI_JPEG_READ_64BIT_BAR_LOW   0x825b
++#define JPEG_V1_REG_CTX_INDEX                 0x8328
++#define JPEG_V1_REG_CTX_DATA                  0x8329
++#define JPEG_V1_REG_SOFT_RESET                        0x83a0
++
+ #endif /*__JPEG_V1_0_H__*/
index d72ad00ad9dbd24a76adcbca46d821669d429b59..6c52eb8934c13fde8a5da8cd7c370176733b7957 100644 (file)
@@ -22,3 +22,6 @@ net-mlx5e-add-missing-link-modes-to-ptys2ethtool_map.patch
 fou-fix-initialization-of-grc.patch
 net-ftgmac100-enable-tx-interrupt-to-avoid-tx-timeou.patch
 net-dpaa-pad-packets-to-eth_zlen.patch
+spi-nxp-fspi-fix-the-kasan-report-out-of-bounds-bug.patch
+soundwire-stream-revert-soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch
+drm-amd-amdgpu-apply-command-submission-parser-for-jpeg-v1.patch
diff --git a/queue-5.10/soundwire-stream-revert-soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch b/queue-5.10/soundwire-stream-revert-soundwire-stream-fix-programming-slave-ports-for-non-continous-port-maps.patch
new file mode 100644 (file)
index 0000000..823d53b
--- /dev/null
@@ -0,0 +1,58 @@
+From 233a95fd574fde1c375c486540a90304a2d2d49f Mon Sep 17 00:00:00 2001
+From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Date: Mon, 9 Sep 2024 18:47:46 +0200
+Subject: soundwire: stream: Revert "soundwire: stream: fix programming slave ports for non-continous port maps"
+
+From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+
+commit 233a95fd574fde1c375c486540a90304a2d2d49f upstream.
+
+This reverts commit ab8d66d132bc8f1992d3eb6cab8d32dda6733c84 because it
+breaks codecs using non-continuous masks in source and sink ports.  The
+commit missed the point that port numbers are not used as indices for
+iterating over prop.sink_ports or prop.source_ports.
+
+Soundwire core and existing codecs expect that the array passed as
+prop.sink_ports and prop.source_ports is continuous.  The port mask still
+might be non-continuous, but that's unrelated.
+
+Reported-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Closes: https://lore.kernel.org/all/b6c75eee-761d-44c8-8413-2a5b34ee2f98@linux.intel.com/
+Fixes: ab8d66d132bc ("soundwire: stream: fix programming slave ports for non-continous port maps")
+Acked-by: Bard Liao <yung-chuan.liao@linux.intel.com>
+Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Tested-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
+Link: https://lore.kernel.org/r/20240909164746.136629-1-krzysztof.kozlowski@linaro.org
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/soundwire/stream.c |    8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/drivers/soundwire/stream.c
++++ b/drivers/soundwire/stream.c
+@@ -1425,18 +1425,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_p
+                                           unsigned int port_num)
+ {
+       struct sdw_dpn_prop *dpn_prop;
+-      unsigned long mask;
++      u8 num_ports;
+       int i;
+       if (direction == SDW_DATA_DIR_TX) {
+-              mask = slave->prop.source_ports;
++              num_ports = hweight32(slave->prop.source_ports);
+               dpn_prop = slave->prop.src_dpn_prop;
+       } else {
+-              mask = slave->prop.sink_ports;
++              num_ports = hweight32(slave->prop.sink_ports);
+               dpn_prop = slave->prop.sink_dpn_prop;
+       }
+-      for_each_set_bit(i, &mask, 32) {
++      for (i = 0; i < num_ports; i++) {
+               if (dpn_prop[i].num == port_num)
+                       return &dpn_prop[i];
+       }
diff --git a/queue-5.10/spi-nxp-fspi-fix-the-kasan-report-out-of-bounds-bug.patch b/queue-5.10/spi-nxp-fspi-fix-the-kasan-report-out-of-bounds-bug.patch
new file mode 100644 (file)
index 0000000..d83a4b9
--- /dev/null
@@ -0,0 +1,122 @@
+From 2a8787c1cdc7be24fdd8953ecd1a8743a1006235 Mon Sep 17 00:00:00 2001
+From: Han Xu <han.xu@nxp.com>
+Date: Wed, 11 Sep 2024 16:11:45 -0500
+Subject: spi: nxp-fspi: fix the KASAN report out-of-bounds bug
+
+From: Han Xu <han.xu@nxp.com>
+
+commit 2a8787c1cdc7be24fdd8953ecd1a8743a1006235 upstream.
+
+Change the memcpy length to fix the out-of-bounds issue when writing the
+data that is not 4 byte aligned to TX FIFO.
+
+To reproduce the issue, write 3 bytes data to NOR chip.
+
+dd if=3b of=/dev/mtd0
+[   36.926103] ==================================================================
+[   36.933409] BUG: KASAN: slab-out-of-bounds in nxp_fspi_exec_op+0x26ec/0x2838
+[   36.940514] Read of size 4 at addr ffff00081037c2a0 by task dd/455
+[   36.946721]
+[   36.948235] CPU: 3 UID: 0 PID: 455 Comm: dd Not tainted 6.11.0-rc5-gc7b0e37c8434 #1070
+[   36.956185] Hardware name: Freescale i.MX8QM MEK (DT)
+[   36.961260] Call trace:
+[   36.963723]  dump_backtrace+0x90/0xe8
+[   36.967414]  show_stack+0x18/0x24
+[   36.970749]  dump_stack_lvl+0x78/0x90
+[   36.974451]  print_report+0x114/0x5cc
+[   36.978151]  kasan_report+0xa4/0xf0
+[   36.981670]  __asan_report_load_n_noabort+0x1c/0x28
+[   36.986587]  nxp_fspi_exec_op+0x26ec/0x2838
+[   36.990800]  spi_mem_exec_op+0x8ec/0xd30
+[   36.994762]  spi_mem_no_dirmap_read+0x190/0x1e0
+[   36.999323]  spi_mem_dirmap_write+0x238/0x32c
+[   37.003710]  spi_nor_write_data+0x220/0x374
+[   37.007932]  spi_nor_write+0x110/0x2e8
+[   37.011711]  mtd_write_oob_std+0x154/0x1f0
+[   37.015838]  mtd_write_oob+0x104/0x1d0
+[   37.019617]  mtd_write+0xb8/0x12c
+[   37.022953]  mtdchar_write+0x224/0x47c
+[   37.026732]  vfs_write+0x1e4/0x8c8
+[   37.030163]  ksys_write+0xec/0x1d0
+[   37.033586]  __arm64_sys_write+0x6c/0x9c
+[   37.037539]  invoke_syscall+0x6c/0x258
+[   37.041327]  el0_svc_common.constprop.0+0x160/0x22c
+[   37.046244]  do_el0_svc+0x44/0x5c
+[   37.049589]  el0_svc+0x38/0x78
+[   37.052681]  el0t_64_sync_handler+0x13c/0x158
+[   37.057077]  el0t_64_sync+0x190/0x194
+[   37.060775]
+[   37.062274] Allocated by task 455:
+[   37.065701]  kasan_save_stack+0x2c/0x54
+[   37.069570]  kasan_save_track+0x20/0x3c
+[   37.073438]  kasan_save_alloc_info+0x40/0x54
+[   37.077736]  __kasan_kmalloc+0xa0/0xb8
+[   37.081515]  __kmalloc_noprof+0x158/0x2f8
+[   37.085563]  mtd_kmalloc_up_to+0x120/0x154
+[   37.089690]  mtdchar_write+0x130/0x47c
+[   37.093469]  vfs_write+0x1e4/0x8c8
+[   37.096901]  ksys_write+0xec/0x1d0
+[   37.100332]  __arm64_sys_write+0x6c/0x9c
+[   37.104287]  invoke_syscall+0x6c/0x258
+[   37.108064]  el0_svc_common.constprop.0+0x160/0x22c
+[   37.112972]  do_el0_svc+0x44/0x5c
+[   37.116319]  el0_svc+0x38/0x78
+[   37.119401]  el0t_64_sync_handler+0x13c/0x158
+[   37.123788]  el0t_64_sync+0x190/0x194
+[   37.127474]
+[   37.128977] The buggy address belongs to the object at ffff00081037c2a0
+[   37.128977]  which belongs to the cache kmalloc-8 of size 8
+[   37.141177] The buggy address is located 0 bytes inside of
+[   37.141177]  allocated 3-byte region [ffff00081037c2a0, ffff00081037c2a3)
+[   37.153465]
+[   37.154971] The buggy address belongs to the physical page:
+[   37.160559] page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x89037c
+[   37.168596] flags: 0xbfffe0000000000(node=0|zone=2|lastcpupid=0x1ffff)
+[   37.175149] page_type: 0xfdffffff(slab)
+[   37.179021] raw: 0bfffe0000000000 ffff000800002500 dead000000000122 0000000000000000
+[   37.186788] raw: 0000000000000000 0000000080800080 00000001fdffffff 0000000000000000
+[   37.194553] page dumped because: kasan: bad access detected
+[   37.200144]
+[   37.201647] Memory state around the buggy address:
+[   37.206460]  ffff00081037c180: fa fc fc fc fa fc fc fc fa fc fc fc fa fc fc fc
+[   37.213701]  ffff00081037c200: fa fc fc fc 05 fc fc fc 03 fc fc fc 02 fc fc fc
+[   37.220946] >ffff00081037c280: 06 fc fc fc 03 fc fc fc fc fc fc fc fc fc fc fc
+[   37.228186]                                ^
+[   37.232473]  ffff00081037c300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
+[   37.239718]  ffff00081037c380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
+[   37.246962] ==================================================================
+[   37.254394] Disabling lock debugging due to kernel taint
+0+1 records in
+0+1 records out
+3 bytes copied, 0.335911 s, 0.0 kB/s
+
+Fixes: a5356aef6a90 ("spi: spi-mem: Add driver for NXP FlexSPI controller")
+Cc: stable@kernel.org
+Signed-off-by: Han Xu <han.xu@nxp.com>
+Link: https://patch.msgid.link/20240911211146.3337068-1-han.xu@nxp.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/spi/spi-nxp-fspi.c |    5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/drivers/spi/spi-nxp-fspi.c
++++ b/drivers/spi/spi-nxp-fspi.c
+@@ -731,14 +731,15 @@ static void nxp_fspi_fill_txfifo(struct
+       if (i < op->data.nbytes) {
+               u32 data = 0;
+               int j;
++              int remaining = op->data.nbytes - i;
+               /* Wait for TXFIFO empty */
+               ret = fspi_readl_poll_tout(f, f->iobase + FSPI_INTR,
+                                          FSPI_INTR_IPTXWE, 0,
+                                          POLL_TOUT, true);
+               WARN_ON(ret);
+-              for (j = 0; j < ALIGN(op->data.nbytes - i, 4); j += 4) {
+-                      memcpy(&data, buf + i + j, 4);
++              for (j = 0; j < ALIGN(remaining, 4); j += 4) {
++                      memcpy(&data, buf + i + j, min_t(int, 4, remaining - j));
+                       fspi_writel(f, data, base + FSPI_TFDR + j);
+               }
+               fspi_writel(f, FSPI_INTR_IPTXWE, base + FSPI_INTR);