]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.12-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jan 2025 10:32:30 +0000 (11:32 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jan 2025 10:32:30 +0000 (11:32 +0100)
added patches:
iio-imu-inv_icm42600-fix-spi-burst-write-not-supported.patch
netdev-prevent-accessing-napi-instances-from-another-namespace.patch

queue-6.12/iio-imu-inv_icm42600-fix-spi-burst-write-not-supported.patch [new file with mode: 0644]
queue-6.12/netdev-prevent-accessing-napi-instances-from-another-namespace.patch [new file with mode: 0644]
queue-6.12/series

diff --git a/queue-6.12/iio-imu-inv_icm42600-fix-spi-burst-write-not-supported.patch b/queue-6.12/iio-imu-inv_icm42600-fix-spi-burst-write-not-supported.patch
new file mode 100644 (file)
index 0000000..57c5383
--- /dev/null
@@ -0,0 +1,72 @@
+From c0f866de4ce447bca3191b9cefac60c4b36a7922 Mon Sep 17 00:00:00 2001
+From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+Date: Tue, 12 Nov 2024 10:30:10 +0100
+Subject: iio: imu: inv_icm42600: fix spi burst write not supported
+
+From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+
+commit c0f866de4ce447bca3191b9cefac60c4b36a7922 upstream.
+
+Burst write with SPI is not working for all icm42600 chips. It was
+only used for setting user offsets with regmap_bulk_write.
+
+Add specific SPI regmap config for using only single write with SPI.
+
+Fixes: 9f9ff91b775b ("iio: imu: inv_icm42600: add SPI driver for inv_icm42600 driver")
+Cc: stable@vger.kernel.org
+Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
+Link: https://patch.msgid.link/20241112-inv-icm42600-fix-spi-burst-write-not-supported-v2-1-97690dc03607@tdk.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/iio/imu/inv_icm42600/inv_icm42600.h      |    1 +
+ drivers/iio/imu/inv_icm42600/inv_icm42600_core.c |   15 +++++++++++++++
+ drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c  |    3 ++-
+ 3 files changed, 18 insertions(+), 1 deletion(-)
+
+--- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h
++++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
+@@ -403,6 +403,7 @@ struct inv_icm42600_sensor_state {
+ typedef int (*inv_icm42600_bus_setup)(struct inv_icm42600_state *);
+ extern const struct regmap_config inv_icm42600_regmap_config;
++extern const struct regmap_config inv_icm42600_spi_regmap_config;
+ extern const struct dev_pm_ops inv_icm42600_pm_ops;
+ const struct iio_mount_matrix *
+--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
++++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+@@ -87,6 +87,21 @@ const struct regmap_config inv_icm42600_
+ };
+ EXPORT_SYMBOL_NS_GPL(inv_icm42600_regmap_config, IIO_ICM42600);
++/* define specific regmap for SPI not supporting burst write */
++const struct regmap_config inv_icm42600_spi_regmap_config = {
++      .name = "inv_icm42600",
++      .reg_bits = 8,
++      .val_bits = 8,
++      .max_register = 0x4FFF,
++      .ranges = inv_icm42600_regmap_ranges,
++      .num_ranges = ARRAY_SIZE(inv_icm42600_regmap_ranges),
++      .volatile_table = inv_icm42600_regmap_volatile_accesses,
++      .rd_noinc_table = inv_icm42600_regmap_rd_noinc_accesses,
++      .cache_type = REGCACHE_RBTREE,
++      .use_single_write = true,
++};
++EXPORT_SYMBOL_NS_GPL(inv_icm42600_spi_regmap_config, IIO_ICM42600);
++
+ struct inv_icm42600_hw {
+       uint8_t whoami;
+       const char *name;
+--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
++++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
+@@ -59,7 +59,8 @@ static int inv_icm42600_probe(struct spi
+               return -EINVAL;
+       chip = (uintptr_t)match;
+-      regmap = devm_regmap_init_spi(spi, &inv_icm42600_regmap_config);
++      /* use SPI specific regmap */
++      regmap = devm_regmap_init_spi(spi, &inv_icm42600_spi_regmap_config);
+       if (IS_ERR(regmap))
+               return PTR_ERR(regmap);
diff --git a/queue-6.12/netdev-prevent-accessing-napi-instances-from-another-namespace.patch b/queue-6.12/netdev-prevent-accessing-napi-instances-from-another-namespace.patch
new file mode 100644 (file)
index 0000000..dac87a3
--- /dev/null
@@ -0,0 +1,129 @@
+From d1cacd74776895f6435941f86a1130e58f6dd226 Mon Sep 17 00:00:00 2001
+From: Jakub Kicinski <kuba@kernel.org>
+Date: Mon, 6 Jan 2025 10:01:36 -0800
+Subject: netdev: prevent accessing NAPI instances from another namespace
+
+From: Jakub Kicinski <kuba@kernel.org>
+
+commit d1cacd74776895f6435941f86a1130e58f6dd226 upstream.
+
+The NAPI IDs were not fully exposed to user space prior to the netlink
+API, so they were never namespaced. The netlink API must ensure that
+at the very least NAPI instance belongs to the same netns as the owner
+of the genl sock.
+
+napi_by_id() can become static now, but it needs to move because of
+dev_get_by_napi_id().
+
+Cc: stable@vger.kernel.org
+Fixes: 1287c1ae0fc2 ("netdev-genl: Support setting per-NAPI config values")
+Fixes: 27f91aaf49b3 ("netdev-genl: Add netlink framework functions for napi")
+Reviewed-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
+Reviewed-by: Joe Damato <jdamato@fastly.com>
+Link: https://patch.msgid.link/20250106180137.1861472-1-kuba@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ net/core/dev.c         |   43 ++++++++++++++++++++++++++++++-------------
+ net/core/dev.h         |    3 ++-
+ net/core/netdev-genl.c |    4 +---
+ 3 files changed, 33 insertions(+), 17 deletions(-)
+
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -753,6 +753,36 @@ int dev_fill_forward_path(const struct n
+ }
+ EXPORT_SYMBOL_GPL(dev_fill_forward_path);
++/* must be called under rcu_read_lock(), as we dont take a reference */
++static struct napi_struct *napi_by_id(unsigned int napi_id)
++{
++      unsigned int hash = napi_id % HASH_SIZE(napi_hash);
++      struct napi_struct *napi;
++
++      hlist_for_each_entry_rcu(napi, &napi_hash[hash], napi_hash_node)
++              if (napi->napi_id == napi_id)
++                      return napi;
++
++      return NULL;
++}
++
++/* must be called under rcu_read_lock(), as we dont take a reference */
++struct napi_struct *netdev_napi_by_id(struct net *net, unsigned int napi_id)
++{
++      struct napi_struct *napi;
++
++      napi = napi_by_id(napi_id);
++      if (!napi)
++              return NULL;
++
++      if (WARN_ON_ONCE(!napi->dev))
++              return NULL;
++      if (!net_eq(net, dev_net(napi->dev)))
++              return NULL;
++
++      return napi;
++}
++
+ /**
+  *    __dev_get_by_name       - find a device by its name
+  *    @net: the applicable net namespace
+@@ -6291,19 +6321,6 @@ bool napi_complete_done(struct napi_stru
+ }
+ EXPORT_SYMBOL(napi_complete_done);
+-/* must be called under rcu_read_lock(), as we dont take a reference */
+-struct napi_struct *napi_by_id(unsigned int napi_id)
+-{
+-      unsigned int hash = napi_id % HASH_SIZE(napi_hash);
+-      struct napi_struct *napi;
+-
+-      hlist_for_each_entry_rcu(napi, &napi_hash[hash], napi_hash_node)
+-              if (napi->napi_id == napi_id)
+-                      return napi;
+-
+-      return NULL;
+-}
+-
+ static void skb_defer_free_flush(struct softnet_data *sd)
+ {
+       struct sk_buff *skb, *next;
+--- a/net/core/dev.h
++++ b/net/core/dev.h
+@@ -22,6 +22,8 @@ struct sd_flow_limit {
+ extern int netdev_flow_limit_table_len;
++struct napi_struct *netdev_napi_by_id(struct net *net, unsigned int napi_id);
++
+ #ifdef CONFIG_PROC_FS
+ int __init dev_proc_init(void);
+ #else
+@@ -146,7 +148,6 @@ void xdp_do_check_flushed(struct napi_st
+ static inline void xdp_do_check_flushed(struct napi_struct *napi) { }
+ #endif
+-struct napi_struct *napi_by_id(unsigned int napi_id);
+ void kick_defer_list_purge(struct softnet_data *sd, unsigned int cpu);
+ #define XMIT_RECURSION_LIMIT  8
+--- a/net/core/netdev-genl.c
++++ b/net/core/netdev-genl.c
+@@ -164,8 +164,6 @@ netdev_nl_napi_fill_one(struct sk_buff *
+       void *hdr;
+       pid_t pid;
+-      if (WARN_ON_ONCE(!napi->dev))
+-              return -EINVAL;
+       if (!(napi->dev->flags & IFF_UP))
+               return 0;
+@@ -216,7 +214,7 @@ int netdev_nl_napi_get_doit(struct sk_bu
+       rtnl_lock();
+       rcu_read_lock();
+-      napi = napi_by_id(napi_id);
++      napi = netdev_napi_by_id(genl_info_net(info), napi_id);
+       if (napi) {
+               err = netdev_nl_napi_fill_one(rsp, napi, info);
+       } else {
index 5dcdfbbeb8e4dfde3c7aa078ed1d7f6a38ebd2d6..bd82ee782cb674948b16c101a7a1d70ca691d427 100644 (file)
@@ -185,3 +185,5 @@ drm-xe-oa-add-input-fence-dependencies.patch
 xe-oa-fix-query-mode-of-operation-for-oar-oac.patch
 drm-mediatek-only-touch-disp_reg_ovl_pitch_msb-if-af.patch
 io_uring-don-t-touch-sqd-thread-off-tw-add.patch
+iio-imu-inv_icm42600-fix-spi-burst-write-not-supported.patch
+netdev-prevent-accessing-napi-instances-from-another-namespace.patch