]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Thu, 30 May 2024 18:48:15 +0000 (14:48 -0400)
committerSasha Levin <sashal@kernel.org>
Thu, 30 May 2024 18:48:15 +0000 (14:48 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
23 files changed:
queue-4.19/dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch [new file with mode: 0644]
queue-4.19/extcon-max8997-select-irq_domain-instead-of-dependin.patch [new file with mode: 0644]
queue-4.19/f2fs-add-error-prints-for-debugging-mount-failure.patch [new file with mode: 0644]
queue-4.19/f2fs-fix-to-release-node-block-count-in-error-path-o.patch [new file with mode: 0644]
queue-4.19/firmware-dmi-id-add-a-release-callback-function.patch [new file with mode: 0644]
queue-4.19/greybus-arche-ctrl-move-device-table-to-its-right-lo.patch [new file with mode: 0644]
queue-4.19/greybus-lights-check-return-of-get_channel_from_mode.patch [new file with mode: 0644]
queue-4.19/libsubcmd-fix-parse-options-memory-leak.patch [new file with mode: 0644]
queue-4.19/microblaze-remove-early-printk-call-from-cpuinfo-sta.patch [new file with mode: 0644]
queue-4.19/microblaze-remove-gcc-flag-for-non-existing-early_pr.patch [new file with mode: 0644]
queue-4.19/perf-annotate-add-demangle-and-demangle-kernel.patch [new file with mode: 0644]
queue-4.19/perf-annotate-get-rid-of-duplicate-group-option-item.patch [new file with mode: 0644]
queue-4.19/perf-probe-add-missing-libgen.h-header-needed-for-us.patch [new file with mode: 0644]
queue-4.19/ppdev-add-an-error-check-in-register_device.patch [new file with mode: 0644]
queue-4.19/ppdev-remove-usage-of-the-deprecated-ida_simple_xx-a.patch [new file with mode: 0644]
queue-4.19/serial-max3100-fix-bitwise-types.patch [new file with mode: 0644]
queue-4.19/serial-max3100-lock-port-lock-when-calling-uart_hand.patch [new file with mode: 0644]
queue-4.19/serial-max3100-update-uart_driver_registered-on-driv.patch [new file with mode: 0644]
queue-4.19/serial-sh-sci-extract-sci_dma_rx_chan_invalidate.patch [new file with mode: 0644]
queue-4.19/serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/stm-class-fix-a-double-free-in-stm_register_device.patch [new file with mode: 0644]
queue-4.19/usb-gadget-u_audio-clear-uac-pointer-when-freed.patch [new file with mode: 0644]

diff --git a/queue-4.19/dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch b/queue-4.19/dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch
new file mode 100644 (file)
index 0000000..5fe2103
--- /dev/null
@@ -0,0 +1,40 @@
+From 89fc7c2ea1b437ae22ad33971b7448d6d95e527b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 02:49:32 +0000
+Subject: dmaengine: idma64: Add check for dma_set_max_seg_size
+
+From: Chen Ni <nichen@iscas.ac.cn>
+
+[ Upstream commit 2b1c1cf08a0addb6df42f16b37133dc7a351de29 ]
+
+As the possible failure of the dma_set_max_seg_size(), it should be
+better to check the return value of the dma_set_max_seg_size().
+
+Fixes: e3fdb1894cfa ("dmaengine: idma64: set maximum allowed segment size for DMA")
+Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
+Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20240403024932.3342606-1-nichen@iscas.ac.cn
+Signed-off-by: Vinod Koul <vkoul@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/dma/idma64.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
+index 920e98dc7113e..b2fb42a4385c1 100644
+--- a/drivers/dma/idma64.c
++++ b/drivers/dma/idma64.c
+@@ -603,7 +603,9 @@ static int idma64_probe(struct idma64_chip *chip)
+       idma64->dma.dev = chip->sysdev;
+-      dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK);
++      ret = dma_set_max_seg_size(idma64->dma.dev, IDMA64C_CTLH_BLOCK_TS_MASK);
++      if (ret)
++              return ret;
+       ret = dma_async_device_register(&idma64->dma);
+       if (ret)
+-- 
+2.43.0
+
diff --git a/queue-4.19/extcon-max8997-select-irq_domain-instead-of-dependin.patch b/queue-4.19/extcon-max8997-select-irq_domain-instead-of-dependin.patch
new file mode 100644 (file)
index 0000000..89f71bf
--- /dev/null
@@ -0,0 +1,47 @@
+From 249112f813f5f3cc732ec6e33a5b6d67673d78de Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 12 Feb 2024 22:00:28 -0800
+Subject: extcon: max8997: select IRQ_DOMAIN instead of depending on it
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+[ Upstream commit b1781d0a1458070d40134e4f3412ec9d70099bec ]
+
+IRQ_DOMAIN is a hidden (not user visible) symbol. Users cannot set
+it directly thru "make *config", so drivers should select it instead
+of depending on it if they need it.
+Relying on it being set for a dependency is risky.
+
+Consistently using "select" or "depends on" can also help reduce
+Kconfig circular dependency issues.
+
+Therefore, change EXTCON_MAX8997's use of "depends on" for
+IRQ_DOMAIN to "select".
+
+Link: https://lore.kernel.org/lkml/20240213060028.9744-1-rdunlap@infradead.org/
+Fixes: dca1a71e4108 ("extcon: Add support irq domain for MAX8997 muic")
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Acked-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/extcon/Kconfig | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
+index de15bf55895bd..19a1e32c3a7e9 100644
+--- a/drivers/extcon/Kconfig
++++ b/drivers/extcon/Kconfig
+@@ -101,7 +101,8 @@ config EXTCON_MAX77843
+ config EXTCON_MAX8997
+       tristate "Maxim MAX8997 EXTCON Support"
+-      depends on MFD_MAX8997 && IRQ_DOMAIN
++      depends on MFD_MAX8997
++      select IRQ_DOMAIN
+       help
+         If you say yes here you get support for the MUIC device of
+         Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory
+-- 
+2.43.0
+
diff --git a/queue-4.19/f2fs-add-error-prints-for-debugging-mount-failure.patch b/queue-4.19/f2fs-add-error-prints-for-debugging-mount-failure.patch
new file mode 100644 (file)
index 0000000..19462c9
--- /dev/null
@@ -0,0 +1,62 @@
+From 935dfcb835a013561b4715e33f10175bd2a0bda0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 23 May 2019 09:49:17 +0530
+Subject: f2fs: add error prints for debugging mount failure
+
+From: Sahitya Tummala <stummala@codeaurora.org>
+
+[ Upstream commit 9227d5227b8db354d386f592f159eaa44db1c0b8 ]
+
+Add error prints to get more details on the mount failure.
+
+Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
+Reviewed-by: Chao Yu <yuchao0@huawei.com>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Stable-dep-of: 0fa4e57c1db2 ("f2fs: fix to release node block count in error path of f2fs_new_node_page()")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/f2fs/segment.c | 6 +++++-
+ fs/f2fs/super.c   | 4 ++--
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
+index 7596fce92bef1..34090edc8ce25 100644
+--- a/fs/f2fs/segment.c
++++ b/fs/f2fs/segment.c
+@@ -3409,8 +3409,12 @@ static int restore_curseg_summaries(struct f2fs_sb_info *sbi)
+       /* sanity check for summary blocks */
+       if (nats_in_cursum(nat_j) > NAT_JOURNAL_ENTRIES ||
+-                      sits_in_cursum(sit_j) > SIT_JOURNAL_ENTRIES)
++                      sits_in_cursum(sit_j) > SIT_JOURNAL_ENTRIES) {
++              f2fs_msg(sbi->sb, KERN_ERR,
++                      "invalid journal entries nats %u sits %u\n",
++                      nats_in_cursum(nat_j), sits_in_cursum(sit_j));
+               return -EINVAL;
++      }
+       return 0;
+ }
+diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
+index 89fc8a4ce1497..b075ba3e62dcd 100644
+--- a/fs/f2fs/super.c
++++ b/fs/f2fs/super.c
+@@ -3016,13 +3016,13 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
+       err = f2fs_build_segment_manager(sbi);
+       if (err) {
+               f2fs_msg(sb, KERN_ERR,
+-                      "Failed to initialize F2FS segment manager");
++                      "Failed to initialize F2FS segment manager (%d)", err);
+               goto free_sm;
+       }
+       err = f2fs_build_node_manager(sbi);
+       if (err) {
+               f2fs_msg(sb, KERN_ERR,
+-                      "Failed to initialize F2FS node manager");
++                      "Failed to initialize F2FS node manager (%d)", err);
+               goto free_nm;
+       }
+-- 
+2.43.0
+
diff --git a/queue-4.19/f2fs-fix-to-release-node-block-count-in-error-path-o.patch b/queue-4.19/f2fs-fix-to-release-node-block-count-in-error-path-o.patch
new file mode 100644 (file)
index 0000000..037a6d0
--- /dev/null
@@ -0,0 +1,44 @@
+From bcb9227a4b84c7c5246ebff66451932f976e7218 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 7 May 2024 11:31:00 +0800
+Subject: f2fs: fix to release node block count in error path of
+ f2fs_new_node_page()
+
+From: Chao Yu <chao@kernel.org>
+
+[ Upstream commit 0fa4e57c1db263effd72d2149d4e21da0055c316 ]
+
+It missed to call dec_valid_node_count() to release node block count
+in error path, fix it.
+
+Fixes: 141170b759e0 ("f2fs: fix to avoid use f2fs_bug_on() in f2fs_new_node_page()")
+Signed-off-by: Chao Yu <chao@kernel.org>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/f2fs/node.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
+index 9911f780e0136..38a937bdcf8ba 100644
+--- a/fs/f2fs/node.c
++++ b/fs/f2fs/node.c
+@@ -1236,6 +1236,7 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)
+       }
+       if (unlikely(new_ni.blk_addr != NULL_ADDR)) {
+               err = -EFSCORRUPTED;
++              dec_valid_node_count(sbi, dn->inode, !ofs);
+               set_sbi_flag(sbi, SBI_NEED_FSCK);
+               goto fail;
+       }
+@@ -1261,7 +1262,6 @@ struct page *f2fs_new_node_page(struct dnode_of_data *dn, unsigned int ofs)
+       if (ofs == 0)
+               inc_valid_inode_count(sbi);
+       return page;
+-
+ fail:
+       clear_node_page_dirty(page);
+       f2fs_put_page(page, 1);
+-- 
+2.43.0
+
diff --git a/queue-4.19/firmware-dmi-id-add-a-release-callback-function.patch b/queue-4.19/firmware-dmi-id-add-a-release-callback-function.patch
new file mode 100644 (file)
index 0000000..d16d568
--- /dev/null
@@ -0,0 +1,50 @@
+From 20e23e5cc2979ab61be1f3de885f69477b426eef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 8 Apr 2024 09:34:24 +0200
+Subject: firmware: dmi-id: add a release callback function
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit cf770af5645a41a753c55a053fa1237105b0964a ]
+
+dmi_class uses kfree() as the .release function, but that now causes
+a warning with clang-16 as it violates control flow integrity (KCFI)
+rules:
+
+drivers/firmware/dmi-id.c:174:17: error: cast from 'void (*)(const void *)' to 'void (*)(struct device *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
+  174 |         .dev_release = (void(*)(struct device *)) kfree,
+
+Add an explicit function to call kfree() instead.
+
+Fixes: 4f5c791a850e ("DMI-based module autoloading")
+Link: https://lore.kernel.org/lkml/20240213100238.456912-1-arnd@kernel.org/
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Jean Delvare <jdelvare@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/firmware/dmi-id.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/firmware/dmi-id.c b/drivers/firmware/dmi-id.c
+index 624a11cb07e23..3ddff56fec995 100644
+--- a/drivers/firmware/dmi-id.c
++++ b/drivers/firmware/dmi-id.c
+@@ -161,9 +161,14 @@ static int dmi_dev_uevent(struct device *dev, struct kobj_uevent_env *env)
+       return 0;
+ }
++static void dmi_dev_release(struct device *dev)
++{
++      kfree(dev);
++}
++
+ static struct class dmi_class = {
+       .name = "dmi",
+-      .dev_release = (void(*)(struct device *)) kfree,
++      .dev_release = dmi_dev_release,
+       .dev_uevent = dmi_dev_uevent,
+ };
+-- 
+2.43.0
+
diff --git a/queue-4.19/greybus-arche-ctrl-move-device-table-to-its-right-lo.patch b/queue-4.19/greybus-arche-ctrl-move-device-table-to-its-right-lo.patch
new file mode 100644 (file)
index 0000000..1df4285
--- /dev/null
@@ -0,0 +1,66 @@
+From bc2e533988699ebf8d9eff16976623dfd0b4db18 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 10:06:35 +0200
+Subject: greybus: arche-ctrl: move device table to its right location
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 6a0b8c0da8d8d418cde6894a104cf74e6098ddfa ]
+
+The arche-ctrl has two platform drivers and three of_device_id tables,
+but one table is only used for the the module loader, while the other
+two seem to be associated with their drivers.
+
+This leads to a W=1 warning when the driver is built-in:
+
+drivers/staging/greybus/arche-platform.c:623:34: error: 'arche_combined_id' defined but not used [-Werror=unused-const-variable=]
+  623 | static const struct of_device_id arche_combined_id[] = {
+
+Drop the extra table and register both tables that are actually
+used as the ones for the module loader instead.
+
+Fixes: 7b62b61c752a ("greybus: arche-ctrl: Don't expose driver internals to arche-platform driver")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Link: https://lore.kernel.org/r/20240403080702.3509288-18-arnd@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/greybus/arche-apb-ctrl.c | 1 +
+ drivers/staging/greybus/arche-platform.c | 9 +--------
+ 2 files changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/staging/greybus/arche-apb-ctrl.c b/drivers/staging/greybus/arche-apb-ctrl.c
+index cc8d6fc831b41..94740142c4e25 100644
+--- a/drivers/staging/greybus/arche-apb-ctrl.c
++++ b/drivers/staging/greybus/arche-apb-ctrl.c
+@@ -499,6 +499,7 @@ static const struct of_device_id arche_apb_ctrl_of_match[] = {
+       { .compatible = "usbffff,2", },
+       { },
+ };
++MODULE_DEVICE_TABLE(of, arche_apb_ctrl_of_match);
+ static struct platform_driver arche_apb_ctrl_device_driver = {
+       .probe          = arche_apb_ctrl_probe,
+diff --git a/drivers/staging/greybus/arche-platform.c b/drivers/staging/greybus/arche-platform.c
+index 4c36e88766e75..0320121dd9d25 100644
+--- a/drivers/staging/greybus/arche-platform.c
++++ b/drivers/staging/greybus/arche-platform.c
+@@ -664,14 +664,7 @@ static const struct of_device_id arche_platform_of_match[] = {
+       { .compatible = "google,arche-platform", },
+       { },
+ };
+-
+-static const struct of_device_id arche_combined_id[] = {
+-      /* Use PID/VID of SVC device */
+-      { .compatible = "google,arche-platform", },
+-      { .compatible = "usbffff,2", },
+-      { },
+-};
+-MODULE_DEVICE_TABLE(of, arche_combined_id);
++MODULE_DEVICE_TABLE(of, arche_platform_of_match);
+ static struct platform_driver arche_platform_device_driver = {
+       .probe          = arche_platform_probe,
+-- 
+2.43.0
+
diff --git a/queue-4.19/greybus-lights-check-return-of-get_channel_from_mode.patch b/queue-4.19/greybus-lights-check-return-of-get_channel_from_mode.patch
new file mode 100644 (file)
index 0000000..0395300
--- /dev/null
@@ -0,0 +1,59 @@
+From 05da1e9d8ff37cf72a26de8a3537dd2e091b6a70 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Mar 2024 22:09:55 +0000
+Subject: greybus: lights: check return of get_channel_from_mode
+
+From: Rui Miguel Silva <rmfrfs@gmail.com>
+
+[ Upstream commit a1ba19a1ae7cd1e324685ded4ab563e78fe68648 ]
+
+If channel for the given node is not found we return null from
+get_channel_from_mode. Make sure we validate the return pointer
+before using it in two of the missing places.
+
+This was originally reported in [0]:
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+[0] https://lore.kernel.org/all/20240301190425.120605-1-m.lobanov@rosalinux.ru
+
+Fixes: 2870b52bae4c ("greybus: lights: add lights implementation")
+Reported-by: Mikhail Lobanov <m.lobanov@rosalinux.ru>
+Suggested-by: Mikhail Lobanov <m.lobanov@rosalinux.ru>
+Suggested-by: Alex Elder <elder@ieee.org>
+Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
+Link: https://lore.kernel.org/r/20240325221549.2185265-1-rmfrfs@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/staging/greybus/light.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c
+index 8c5819d1e1abe..9dc51315f1fc6 100644
+--- a/drivers/staging/greybus/light.c
++++ b/drivers/staging/greybus/light.c
+@@ -149,6 +149,9 @@ static int __gb_lights_flash_brightness_set(struct gb_channel *channel)
+               channel = get_channel_from_mode(channel->light,
+                                               GB_CHANNEL_MODE_TORCH);
++      if (!channel)
++              return -EINVAL;
++
+       /* For not flash we need to convert brightness to intensity */
+       intensity = channel->intensity_uA.min +
+                       (channel->intensity_uA.step * channel->led->brightness);
+@@ -552,7 +555,10 @@ static int gb_lights_light_v4l2_register(struct gb_light *light)
+       }
+       channel_flash = get_channel_from_mode(light, GB_CHANNEL_MODE_FLASH);
+-      WARN_ON(!channel_flash);
++      if (!channel_flash) {
++              dev_err(dev, "failed to get flash channel from mode\n");
++              return -EINVAL;
++      }
+       fled = &channel_flash->fled;
+-- 
+2.43.0
+
diff --git a/queue-4.19/libsubcmd-fix-parse-options-memory-leak.patch b/queue-4.19/libsubcmd-fix-parse-options-memory-leak.patch
new file mode 100644 (file)
index 0000000..ed1ad6a
--- /dev/null
@@ -0,0 +1,61 @@
+From d1218794e8d924f127b5c601b8cdde5188d8b7cb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 May 2024 22:20:15 -0700
+Subject: libsubcmd: Fix parse-options memory leak
+
+From: Ian Rogers <irogers@google.com>
+
+[ Upstream commit 230a7a71f92212e723fa435d4ca5922de33ec88a ]
+
+If a usage string is built in parse_options_subcommand, also free it.
+
+Fixes: 901421a5bdf605d2 ("perf tools: Remove subcmd dependencies on strbuf")
+Signed-off-by: Ian Rogers <irogers@google.com>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Cc: Ingo Molnar <mingo@redhat.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Josh Poimboeuf <jpoimboe@kernel.org>
+Cc: Kan Liang <kan.liang@linux.intel.com>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: https://lore.kernel.org/r/20240509052015.1914670-1-irogers@google.com
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/lib/subcmd/parse-options.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/tools/lib/subcmd/parse-options.c b/tools/lib/subcmd/parse-options.c
+index cb7154eccbdc1..bf983f51db50c 100644
+--- a/tools/lib/subcmd/parse-options.c
++++ b/tools/lib/subcmd/parse-options.c
+@@ -612,11 +612,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o
+                       const char *const subcommands[], const char *usagestr[], int flags)
+ {
+       struct parse_opt_ctx_t ctx;
++      char *buf = NULL;
+       /* build usage string if it's not provided */
+       if (subcommands && !usagestr[0]) {
+-              char *buf = NULL;
+-
+               astrcatf(&buf, "%s %s [<options>] {", subcmd_config.exec_name, argv[0]);
+               for (int i = 0; subcommands[i]; i++) {
+@@ -658,7 +657,10 @@ int parse_options_subcommand(int argc, const char **argv, const struct option *o
+                       astrcatf(&error_buf, "unknown switch `%c'", *ctx.opt);
+               usage_with_options(usagestr, options);
+       }
+-
++      if (buf) {
++              usagestr[0] = NULL;
++              free(buf);
++      }
+       return parse_options_end(&ctx);
+ }
+-- 
+2.43.0
+
diff --git a/queue-4.19/microblaze-remove-early-printk-call-from-cpuinfo-sta.patch b/queue-4.19/microblaze-remove-early-printk-call-from-cpuinfo-sta.patch
new file mode 100644 (file)
index 0000000..e313909
--- /dev/null
@@ -0,0 +1,37 @@
+From 20dcc6fc3106f08744c51255d20a3fca0bc6d637 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 11 Apr 2024 10:27:21 +0200
+Subject: microblaze: Remove early printk call from cpuinfo-static.c
+
+From: Michal Simek <michal.simek@amd.com>
+
+[ Upstream commit 58d647506c92ccd3cfa0c453c68ddd14f40bf06f ]
+
+Early printk has been removed already that's why also remove calling it.
+Similar change has been done in cpuinfo-pvr-full.c by commit cfbd8d1979af
+("microblaze: Remove early printk setup").
+
+Fixes: 96f0e6fcc9ad ("microblaze: remove redundant early_printk support")
+Signed-off-by: Michal Simek <michal.simek@amd.com>
+Link: https://lore.kernel.org/r/2f10db506be8188fa07b6ec331caca01af1b10f8.1712824039.git.michal.simek@amd.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/microblaze/kernel/cpu/cpuinfo-static.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c
+index 85dbda4a08a81..03da36dc6d9c9 100644
+--- a/arch/microblaze/kernel/cpu/cpuinfo-static.c
++++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
+@@ -18,7 +18,7 @@ static const char family_string[] = CONFIG_XILINX_MICROBLAZE0_FAMILY;
+ static const char cpu_ver_string[] = CONFIG_XILINX_MICROBLAZE0_HW_VER;
+ #define err_printk(x) \
+-      early_printk("ERROR: Microblaze " x "-different for kernel and DTS\n");
++      pr_err("ERROR: Microblaze " x "-different for kernel and DTS\n");
+ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
+ {
+-- 
+2.43.0
+
diff --git a/queue-4.19/microblaze-remove-gcc-flag-for-non-existing-early_pr.patch b/queue-4.19/microblaze-remove-gcc-flag-for-non-existing-early_pr.patch
new file mode 100644 (file)
index 0000000..32a4186
--- /dev/null
@@ -0,0 +1,36 @@
+From 8087cd13ab3cf40342d3cf4acce38fd52f61e64a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 11 Apr 2024 10:21:44 +0200
+Subject: microblaze: Remove gcc flag for non existing early_printk.c file
+
+From: Michal Simek <michal.simek@amd.com>
+
+[ Upstream commit edc66cf0c4164aa3daf6cc55e970bb94383a6a57 ]
+
+early_printk support for removed long time ago but compilation flag for
+ftrace still points to already removed file that's why remove that line
+too.
+
+Fixes: 96f0e6fcc9ad ("microblaze: remove redundant early_printk support")
+Signed-off-by: Michal Simek <michal.simek@amd.com>
+Link: https://lore.kernel.org/r/5493467419cd2510a32854e2807bcd263de981a0.1712823702.git.michal.simek@amd.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/microblaze/kernel/Makefile | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
+index dd71637437f4f..8b9d52b194cb4 100644
+--- a/arch/microblaze/kernel/Makefile
++++ b/arch/microblaze/kernel/Makefile
+@@ -7,7 +7,6 @@ ifdef CONFIG_FUNCTION_TRACER
+ # Do not trace early boot code and low level code
+ CFLAGS_REMOVE_timer.o = -pg
+ CFLAGS_REMOVE_intc.o = -pg
+-CFLAGS_REMOVE_early_printk.o = -pg
+ CFLAGS_REMOVE_ftrace.o = -pg
+ CFLAGS_REMOVE_process.o = -pg
+ endif
+-- 
+2.43.0
+
diff --git a/queue-4.19/perf-annotate-add-demangle-and-demangle-kernel.patch b/queue-4.19/perf-annotate-add-demangle-and-demangle-kernel.patch
new file mode 100644 (file)
index 0000000..dcaae01
--- /dev/null
@@ -0,0 +1,62 @@
+From ffe555e5e0ce9dbc178c94896fadb680a04d39c6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Mar 2021 20:33:55 +0200
+Subject: perf annotate: Add --demangle and --demangle-kernel
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Martin Liška <mliska@suse.cz>
+
+[ Upstream commit 3406ac5347dbf64ab9f7b137ed25a18493f5ea2d ]
+
+'perf annotate' supports --symbol but it's impossible to filter a C++
+symbol. With --no-demangle one can filter easily by mangled function
+name.
+
+Signed-off-by: Martin Liška <mliska@suse.cz>
+Link: http://lore.kernel.org/lkml/c3c7e959-9f7f-18e2-e795-f604275cbac3@suse.cz
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Stable-dep-of: 374af9f1f06b ("perf annotate: Get rid of duplicate --group option item")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/Documentation/perf-annotate.txt | 7 +++++++
+ tools/perf/builtin-annotate.c              | 4 ++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/tools/perf/Documentation/perf-annotate.txt b/tools/perf/Documentation/perf-annotate.txt
+index e8c972f89357d..066ecfffbf4ed 100644
+--- a/tools/perf/Documentation/perf-annotate.txt
++++ b/tools/perf/Documentation/perf-annotate.txt
+@@ -118,6 +118,13 @@ OPTIONS
+ --group::
+       Show event group information together
++--demangle::
++      Demangle symbol names to human readable form. It's enabled by default,
++      disable with --no-demangle.
++
++--demangle-kernel::
++      Demangle kernel symbol names to human readable form (for C++ kernels).
++
+ --percent-type::
+       Set annotation percent type from following choices:
+         global-period, local-period, global-hits, local-hits
+diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
+index 830481b8db26a..d12430fe9c783 100644
+--- a/tools/perf/builtin-annotate.c
++++ b/tools/perf/builtin-annotate.c
+@@ -533,6 +533,10 @@ int cmd_annotate(int argc, const char **argv)
+                  "Specify disassembler style (e.g. -M intel for intel syntax)"),
+       OPT_STRING(0, "objdump", &annotate.opts.objdump_path, "path",
+                  "objdump binary to use for disassembly and annotations"),
++      OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle,
++                  "Enable symbol demangling"),
++      OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
++                  "Enable kernel symbol demangling"),
+       OPT_BOOLEAN(0, "group", &symbol_conf.event_group,
+                   "Show event group information together"),
+       OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
+-- 
+2.43.0
+
diff --git a/queue-4.19/perf-annotate-get-rid-of-duplicate-group-option-item.patch b/queue-4.19/perf-annotate-get-rid-of-duplicate-group-option-item.patch
new file mode 100644 (file)
index 0000000..631f550
--- /dev/null
@@ -0,0 +1,48 @@
+From 4e48c899ca93506e41f82ffc104535acccf7f5f9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 22 Mar 2024 15:43:12 -0700
+Subject: perf annotate: Get rid of duplicate --group option item
+
+From: Namhyung Kim <namhyung@kernel.org>
+
+[ Upstream commit 374af9f1f06b5e991c810d2e4983d6f58df32136 ]
+
+The options array in cmd_annotate() has duplicate --group options.  It
+only needs one and let's get rid of the other.
+
+  $ perf annotate -h 2>&1 | grep group
+        --group           Show event group information together
+        --group           Show event group information together
+
+Fixes: 7ebaf4890f63eb90 ("perf annotate: Support '--group' option")
+Reviewed-by: Kan Liang <kan.liang@linux.intel.com>
+Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Ingo Molnar <mingo@kernel.org>
+Cc: Jin Yao <yao.jin@linux.intel.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Link: https://lore.kernel.org/r/20240322224313.423181-1-namhyung@kernel.org
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/builtin-annotate.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
+index d12430fe9c783..17d008b706c92 100644
+--- a/tools/perf/builtin-annotate.c
++++ b/tools/perf/builtin-annotate.c
+@@ -537,8 +537,6 @@ int cmd_annotate(int argc, const char **argv)
+                   "Enable symbol demangling"),
+       OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel,
+                   "Enable kernel symbol demangling"),
+-      OPT_BOOLEAN(0, "group", &symbol_conf.event_group,
+-                  "Show event group information together"),
+       OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period,
+                   "Show a column with the sum of periods"),
+       OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
+-- 
+2.43.0
+
diff --git a/queue-4.19/perf-probe-add-missing-libgen.h-header-needed-for-us.patch b/queue-4.19/perf-probe-add-missing-libgen.h-header-needed-for-us.patch
new file mode 100644 (file)
index 0000000..d644e3a
--- /dev/null
@@ -0,0 +1,53 @@
+From 04af210e5a2bad24c4c984d1bb1cd6e64770de59 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 21 Mar 2024 11:13:30 -0300
+Subject: perf probe: Add missing libgen.h header needed for using basename()
+
+From: Arnaldo Carvalho de Melo <acme@redhat.com>
+
+[ Upstream commit 581037151910126a7934e369e4b6ac70eda9a703 ]
+
+This prototype is obtained indirectly, by luck, from some other header
+in probe-event.c in most systems, but recently exploded on alpine:edge:
+
+   8    13.39 alpine:edge                   : FAIL gcc version 13.2.1 20240309 (Alpine 13.2.1_git20240309)
+    util/probe-event.c: In function 'convert_exec_to_group':
+    util/probe-event.c:225:16: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration]
+      225 |         ptr1 = basename(exec_copy);
+          |                ^~~~~~~~
+    util/probe-event.c:225:14: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
+      225 |         ptr1 = basename(exec_copy);
+          |              ^
+    cc1: all warnings being treated as errors
+    make[3]: *** [/git/perf-6.8.0/tools/build/Makefile.build:158: util] Error 2
+
+Fix it by adding the libgen.h header where basename() is prototyped.
+
+Fixes: fb7345bbf7fad9bf ("perf probe: Support basic dwarf-based operations on uprobe events")
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Adrian Hunter <adrian.hunter@intel.com>
+Cc: Ian Rogers <irogers@google.com>
+Cc: Jiri Olsa <jolsa@kernel.org>
+Cc: Namhyung Kim <namhyung@kernel.org>
+Link: https://lore.kernel.org/lkml/
+Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/perf/util/probe-event.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
+index 4aeb3e1399010..c4c72d5c82ccc 100644
+--- a/tools/perf/util/probe-event.c
++++ b/tools/perf/util/probe-event.c
+@@ -25,6 +25,7 @@
+ #include <sys/stat.h>
+ #include <fcntl.h>
+ #include <errno.h>
++#include <libgen.h>
+ #include <stdio.h>
+ #include <unistd.h>
+ #include <stdlib.h>
+-- 
+2.43.0
+
diff --git a/queue-4.19/ppdev-add-an-error-check-in-register_device.patch b/queue-4.19/ppdev-add-an-error-check-in-register_device.patch
new file mode 100644 (file)
index 0000000..4df7ada
--- /dev/null
@@ -0,0 +1,72 @@
+From 76139ec6ee07e238448e1550c7e71a2da3f5ce8e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 12 Apr 2024 16:38:40 +0800
+Subject: ppdev: Add an error check in register_device
+
+From: Huai-Yuan Liu <qq810974084@gmail.com>
+
+[ Upstream commit fbf740aeb86a4fe82ad158d26d711f2f3be79b3e ]
+
+In register_device, the return value of ida_simple_get is unchecked,
+in witch ida_simple_get will use an invalid index value.
+
+To address this issue, index should be checked after ida_simple_get. When
+the index value is abnormal, a warning message should be printed, the port
+should be dropped, and the value should be recorded.
+
+Fixes: 9a69645dde11 ("ppdev: fix registering same device name")
+Signed-off-by: Huai-Yuan Liu <qq810974084@gmail.com>
+Link: https://lore.kernel.org/r/20240412083840.234085-1-qq810974084@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/ppdev.c | 15 +++++++++++----
+ 1 file changed, 11 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
+index af74b05d470c3..6422a184a58aa 100644
+--- a/drivers/char/ppdev.c
++++ b/drivers/char/ppdev.c
+@@ -300,28 +300,35 @@ static int register_device(int minor, struct pp_struct *pp)
+       if (!port) {
+               pr_warn("%s: no associated port!\n", name);
+               rc = -ENXIO;
+-              goto err;
++              goto err_free_name;
+       }
+       index = ida_alloc(&ida_index, GFP_KERNEL);
++      if (index < 0) {
++              pr_warn("%s: failed to get index!\n", name);
++              rc = index;
++              goto err_put_port;
++      }
++
+       memset(&ppdev_cb, 0, sizeof(ppdev_cb));
+       ppdev_cb.irq_func = pp_irq;
+       ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
+       ppdev_cb.private = pp;
+       pdev = parport_register_dev_model(port, name, &ppdev_cb, index);
+-      parport_put_port(port);
+       if (!pdev) {
+               pr_warn("%s: failed to register device!\n", name);
+               rc = -ENXIO;
+               ida_free(&ida_index, index);
+-              goto err;
++              goto err_put_port;
+       }
+       pp->pdev = pdev;
+       pp->index = index;
+       dev_dbg(&pdev->dev, "registered pardevice\n");
+-err:
++err_put_port:
++      parport_put_port(port);
++err_free_name:
+       kfree(name);
+       return rc;
+ }
+-- 
+2.43.0
+
diff --git a/queue-4.19/ppdev-remove-usage-of-the-deprecated-ida_simple_xx-a.patch b/queue-4.19/ppdev-remove-usage-of-the-deprecated-ida_simple_xx-a.patch
new file mode 100644 (file)
index 0000000..ab7bd70
--- /dev/null
@@ -0,0 +1,57 @@
+From d2db63b026091d0252191b5451d3ea343c1bd312 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Dec 2023 06:01:47 +0100
+Subject: ppdev: Remove usage of the deprecated ida_simple_xx() API
+
+From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+
+[ Upstream commit d8407f71ebeaeb6f50bd89791837873e44609708 ]
+
+ida_alloc() and ida_free() should be preferred to the deprecated
+ida_simple_get() and ida_simple_remove().
+
+This is less verbose.
+
+Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
+Link: https://lore.kernel.org/r/ba9da12fdd5cdb2c28180b7160af5042447d803f.1702962092.git.christophe.jaillet@wanadoo.fr
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Stable-dep-of: fbf740aeb86a ("ppdev: Add an error check in register_device")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/ppdev.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c
+index 51faafd310a2e..af74b05d470c3 100644
+--- a/drivers/char/ppdev.c
++++ b/drivers/char/ppdev.c
+@@ -303,7 +303,7 @@ static int register_device(int minor, struct pp_struct *pp)
+               goto err;
+       }
+-      index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
++      index = ida_alloc(&ida_index, GFP_KERNEL);
+       memset(&ppdev_cb, 0, sizeof(ppdev_cb));
+       ppdev_cb.irq_func = pp_irq;
+       ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
+@@ -314,7 +314,7 @@ static int register_device(int minor, struct pp_struct *pp)
+       if (!pdev) {
+               pr_warn("%s: failed to register device!\n", name);
+               rc = -ENXIO;
+-              ida_simple_remove(&ida_index, index);
++              ida_free(&ida_index, index);
+               goto err;
+       }
+@@ -766,7 +766,7 @@ static int pp_release(struct inode *inode, struct file *file)
+       if (pp->pdev) {
+               parport_unregister_device(pp->pdev);
+-              ida_simple_remove(&ida_index, pp->index);
++              ida_free(&ida_index, pp->index);
+               pp->pdev = NULL;
+               pr_debug(CHRDEV "%x: unregistered pardevice\n", minor);
+       }
+-- 
+2.43.0
+
diff --git a/queue-4.19/serial-max3100-fix-bitwise-types.patch b/queue-4.19/serial-max3100-fix-bitwise-types.patch
new file mode 100644 (file)
index 0000000..12f6f37
--- /dev/null
@@ -0,0 +1,53 @@
+From 38ac8ec699d6afe8a20d7e95ec7fc19160274f19 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 2 Apr 2024 22:50:30 +0300
+Subject: serial: max3100: Fix bitwise types
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit e60955dbecb97f080848a57524827e2db29c70fd ]
+
+Sparse is not happy about misuse of bitwise types:
+
+  .../max3100.c:194:13: warning: incorrect type in assignment (different base types)
+  .../max3100.c:194:13:    expected unsigned short [addressable] [usertype] etx
+  .../max3100.c:194:13:    got restricted __be16 [usertype]
+  .../max3100.c:202:15: warning: cast to restricted __be16
+
+Fix this by choosing proper types for the respective variables.
+
+Fixes: 7831d56b0a35 ("tty: MAX3100")
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20240402195306.269276-4-andriy.shevchenko@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/max3100.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
+index c1ee88f530334..17b6f4a872d6a 100644
+--- a/drivers/tty/serial/max3100.c
++++ b/drivers/tty/serial/max3100.c
+@@ -45,6 +45,9 @@
+ #include <linux/freezer.h>
+ #include <linux/tty.h>
+ #include <linux/tty_flip.h>
++#include <linux/types.h>
++
++#include <asm/unaligned.h>
+ #include <linux/serial_max3100.h>
+@@ -191,7 +194,7 @@ static void max3100_timeout(struct timer_list *t)
+ static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)
+ {
+       struct spi_message message;
+-      u16 etx, erx;
++      __be16 etx, erx;
+       int status;
+       struct spi_transfer tran = {
+               .tx_buf = &etx,
+-- 
+2.43.0
+
diff --git a/queue-4.19/serial-max3100-lock-port-lock-when-calling-uart_hand.patch b/queue-4.19/serial-max3100-lock-port-lock-when-calling-uart_hand.patch
new file mode 100644 (file)
index 0000000..34a9fbd
--- /dev/null
@@ -0,0 +1,66 @@
+From 1902b1c71a7ce473fdaf825ad0e912eabca307fe Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 2 Apr 2024 22:50:28 +0300
+Subject: serial: max3100: Lock port->lock when calling
+ uart_handle_cts_change()
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit 77ab53371a2066fdf9b895246505f5ef5a4b5d47 ]
+
+uart_handle_cts_change() has to be called with port lock taken,
+Since we run it in a separate work, the lock may not be taken at
+the time of running. Make sure that it's taken by explicitly doing
+that. Without it we got a splat:
+
+  WARNING: CPU: 0 PID: 10 at drivers/tty/serial/serial_core.c:3491 uart_handle_cts_change+0xa6/0xb0
+  ...
+  Workqueue: max3100-0 max3100_work [max3100]
+  RIP: 0010:uart_handle_cts_change+0xa6/0xb0
+  ...
+   max3100_handlerx+0xc5/0x110 [max3100]
+   max3100_work+0x12a/0x340 [max3100]
+
+Fixes: 7831d56b0a35 ("tty: MAX3100")
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Link: https://lore.kernel.org/r/20240402195306.269276-2-andriy.shevchenko@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/max3100.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
+index 371569a0fd00a..915d7753eec2f 100644
+--- a/drivers/tty/serial/max3100.c
++++ b/drivers/tty/serial/max3100.c
+@@ -213,7 +213,7 @@ static int max3100_sr(struct max3100_port *s, u16 tx, u16 *rx)
+       return 0;
+ }
+-static int max3100_handlerx(struct max3100_port *s, u16 rx)
++static int max3100_handlerx_unlocked(struct max3100_port *s, u16 rx)
+ {
+       unsigned int ch, flg, status = 0;
+       int ret = 0, cts;
+@@ -253,6 +253,17 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx)
+       return ret;
+ }
++static int max3100_handlerx(struct max3100_port *s, u16 rx)
++{
++      unsigned long flags;
++      int ret;
++
++      uart_port_lock_irqsave(&s->port, &flags);
++      ret = max3100_handlerx_unlocked(s, rx);
++      uart_port_unlock_irqrestore(&s->port, flags);
++      return ret;
++}
++
+ static void max3100_work(struct work_struct *w)
+ {
+       struct max3100_port *s = container_of(w, struct max3100_port, work);
+-- 
+2.43.0
+
diff --git a/queue-4.19/serial-max3100-update-uart_driver_registered-on-driv.patch b/queue-4.19/serial-max3100-update-uart_driver_registered-on-driv.patch
new file mode 100644 (file)
index 0000000..9996b91
--- /dev/null
@@ -0,0 +1,73 @@
+From c64c9aa51026f7863f1d746e080b40e9e7aae349 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 2 Apr 2024 22:50:29 +0300
+Subject: serial: max3100: Update uart_driver_registered on driver removal
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+
+[ Upstream commit 712a1fcb38dc7cac6da63ee79a88708fbf9c45ec ]
+
+The removal of the last MAX3100 device triggers the removal of
+the driver. However, code doesn't update the respective global
+variable and after insmod — rmmod — insmod cycle the kernel
+oopses:
+
+  max3100 spi-PRP0001:01: max3100_probe: adding port 0
+  BUG: kernel NULL pointer dereference, address: 0000000000000408
+  ...
+  RIP: 0010:serial_core_register_port+0xa0/0x840
+  ...
+   max3100_probe+0x1b6/0x280 [max3100]
+   spi_probe+0x8d/0xb0
+
+Update the actual state so next time UART driver will be registered
+again.
+
+Hugo also noticed, that the error path in the probe also affected
+by having the variable set, and not cleared. Instead of clearing it
+move the assignment after the successfull uart_register_driver() call.
+
+Fixes: 7831d56b0a35 ("tty: MAX3100")
+Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Reviewed-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
+Link: https://lore.kernel.org/r/20240402195306.269276-3-andriy.shevchenko@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/max3100.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/tty/serial/max3100.c b/drivers/tty/serial/max3100.c
+index 915d7753eec2f..c1ee88f530334 100644
+--- a/drivers/tty/serial/max3100.c
++++ b/drivers/tty/serial/max3100.c
+@@ -754,13 +754,14 @@ static int max3100_probe(struct spi_device *spi)
+       mutex_lock(&max3100s_lock);
+       if (!uart_driver_registered) {
+-              uart_driver_registered = 1;
+               retval = uart_register_driver(&max3100_uart_driver);
+               if (retval) {
+                       printk(KERN_ERR "Couldn't register max3100 uart driver\n");
+                       mutex_unlock(&max3100s_lock);
+                       return retval;
+               }
++
++              uart_driver_registered = 1;
+       }
+       for (i = 0; i < MAX_MAX3100; i++)
+@@ -846,6 +847,7 @@ static int max3100_remove(struct spi_device *spi)
+               }
+       pr_debug("removing max3100 driver\n");
+       uart_unregister_driver(&max3100_uart_driver);
++      uart_driver_registered = 0;
+       mutex_unlock(&max3100s_lock);
+       return 0;
+-- 
+2.43.0
+
diff --git a/queue-4.19/serial-sh-sci-extract-sci_dma_rx_chan_invalidate.patch b/queue-4.19/serial-sh-sci-extract-sci_dma_rx_chan_invalidate.patch
new file mode 100644 (file)
index 0000000..6cfd0c0
--- /dev/null
@@ -0,0 +1,66 @@
+From 374d6677bc8c5fcc2e361a258b3b9c30757a8317 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 7 Jan 2019 17:23:17 +0100
+Subject: serial: sh-sci: Extract sci_dma_rx_chan_invalidate()
+
+From: Geert Uytterhoeven <geert+renesas@glider.be>
+
+[ Upstream commit 11b3770d54b28dcd905155a6d4aa551187ff00eb ]
+
+The cookies and channel pointer for the DMA receive channel are
+invalidated in two places, and one more is planned.
+Extract this functionality in a common helper.
+
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Stable-dep-of: aae20f6e34cd ("serial: sh-sci: protect invalidating RXDMA on shutdown")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/sh-sci.c | 19 +++++++++++++------
+ 1 file changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index dfe9ac3b95af2..8a7592cd1aff9 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1248,12 +1248,22 @@ static int sci_dma_rx_find_active(struct sci_port *s)
+       return -1;
+ }
++static void sci_dma_rx_chan_invalidate(struct sci_port *s)
++{
++      unsigned int i;
++
++      s->chan_rx = NULL;
++      for (i = 0; i < ARRAY_SIZE(s->cookie_rx); i++)
++              s->cookie_rx[i] = -EINVAL;
++      s->active_rx = 0;
++}
++
+ static void sci_rx_dma_release(struct sci_port *s)
+ {
+       struct dma_chan *chan = s->chan_rx_saved;
+-      s->chan_rx_saved = s->chan_rx = NULL;
+-      s->cookie_rx[0] = s->cookie_rx[1] = -EINVAL;
++      s->chan_rx_saved = NULL;
++      sci_dma_rx_chan_invalidate(s);
+       dmaengine_terminate_sync(chan);
+       dma_free_coherent(chan->device->dev, s->buf_len_rx * 2, s->rx_buf[0],
+                         sg_dma_address(&s->sg_rx[0]));
+@@ -1372,10 +1382,7 @@ static int sci_submit_rx(struct sci_port *s, bool port_lock_held)
+               spin_lock_irqsave(&port->lock, flags);
+       if (i)
+               dmaengine_terminate_async(chan);
+-      for (i = 0; i < 2; i++)
+-              s->cookie_rx[i] = -EINVAL;
+-      s->active_rx = 0;
+-      s->chan_rx = NULL;
++      sci_dma_rx_chan_invalidate(s);
+       sci_start_rx(port);
+       if (!port_lock_held)
+               spin_unlock_irqrestore(&port->lock, flags);
+-- 
+2.43.0
+
diff --git a/queue-4.19/serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch b/queue-4.19/serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch
new file mode 100644 (file)
index 0000000..6d2c443
--- /dev/null
@@ -0,0 +1,47 @@
+From b478e7f92acf5f7bfc6b44d587bd2fd85fee7803 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 May 2024 13:40:17 +0200
+Subject: serial: sh-sci: protect invalidating RXDMA on shutdown
+
+From: Wolfram Sang <wsa+renesas@sang-engineering.com>
+
+[ Upstream commit aae20f6e34cd0cbd67a1d0e5877561c40109a81b ]
+
+The to-be-fixed commit removed locking when invalidating the DMA RX
+descriptors on shutdown. It overlooked that there is still a rx_timer
+running which may still access the protected data. So, re-add the
+locking.
+
+Reported-by: Dirk Behme <dirk.behme@de.bosch.com>
+Closes: https://lore.kernel.org/r/ee6c9e16-9f29-450e-81da-4a8dceaa8fc7@de.bosch.com
+Fixes: 2c4ee23530ff ("serial: sh-sci: Postpone DMA release when falling back to PIO")
+Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
+Link: https://lore.kernel.org/r/20240506114016.30498-7-wsa+renesas@sang-engineering.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tty/serial/sh-sci.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
+index 8a7592cd1aff9..0a89fd43848df 100644
+--- a/drivers/tty/serial/sh-sci.c
++++ b/drivers/tty/serial/sh-sci.c
+@@ -1261,9 +1261,14 @@ static void sci_dma_rx_chan_invalidate(struct sci_port *s)
+ static void sci_rx_dma_release(struct sci_port *s)
+ {
+       struct dma_chan *chan = s->chan_rx_saved;
++      struct uart_port *port = &s->port;
++      unsigned long flags;
++      uart_port_lock_irqsave(port, &flags);
+       s->chan_rx_saved = NULL;
+       sci_dma_rx_chan_invalidate(s);
++      uart_port_unlock_irqrestore(port, flags);
++
+       dmaengine_terminate_sync(chan);
+       dma_free_coherent(chan->device->dev, s->buf_len_rx * 2, s->rx_buf[0],
+                         sg_dma_address(&s->sg_rx[0]));
+-- 
+2.43.0
+
index b1c280311d787b5110582dfb4363ddcac8c7cd35..bd0162e0aac5949c6c5349e691bdd2c9bb378ccf 100644 (file)
@@ -84,3 +84,25 @@ netrom-fix-possible-dead-lock-in-nr_rt_ioctl.patch
 af_packet-do-not-call-packet_read_pending-from-tpack.patch
 sched-topology-don-t-set-sd_balance_wake-on-cpuset-d.patch
 sched-fair-allow-disabling-sched_balance_newidle-wit.patch
+perf-probe-add-missing-libgen.h-header-needed-for-us.patch
+greybus-lights-check-return-of-get_channel_from_mode.patch
+perf-annotate-add-demangle-and-demangle-kernel.patch
+perf-annotate-get-rid-of-duplicate-group-option-item.patch
+dmaengine-idma64-add-check-for-dma_set_max_seg_size.patch
+firmware-dmi-id-add-a-release-callback-function.patch
+serial-max3100-lock-port-lock-when-calling-uart_hand.patch
+serial-max3100-update-uart_driver_registered-on-driv.patch
+serial-max3100-fix-bitwise-types.patch
+greybus-arche-ctrl-move-device-table-to-its-right-lo.patch
+microblaze-remove-gcc-flag-for-non-existing-early_pr.patch
+microblaze-remove-early-printk-call-from-cpuinfo-sta.patch
+usb-gadget-u_audio-clear-uac-pointer-when-freed.patch
+stm-class-fix-a-double-free-in-stm_register_device.patch
+ppdev-remove-usage-of-the-deprecated-ida_simple_xx-a.patch
+ppdev-add-an-error-check-in-register_device.patch
+extcon-max8997-select-irq_domain-instead-of-dependin.patch
+f2fs-add-error-prints-for-debugging-mount-failure.patch
+f2fs-fix-to-release-node-block-count-in-error-path-o.patch
+serial-sh-sci-extract-sci_dma_rx_chan_invalidate.patch
+serial-sh-sci-protect-invalidating-rxdma-on-shutdown.patch
+libsubcmd-fix-parse-options-memory-leak.patch
diff --git a/queue-4.19/stm-class-fix-a-double-free-in-stm_register_device.patch b/queue-4.19/stm-class-fix-a-double-free-in-stm_register_device.patch
new file mode 100644 (file)
index 0000000..b474675
--- /dev/null
@@ -0,0 +1,57 @@
+From b7135665ce1264a77c2de386cb8782281f350cc6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Apr 2024 16:01:05 +0300
+Subject: stm class: Fix a double free in stm_register_device()
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+[ Upstream commit 3df463865ba42b8f88a590326f4c9ea17a1ce459 ]
+
+The put_device(&stm->dev) call will trigger stm_device_release() which
+frees "stm" so the vfree(stm) on the next line is a double free.
+
+Fixes: 389b6699a2aa ("stm class: Fix stm device initialization order")
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Reviewed-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
+Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
+Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com>
+Link: https://lore.kernel.org/r/20240429130119.1518073-2-alexander.shishkin@linux.intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hwtracing/stm/core.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
+index eeba421dc823d..9bb85d20934a0 100644
+--- a/drivers/hwtracing/stm/core.c
++++ b/drivers/hwtracing/stm/core.c
+@@ -701,8 +701,11 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
+               return -ENOMEM;
+       stm->major = register_chrdev(0, stm_data->name, &stm_fops);
+-      if (stm->major < 0)
+-              goto err_free;
++      if (stm->major < 0) {
++              err = stm->major;
++              vfree(stm);
++              return err;
++      }
+       device_initialize(&stm->dev);
+       stm->dev.devt = MKDEV(stm->major, 0);
+@@ -746,10 +749,8 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
+ err_device:
+       unregister_chrdev(stm->major, stm_data->name);
+-      /* matches device_initialize() above */
++      /* calls stm_device_release() */
+       put_device(&stm->dev);
+-err_free:
+-      vfree(stm);
+       return err;
+ }
+-- 
+2.43.0
+
diff --git a/queue-4.19/usb-gadget-u_audio-clear-uac-pointer-when-freed.patch b/queue-4.19/usb-gadget-u_audio-clear-uac-pointer-when-freed.patch
new file mode 100644 (file)
index 0000000..270e481
--- /dev/null
@@ -0,0 +1,40 @@
+From 527019ccdc801c1627d4320c28b1a4766fa6e005 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 25 Apr 2024 15:20:20 +0000
+Subject: usb: gadget: u_audio: Clear uac pointer when freed.
+
+From: Chris Wulff <Chris.Wulff@biamp.com>
+
+[ Upstream commit a2cf936ebef291ef7395172b9e2f624779fb6dc0 ]
+
+This prevents use of a stale pointer if functions are called after
+g_cleanup that shouldn't be. This doesn't fix any races, but converts
+a possibly silent kernel memory corruption into an obvious NULL pointer
+dereference report.
+
+Fixes: eb9fecb9e69b ("usb: gadget: f_uac2: split out audio core")
+Signed-off-by: Chris Wulff <chris.wulff@biamp.com>
+Link: https://lore.kernel.org/stable/CO1PR17MB54194226DA08BFC9EBD8C163E1172%40CO1PR17MB5419.namprd17.prod.outlook.com
+Link: https://lore.kernel.org/r/CO1PR17MB54194226DA08BFC9EBD8C163E1172@CO1PR17MB5419.namprd17.prod.outlook.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/usb/gadget/function/u_audio.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c
+index 3136a239e7828..f7c610b7e3fd3 100644
+--- a/drivers/usb/gadget/function/u_audio.c
++++ b/drivers/usb/gadget/function/u_audio.c
+@@ -624,6 +624,8 @@ void g_audio_cleanup(struct g_audio *g_audio)
+               return;
+       uac = g_audio->uac;
++      g_audio->uac = NULL;
++
+       card = uac->card;
+       if (card)
+               snd_card_free_when_closed(card);
+-- 
+2.43.0
+