]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Aug 2023 19:33:33 +0000 (21:33 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Aug 2023 19:33:33 +0000 (21:33 +0200)
added patches:
btrfs-fix-bug_on-condition-in-btrfs_cancel_balance.patch
fbdev-mmp-fix-value-check-in-mmphw_probe.patch
i2c-bcm-iproc-fix-bcm_iproc_i2c_isr-deadlock-issue.patch
i2c-designware-correct-length-byte-validation-logic.patch
i2c-designware-handle-invalid-smbus-block-data-response-length-value.patch
i2c-hisi-only-handle-the-interrupt-of-the-driver-s-transfer.patch
powerpc-rtas_flash-allow-user-copy-to-flash-block-cache-objects.patch
tty-n_gsm-fix-the-uaf-caused-by-race-condition-in-gsm_cleanup_mux.patch
tty-serial-fsl_lpuart-clear-the-error-flags-by-writing-1-for-lpuart32-platforms.patch

queue-5.15/btrfs-fix-bug_on-condition-in-btrfs_cancel_balance.patch [new file with mode: 0644]
queue-5.15/fbdev-mmp-fix-value-check-in-mmphw_probe.patch [new file with mode: 0644]
queue-5.15/i2c-bcm-iproc-fix-bcm_iproc_i2c_isr-deadlock-issue.patch [new file with mode: 0644]
queue-5.15/i2c-designware-correct-length-byte-validation-logic.patch [new file with mode: 0644]
queue-5.15/i2c-designware-handle-invalid-smbus-block-data-response-length-value.patch [new file with mode: 0644]
queue-5.15/i2c-hisi-only-handle-the-interrupt-of-the-driver-s-transfer.patch [new file with mode: 0644]
queue-5.15/powerpc-rtas_flash-allow-user-copy-to-flash-block-cache-objects.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/tty-n_gsm-fix-the-uaf-caused-by-race-condition-in-gsm_cleanup_mux.patch [new file with mode: 0644]
queue-5.15/tty-serial-fsl_lpuart-clear-the-error-flags-by-writing-1-for-lpuart32-platforms.patch [new file with mode: 0644]

diff --git a/queue-5.15/btrfs-fix-bug_on-condition-in-btrfs_cancel_balance.patch b/queue-5.15/btrfs-fix-bug_on-condition-in-btrfs_cancel_balance.patch
new file mode 100644 (file)
index 0000000..ef9d3e6
--- /dev/null
@@ -0,0 +1,64 @@
+From 29eefa6d0d07e185f7bfe9576f91e6dba98189c2 Mon Sep 17 00:00:00 2001
+From: xiaoshoukui <xiaoshoukui@gmail.com>
+Date: Tue, 15 Aug 2023 02:55:59 -0400
+Subject: btrfs: fix BUG_ON condition in btrfs_cancel_balance
+
+From: xiaoshoukui <xiaoshoukui@gmail.com>
+
+commit 29eefa6d0d07e185f7bfe9576f91e6dba98189c2 upstream.
+
+Pausing and canceling balance can race to interrupt balance lead to BUG_ON
+panic in btrfs_cancel_balance. The BUG_ON condition in btrfs_cancel_balance
+does not take this race scenario into account.
+
+However, the race condition has no other side effects. We can fix that.
+
+Reproducing it with panic trace like this:
+
+  kernel BUG at fs/btrfs/volumes.c:4618!
+  RIP: 0010:btrfs_cancel_balance+0x5cf/0x6a0
+  Call Trace:
+   <TASK>
+   ? do_nanosleep+0x60/0x120
+   ? hrtimer_nanosleep+0xb7/0x1a0
+   ? sched_core_clone_cookie+0x70/0x70
+   btrfs_ioctl_balance_ctl+0x55/0x70
+   btrfs_ioctl+0xa46/0xd20
+   __x64_sys_ioctl+0x7d/0xa0
+   do_syscall_64+0x38/0x80
+   entry_SYSCALL_64_after_hwframe+0x63/0xcd
+
+  Race scenario as follows:
+  > mutex_unlock(&fs_info->balance_mutex);
+  > --------------------
+  > .......issue pause and cancel req in another thread
+  > --------------------
+  > ret = __btrfs_balance(fs_info);
+  >
+  > mutex_lock(&fs_info->balance_mutex);
+  > if (ret == -ECANCELED && atomic_read(&fs_info->balance_pause_req)) {
+  >         btrfs_info(fs_info, "balance: paused");
+  >         btrfs_exclop_balance(fs_info, BTRFS_EXCLOP_BALANCE_PAUSED);
+  > }
+
+CC: stable@vger.kernel.org # 4.19+
+Signed-off-by: xiaoshoukui <xiaoshoukui@ruijie.com.cn>
+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/volumes.c |    3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+--- a/fs/btrfs/volumes.c
++++ b/fs/btrfs/volumes.c
+@@ -4636,8 +4636,7 @@ int btrfs_cancel_balance(struct btrfs_fs
+               }
+       }
+-      BUG_ON(fs_info->balance_ctl ||
+-              test_bit(BTRFS_FS_BALANCE_RUNNING, &fs_info->flags));
++      ASSERT(!test_bit(BTRFS_FS_BALANCE_RUNNING, &fs_info->flags));
+       atomic_dec(&fs_info->balance_cancel_req);
+       mutex_unlock(&fs_info->balance_mutex);
+       return 0;
diff --git a/queue-5.15/fbdev-mmp-fix-value-check-in-mmphw_probe.patch b/queue-5.15/fbdev-mmp-fix-value-check-in-mmphw_probe.patch
new file mode 100644 (file)
index 0000000..2fc88c6
--- /dev/null
@@ -0,0 +1,34 @@
+From 0872b2c0abc0e84ac82472959c8e14e35277549c Mon Sep 17 00:00:00 2001
+From: Yuanjun Gong <ruc_gongyuanjun@163.com>
+Date: Fri, 28 Jul 2023 01:03:18 +0800
+Subject: fbdev: mmp: fix value check in mmphw_probe()
+
+From: Yuanjun Gong <ruc_gongyuanjun@163.com>
+
+commit 0872b2c0abc0e84ac82472959c8e14e35277549c upstream.
+
+in mmphw_probe(), check the return value of clk_prepare_enable()
+and return the error code if clk_prepare_enable() returns an
+unexpected value.
+
+Fixes: d63028c38905 ("video: mmp display controller support")
+Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/video/fbdev/mmp/hw/mmp_ctrl.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/video/fbdev/mmp/hw/mmp_ctrl.c
++++ b/drivers/video/fbdev/mmp/hw/mmp_ctrl.c
+@@ -518,7 +518,9 @@ static int mmphw_probe(struct platform_d
+               ret = -ENOENT;
+               goto failed;
+       }
+-      clk_prepare_enable(ctrl->clk);
++      ret = clk_prepare_enable(ctrl->clk);
++      if (ret)
++              goto failed;
+       /* init global regs */
+       ctrl_set_default(ctrl);
diff --git a/queue-5.15/i2c-bcm-iproc-fix-bcm_iproc_i2c_isr-deadlock-issue.patch b/queue-5.15/i2c-bcm-iproc-fix-bcm_iproc_i2c_isr-deadlock-issue.patch
new file mode 100644 (file)
index 0000000..c67419f
--- /dev/null
@@ -0,0 +1,61 @@
+From 4caf4cb1eaed469742ef719f2cc024b1ec3fa9e6 Mon Sep 17 00:00:00 2001
+From: Chengfeng Ye <dg573847474@gmail.com>
+Date: Fri, 7 Jul 2023 08:49:41 +0000
+Subject: i2c: bcm-iproc: Fix bcm_iproc_i2c_isr deadlock issue
+
+From: Chengfeng Ye <dg573847474@gmail.com>
+
+commit 4caf4cb1eaed469742ef719f2cc024b1ec3fa9e6 upstream.
+
+iproc_i2c_rd_reg() and iproc_i2c_wr_reg() are called from both
+interrupt context (e.g. bcm_iproc_i2c_isr) and process context
+(e.g. bcm_iproc_i2c_suspend). Therefore, interrupts should be
+disabled to avoid potential deadlock. To prevent this scenario,
+use spin_lock_irqsave().
+
+Fixes: 9a1038728037 ("i2c: iproc: add NIC I2C support")
+Signed-off-by: Chengfeng Ye <dg573847474@gmail.com>
+Acked-by: Ray Jui <ray.jui@broadcom.com>
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-bcm-iproc.c |   11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+--- a/drivers/i2c/busses/i2c-bcm-iproc.c
++++ b/drivers/i2c/busses/i2c-bcm-iproc.c
+@@ -243,13 +243,14 @@ static inline u32 iproc_i2c_rd_reg(struc
+                                  u32 offset)
+ {
+       u32 val;
++      unsigned long flags;
+       if (iproc_i2c->idm_base) {
+-              spin_lock(&iproc_i2c->idm_lock);
++              spin_lock_irqsave(&iproc_i2c->idm_lock, flags);
+               writel(iproc_i2c->ape_addr_mask,
+                      iproc_i2c->idm_base + IDM_CTRL_DIRECT_OFFSET);
+               val = readl(iproc_i2c->base + offset);
+-              spin_unlock(&iproc_i2c->idm_lock);
++              spin_unlock_irqrestore(&iproc_i2c->idm_lock, flags);
+       } else {
+               val = readl(iproc_i2c->base + offset);
+       }
+@@ -260,12 +261,14 @@ static inline u32 iproc_i2c_rd_reg(struc
+ static inline void iproc_i2c_wr_reg(struct bcm_iproc_i2c_dev *iproc_i2c,
+                                   u32 offset, u32 val)
+ {
++      unsigned long flags;
++
+       if (iproc_i2c->idm_base) {
+-              spin_lock(&iproc_i2c->idm_lock);
++              spin_lock_irqsave(&iproc_i2c->idm_lock, flags);
+               writel(iproc_i2c->ape_addr_mask,
+                      iproc_i2c->idm_base + IDM_CTRL_DIRECT_OFFSET);
+               writel(val, iproc_i2c->base + offset);
+-              spin_unlock(&iproc_i2c->idm_lock);
++              spin_unlock_irqrestore(&iproc_i2c->idm_lock, flags);
+       } else {
+               writel(val, iproc_i2c->base + offset);
+       }
diff --git a/queue-5.15/i2c-designware-correct-length-byte-validation-logic.patch b/queue-5.15/i2c-designware-correct-length-byte-validation-logic.patch
new file mode 100644 (file)
index 0000000..915dea3
--- /dev/null
@@ -0,0 +1,48 @@
+From 49d4db3953cb9004ff94efc0c176e026c820af5a Mon Sep 17 00:00:00 2001
+From: Quan Nguyen <quan@os.amperecomputing.com>
+Date: Wed, 26 Jul 2023 15:00:00 +0700
+Subject: i2c: designware: Correct length byte validation logic
+
+From: Quan Nguyen <quan@os.amperecomputing.com>
+
+commit 49d4db3953cb9004ff94efc0c176e026c820af5a upstream.
+
+Commit 0daede80f870 ("i2c: designware: Convert driver to using regmap API")
+changes the logic to validate the whole 32-bit return value of
+DW_IC_DATA_CMD register instead of 8-bit LSB without reason.
+
+Later, commit f53f15ba5a85 ("i2c: designware: Get right data length"),
+introduced partial fix but not enough because the "tmp > 0" still test
+tmp as 32-bit value and is wrong in case the IC_DATA_CMD[11] is set.
+
+Revert the logic to just before commit 0daede80f870
+("i2c: designware: Convert driver to using regmap API").
+
+Fixes: f53f15ba5a85 ("i2c: designware: Get right data length")
+Fixes: 0daede80f870 ("i2c: designware: Convert driver to using regmap API")
+Cc: stable@vger.kernel.org
+Signed-off-by: Tam Nguyen <tamnguyenchi@os.amperecomputing.com>
+Signed-off-by: Quan Nguyen <quan@os.amperecomputing.com>
+Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
+Link: https://lore.kernel.org/r/20230726080001.337353-2-tamnguyenchi@os.amperecomputing.com
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-designware-master.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/i2c/busses/i2c-designware-master.c
++++ b/drivers/i2c/busses/i2c-designware-master.c
+@@ -525,9 +525,10 @@ i2c_dw_read(struct dw_i2c_dev *dev)
+                       u32 flags = msgs[dev->msg_read_idx].flags;
+                       regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
++                      tmp &= DW_IC_DATA_CMD_DAT;
+                       /* Ensure length byte is a valid value */
+                       if (flags & I2C_M_RECV_LEN &&
+-                          (tmp & DW_IC_DATA_CMD_DAT) <= I2C_SMBUS_BLOCK_MAX && tmp > 0) {
++                          tmp <= I2C_SMBUS_BLOCK_MAX && tmp > 0) {
+                               len = i2c_dw_recv_len(dev, tmp);
+                       }
+                       *buf++ = tmp;
diff --git a/queue-5.15/i2c-designware-handle-invalid-smbus-block-data-response-length-value.patch b/queue-5.15/i2c-designware-handle-invalid-smbus-block-data-response-length-value.patch
new file mode 100644 (file)
index 0000000..8063c24
--- /dev/null
@@ -0,0 +1,57 @@
+From 69f035c480d76f12bf061148ccfd578e1099e5fc Mon Sep 17 00:00:00 2001
+From: Tam Nguyen <tamnguyenchi@os.amperecomputing.com>
+Date: Wed, 26 Jul 2023 15:00:01 +0700
+Subject: i2c: designware: Handle invalid SMBus block data response length value
+
+From: Tam Nguyen <tamnguyenchi@os.amperecomputing.com>
+
+commit 69f035c480d76f12bf061148ccfd578e1099e5fc upstream.
+
+In the I2C_FUNC_SMBUS_BLOCK_DATA case, the invalid length byte value
+(outside of 1-32) of the SMBus block data response from the Slave device
+is not correctly handled by the I2C Designware driver.
+
+In case IC_EMPTYFIFO_HOLD_MASTER_EN==1, which cannot be detected
+from the registers, the Master can be disabled only if the STOP bit
+is set. Without STOP bit set, the Master remains active, holding the bus
+until receiving a block data response length. This hangs the bus and
+is unrecoverable.
+
+Avoid this by issuing another dump read to reach the stop condition when
+an invalid length byte is received.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Tam Nguyen <tamnguyenchi@os.amperecomputing.com>
+Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
+Link: https://lore.kernel.org/r/20230726080001.337353-3-tamnguyenchi@os.amperecomputing.com
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-designware-master.c |   15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+--- a/drivers/i2c/busses/i2c-designware-master.c
++++ b/drivers/i2c/busses/i2c-designware-master.c
+@@ -527,8 +527,19 @@ i2c_dw_read(struct dw_i2c_dev *dev)
+                       regmap_read(dev->map, DW_IC_DATA_CMD, &tmp);
+                       tmp &= DW_IC_DATA_CMD_DAT;
+                       /* Ensure length byte is a valid value */
+-                      if (flags & I2C_M_RECV_LEN &&
+-                          tmp <= I2C_SMBUS_BLOCK_MAX && tmp > 0) {
++                      if (flags & I2C_M_RECV_LEN) {
++                              /*
++                               * if IC_EMPTYFIFO_HOLD_MASTER_EN is set, which cannot be
++                               * detected from the registers, the controller can be
++                               * disabled if the STOP bit is set. But it is only set
++                               * after receiving block data response length in
++                               * I2C_FUNC_SMBUS_BLOCK_DATA case. That needs to read
++                               * another byte with STOP bit set when the block data
++                               * response length is invalid to complete the transaction.
++                               */
++                              if (!tmp || tmp > I2C_SMBUS_BLOCK_MAX)
++                                      tmp = 1;
++
+                               len = i2c_dw_recv_len(dev, tmp);
+                       }
+                       *buf++ = tmp;
diff --git a/queue-5.15/i2c-hisi-only-handle-the-interrupt-of-the-driver-s-transfer.patch b/queue-5.15/i2c-hisi-only-handle-the-interrupt-of-the-driver-s-transfer.patch
new file mode 100644 (file)
index 0000000..a711d17
--- /dev/null
@@ -0,0 +1,41 @@
+From fff67c1b17ee093947bdcbac6f64d072e644159a Mon Sep 17 00:00:00 2001
+From: Yicong Yang <yangyicong@hisilicon.com>
+Date: Tue, 1 Aug 2023 20:46:25 +0800
+Subject: i2c: hisi: Only handle the interrupt of the driver's transfer
+
+From: Yicong Yang <yangyicong@hisilicon.com>
+
+commit fff67c1b17ee093947bdcbac6f64d072e644159a upstream.
+
+The controller may be shared with other port, for example the firmware.
+Handle the interrupt from other sources will cause crash since some
+data are not initialized. So only handle the interrupt of the driver's
+transfer and discard others.
+
+Fixes: d62fbdb99a85 ("i2c: add support for HiSilicon I2C controller")
+Signed-off-by: Yicong Yang <yangyicong@hisilicon.com>
+Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
+Link: https://lore.kernel.org/r/20230801124625.63587-1-yangyicong@huawei.com
+Signed-off-by: Wolfram Sang <wsa@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/i2c/busses/i2c-hisi.c |    8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/i2c/busses/i2c-hisi.c
++++ b/drivers/i2c/busses/i2c-hisi.c
+@@ -329,6 +329,14 @@ static irqreturn_t hisi_i2c_irq(int irq,
+       struct hisi_i2c_controller *ctlr = context;
+       u32 int_stat;
++      /*
++       * Don't handle the interrupt if cltr->completion is NULL. We may
++       * reach here because the interrupt is spurious or the transfer is
++       * started by another port (e.g. firmware) rather than us.
++       */
++      if (!ctlr->completion)
++              return IRQ_NONE;
++
+       int_stat = readl(ctlr->iobase + HISI_I2C_INT_MSTAT);
+       hisi_i2c_clear_int(ctlr, int_stat);
+       if (!(int_stat & HISI_I2C_INT_ALL))
diff --git a/queue-5.15/powerpc-rtas_flash-allow-user-copy-to-flash-block-cache-objects.patch b/queue-5.15/powerpc-rtas_flash-allow-user-copy-to-flash-block-cache-objects.patch
new file mode 100644 (file)
index 0000000..5f779fc
--- /dev/null
@@ -0,0 +1,68 @@
+From 4f3175979e62de3b929bfa54a0db4b87d36257a7 Mon Sep 17 00:00:00 2001
+From: Nathan Lynch <nathanl@linux.ibm.com>
+Date: Thu, 10 Aug 2023 22:37:55 -0500
+Subject: powerpc/rtas_flash: allow user copy to flash block cache objects
+
+From: Nathan Lynch <nathanl@linux.ibm.com>
+
+commit 4f3175979e62de3b929bfa54a0db4b87d36257a7 upstream.
+
+With hardened usercopy enabled (CONFIG_HARDENED_USERCOPY=y), using the
+/proc/powerpc/rtas/firmware_update interface to prepare a system
+firmware update yields a BUG():
+
+  kernel BUG at mm/usercopy.c:102!
+  Oops: Exception in kernel mode, sig: 5 [#1]
+  LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries
+  Modules linked in:
+  CPU: 0 PID: 2232 Comm: dd Not tainted 6.5.0-rc3+ #2
+  Hardware name: IBM,8408-E8E POWER8E (raw) 0x4b0201 0xf000004 of:IBM,FW860.50 (SV860_146) hv:phyp pSeries
+  NIP:  c0000000005991d0 LR: c0000000005991cc CTR: 0000000000000000
+  REGS: c0000000148c76a0 TRAP: 0700   Not tainted  (6.5.0-rc3+)
+  MSR:  8000000000029033 <SF,EE,ME,IR,DR,RI,LE>  CR: 24002242  XER: 0000000c
+  CFAR: c0000000001fbd34 IRQMASK: 0
+  [ ... GPRs omitted ... ]
+  NIP usercopy_abort+0xa0/0xb0
+  LR  usercopy_abort+0x9c/0xb0
+  Call Trace:
+    usercopy_abort+0x9c/0xb0 (unreliable)
+    __check_heap_object+0x1b4/0x1d0
+    __check_object_size+0x2d0/0x380
+    rtas_flash_write+0xe4/0x250
+    proc_reg_write+0xfc/0x160
+    vfs_write+0xfc/0x4e0
+    ksys_write+0x90/0x160
+    system_call_exception+0x178/0x320
+    system_call_common+0x160/0x2c4
+
+The blocks of the firmware image are copied directly from user memory
+to objects allocated from flash_block_cache, so flash_block_cache must
+be created using kmem_cache_create_usercopy() to mark it safe for user
+access.
+
+Fixes: 6d07d1cd300f ("usercopy: Restrict non-usercopy caches to size 0")
+Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
+Reviewed-by: Kees Cook <keescook@chromium.org>
+[mpe: Trim and indent oops]
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://msgid.link/20230810-rtas-flash-vs-hardened-usercopy-v2-1-dcf63793a938@linux.ibm.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/powerpc/kernel/rtas_flash.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/arch/powerpc/kernel/rtas_flash.c
++++ b/arch/powerpc/kernel/rtas_flash.c
+@@ -710,9 +710,9 @@ static int __init rtas_flash_init(void)
+       if (!rtas_validate_flash_data.buf)
+               return -ENOMEM;
+-      flash_block_cache = kmem_cache_create("rtas_flash_cache",
+-                                            RTAS_BLK_SIZE, RTAS_BLK_SIZE, 0,
+-                                            NULL);
++      flash_block_cache = kmem_cache_create_usercopy("rtas_flash_cache",
++                                                     RTAS_BLK_SIZE, RTAS_BLK_SIZE,
++                                                     0, 0, RTAS_BLK_SIZE, NULL);
+       if (!flash_block_cache) {
+               printk(KERN_ERR "%s: failed to create block cache\n",
+                               __func__);
index 0bc574b146dabb0a9d5f4a2a83c5ddeed3e7644c..8c3470d5ab7122aea9127455c69b2ced4d41dc7e 100644 (file)
@@ -71,3 +71,12 @@ btrfs-move-out-now-unused-bg-from-the-reclaim-list.patch
 virtio-mmio-don-t-break-lifecycle-of-vm_dev.patch
 vduse-use-proper-spinlock-for-irq-injection.patch
 cifs-fix-potential-oops-in-cifs_oplock_break.patch
+i2c-bcm-iproc-fix-bcm_iproc_i2c_isr-deadlock-issue.patch
+i2c-hisi-only-handle-the-interrupt-of-the-driver-s-transfer.patch
+fbdev-mmp-fix-value-check-in-mmphw_probe.patch
+powerpc-rtas_flash-allow-user-copy-to-flash-block-cache-objects.patch
+tty-n_gsm-fix-the-uaf-caused-by-race-condition-in-gsm_cleanup_mux.patch
+tty-serial-fsl_lpuart-clear-the-error-flags-by-writing-1-for-lpuart32-platforms.patch
+btrfs-fix-bug_on-condition-in-btrfs_cancel_balance.patch
+i2c-designware-correct-length-byte-validation-logic.patch
+i2c-designware-handle-invalid-smbus-block-data-response-length-value.patch
diff --git a/queue-5.15/tty-n_gsm-fix-the-uaf-caused-by-race-condition-in-gsm_cleanup_mux.patch b/queue-5.15/tty-n_gsm-fix-the-uaf-caused-by-race-condition-in-gsm_cleanup_mux.patch
new file mode 100644 (file)
index 0000000..7aeee9d
--- /dev/null
@@ -0,0 +1,59 @@
+From 3c4f8333b582487a2d1e02171f1465531cde53e3 Mon Sep 17 00:00:00 2001
+From: Yi Yang <yiyang13@huawei.com>
+Date: Fri, 11 Aug 2023 11:11:21 +0800
+Subject: tty: n_gsm: fix the UAF caused by race condition in gsm_cleanup_mux
+
+From: Yi Yang <yiyang13@huawei.com>
+
+commit 3c4f8333b582487a2d1e02171f1465531cde53e3 upstream.
+
+In commit 9b9c8195f3f0 ("tty: n_gsm: fix UAF in gsm_cleanup_mux"), the UAF
+problem is not completely fixed. There is a race condition in
+gsm_cleanup_mux(), which caused this UAF.
+
+The UAF problem is triggered by the following race:
+task[5046]                     task[5054]
+-----------------------        -----------------------
+gsm_cleanup_mux();
+dlci = gsm->dlci[0];
+mutex_lock(&gsm->mutex);
+                               gsm_cleanup_mux();
+                              dlci = gsm->dlci[0]; //Didn't take the lock
+gsm_dlci_release(gsm->dlci[i]);
+gsm->dlci[i] = NULL;
+mutex_unlock(&gsm->mutex);
+                               mutex_lock(&gsm->mutex);
+                              dlci->dead = true; //UAF
+
+Fix it by assigning values after mutex_lock().
+
+Link: https://syzkaller.appspot.com/text?tag=CrashReport&x=176188b5a80000
+Cc: stable <stable@kernel.org>
+Fixes: 9b9c8195f3f0 ("tty: n_gsm: fix UAF in gsm_cleanup_mux")
+Fixes: aa371e96f05d ("tty: n_gsm: fix restart handling via CLD command")
+Signed-off-by: Yi Yang <yiyang13@huawei.com>
+Co-developed-by: Qiumiao Zhang <zhangqiumiao1@huawei.com>
+Signed-off-by: Qiumiao Zhang <zhangqiumiao1@huawei.com>
+Link: https://lore.kernel.org/r/20230811031121.153237-1-yiyang13@huawei.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/n_gsm.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/n_gsm.c
++++ b/drivers/tty/n_gsm.c
+@@ -2387,12 +2387,13 @@ static void gsm_error(struct gsm_mux *gs
+ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool disc)
+ {
+       int i;
+-      struct gsm_dlci *dlci = gsm->dlci[0];
++      struct gsm_dlci *dlci;
+       struct gsm_msg *txq, *ntxq;
+       gsm->dead = true;
+       mutex_lock(&gsm->mutex);
++      dlci = gsm->dlci[0];
+       if (dlci) {
+               if (disc && dlci->state != DLCI_CLOSED) {
+                       gsm_dlci_begin_close(dlci);
diff --git a/queue-5.15/tty-serial-fsl_lpuart-clear-the-error-flags-by-writing-1-for-lpuart32-platforms.patch b/queue-5.15/tty-serial-fsl_lpuart-clear-the-error-flags-by-writing-1-for-lpuart32-platforms.patch
new file mode 100644 (file)
index 0000000..dcee96c
--- /dev/null
@@ -0,0 +1,37 @@
+From 282069845af388b08d622ad192b831dcd0549c62 Mon Sep 17 00:00:00 2001
+From: Sherry Sun <sherry.sun@nxp.com>
+Date: Tue, 1 Aug 2023 10:23:04 +0800
+Subject: tty: serial: fsl_lpuart: Clear the error flags by writing 1 for lpuart32 platforms
+
+From: Sherry Sun <sherry.sun@nxp.com>
+
+commit 282069845af388b08d622ad192b831dcd0549c62 upstream.
+
+Do not read the data register to clear the error flags for lpuart32
+platforms, the additional read may cause the receive FIFO underflow
+since the DMA has already read the data register.
+Actually all lpuart32 platforms support write 1 to clear those error
+bits, let's use this method to better clear the error flags.
+
+Fixes: 42b68768e51b ("serial: fsl_lpuart: DMA support for 32-bit variant")
+Cc: stable <stable@kernel.org>
+Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
+Link: https://lore.kernel.org/r/20230801022304.24251-1-sherry.sun@nxp.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/tty/serial/fsl_lpuart.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/tty/serial/fsl_lpuart.c
++++ b/drivers/tty/serial/fsl_lpuart.c
+@@ -1107,8 +1107,8 @@ static void lpuart_copy_rx_to_tty(struct
+               unsigned long sr = lpuart32_read(&sport->port, UARTSTAT);
+               if (sr & (UARTSTAT_PE | UARTSTAT_FE)) {
+-                      /* Read DR to clear the error flags */
+-                      lpuart32_read(&sport->port, UARTDATA);
++                      /* Clear the error flags */
++                      lpuart32_write(&sport->port, sr, UARTSTAT);
+                       if (sr & UARTSTAT_PE)
+                               sport->port.icount.parity++;