]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.18-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Mar 2019 20:08:21 +0000 (21:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Mar 2019 20:08:21 +0000 (21:08 +0100)
added patches:
cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch
ext2-fix-underflow-in-ext2_max_size.patch
ext4-fix-crash-during-online-resizing.patch

queue-3.18/cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch [new file with mode: 0644]
queue-3.18/ext2-fix-underflow-in-ext2_max_size.patch [new file with mode: 0644]
queue-3.18/ext4-fix-crash-during-online-resizing.patch [new file with mode: 0644]
queue-3.18/series

diff --git a/queue-3.18/cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch b/queue-3.18/cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch
new file mode 100644 (file)
index 0000000..1147692
--- /dev/null
@@ -0,0 +1,53 @@
+From 9505b98ccddc454008ca7efff90044e3e857c827 Mon Sep 17 00:00:00 2001
+From: Arnd Bergmann <arnd@arndb.de>
+Date: Thu, 7 Mar 2019 11:22:41 +0100
+Subject: cpufreq: pxa2xx: remove incorrect __init annotation
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+commit 9505b98ccddc454008ca7efff90044e3e857c827 upstream.
+
+pxa_cpufreq_init_voltages() is marked __init but usually inlined into
+the non-__init pxa_cpufreq_init() function. When building with clang,
+it can stay as a standalone function in a discarded section, and produce
+this warning:
+
+WARNING: vmlinux.o(.text+0x616a00): Section mismatch in reference from the function pxa_cpufreq_init() to the function .init.text:pxa_cpufreq_init_voltages()
+The function pxa_cpufreq_init() references
+the function __init pxa_cpufreq_init_voltages().
+This is often because pxa_cpufreq_init lacks a __init
+annotation or the annotation of pxa_cpufreq_init_voltages is wrong.
+
+Fixes: 50e77fcd790e ("ARM: pxa: remove __init from cpufreq_driver->init()")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
+Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
+Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>
+Cc: All applicable <stable@vger.kernel.org>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/cpufreq/pxa2xx-cpufreq.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/cpufreq/pxa2xx-cpufreq.c
++++ b/drivers/cpufreq/pxa2xx-cpufreq.c
+@@ -191,7 +191,7 @@ static int pxa_cpufreq_change_voltage(px
+       return ret;
+ }
+-static void __init pxa_cpufreq_init_voltages(void)
++static void pxa_cpufreq_init_voltages(void)
+ {
+       vcc_core = regulator_get(NULL, "vcc_core");
+       if (IS_ERR(vcc_core)) {
+@@ -207,7 +207,7 @@ static int pxa_cpufreq_change_voltage(px
+       return 0;
+ }
+-static void __init pxa_cpufreq_init_voltages(void) { }
++static void pxa_cpufreq_init_voltages(void) { }
+ #endif
+ static void find_freq_tables(struct cpufreq_frequency_table **freq_table,
diff --git a/queue-3.18/ext2-fix-underflow-in-ext2_max_size.patch b/queue-3.18/ext2-fix-underflow-in-ext2_max_size.patch
new file mode 100644 (file)
index 0000000..9ca04ce
--- /dev/null
@@ -0,0 +1,98 @@
+From 1c2d14212b15a60300a2d4f6364753e87394c521 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Tue, 29 Jan 2019 17:17:24 +0100
+Subject: ext2: Fix underflow in ext2_max_size()
+
+From: Jan Kara <jack@suse.cz>
+
+commit 1c2d14212b15a60300a2d4f6364753e87394c521 upstream.
+
+When ext2 filesystem is created with 64k block size, ext2_max_size()
+will return value less than 0. Also, we cannot write any file in this fs
+since the sb->maxbytes is less than 0. The core of the problem is that
+the size of block index tree for such large block size is more than
+i_blocks can carry. So fix the computation to count with this
+possibility.
+
+File size limits computed with the new function for the full range of
+possible block sizes look like:
+
+bits file_size
+10     17247252480
+11    275415851008
+12   2196873666560
+13   2197948973056
+14   2198486220800
+15   2198754754560
+16   2198888906752
+
+CC: stable@vger.kernel.org
+Reported-by: yangerkun <yangerkun@huawei.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext2/super.c |   41 ++++++++++++++++++++++++++---------------
+ 1 file changed, 26 insertions(+), 15 deletions(-)
+
+--- a/fs/ext2/super.c
++++ b/fs/ext2/super.c
+@@ -701,7 +701,8 @@ static loff_t ext2_max_size(int bits)
+ {
+       loff_t res = EXT2_NDIR_BLOCKS;
+       int meta_blocks;
+-      loff_t upper_limit;
++      unsigned int upper_limit;
++      unsigned int ppb = 1 << (bits-2);
+       /* This is calculated to be the largest file size for a
+        * dense, file such that the total number of
+@@ -715,24 +716,34 @@ static loff_t ext2_max_size(int bits)
+       /* total blocks in file system block size */
+       upper_limit >>= (bits - 9);
+-
+-      /* indirect blocks */
+-      meta_blocks = 1;
+-      /* double indirect blocks */
+-      meta_blocks += 1 + (1LL << (bits-2));
+-      /* tripple indirect blocks */
+-      meta_blocks += 1 + (1LL << (bits-2)) + (1LL << (2*(bits-2)));
+-
+-      upper_limit -= meta_blocks;
+-      upper_limit <<= bits;
+-
++      /* Compute how many blocks we can address by block tree */
+       res += 1LL << (bits-2);
+       res += 1LL << (2*(bits-2));
+       res += 1LL << (3*(bits-2));
++      /* Does block tree limit file size? */
++      if (res < upper_limit)
++              goto check_lfs;
++
++      res = upper_limit;
++      /* How many metadata blocks are needed for addressing upper_limit? */
++      upper_limit -= EXT2_NDIR_BLOCKS;
++      /* indirect blocks */
++      meta_blocks = 1;
++      upper_limit -= ppb;
++      /* double indirect blocks */
++      if (upper_limit < ppb * ppb) {
++              meta_blocks += 1 + DIV_ROUND_UP(upper_limit, ppb);
++              res -= meta_blocks;
++              goto check_lfs;
++      }
++      meta_blocks += 1 + ppb;
++      upper_limit -= ppb * ppb;
++      /* tripple indirect blocks for the rest */
++      meta_blocks += 1 + DIV_ROUND_UP(upper_limit, ppb) +
++              DIV_ROUND_UP(upper_limit, ppb*ppb);
++      res -= meta_blocks;
++check_lfs:
+       res <<= bits;
+-      if (res > upper_limit)
+-              res = upper_limit;
+-
+       if (res > MAX_LFS_FILESIZE)
+               res = MAX_LFS_FILESIZE;
diff --git a/queue-3.18/ext4-fix-crash-during-online-resizing.patch b/queue-3.18/ext4-fix-crash-during-online-resizing.patch
new file mode 100644 (file)
index 0000000..6a01c6f
--- /dev/null
@@ -0,0 +1,48 @@
+From f96c3ac8dfc24b4e38fc4c2eba5fea2107b929d1 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Mon, 11 Feb 2019 13:30:32 -0500
+Subject: ext4: fix crash during online resizing
+
+From: Jan Kara <jack@suse.cz>
+
+commit f96c3ac8dfc24b4e38fc4c2eba5fea2107b929d1 upstream.
+
+When computing maximum size of filesystem possible with given number of
+group descriptor blocks, we forget to include s_first_data_block into
+the number of blocks. Thus for filesystems with non-zero
+s_first_data_block it can happen that computed maximum filesystem size
+is actually lower than current filesystem size which confuses the code
+and eventually leads to a BUG_ON in ext4_alloc_group_tables() hitting on
+flex_gd->count == 0. The problem can be reproduced like:
+
+truncate -s 100g /tmp/image
+mkfs.ext4 -b 1024 -E resize=262144 /tmp/image 32768
+mount -t ext4 -o loop /tmp/image /mnt
+resize2fs /dev/loop0 262145
+resize2fs /dev/loop0 300000
+
+Fix the problem by properly including s_first_data_block into the
+computed number of filesystem blocks.
+
+Fixes: 1c6bd7173d66 "ext4: convert file system to meta_bg if needed..."
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/resize.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/fs/ext4/resize.c
++++ b/fs/ext4/resize.c
+@@ -1930,7 +1930,8 @@ retry:
+                               le16_to_cpu(es->s_reserved_gdt_blocks);
+                       n_group = n_desc_blocks * EXT4_DESC_PER_BLOCK(sb);
+                       n_blocks_count = (ext4_fsblk_t)n_group *
+-                              EXT4_BLOCKS_PER_GROUP(sb);
++                              EXT4_BLOCKS_PER_GROUP(sb) +
++                              le32_to_cpu(es->s_first_data_block);
+                       n_group--; /* set to last group number */
+               }
index 2362d31e476e7b0c19e2519866543711ebc9dda9..04796715162444414450f241224753c05a710cfd 100644 (file)
@@ -116,3 +116,6 @@ scsi-target-iscsi-avoid-iscsit_release_commands_from_conn-deadlock.patch
 m68k-add-ffreestanding-to-cflags.patch
 btrfs-fix-corruption-reading-shared-and-compressed-extents-after-hole-punching.patch
 crypto-pcbc-remove-bogus-memcpy-s-with-src-dest.patch
+cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch
+ext4-fix-crash-during-online-resizing.patch
+ext2-fix-underflow-in-ext2_max_size.patch