]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.15
authorSasha Levin <sashal@kernel.org>
Fri, 29 Sep 2023 13:45:20 +0000 (09:45 -0400)
committerSasha Levin <sashal@kernel.org>
Fri, 29 Sep 2023 13:45:20 +0000 (09:45 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.15/btrfs-reset-destination-buffer-when-read_extent_buff.patch [new file with mode: 0644]
queue-5.15/mips-alchemy-only-build-mmc-support-helpers-if-au1xm.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/btrfs-reset-destination-buffer-when-read_extent_buff.patch b/queue-5.15/btrfs-reset-destination-buffer-when-read_extent_buff.patch
new file mode 100644 (file)
index 0000000..e92c4f5
--- /dev/null
@@ -0,0 +1,63 @@
+From ad6a429c51d7e0080f1c99c3c133fdd48fcdeeee Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 19 Sep 2023 11:44:42 +0930
+Subject: btrfs: reset destination buffer when read_extent_buffer() gets
+ invalid range
+
+From: Qu Wenruo <wqu@suse.com>
+
+[ Upstream commit 74ee79142c0a344d4eae2eb7012ebc4e82254109 ]
+
+Commit f98b6215d7d1 ("btrfs: extent_io: do extra check for extent buffer
+read write functions") changed how we handle invalid extent buffer range
+for read_extent_buffer().
+
+Previously if the range is invalid we just set the destination to zero,
+but after the patch we do nothing and error out.
+
+This can lead to smatch static checker errors like:
+
+  fs/btrfs/print-tree.c:186 print_uuid_item() error: uninitialized symbol 'subvol_id'.
+  fs/btrfs/tests/extent-io-tests.c:338 check_eb_bitmap() error: uninitialized symbol 'has'.
+  fs/btrfs/tests/extent-io-tests.c:353 check_eb_bitmap() error: uninitialized symbol 'has'.
+  fs/btrfs/uuid-tree.c:203 btrfs_uuid_tree_remove() error: uninitialized symbol 'read_subid'.
+  fs/btrfs/uuid-tree.c:353 btrfs_uuid_tree_iterate() error: uninitialized symbol 'subid_le'.
+  fs/btrfs/uuid-tree.c:72 btrfs_uuid_tree_lookup() error: uninitialized symbol 'data'.
+  fs/btrfs/volumes.c:7415 btrfs_dev_stats_value() error: uninitialized symbol 'val'.
+
+Fix those warnings by reverting back to the old memset() behavior.
+By this we keep the static checker happy and would still make a lot of
+noise when such invalid ranges are passed in.
+
+Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
+Fixes: f98b6215d7d1 ("btrfs: extent_io: do extra check for extent buffer read write functions")
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/extent_io.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
+index f9f6dfbc86bcd..346fc46d019bf 100644
+--- a/fs/btrfs/extent_io.c
++++ b/fs/btrfs/extent_io.c
+@@ -6722,8 +6722,14 @@ void read_extent_buffer(const struct extent_buffer *eb, void *dstv,
+       char *dst = (char *)dstv;
+       unsigned long i = get_eb_page_index(start);
+-      if (check_eb_range(eb, start, len))
++      if (check_eb_range(eb, start, len)) {
++              /*
++               * Invalid range hit, reset the memory, so callers won't get
++               * some random garbage for their uninitialzed memory.
++               */
++              memset(dstv, 0, len);
+               return;
++      }
+       offset = get_eb_offset_in_page(eb, start);
+-- 
+2.40.1
+
diff --git a/queue-5.15/mips-alchemy-only-build-mmc-support-helpers-if-au1xm.patch b/queue-5.15/mips-alchemy-only-build-mmc-support-helpers-if-au1xm.patch
new file mode 100644 (file)
index 0000000..2ad65bd
--- /dev/null
@@ -0,0 +1,134 @@
+From bff9042f746547488f97aba4cf43ffd7616b7eb1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 5 Sep 2023 09:06:56 +0200
+Subject: MIPS: Alchemy: only build mmc support helpers if au1xmmc is enabled
+
+From: Christoph Hellwig <hch@lst.de>
+
+[ Upstream commit ef8f8f04a0b25e8f294b24350e8463a8d6a9ba0b ]
+
+While commit d4a5c59a955b ("mmc: au1xmmc: force non-modular build and
+remove symbol_get usage") to be built in, it can still build a kernel
+without MMC support and thuse no mmc_detect_change symbol at all.
+
+Add ifdefs to build the mmc support code in the alchemy arch code
+conditional on mmc support.
+
+Fixes: d4a5c59a955b ("mmc: au1xmmc: force non-modular build and remove symbol_get usage")
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: Christoph Hellwig <hch@lst.de>
+Acked-by: Randy Dunlap <rdunlap@infradead.org>
+Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/alchemy/devboards/db1000.c | 4 ++++
+ arch/mips/alchemy/devboards/db1200.c | 6 ++++++
+ arch/mips/alchemy/devboards/db1300.c | 4 ++++
+ 3 files changed, 14 insertions(+)
+
+diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c
+index 50de86eb8784c..3183df60ad337 100644
+--- a/arch/mips/alchemy/devboards/db1000.c
++++ b/arch/mips/alchemy/devboards/db1000.c
+@@ -164,6 +164,7 @@ static struct platform_device db1x00_audio_dev = {
+ /******************************************************************************/
++#ifdef CONFIG_MMC_AU1X
+ static irqreturn_t db1100_mmc_cd(int irq, void *ptr)
+ {
+       mmc_detect_change(ptr, msecs_to_jiffies(500));
+@@ -369,6 +370,7 @@ static struct platform_device db1100_mmc1_dev = {
+       .num_resources  = ARRAY_SIZE(au1100_mmc1_res),
+       .resource       = au1100_mmc1_res,
+ };
++#endif /* CONFIG_MMC_AU1X */
+ /******************************************************************************/
+@@ -432,8 +434,10 @@ static struct platform_device *db1x00_devs[] = {
+ static struct platform_device *db1100_devs[] = {
+       &au1100_lcd_device,
++#ifdef CONFIG_MMC_AU1X
+       &db1100_mmc0_dev,
+       &db1100_mmc1_dev,
++#endif
+ };
+ int __init db1000_dev_setup(void)
+diff --git a/arch/mips/alchemy/devboards/db1200.c b/arch/mips/alchemy/devboards/db1200.c
+index 76080c71a2a7b..f521874ebb07b 100644
+--- a/arch/mips/alchemy/devboards/db1200.c
++++ b/arch/mips/alchemy/devboards/db1200.c
+@@ -326,6 +326,7 @@ static struct platform_device db1200_ide_dev = {
+ /**********************************************************************/
++#ifdef CONFIG_MMC_AU1X
+ /* SD carddetects:  they're supposed to be edge-triggered, but ack
+  * doesn't seem to work (CPLD Rev 2).  Instead, the screaming one
+  * is disabled and its counterpart enabled.  The 200ms timeout is
+@@ -584,6 +585,7 @@ static struct platform_device pb1200_mmc1_dev = {
+       .num_resources  = ARRAY_SIZE(au1200_mmc1_res),
+       .resource       = au1200_mmc1_res,
+ };
++#endif /* CONFIG_MMC_AU1X */
+ /**********************************************************************/
+@@ -751,7 +753,9 @@ static struct platform_device db1200_audiodma_dev = {
+ static struct platform_device *db1200_devs[] __initdata = {
+       NULL,           /* PSC0, selected by S6.8 */
+       &db1200_ide_dev,
++#ifdef CONFIG_MMC_AU1X
+       &db1200_mmc0_dev,
++#endif
+       &au1200_lcd_dev,
+       &db1200_eth_dev,
+       &db1200_nand_dev,
+@@ -762,7 +766,9 @@ static struct platform_device *db1200_devs[] __initdata = {
+ };
+ static struct platform_device *pb1200_devs[] __initdata = {
++#ifdef CONFIG_MMC_AU1X
+       &pb1200_mmc1_dev,
++#endif
+ };
+ /* Some peripheral base addresses differ on the PB1200 */
+diff --git a/arch/mips/alchemy/devboards/db1300.c b/arch/mips/alchemy/devboards/db1300.c
+index ca71e5ed51abd..c965d00074818 100644
+--- a/arch/mips/alchemy/devboards/db1300.c
++++ b/arch/mips/alchemy/devboards/db1300.c
+@@ -450,6 +450,7 @@ static struct platform_device db1300_ide_dev = {
+ /**********************************************************************/
++#ifdef CONFIG_MMC_AU1X
+ static irqreturn_t db1300_mmc_cd(int irq, void *ptr)
+ {
+       disable_irq_nosync(irq);
+@@ -632,6 +633,7 @@ static struct platform_device db1300_sd0_dev = {
+       .resource       = au1300_sd0_res,
+       .num_resources  = ARRAY_SIZE(au1300_sd0_res),
+ };
++#endif /* CONFIG_MMC_AU1X */
+ /**********************************************************************/
+@@ -776,8 +778,10 @@ static struct platform_device *db1300_dev[] __initdata = {
+       &db1300_5waysw_dev,
+       &db1300_nand_dev,
+       &db1300_ide_dev,
++#ifdef CONFIG_MMC_AU1X
+       &db1300_sd0_dev,
+       &db1300_sd1_dev,
++#endif
+       &db1300_lcd_dev,
+       &db1300_ac97_dev,
+       &db1300_i2s_dev,
+-- 
+2.40.1
+
index 4e64369f46515237a8435d32f4c60dde1629c659..f48dc23b98e5ed73576b10481efc15d9dc05276d 100644 (file)
@@ -88,3 +88,5 @@ ata-ahci-rename-board_ahci_mobile.patch
 ata-ahci-add-elkhart-lake-ahci-controller.patch
 scsi-qla2xxx-select-qpair-depending-on-which-cpu-pos.patch
 scsi-qla2xxx-use-raw_smp_processor_id-instead-of-smp.patch
+btrfs-reset-destination-buffer-when-read_extent_buff.patch
+mips-alchemy-only-build-mmc-support-helpers-if-au1xm.patch