From: Greg Kroah-Hartman Date: Wed, 20 Mar 2019 20:08:21 +0000 (+0100) Subject: 3.18-stable patches X-Git-Tag: v3.18.137~58 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e5bc3887bb86916ec7cc919cc4d9daf4c5a0cda3;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch ext2-fix-underflow-in-ext2_max_size.patch ext4-fix-crash-during-online-resizing.patch --- 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 index 00000000000..11476920912 --- /dev/null +++ b/queue-3.18/cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch @@ -0,0 +1,53 @@ +From 9505b98ccddc454008ca7efff90044e3e857c827 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Thu, 7 Mar 2019 11:22:41 +0100 +Subject: cpufreq: pxa2xx: remove incorrect __init annotation + +From: Arnd Bergmann + +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 +Acked-by: Viresh Kumar +Reviewed-by: Nathan Chancellor +Acked-by: Robert Jarzmik +Cc: All applicable +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..9ca04ce8370 --- /dev/null +++ b/queue-3.18/ext2-fix-underflow-in-ext2_max_size.patch @@ -0,0 +1,98 @@ +From 1c2d14212b15a60300a2d4f6364753e87394c521 Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Tue, 29 Jan 2019 17:17:24 +0100 +Subject: ext2: Fix underflow in ext2_max_size() + +From: Jan Kara + +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 +Signed-off-by: Jan Kara +Signed-off-by: Greg Kroah-Hartman + +--- + 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 index 00000000000..6a01c6f3611 --- /dev/null +++ b/queue-3.18/ext4-fix-crash-during-online-resizing.patch @@ -0,0 +1,48 @@ +From f96c3ac8dfc24b4e38fc4c2eba5fea2107b929d1 Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Mon, 11 Feb 2019 13:30:32 -0500 +Subject: ext4: fix crash during online resizing + +From: Jan Kara + +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 +Signed-off-by: Theodore Ts'o +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman + +--- + 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 */ + } + diff --git a/queue-3.18/series b/queue-3.18/series index 2362d31e476..04796715162 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -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