]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.1
authorSasha Levin <sashal@kernel.org>
Mon, 17 Mar 2025 14:33:53 +0000 (10:33 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 17 Mar 2025 14:33:53 +0000 (10:33 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
12 files changed:
queue-6.1/asoc-codecs-wm0010-fix-error-handling-path-in-wm0010.patch [new file with mode: 0644]
queue-6.1/asoc-ops-consistently-treat-platform_max-as-control-.patch [new file with mode: 0644]
queue-6.1/cifs-fix-integer-overflow-while-processing-acdirmax-.patch [new file with mode: 0644]
queue-6.1/cifs-fix-integer-overflow-while-processing-acregmax-.patch [new file with mode: 0644]
queue-6.1/cifs-fix-integer-overflow-while-processing-actimeo-m.patch [new file with mode: 0644]
queue-6.1/cifs-fix-integer-overflow-while-processing-closetime.patch [new file with mode: 0644]
queue-6.1/drm-gma500-add-null-check-for-pci_gfx_root-in-mid_ge.patch [new file with mode: 0644]
queue-6.1/scripts-generate_rust_analyzer-add-missing-macros-de.patch [new file with mode: 0644]
queue-6.1/scripts-generate_rust_analyzer-handle-sub-modules-wi.patch [new file with mode: 0644]
queue-6.1/scripts-generate_rust_analyzer-provide-cfg-s-for-cor.patch [new file with mode: 0644]
queue-6.1/scripts-make-rust-analyzer-for-out-of-tree-modules.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/asoc-codecs-wm0010-fix-error-handling-path-in-wm0010.patch b/queue-6.1/asoc-codecs-wm0010-fix-error-handling-path-in-wm0010.patch
new file mode 100644 (file)
index 0000000..4ddad1b
--- /dev/null
@@ -0,0 +1,59 @@
+From 313261a31d891f2bd647c02b168a28de7b7d8bb0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 10 Mar 2025 18:45:36 +0100
+Subject: ASoC: codecs: wm0010: Fix error handling path in wm0010_spi_probe()
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit ed92bc5264c4357d4fca292c769ea9967cd3d3b6 ]
+
+Free some resources in the error handling path of the probe, as already
+done in the remove function.
+
+Fixes: e3523e01869d ("ASoC: wm0010: Add initial wm0010 DSP driver")
+Fixes: fd8b96574456 ("ASoC: wm0010: Clear IRQ as wake source and include missing header")
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Link: https://patch.msgid.link/5139ba1ab8c4c157ce04e56096a0f54a1683195c.1741549792.git.christophe.jaillet@wanadoo.fr
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/wm0010.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
+index 034a4e858c7e6..602fa7cc2c5e2 100644
+--- a/sound/soc/codecs/wm0010.c
++++ b/sound/soc/codecs/wm0010.c
+@@ -951,7 +951,7 @@ static int wm0010_spi_probe(struct spi_device *spi)
+       if (ret) {
+               dev_err(wm0010->dev, "Failed to set IRQ %d as wake source: %d\n",
+                       irq, ret);
+-              return ret;
++              goto free_irq;
+       }
+       if (spi->max_speed_hz)
+@@ -963,9 +963,18 @@ static int wm0010_spi_probe(struct spi_device *spi)
+                                    &soc_component_dev_wm0010, wm0010_dai,
+                                    ARRAY_SIZE(wm0010_dai));
+       if (ret < 0)
+-              return ret;
++              goto disable_irq_wake;
+       return 0;
++
++disable_irq_wake:
++      irq_set_irq_wake(wm0010->irq, 0);
++
++free_irq:
++      if (wm0010->irq)
++              free_irq(wm0010->irq, wm0010);
++
++      return ret;
+ }
+ static void wm0010_spi_remove(struct spi_device *spi)
+-- 
+2.39.5
+
diff --git a/queue-6.1/asoc-ops-consistently-treat-platform_max-as-control-.patch b/queue-6.1/asoc-ops-consistently-treat-platform_max-as-control-.patch
new file mode 100644 (file)
index 0000000..47d0284
--- /dev/null
@@ -0,0 +1,106 @@
+From 0affa1618fceab60bfc3bd39706157085b22e655 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 28 Feb 2025 15:14:56 +0000
+Subject: ASoC: ops: Consistently treat platform_max as control value
+
+From: Charles Keepax <ckeepax@opensource.cirrus.com>
+
+[ Upstream commit 0eba2a7e858907a746ba69cd002eb9eb4dbd7bf3 ]
+
+This reverts commit 9bdd10d57a88 ("ASoC: ops: Shift tested values in
+snd_soc_put_volsw() by +min"), and makes some additional related
+updates.
+
+There are two ways the platform_max could be interpreted; the maximum
+register value, or the maximum value the control can be set to. The
+patch moved from treating the value as a control value to a register
+one. When the patch was applied it was technically correct as
+snd_soc_limit_volume() also used the register interpretation. However,
+even then most of the other usages treated platform_max as a
+control value, and snd_soc_limit_volume() has since been updated to
+also do so in commit fb9ad24485087 ("ASoC: ops: add correct range
+check for limiting volume"). That patch however, missed updating
+snd_soc_put_volsw() back to the control interpretation, and fixing
+snd_soc_info_volsw_range(). The control interpretation makes more
+sense as limiting is typically done from the machine driver, so it is
+appropriate to use the customer facing representation rather than the
+internal codec representation. Update all the code to consistently use
+this interpretation of platform_max.
+
+Finally, also add some comments to the soc_mixer_control struct to
+hopefully avoid further patches switching between the two approaches.
+
+Fixes: fb9ad24485087 ("ASoC: ops: add correct range check for limiting volume")
+Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
+Link: https://patch.msgid.link/20250228151456.3703342-1-ckeepax@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/soc.h |  5 ++++-
+ sound/soc/soc-ops.c | 15 +++++++--------
+ 2 files changed, 11 insertions(+), 9 deletions(-)
+
+diff --git a/include/sound/soc.h b/include/sound/soc.h
+index 108617cea9c67..d63ac6d9fbdc4 100644
+--- a/include/sound/soc.h
++++ b/include/sound/soc.h
+@@ -1141,7 +1141,10 @@ void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd);
+ /* mixer control */
+ struct soc_mixer_control {
+-      int min, max, platform_max;
++      /* Minimum and maximum specified as written to the hardware */
++      int min, max;
++      /* Limited maximum value specified as presented through the control */
++      int platform_max;
+       int reg, rreg;
+       unsigned int shift, rshift;
+       unsigned int sign_bit;
+diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
+index b27e89ff6a167..b4cfc34d00ee6 100644
+--- a/sound/soc/soc-ops.c
++++ b/sound/soc/soc-ops.c
+@@ -336,7 +336,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
+       if (ucontrol->value.integer.value[0] < 0)
+               return -EINVAL;
+       val = ucontrol->value.integer.value[0];
+-      if (mc->platform_max && ((int)val + min) > mc->platform_max)
++      if (mc->platform_max && val > mc->platform_max)
+               return -EINVAL;
+       if (val > max - min)
+               return -EINVAL;
+@@ -349,7 +349,7 @@ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol,
+               if (ucontrol->value.integer.value[1] < 0)
+                       return -EINVAL;
+               val2 = ucontrol->value.integer.value[1];
+-              if (mc->platform_max && ((int)val2 + min) > mc->platform_max)
++              if (mc->platform_max && val2 > mc->platform_max)
+                       return -EINVAL;
+               if (val2 > max - min)
+                       return -EINVAL;
+@@ -502,17 +502,16 @@ int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
+ {
+       struct soc_mixer_control *mc =
+               (struct soc_mixer_control *)kcontrol->private_value;
+-      int platform_max;
+-      int min = mc->min;
++      int max;
+-      if (!mc->platform_max)
+-              mc->platform_max = mc->max;
+-      platform_max = mc->platform_max;
++      max = mc->max - mc->min;
++      if (mc->platform_max && mc->platform_max < max)
++              max = mc->platform_max;
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
+       uinfo->value.integer.min = 0;
+-      uinfo->value.integer.max = platform_max - min;
++      uinfo->value.integer.max = max;
+       return 0;
+ }
+-- 
+2.39.5
+
diff --git a/queue-6.1/cifs-fix-integer-overflow-while-processing-acdirmax-.patch b/queue-6.1/cifs-fix-integer-overflow-while-processing-acdirmax-.patch
new file mode 100644 (file)
index 0000000..a891fc9
--- /dev/null
@@ -0,0 +1,44 @@
+From 8625d0f79025d81dc6725285ef9258b0c171c654 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Mar 2025 17:22:04 +0300
+Subject: cifs: Fix integer overflow while processing acdirmax mount option
+
+From: Murad Masimov <m.masimov@mt-integration.ru>
+
+[ Upstream commit 5b29891f91dfb8758baf1e2217bef4b16b2b165b ]
+
+User-provided mount parameter acdirmax of type u32 is intended to have
+an upper limit, but before it is validated, the value is converted from
+seconds to jiffies which can lead to an integer overflow.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: 4c9f948142a5 ("cifs: Add new mount parameter "acdirmax" to allow caching directory metadata")
+Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/fs_context.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
+index b9a47dd5db632..d2b9aca2b2790 100644
+--- a/fs/smb/client/fs_context.c
++++ b/fs/smb/client/fs_context.c
+@@ -1085,11 +1085,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
+               ctx->acregmax = HZ * result.uint_32;
+               break;
+       case Opt_acdirmax:
+-              ctx->acdirmax = HZ * result.uint_32;
+-              if (ctx->acdirmax > CIFS_MAX_ACTIMEO) {
++              if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
+                       cifs_errorf(fc, "acdirmax too large\n");
+                       goto cifs_parse_mount_err;
+               }
++              ctx->acdirmax = HZ * result.uint_32;
+               break;
+       case Opt_actimeo:
+               if (HZ * result.uint_32 > CIFS_MAX_ACTIMEO) {
+-- 
+2.39.5
+
diff --git a/queue-6.1/cifs-fix-integer-overflow-while-processing-acregmax-.patch b/queue-6.1/cifs-fix-integer-overflow-while-processing-acregmax-.patch
new file mode 100644 (file)
index 0000000..bf5f201
--- /dev/null
@@ -0,0 +1,44 @@
+From f3e840b8b5b14f32492069f840b7789c561c281a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Mar 2025 17:22:03 +0300
+Subject: cifs: Fix integer overflow while processing acregmax mount option
+
+From: Murad Masimov <m.masimov@mt-integration.ru>
+
+[ Upstream commit 7489161b1852390b4413d57f2457cd40b34da6cc ]
+
+User-provided mount parameter acregmax of type u32 is intended to have
+an upper limit, but before it is validated, the value is converted from
+seconds to jiffies which can lead to an integer overflow.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: 5780464614f6 ("cifs: Add new parameter "acregmax" for distinct file and directory metadata timeout")
+Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/fs_context.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
+index ca39d01077cdf..b9a47dd5db632 100644
+--- a/fs/smb/client/fs_context.c
++++ b/fs/smb/client/fs_context.c
+@@ -1078,11 +1078,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
+               ctx->got_wsize = true;
+               break;
+       case Opt_acregmax:
+-              ctx->acregmax = HZ * result.uint_32;
+-              if (ctx->acregmax > CIFS_MAX_ACTIMEO) {
++              if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
+                       cifs_errorf(fc, "acregmax too large\n");
+                       goto cifs_parse_mount_err;
+               }
++              ctx->acregmax = HZ * result.uint_32;
+               break;
+       case Opt_acdirmax:
+               ctx->acdirmax = HZ * result.uint_32;
+-- 
+2.39.5
+
diff --git a/queue-6.1/cifs-fix-integer-overflow-while-processing-actimeo-m.patch b/queue-6.1/cifs-fix-integer-overflow-while-processing-actimeo-m.patch
new file mode 100644 (file)
index 0000000..881536a
--- /dev/null
@@ -0,0 +1,39 @@
+From dfe26b4dce4ce56c15eb056d6386c68c01d26def Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Mar 2025 17:22:05 +0300
+Subject: cifs: Fix integer overflow while processing actimeo mount option
+
+From: Murad Masimov <m.masimov@mt-integration.ru>
+
+[ Upstream commit 64f690ee22c99e16084e0e45181b2a1eed2fa149 ]
+
+User-provided mount parameter actimeo of type u32 is intended to have
+an upper limit, but before it is validated, the value is converted from
+seconds to jiffies which can lead to an integer overflow.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: 6d20e8406f09 ("cifs: add attribute cache timeout (actimeo) tunable")
+Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/fs_context.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
+index d2b9aca2b2790..76842fbd2bb83 100644
+--- a/fs/smb/client/fs_context.c
++++ b/fs/smb/client/fs_context.c
+@@ -1092,7 +1092,7 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
+               ctx->acdirmax = HZ * result.uint_32;
+               break;
+       case Opt_actimeo:
+-              if (HZ * result.uint_32 > CIFS_MAX_ACTIMEO) {
++              if (result.uint_32 > CIFS_MAX_ACTIMEO / HZ) {
+                       cifs_errorf(fc, "timeout too large\n");
+                       goto cifs_parse_mount_err;
+               }
+-- 
+2.39.5
+
diff --git a/queue-6.1/cifs-fix-integer-overflow-while-processing-closetime.patch b/queue-6.1/cifs-fix-integer-overflow-while-processing-closetime.patch
new file mode 100644 (file)
index 0000000..1d5f114
--- /dev/null
@@ -0,0 +1,44 @@
+From f0f8e9aa42b8b0836bde64497090764715ba2ad8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Mar 2025 17:22:06 +0300
+Subject: cifs: Fix integer overflow while processing closetimeo mount option
+
+From: Murad Masimov <m.masimov@mt-integration.ru>
+
+[ Upstream commit d5a30fddfe2f2e540f6c43b59cf701809995faef ]
+
+User-provided mount parameter closetimeo of type u32 is intended to have
+an upper limit, but before it is validated, the value is converted from
+seconds to jiffies which can lead to an integer overflow.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: 5efdd9122eff ("smb3: allow deferred close timeout to be configurable")
+Signed-off-by: Murad Masimov <m.masimov@mt-integration.ru>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/client/fs_context.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/smb/client/fs_context.c b/fs/smb/client/fs_context.c
+index 76842fbd2bb83..de2366d05767f 100644
+--- a/fs/smb/client/fs_context.c
++++ b/fs/smb/client/fs_context.c
+@@ -1104,11 +1104,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
+               ctx->acdirmax = ctx->acregmax = HZ * result.uint_32;
+               break;
+       case Opt_closetimeo:
+-              ctx->closetimeo = HZ * result.uint_32;
+-              if (ctx->closetimeo > SMB3_MAX_DCLOSETIMEO) {
++              if (result.uint_32 > SMB3_MAX_DCLOSETIMEO / HZ) {
+                       cifs_errorf(fc, "closetimeo too large\n");
+                       goto cifs_parse_mount_err;
+               }
++              ctx->closetimeo = HZ * result.uint_32;
+               break;
+       case Opt_echo_interval:
+               ctx->echo_interval = result.uint_32;
+-- 
+2.39.5
+
diff --git a/queue-6.1/drm-gma500-add-null-check-for-pci_gfx_root-in-mid_ge.patch b/queue-6.1/drm-gma500-add-null-check-for-pci_gfx_root-in-mid_ge.patch
new file mode 100644 (file)
index 0000000..92273f9
--- /dev/null
@@ -0,0 +1,47 @@
+From dd203321ffb8acea8bcfa5bc8ad99714365c5f76 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Mar 2025 14:20:45 +0300
+Subject: drm/gma500: Add NULL check for pci_gfx_root in mid_get_vbt_data()
+
+From: Ivan Abramov <i.abramov@mt-integration.ru>
+
+[ Upstream commit 9af152dcf1a06f589f44a74da4ad67e365d4db9a ]
+
+Since pci_get_domain_bus_and_slot() can return NULL, add NULL check for
+pci_gfx_root in the mid_get_vbt_data().
+
+This change is similar to the checks implemented in mid_get_fuse_settings()
+and mid_get_pci_revID(), which were introduced by commit 0cecdd818cd7
+("gma500: Final enables for Oaktrail") as "additional minor
+bulletproofing".
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: f910b411053f ("gma500: Add the glue to the various BIOS and firmware interfaces")
+Signed-off-by: Ivan Abramov <i.abramov@mt-integration.ru>
+Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20250306112046.17144-1-i.abramov@mt-integration.ru
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/gma500/mid_bios.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/gpu/drm/gma500/mid_bios.c b/drivers/gpu/drm/gma500/mid_bios.c
+index 7e76790c6a81f..cba97d7db131d 100644
+--- a/drivers/gpu/drm/gma500/mid_bios.c
++++ b/drivers/gpu/drm/gma500/mid_bios.c
+@@ -279,6 +279,11 @@ static void mid_get_vbt_data(struct drm_psb_private *dev_priv)
+                                           0, PCI_DEVFN(2, 0));
+       int ret = -1;
++      if (pci_gfx_root == NULL) {
++              WARN_ON(1);
++              return;
++      }
++
+       /* Get the address of the platform config vbt */
+       pci_read_config_dword(pci_gfx_root, 0xFC, &addr);
+       pci_dev_put(pci_gfx_root);
+-- 
+2.39.5
+
diff --git a/queue-6.1/scripts-generate_rust_analyzer-add-missing-macros-de.patch b/queue-6.1/scripts-generate_rust_analyzer-add-missing-macros-de.patch
new file mode 100644 (file)
index 0000000..bee7a79
--- /dev/null
@@ -0,0 +1,112 @@
+From 2013eebd871ddd5ed4c6ce35f98c7324e927459e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 10 Feb 2025 12:03:24 -0500
+Subject: scripts: generate_rust_analyzer: add missing macros deps
+
+From: Tamir Duberstein <tamird@gmail.com>
+
+[ Upstream commit 2e0f91aba507a3cb59f7a12fc3ea2b7d4d6675b7 ]
+
+The macros crate has depended on std and proc_macro since its
+introduction in commit 1fbde52bde73 ("rust: add `macros` crate"). These
+dependencies were omitted from commit 8c4555ccc55c ("scripts: add
+`generate_rust_analyzer.py`") resulting in missing go-to-definition and
+autocomplete, and false-positive warnings emitted from rust-analyzer
+such as:
+
+  [{
+       "resource": "/Users/tamird/src/linux/rust/macros/module.rs",
+       "owner": "_generated_diagnostic_collection_name_#1",
+       "code": {
+               "value": "non_snake_case",
+               "target": {
+                       "$mid": 1,
+                       "path": "/rustc/",
+                       "scheme": "https",
+                       "authority": "doc.rust-lang.org",
+                       "query": "search=non_snake_case"
+               }
+       },
+       "severity": 4,
+       "message": "Variable `None` should have snake_case name, e.g. `none`",
+       "source": "rust-analyzer",
+       "startLineNumber": 123,
+       "startColumn": 17,
+       "endLineNumber": 123,
+       "endColumn": 21
+  }]
+
+Add the missing dependencies to improve the developer experience.
+
+  [ Fiona had a different approach (thanks!) at:
+
+        https://lore.kernel.org/rust-for-linux/20241205115438.234221-1-me@kloenk.dev/
+
+    But Tamir and Fiona agreed to this one. - Miguel ]
+
+Fixes: 8c4555ccc55c ("scripts: add `generate_rust_analyzer.py`")
+Reviewed-by: Fiona Behrens <me@kloenk.dev>
+Diagnosed-by: Chayim Refael Friedman <chayimfr@gmail.com>
+Link: https://github.com/rust-lang/rust-analyzer/issues/17759#issuecomment-2646328275
+Signed-off-by: Tamir Duberstein <tamird@gmail.com>
+Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
+Link: https://lore.kernel.org/r/20250210-rust-analyzer-macros-core-dep-v3-1-45eb4836f218@gmail.com
+[ Removed `return`. Changed tag name. Added Link. Slightly
+  reworded. - Miguel ]
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/generate_rust_analyzer.py | 30 +++++++++++++++++++++---------
+ 1 file changed, 21 insertions(+), 9 deletions(-)
+
+diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
+index 030e26ef87c25..1093c540e3240 100755
+--- a/scripts/generate_rust_analyzer.py
++++ b/scripts/generate_rust_analyzer.py
+@@ -49,14 +49,26 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs):
+             }
+         })
+-    # First, the ones in `rust/` since they are a bit special.
+-    append_crate(
+-        "core",
+-        sysroot_src / "core" / "src" / "lib.rs",
+-        [],
+-        cfg=crates_cfgs.get("core", []),
+-        is_workspace_member=False,
+-    )
++    def append_sysroot_crate(
++        display_name,
++        deps,
++        cfg=[],
++    ):
++        append_crate(
++            display_name,
++            sysroot_src / display_name / "src" / "lib.rs",
++            deps,
++            cfg,
++            is_workspace_member=False,
++        )
++
++    # NB: sysroot crates reexport items from one another so setting up our transitive dependencies
++    # here is important for ensuring that rust-analyzer can resolve symbols. The sources of truth
++    # for this dependency graph are `(sysroot_src / crate / "Cargo.toml" for crate in crates)`.
++    append_sysroot_crate("core", [], cfg=crates_cfgs.get("core", []))
++    append_sysroot_crate("alloc", ["core"])
++    append_sysroot_crate("std", ["alloc", "core"])
++    append_sysroot_crate("proc_macro", ["core", "std"])
+     append_crate(
+         "compiler_builtins",
+@@ -74,7 +86,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs):
+     append_crate(
+         "macros",
+         srctree / "rust" / "macros" / "lib.rs",
+-        [],
++        ["std", "proc_macro"],
+         is_proc_macro=True,
+     )
+     crates[-1]["proc_macro_dylib_path"] = f"{objtree}/rust/libmacros.so"
+-- 
+2.39.5
+
diff --git a/queue-6.1/scripts-generate_rust_analyzer-handle-sub-modules-wi.patch b/queue-6.1/scripts-generate_rust_analyzer-handle-sub-modules-wi.patch
new file mode 100644 (file)
index 0000000..1528e15
--- /dev/null
@@ -0,0 +1,42 @@
+From b89044acb3451df9f87c182d372e5f0b961cfea9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 7 Apr 2023 00:25:22 +0200
+Subject: scripts: generate_rust_analyzer: Handle sub-modules with no Makefile
+
+From: Asahi Lina <lina@asahilina.net>
+
+[ Upstream commit 5c7548d5a25306dcdb97689479be81cacc8ce596 ]
+
+More complex drivers might want to use modules to organize their Rust
+code, but those module folders do not need a Makefile.
+generate_rust_analyzer.py currently crashes on those. Fix it so that a
+missing Makefile is silently ignored.
+
+Link: https://github.com/Rust-for-Linux/linux/pull/883
+Signed-off-by: Asahi Lina <lina@asahilina.net>
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Stable-dep-of: 2e0f91aba507 ("scripts: generate_rust_analyzer: add missing macros deps")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/generate_rust_analyzer.py | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
+index 75bb611bd7516..ab6af280b9de0 100755
+--- a/scripts/generate_rust_analyzer.py
++++ b/scripts/generate_rust_analyzer.py
+@@ -98,7 +98,10 @@ def generate_crates(srctree, objtree, sysroot_src):
+             name = path.name.replace(".rs", "")
+             # Skip those that are not crate roots.
+-            if f"{name}.o" not in open(path.parent / "Makefile").read():
++            try:
++                if f"{name}.o" not in open(path.parent / "Makefile").read():
++                    continue
++            except FileNotFoundError:
+                 continue
+             logging.info("Adding %s", name)
+-- 
+2.39.5
+
diff --git a/queue-6.1/scripts-generate_rust_analyzer-provide-cfg-s-for-cor.patch b/queue-6.1/scripts-generate_rust_analyzer-provide-cfg-s-for-cor.patch
new file mode 100644 (file)
index 0000000..b791078
--- /dev/null
@@ -0,0 +1,107 @@
+From d1a380e6176b8200cf7cdb4b3390c88245eed287 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 4 Aug 2023 14:14:39 -0300
+Subject: scripts: generate_rust_analyzer: provide `cfg`s for `core` and
+ `alloc`
+
+From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
+
+[ Upstream commit 4f353e0d1282dfe6b8082290fe8e606c5739a954 ]
+
+Both `core` and `alloc` have their `cfgs` (such as `no_rc`) missing
+in `rust-project.json`.
+
+To remedy this, pass the flags to `generate_rust_analyzer.py` for
+them to be added to a dictionary where each key corresponds to
+a crate and each value to a list of `cfg`s. The dictionary is then
+used to pass the `cfg`s to each crate in the generated file (for
+`core` and `alloc` only).
+
+Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
+Link: https://lore.kernel.org/r/20230804171448.54976-1-yakoyoku@gmail.com
+[ Removed `Suggested-by` as discussed in mailing list. ]
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Stable-dep-of: 2e0f91aba507 ("scripts: generate_rust_analyzer: add missing macros deps")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ rust/Makefile                     |  1 +
+ scripts/generate_rust_analyzer.py | 16 ++++++++++++++--
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/rust/Makefile b/rust/Makefile
+index 003a1277d705f..ec737bad7fbb0 100644
+--- a/rust/Makefile
++++ b/rust/Makefile
+@@ -345,6 +345,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
+ rust-analyzer:
+       $(Q)$(srctree)/scripts/generate_rust_analyzer.py \
++              --cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \
+               $(abs_srctree) $(abs_objtree) \
+               $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \
+               $(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json
+diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
+index a7fcacc1c72e7..030e26ef87c25 100755
+--- a/scripts/generate_rust_analyzer.py
++++ b/scripts/generate_rust_analyzer.py
+@@ -10,7 +10,15 @@ import os
+ import pathlib
+ import sys
+-def generate_crates(srctree, objtree, sysroot_src, external_src):
++def args_crates_cfgs(cfgs):
++    crates_cfgs = {}
++    for cfg in cfgs:
++        crate, vals = cfg.split("=", 1)
++        crates_cfgs[crate] = vals.replace("--cfg", "").split()
++
++    return crates_cfgs
++
++def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs):
+     # Generate the configuration list.
+     cfg = []
+     with open(objtree / "include" / "generated" / "rustc_cfg") as fd:
+@@ -24,6 +32,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src):
+     # Avoid O(n^2) iterations by keeping a map of indexes.
+     crates = []
+     crates_indexes = {}
++    crates_cfgs = args_crates_cfgs(cfgs)
+     def append_crate(display_name, root_module, deps, cfg=[], is_workspace_member=True, is_proc_macro=False):
+         crates_indexes[display_name] = len(crates)
+@@ -45,6 +54,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src):
+         "core",
+         sysroot_src / "core" / "src" / "lib.rs",
+         [],
++        cfg=crates_cfgs.get("core", []),
+         is_workspace_member=False,
+     )
+@@ -58,6 +68,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src):
+         "alloc",
+         srctree / "rust" / "alloc" / "lib.rs",
+         ["core", "compiler_builtins"],
++        cfg=crates_cfgs.get("alloc", []),
+     )
+     append_crate(
+@@ -125,6 +136,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src):
+ def main():
+     parser = argparse.ArgumentParser()
+     parser.add_argument('--verbose', '-v', action='store_true')
++    parser.add_argument('--cfgs', action='append', default=[])
+     parser.add_argument("srctree", type=pathlib.Path)
+     parser.add_argument("objtree", type=pathlib.Path)
+     parser.add_argument("sysroot_src", type=pathlib.Path)
+@@ -137,7 +149,7 @@ def main():
+     )
+     rust_project = {
+-        "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree),
++        "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree, args.cfgs),
+         "sysroot_src": str(args.sysroot_src),
+     }
+-- 
+2.39.5
+
diff --git a/queue-6.1/scripts-make-rust-analyzer-for-out-of-tree-modules.patch b/queue-6.1/scripts-make-rust-analyzer-for-out-of-tree-modules.patch
new file mode 100644 (file)
index 0000000..dee6e62
--- /dev/null
@@ -0,0 +1,165 @@
+From 45549efea40865e42f2028a9e4d516fc09b55139 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Apr 2023 17:17:15 +0800
+Subject: scripts: `make rust-analyzer` for out-of-tree modules
+
+From: Vinay Varma <varmavinaym@gmail.com>
+
+[ Upstream commit 49a9ef76740206d52e7393f6fe25fc764de8df32 ]
+
+Adds support for out-of-tree rust modules to use the `rust-analyzer`
+make target to generate the rust-project.json file.
+
+The change involves adding an optional parameter `external_src` to the
+`generate_rust_analyzer.py` which expects the path to the out-of-tree
+module's source directory. When this parameter is passed, I have chosen
+not to add the non-core modules (samples and drivers) into the result
+since these are not expected to be used in third party modules. Related
+changes are also made to the Makefile and rust/Makefile allowing the
+`rust-analyzer` target to be used for out-of-tree modules as well.
+
+Link: https://github.com/Rust-for-Linux/linux/pull/914
+Link: https://github.com/Rust-for-Linux/rust-out-of-tree-module/pull/2
+Signed-off-by: Vinay Varma <varmavinaym@gmail.com>
+Link: https://lore.kernel.org/r/20230411091714.130525-1-varmavinaym@gmail.com
+Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
+Stable-dep-of: 2e0f91aba507 ("scripts: generate_rust_analyzer: add missing macros deps")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ Makefile                          | 11 ++++++-----
+ rust/Makefile                     |  6 ++++--
+ scripts/generate_rust_analyzer.py | 27 ++++++++++++++++++---------
+ 3 files changed, 28 insertions(+), 16 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 58d17d3395782..8d9cb47a76f2e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1851,11 +1851,6 @@ rustfmt:
+ rustfmtcheck: rustfmt_flags = --check
+ rustfmtcheck: rustfmt
+-# IDE support targets
+-PHONY += rust-analyzer
+-rust-analyzer:
+-      $(Q)$(MAKE) $(build)=rust $@
+-
+ # Misc
+ # ---------------------------------------------------------------------------
+@@ -1908,6 +1903,7 @@ help:
+       @echo  '  modules         - default target, build the module(s)'
+       @echo  '  modules_install - install the module'
+       @echo  '  clean           - remove generated files in module directory only'
++      @echo  '  rust-analyzer   - generate rust-project.json rust-analyzer support file'
+       @echo  ''
+ endif # KBUILD_EXTMOD
+@@ -2044,6 +2040,11 @@ quiet_cmd_tags = GEN     $@
+ tags TAGS cscope gtags: FORCE
+       $(call cmd,tags)
++# IDE support targets
++PHONY += rust-analyzer
++rust-analyzer:
++      $(Q)$(MAKE) $(build)=rust $@
++
+ # Script to generate missing namespace dependencies
+ # ---------------------------------------------------------------------------
+diff --git a/rust/Makefile b/rust/Makefile
+index 28ba3b9ee18dd..003a1277d705f 100644
+--- a/rust/Makefile
++++ b/rust/Makefile
+@@ -344,8 +344,10 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
+       $(if $(rustc_objcopy),;$(OBJCOPY) $(rustc_objcopy) $@)
+ rust-analyzer:
+-      $(Q)$(srctree)/scripts/generate_rust_analyzer.py $(srctree) $(objtree) \
+-              $(RUST_LIB_SRC) > $(objtree)/rust-project.json
++      $(Q)$(srctree)/scripts/generate_rust_analyzer.py \
++              $(abs_srctree) $(abs_objtree) \
++              $(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \
++              $(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json
+ $(obj)/core.o: private skip_clippy = 1
+ $(obj)/core.o: private skip_flags = -Dunreachable_pub
+diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py
+index ab6af280b9de0..a7fcacc1c72e7 100755
+--- a/scripts/generate_rust_analyzer.py
++++ b/scripts/generate_rust_analyzer.py
+@@ -6,10 +6,11 @@
+ import argparse
+ import json
+ import logging
++import os
+ import pathlib
+ import sys
+-def generate_crates(srctree, objtree, sysroot_src):
++def generate_crates(srctree, objtree, sysroot_src, external_src):
+     # Generate the configuration list.
+     cfg = []
+     with open(objtree / "include" / "generated" / "rustc_cfg") as fd:
+@@ -65,7 +66,7 @@ def generate_crates(srctree, objtree, sysroot_src):
+         [],
+         is_proc_macro=True,
+     )
+-    crates[-1]["proc_macro_dylib_path"] = "rust/libmacros.so"
++    crates[-1]["proc_macro_dylib_path"] = f"{objtree}/rust/libmacros.so"
+     append_crate(
+         "bindings",
+@@ -89,19 +90,26 @@ def generate_crates(srctree, objtree, sysroot_src):
+         "exclude_dirs": [],
+     }
++    def is_root_crate(build_file, target):
++        try:
++            return f"{target}.o" in open(build_file).read()
++        except FileNotFoundError:
++            return False
++
+     # Then, the rest outside of `rust/`.
+     #
+     # We explicitly mention the top-level folders we want to cover.
+-    for folder in ("samples", "drivers"):
+-        for path in (srctree / folder).rglob("*.rs"):
++    extra_dirs = map(lambda dir: srctree / dir, ("samples", "drivers"))
++    if external_src is not None:
++        extra_dirs = [external_src]
++    for folder in extra_dirs:
++        for path in folder.rglob("*.rs"):
+             logging.info("Checking %s", path)
+             name = path.name.replace(".rs", "")
+             # Skip those that are not crate roots.
+-            try:
+-                if f"{name}.o" not in open(path.parent / "Makefile").read():
+-                    continue
+-            except FileNotFoundError:
++            if not is_root_crate(path.parent / "Makefile", name) and \
++               not is_root_crate(path.parent / "Kbuild", name):
+                 continue
+             logging.info("Adding %s", name)
+@@ -120,6 +128,7 @@ def main():
+     parser.add_argument("srctree", type=pathlib.Path)
+     parser.add_argument("objtree", type=pathlib.Path)
+     parser.add_argument("sysroot_src", type=pathlib.Path)
++    parser.add_argument("exttree", type=pathlib.Path, nargs="?")
+     args = parser.parse_args()
+     logging.basicConfig(
+@@ -128,7 +137,7 @@ def main():
+     )
+     rust_project = {
+-        "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src),
++        "crates": generate_crates(args.srctree, args.objtree, args.sysroot_src, args.exttree),
+         "sysroot_src": str(args.sysroot_src),
+     }
+-- 
+2.39.5
+
index 4e11a9515733779b9c3ec35db5414d991077c53b..af16c1b39de249caec1b653602441ada111c9a8f 100644 (file)
@@ -126,3 +126,14 @@ lib-buildid-handle-memfd_secret-files-in-build_id_parse.patch
 tcp-fix-races-in-tcp_abort.patch
 tcp-fix-forever-orphan-socket-caused-by-tcp_abort.patch
 leds-mlxreg-use-devm_mutex_init-for-mutex-initialization.patch
+asoc-ops-consistently-treat-platform_max-as-control-.patch
+drm-gma500-add-null-check-for-pci_gfx_root-in-mid_ge.patch
+asoc-codecs-wm0010-fix-error-handling-path-in-wm0010.patch
+scripts-generate_rust_analyzer-handle-sub-modules-wi.patch
+scripts-make-rust-analyzer-for-out-of-tree-modules.patch
+scripts-generate_rust_analyzer-provide-cfg-s-for-cor.patch
+scripts-generate_rust_analyzer-add-missing-macros-de.patch
+cifs-fix-integer-overflow-while-processing-acregmax-.patch
+cifs-fix-integer-overflow-while-processing-acdirmax-.patch
+cifs-fix-integer-overflow-while-processing-actimeo-m.patch
+cifs-fix-integer-overflow-while-processing-closetime.patch