From: Greg Kroah-Hartman Date: Wed, 20 Mar 2019 20:10:50 +0000 (+0100) Subject: 4.4-stable patches X-Git-Tag: v3.18.137~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b317d76835ca47c0727d02ae922fe012e435a206;p=thirdparty%2Fkernel%2Fstable-queue.git 4.4-stable patches added patches: clk-ingenic-fix-round_rate-misbehaving-with-non-integer-dividers.patch cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch cpufreq-tegra124-add-missing-of_node_put.patch dmaengine-usb-dmac-make-dmac-system-sleep-callbacks-explicit.patch ext2-fix-underflow-in-ext2_max_size.patch ext4-fix-crash-during-online-resizing.patch --- diff --git a/queue-4.4/clk-ingenic-fix-round_rate-misbehaving-with-non-integer-dividers.patch b/queue-4.4/clk-ingenic-fix-round_rate-misbehaving-with-non-integer-dividers.patch new file mode 100644 index 00000000000..9cf34293098 --- /dev/null +++ b/queue-4.4/clk-ingenic-fix-round_rate-misbehaving-with-non-integer-dividers.patch @@ -0,0 +1,63 @@ +From bc5d922c93491878c44c9216e9d227c7eeb81d7f Mon Sep 17 00:00:00 2001 +From: Paul Cercueil +Date: Sun, 27 Jan 2019 23:09:20 -0300 +Subject: clk: ingenic: Fix round_rate misbehaving with non-integer dividers + +From: Paul Cercueil + +commit bc5d922c93491878c44c9216e9d227c7eeb81d7f upstream. + +Take a parent rate of 180 MHz, and a requested rate of 4.285715 MHz. +This results in a theorical divider of 41.999993 which is then rounded +up to 42. The .round_rate function would then return (180 MHz / 42) as +the clock, rounded down, so 4.285714 MHz. + +Calling clk_set_rate on 4.285714 MHz would round the rate again, and +give a theorical divider of 42,0000028, now rounded up to 43, and the +rate returned would be (180 MHz / 43) which is 4.186046 MHz, aka. not +what we requested. + +Fix this by rounding up the divisions. + +Signed-off-by: Paul Cercueil +Tested-by: Maarten ter Huurne +Cc: +Signed-off-by: Stephen Boyd +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/clk/ingenic/cgu.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/drivers/clk/ingenic/cgu.c ++++ b/drivers/clk/ingenic/cgu.c +@@ -355,16 +355,16 @@ ingenic_clk_round_rate(struct clk_hw *hw + struct ingenic_clk *ingenic_clk = to_ingenic_clk(hw); + struct ingenic_cgu *cgu = ingenic_clk->cgu; + const struct ingenic_cgu_clk_info *clk_info; +- long rate = *parent_rate; ++ unsigned int div = 1; + + clk_info = &cgu->clock_info[ingenic_clk->idx]; + + if (clk_info->type & CGU_CLK_DIV) +- rate /= ingenic_clk_calc_div(clk_info, *parent_rate, req_rate); ++ div = ingenic_clk_calc_div(clk_info, *parent_rate, req_rate); + else if (clk_info->type & CGU_CLK_FIXDIV) +- rate /= clk_info->fixdiv.div; ++ div = clk_info->fixdiv.div; + +- return rate; ++ return DIV_ROUND_UP(*parent_rate, div); + } + + static int +@@ -384,7 +384,7 @@ ingenic_clk_set_rate(struct clk_hw *hw, + + if (clk_info->type & CGU_CLK_DIV) { + div = ingenic_clk_calc_div(clk_info, parent_rate, req_rate); +- rate = parent_rate / div; ++ rate = DIV_ROUND_UP(parent_rate, div); + + if (rate != req_rate) + return -EINVAL; diff --git a/queue-4.4/cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch b/queue-4.4/cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch new file mode 100644 index 00000000000..bdacbaae1e2 --- /dev/null +++ b/queue-4.4/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(co + 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(co + 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-4.4/cpufreq-tegra124-add-missing-of_node_put.patch b/queue-4.4/cpufreq-tegra124-add-missing-of_node_put.patch new file mode 100644 index 00000000000..2b3213cce79 --- /dev/null +++ b/queue-4.4/cpufreq-tegra124-add-missing-of_node_put.patch @@ -0,0 +1,35 @@ +From 446fae2bb5395f3028d8e3aae1508737e5a72ea1 Mon Sep 17 00:00:00 2001 +From: Yangtao Li +Date: Mon, 4 Feb 2019 02:48:54 -0500 +Subject: cpufreq: tegra124: add missing of_node_put() + +From: Yangtao Li + +commit 446fae2bb5395f3028d8e3aae1508737e5a72ea1 upstream. + +of_cpu_device_node_get() will increase the refcount of device_node, +it is necessary to call of_node_put() at the end to release the +refcount. + +Fixes: 9eb15dbbfa1a2 ("cpufreq: Add cpufreq driver for Tegra124") +Cc: # 4.4+ +Signed-off-by: Yangtao Li +Acked-by: Thierry Reding +Signed-off-by: Viresh Kumar +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/cpufreq/tegra124-cpufreq.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/cpufreq/tegra124-cpufreq.c ++++ b/drivers/cpufreq/tegra124-cpufreq.c +@@ -141,6 +141,8 @@ static int tegra124_cpufreq_probe(struct + + platform_set_drvdata(pdev, priv); + ++ of_node_put(np); ++ + return 0; + + out_switch_to_pllx: diff --git a/queue-4.4/dmaengine-usb-dmac-make-dmac-system-sleep-callbacks-explicit.patch b/queue-4.4/dmaengine-usb-dmac-make-dmac-system-sleep-callbacks-explicit.patch new file mode 100644 index 00000000000..970612556ea --- /dev/null +++ b/queue-4.4/dmaengine-usb-dmac-make-dmac-system-sleep-callbacks-explicit.patch @@ -0,0 +1,60 @@ +From d9140a0da4a230a03426d175145989667758aa6a Mon Sep 17 00:00:00 2001 +From: Phuong Nguyen +Date: Thu, 17 Jan 2019 17:44:17 +0900 +Subject: dmaengine: usb-dmac: Make DMAC system sleep callbacks explicit + +From: Phuong Nguyen + +commit d9140a0da4a230a03426d175145989667758aa6a upstream. + +This commit fixes the issue that USB-DMAC hangs silently after system +resumes on R-Car Gen3 hence renesas_usbhs will not work correctly +when using USB-DMAC for bulk transfer e.g. ethernet or serial +gadgets. + +The issue can be reproduced by these steps: + 1. modprobe g_serial + 2. Suspend and resume system. + 3. connect a usb cable to host side + 4. Transfer data from Host to Target + 5. cat /dev/ttyGS0 (Target side) + 6. echo "test" > /dev/ttyACM0 (Host side) + +The 'cat' will not result anything. However, system still can work +normally. + +Currently, USB-DMAC driver does not have system sleep callbacks hence +this driver relies on the PM core to force runtime suspend/resume to +suspend and reinitialize USB-DMAC during system resume. After +the commit 17218e0092f8 ("PM / genpd: Stop/start devices without +pm_runtime_force_suspend/resume()"), PM core will not force +runtime suspend/resume anymore so this issue happens. + +To solve this, make system suspend resume explicit by using +pm_runtime_force_{suspend,resume}() as the system sleep callbacks. +SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() is used to make sure USB-DMAC +suspended after and initialized before renesas_usbhs." + +Signed-off-by: Phuong Nguyen +Signed-off-by: Hiroyuki Yokoyama +Cc: # v4.16+ +[shimoda: revise the commit log and add Cc tag] +Signed-off-by: Yoshihiro Shimoda +Signed-off-by: Vinod Koul +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/dma/sh/usb-dmac.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/dma/sh/usb-dmac.c ++++ b/drivers/dma/sh/usb-dmac.c +@@ -700,6 +700,8 @@ static int usb_dmac_runtime_resume(struc + #endif /* CONFIG_PM */ + + static const struct dev_pm_ops usb_dmac_pm = { ++ SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, ++ pm_runtime_force_resume) + SET_RUNTIME_PM_OPS(usb_dmac_runtime_suspend, usb_dmac_runtime_resume, + NULL) + }; diff --git a/queue-4.4/ext2-fix-underflow-in-ext2_max_size.patch b/queue-4.4/ext2-fix-underflow-in-ext2_max_size.patch new file mode 100644 index 00000000000..f38b4478d1a --- /dev/null +++ b/queue-4.4/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 +@@ -721,7 +721,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 +@@ -735,24 +736,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-4.4/ext4-fix-crash-during-online-resizing.patch b/queue-4.4/ext4-fix-crash-during-online-resizing.patch new file mode 100644 index 00000000000..25b192b0e22 --- /dev/null +++ b/queue-4.4/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 +@@ -1928,7 +1928,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-4.4/series b/queue-4.4/series index f28c2a82d91..fdce934023d 100644 --- a/queue-4.4/series +++ b/queue-4.4/series @@ -190,3 +190,9 @@ m68k-add-ffreestanding-to-cflags.patch btrfs-ensure-that-a-dup-or-raid1-block-group-has-exactly-two-stripes.patch btrfs-fix-corruption-reading-shared-and-compressed-extents-after-hole-punching.patch crypto-pcbc-remove-bogus-memcpy-s-with-src-dest.patch +cpufreq-tegra124-add-missing-of_node_put.patch +cpufreq-pxa2xx-remove-incorrect-__init-annotation.patch +ext4-fix-crash-during-online-resizing.patch +ext2-fix-underflow-in-ext2_max_size.patch +clk-ingenic-fix-round_rate-misbehaving-with-non-integer-dividers.patch +dmaengine-usb-dmac-make-dmac-system-sleep-callbacks-explicit.patch