]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 May 2022 17:45:36 +0000 (19:45 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 May 2022 17:45:36 +0000 (19:45 +0200)
added patches:
drm-i915-fix-sel_fetch_plane_-pipe_b-register-addresses.patch
kasan-prevent-cpu_quarantine-corruption-when-cpu-offline-and-cache-shrink-occur-at-same-time.patch
net-ethernet-stmmac-fix-write-to-sgmii_adapter_base.patch
thermal-int340x-fix-attr.show-callback-prototype.patch
zonefs-clear-inode-information-flags-on-inode-creation.patch
zonefs-fix-management-of-open-zones.patch

queue-5.10/drm-i915-fix-sel_fetch_plane_-pipe_b-register-addresses.patch [new file with mode: 0644]
queue-5.10/kasan-prevent-cpu_quarantine-corruption-when-cpu-offline-and-cache-shrink-occur-at-same-time.patch [new file with mode: 0644]
queue-5.10/net-ethernet-stmmac-fix-write-to-sgmii_adapter_base.patch [new file with mode: 0644]
queue-5.10/powerpc-perf-fix-32bit-compile.patch
queue-5.10/series
queue-5.10/thermal-int340x-fix-attr.show-callback-prototype.patch [new file with mode: 0644]
queue-5.10/zonefs-clear-inode-information-flags-on-inode-creation.patch [new file with mode: 0644]
queue-5.10/zonefs-fix-management-of-open-zones.patch [new file with mode: 0644]

diff --git a/queue-5.10/drm-i915-fix-sel_fetch_plane_-pipe_b-register-addresses.patch b/queue-5.10/drm-i915-fix-sel_fetch_plane_-pipe_b-register-addresses.patch
new file mode 100644 (file)
index 0000000..b5426fa
--- /dev/null
@@ -0,0 +1,39 @@
+From 4ae4dd2e26fdfebf0b8c6af6c325383eadfefdb4 Mon Sep 17 00:00:00 2001
+From: Imre Deak <imre.deak@intel.com>
+Date: Thu, 21 Apr 2022 19:22:21 +0300
+Subject: drm/i915: Fix SEL_FETCH_PLANE_*(PIPE_B+) register addresses
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Imre Deak <imre.deak@intel.com>
+
+commit 4ae4dd2e26fdfebf0b8c6af6c325383eadfefdb4 upstream.
+
+Fix typo in the _SEL_FETCH_PLANE_BASE_1_B register base address.
+
+Fixes: a5523e2ff074a5 ("drm/i915: Add PSR2 selective fetch registers")
+References: https://gitlab.freedesktop.org/drm/intel/-/issues/5400
+Cc: José Roberto de Souza <jose.souza@intel.com>
+Cc: <stable@vger.kernel.org> # v5.9+
+Signed-off-by: Imre Deak <imre.deak@intel.com>
+Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20220421162221.2261895-1-imre.deak@intel.com
+(cherry picked from commit af2cbc6ef967f61711a3c40fca5366ea0bc7fecc)
+Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/i915/i915_reg.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/i915_reg.h
++++ b/drivers/gpu/drm/i915/i915_reg.h
+@@ -7202,7 +7202,7 @@ enum {
+ #define _SEL_FETCH_PLANE_BASE_6_A             0x70940
+ #define _SEL_FETCH_PLANE_BASE_7_A             0x70960
+ #define _SEL_FETCH_PLANE_BASE_CUR_A           0x70880
+-#define _SEL_FETCH_PLANE_BASE_1_B             0x70990
++#define _SEL_FETCH_PLANE_BASE_1_B             0x71890
+ #define _SEL_FETCH_PLANE_BASE_A(plane) _PICK(plane, \
+                                            _SEL_FETCH_PLANE_BASE_1_A, \
diff --git a/queue-5.10/kasan-prevent-cpu_quarantine-corruption-when-cpu-offline-and-cache-shrink-occur-at-same-time.patch b/queue-5.10/kasan-prevent-cpu_quarantine-corruption-when-cpu-offline-and-cache-shrink-occur-at-same-time.patch
new file mode 100644 (file)
index 0000000..34da96f
--- /dev/null
@@ -0,0 +1,53 @@
+From 31fa985b4196f8a66f027672e9bf2b81fea0417c Mon Sep 17 00:00:00 2001
+From: Zqiang <qiang1.zhang@intel.com>
+Date: Wed, 27 Apr 2022 12:41:56 -0700
+Subject: kasan: prevent cpu_quarantine corruption when CPU offline and cache shrink occur at same time
+
+From: Zqiang <qiang1.zhang@intel.com>
+
+commit 31fa985b4196f8a66f027672e9bf2b81fea0417c upstream.
+
+kasan_quarantine_remove_cache() is called in kmem_cache_shrink()/
+destroy().  The kasan_quarantine_remove_cache() call is protected by
+cpuslock in kmem_cache_destroy() to ensure serialization with
+kasan_cpu_offline().
+
+However the kasan_quarantine_remove_cache() call is not protected by
+cpuslock in kmem_cache_shrink().  When a CPU is going offline and cache
+shrink occurs at same time, the cpu_quarantine may be corrupted by
+interrupt (per_cpu_remove_cache operation).
+
+So add a cpu_quarantine offline flags check in per_cpu_remove_cache().
+
+[akpm@linux-foundation.org: add comment, per Zqiang]
+
+Link: https://lkml.kernel.org/r/20220414025925.2423818-1-qiang1.zhang@intel.com
+Signed-off-by: Zqiang <qiang1.zhang@intel.com>
+Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
+Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
+Cc: Alexander Potapenko <glider@google.com>
+Cc: Andrey Konovalov <andreyknvl@gmail.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ mm/kasan/quarantine.c |    7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/mm/kasan/quarantine.c
++++ b/mm/kasan/quarantine.c
+@@ -299,6 +299,13 @@ static void per_cpu_remove_cache(void *a
+       struct qlist_head *q;
+       q = this_cpu_ptr(&cpu_quarantine);
++      /*
++       * Ensure the ordering between the writing to q->offline and
++       * per_cpu_remove_cache.  Prevent cpu_quarantine from being corrupted
++       * by interrupt.
++       */
++      if (READ_ONCE(q->offline))
++              return;
+       qlist_move_cache(q, &to_free, cache);
+       qlist_free_all(&to_free, cache);
+ }
diff --git a/queue-5.10/net-ethernet-stmmac-fix-write-to-sgmii_adapter_base.patch b/queue-5.10/net-ethernet-stmmac-fix-write-to-sgmii_adapter_base.patch
new file mode 100644 (file)
index 0000000..2fa58b2
--- /dev/null
@@ -0,0 +1,56 @@
+From 5fd1fe4807f91ea0cca043114d929faa11bd4190 Mon Sep 17 00:00:00 2001
+From: Dinh Nguyen <dinguyen@kernel.org>
+Date: Wed, 20 Apr 2022 10:23:45 -0500
+Subject: net: ethernet: stmmac: fix write to sgmii_adapter_base
+
+From: Dinh Nguyen <dinguyen@kernel.org>
+
+commit 5fd1fe4807f91ea0cca043114d929faa11bd4190 upstream.
+
+I made a mistake with the commit a6aaa0032424 ("net: ethernet: stmmac:
+fix altr_tse_pcs function when using a fixed-link"). I should have
+tested against both scenario of having a SGMII interface and one
+without.
+
+Without the SGMII PCS TSE adpater, the sgmii_adapter_base address is
+NULL, thus a write to this address will fail.
+
+Cc: stable@vger.kernel.org
+Fixes: a6aaa0032424 ("net: ethernet: stmmac: fix altr_tse_pcs function when using a fixed-link")
+Signed-off-by: Dinh Nguyen <dinguyen@kernel.org>
+Link: https://lore.kernel.org/r/20220420152345.27415-1-dinguyen@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c |   12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c
+@@ -65,8 +65,9 @@ static void socfpga_dwmac_fix_mac_speed(
+       struct phy_device *phy_dev = ndev->phydev;
+       u32 val;
+-      writew(SGMII_ADAPTER_DISABLE,
+-             sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
++      if (sgmii_adapter_base)
++              writew(SGMII_ADAPTER_DISABLE,
++                     sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
+       if (splitter_base) {
+               val = readl(splitter_base + EMAC_SPLITTER_CTRL_REG);
+@@ -88,10 +89,11 @@ static void socfpga_dwmac_fix_mac_speed(
+               writel(val, splitter_base + EMAC_SPLITTER_CTRL_REG);
+       }
+-      writew(SGMII_ADAPTER_ENABLE,
+-             sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
+-      if (phy_dev)
++      if (phy_dev && sgmii_adapter_base) {
++              writew(SGMII_ADAPTER_ENABLE,
++                     sgmii_adapter_base + SGMII_ADAPTER_CTRL_REG);
+               tse_pcs_fix_mac_speed(&dwmac->pcs, phy_dev, speed);
++      }
+ }
+ static int socfpga_dwmac_parse_data(struct socfpga_dwmac *dwmac, struct device *dev)
index 8175cdc2e0e278bc4c24e47e6a9f59f6315f720e..3c14e1a60eb8c7c16a16a950b60c92295a80174c 100644 (file)
@@ -18,11 +18,9 @@ Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
 Link: https://lore.kernel.org/r/20220421025756.571995-1-aik@ozlabs.ru
 Signed-off-by: Sasha Levin <sashal@kernel.org>
 ---
- arch/powerpc/perf/Makefile | 4 ++--
+ arch/powerpc/perf/Makefile |    4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
 
-diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile
-index c02854dea2b2..da9f60ede97b 100644
 --- a/arch/powerpc/perf/Makefile
 +++ b/arch/powerpc/perf/Makefile
 @@ -5,11 +5,11 @@ ifdef CONFIG_COMPAT
@@ -39,6 +37,3 @@ index c02854dea2b2..da9f60ede97b 100644
  obj32-$(CONFIG_PPC_PERF_CTRS) += mpc7450-pmu.o
  
  obj-$(CONFIG_PPC_POWERNV)     += imc-pmu.o
--- 
-2.35.1
-
index e54b63d4a371cda730887595973ed0cf2c59c0b4..828b02e2b3af3303307fc351de6b7c64359267b8 100644 (file)
@@ -103,3 +103,9 @@ x86-__memcpy_flushcache-fix-wrong-alignment-if-size-.patch
 cifs-destage-any-unwritten-data-to-the-server-before.patch
 drivers-net-hippi-fix-deadlock-in-rr_close.patch
 powerpc-perf-fix-32bit-compile.patch
+zonefs-fix-management-of-open-zones.patch
+zonefs-clear-inode-information-flags-on-inode-creation.patch
+kasan-prevent-cpu_quarantine-corruption-when-cpu-offline-and-cache-shrink-occur-at-same-time.patch
+drm-i915-fix-sel_fetch_plane_-pipe_b-register-addresses.patch
+net-ethernet-stmmac-fix-write-to-sgmii_adapter_base.patch
+thermal-int340x-fix-attr.show-callback-prototype.patch
diff --git a/queue-5.10/thermal-int340x-fix-attr.show-callback-prototype.patch b/queue-5.10/thermal-int340x-fix-attr.show-callback-prototype.patch
new file mode 100644 (file)
index 0000000..4c10870
--- /dev/null
@@ -0,0 +1,46 @@
+From d0f6cfb2bd165b0aa307750e07e03420859bd554 Mon Sep 17 00:00:00 2001
+From: Kees Cook <keescook@chromium.org>
+Date: Thu, 21 Apr 2022 09:55:04 -0700
+Subject: thermal: int340x: Fix attr.show callback prototype
+
+From: Kees Cook <keescook@chromium.org>
+
+commit d0f6cfb2bd165b0aa307750e07e03420859bd554 upstream.
+
+Control Flow Integrity (CFI) instrumentation of the kernel noticed that
+the caller, dev_attr_show(), and the callback, odvp_show(), did not have
+matching function prototypes, which would cause a CFI exception to be
+raised. Correct the prototype by using struct device_attribute instead
+of struct kobj_attribute.
+
+Reported-and-tested-by: Joao Moreira <joao@overdrivepizza.com>
+Link: https://lore.kernel.org/lkml/067ce8bd4c3968054509831fa2347f4f@overdrivepizza.com/
+Fixes: 006f006f1e5c ("thermal/int340x_thermal: Export OEM vendor variables")
+Cc: 5.8+ <stable@vger.kernel.org> # 5.8+
+Signed-off-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/thermal/intel/int340x_thermal/int3400_thermal.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
++++ b/drivers/thermal/intel/int340x_thermal/int3400_thermal.c
+@@ -67,7 +67,7 @@ static int evaluate_odvp(struct int3400_
+ struct odvp_attr {
+       int odvp;
+       struct int3400_thermal_priv *priv;
+-      struct kobj_attribute attr;
++      struct device_attribute attr;
+ };
+ static ssize_t data_vault_read(struct file *file, struct kobject *kobj,
+@@ -269,7 +269,7 @@ static int int3400_thermal_run_osc(acpi_
+       return result;
+ }
+-static ssize_t odvp_show(struct kobject *kobj, struct kobj_attribute *attr,
++static ssize_t odvp_show(struct device *dev, struct device_attribute *attr,
+                        char *buf)
+ {
+       struct odvp_attr *odvp_attr;
diff --git a/queue-5.10/zonefs-clear-inode-information-flags-on-inode-creation.patch b/queue-5.10/zonefs-clear-inode-information-flags-on-inode-creation.patch
new file mode 100644 (file)
index 0000000..f88af7d
--- /dev/null
@@ -0,0 +1,34 @@
+From 694852ead287a3433126e7ebda397b242dc99624 Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+Date: Tue, 12 Apr 2022 20:52:35 +0900
+Subject: zonefs: Clear inode information flags on inode creation
+
+From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+
+commit 694852ead287a3433126e7ebda397b242dc99624 upstream.
+
+Ensure that the i_flags field of struct zonefs_inode_info is cleared to
+0 when initializing a zone file inode, avoiding seeing the flag
+ZONEFS_ZONE_OPEN being incorrectly set.
+
+Fixes: b5c00e975779 ("zonefs: open/close zone on file open/close")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
+Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/zonefs/super.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/zonefs/super.c
++++ b/fs/zonefs/super.c
+@@ -1163,6 +1163,7 @@ static struct inode *zonefs_alloc_inode(
+       mutex_init(&zi->i_truncate_mutex);
+       init_rwsem(&zi->i_mmap_sem);
+       zi->i_wr_refcnt = 0;
++      zi->i_flags = 0;
+       return &zi->i_vnode;
+ }
diff --git a/queue-5.10/zonefs-fix-management-of-open-zones.patch b/queue-5.10/zonefs-fix-management-of-open-zones.patch
new file mode 100644 (file)
index 0000000..c0496c3
--- /dev/null
@@ -0,0 +1,126 @@
+From 1da18a296f5ba4f99429e62a7cf4fdbefa598902 Mon Sep 17 00:00:00 2001
+From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+Date: Tue, 12 Apr 2022 17:41:37 +0900
+Subject: zonefs: Fix management of open zones
+
+From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+
+commit 1da18a296f5ba4f99429e62a7cf4fdbefa598902 upstream.
+
+The mount option "explicit_open" manages the device open zone
+resources to ensure that if an application opens a sequential file for
+writing, the file zone can always be written by explicitly opening
+the zone and accounting for that state with the s_open_zones counter.
+
+However, if some zones are already open when mounting, the device open
+zone resource usage status will be larger than the initial s_open_zones
+value of 0. Ensure that this inconsistency does not happen by closing
+any sequential zone that is open when mounting.
+
+Furthermore, with ZNS drives, closing an explicitly open zone that has
+not been written will change the zone state to "closed", that is, the
+zone will remain in an active state. Since this can then cause failures
+of explicit open operations on other zones if the drive active zone
+resources are exceeded, we need to make sure that the zone is not
+active anymore by resetting it instead of closing it. To address this,
+zonefs_zone_mgmt() is modified to change a REQ_OP_ZONE_CLOSE request
+into a REQ_OP_ZONE_RESET for sequential zones that have not been
+written.
+
+Fixes: b5c00e975779 ("zonefs: open/close zone on file open/close")
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ fs/zonefs/super.c |   45 ++++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 40 insertions(+), 5 deletions(-)
+
+--- a/fs/zonefs/super.c
++++ b/fs/zonefs/super.c
+@@ -32,6 +32,17 @@ static inline int zonefs_zone_mgmt(struc
+       lockdep_assert_held(&zi->i_truncate_mutex);
++      /*
++       * With ZNS drives, closing an explicitly open zone that has not been
++       * written will change the zone state to "closed", that is, the zone
++       * will remain active. Since this can then cause failure of explicit
++       * open operation on other zones if the drive active zone resources
++       * are exceeded, make sure that the zone does not remain active by
++       * resetting it.
++       */
++      if (op == REQ_OP_ZONE_CLOSE && !zi->i_wpoffset)
++              op = REQ_OP_ZONE_RESET;
++
+       ret = blkdev_zone_mgmt(inode->i_sb->s_bdev, op, zi->i_zsector,
+                              zi->i_zone_size >> SECTOR_SHIFT, GFP_NOFS);
+       if (ret) {
+@@ -1306,12 +1317,13 @@ static void zonefs_init_dir_inode(struct
+       inc_nlink(parent);
+ }
+-static void zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone,
+-                                 enum zonefs_ztype type)
++static int zonefs_init_file_inode(struct inode *inode, struct blk_zone *zone,
++                                enum zonefs_ztype type)
+ {
+       struct super_block *sb = inode->i_sb;
+       struct zonefs_sb_info *sbi = ZONEFS_SB(sb);
+       struct zonefs_inode_info *zi = ZONEFS_I(inode);
++      int ret = 0;
+       inode->i_ino = zone->start >> sbi->s_zone_sectors_shift;
+       inode->i_mode = S_IFREG | sbi->s_perm;
+@@ -1336,6 +1348,22 @@ static void zonefs_init_file_inode(struc
+       sb->s_maxbytes = max(zi->i_max_size, sb->s_maxbytes);
+       sbi->s_blocks += zi->i_max_size >> sb->s_blocksize_bits;
+       sbi->s_used_blocks += zi->i_wpoffset >> sb->s_blocksize_bits;
++
++      /*
++       * For sequential zones, make sure that any open zone is closed first
++       * to ensure that the initial number of open zones is 0, in sync with
++       * the open zone accounting done when the mount option
++       * ZONEFS_MNTOPT_EXPLICIT_OPEN is used.
++       */
++      if (type == ZONEFS_ZTYPE_SEQ &&
++          (zone->cond == BLK_ZONE_COND_IMP_OPEN ||
++           zone->cond == BLK_ZONE_COND_EXP_OPEN)) {
++              mutex_lock(&zi->i_truncate_mutex);
++              ret = zonefs_zone_mgmt(inode, REQ_OP_ZONE_CLOSE);
++              mutex_unlock(&zi->i_truncate_mutex);
++      }
++
++      return ret;
+ }
+ static struct dentry *zonefs_create_inode(struct dentry *parent,
+@@ -1345,6 +1373,7 @@ static struct dentry *zonefs_create_inod
+       struct inode *dir = d_inode(parent);
+       struct dentry *dentry;
+       struct inode *inode;
++      int ret;
+       dentry = d_alloc_name(parent, name);
+       if (!dentry)
+@@ -1355,10 +1384,16 @@ static struct dentry *zonefs_create_inod
+               goto dput;
+       inode->i_ctime = inode->i_mtime = inode->i_atime = dir->i_ctime;
+-      if (zone)
+-              zonefs_init_file_inode(inode, zone, type);
+-      else
++      if (zone) {
++              ret = zonefs_init_file_inode(inode, zone, type);
++              if (ret) {
++                      iput(inode);
++                      goto dput;
++              }
++      } else {
+               zonefs_init_dir_inode(dir, inode, type);
++      }
++
+       d_add(dentry, inode);
+       dir->i_size++;