From: Greg Kroah-Hartman Date: Mon, 2 May 2016 23:56:28 +0000 (-0700) Subject: 4.5-stable patches X-Git-Tag: v3.14.68~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f809dc445b206d081c337ba0b3adca6e83865d29;p=thirdparty%2Fkernel%2Fstable-queue.git 4.5-stable patches added patches: btrfs-cleaner_kthread-doesn-t-need-explicit-freeze.patch btrfs-fix-memory-leak-of-fs_info-in-block-group-cache.patch megaraid_sas-add-missing-curly-braces-in-ioctl-handler.patch sunrpc-cache-drop-reference-when-sunrpc_cache_pipe_upcall-detects-a-race.patch thermal-rockchip-fix-a-impossible-condition-caused-by-the-warning.patch unbreak-allmodconfig-kconfig_allconfig.patch --- diff --git a/queue-4.5/btrfs-cleaner_kthread-doesn-t-need-explicit-freeze.patch b/queue-4.5/btrfs-cleaner_kthread-doesn-t-need-explicit-freeze.patch new file mode 100644 index 00000000000..986e3f5027d --- /dev/null +++ b/queue-4.5/btrfs-cleaner_kthread-doesn-t-need-explicit-freeze.patch @@ -0,0 +1,40 @@ +From 838fe1887765f4cc679febea60d87d2a06bd300e Mon Sep 17 00:00:00 2001 +From: Jiri Kosina +Date: Tue, 15 Mar 2016 11:28:54 +0100 +Subject: btrfs: cleaner_kthread() doesn't need explicit freeze + +From: Jiri Kosina + +commit 838fe1887765f4cc679febea60d87d2a06bd300e upstream. + +cleaner_kthread() is not marked freezable, and therefore calling +try_to_freeze() in its context is a pointless no-op. + +In addition to that, as has been clearly demonstrated by 80ad623edd2d +("Revert "btrfs: clear PF_NOFREEZE in cleaner_kthread()"), it's perfectly +valid / legal for cleaner_kthread() to stay scheduled out in an arbitrary +place during suspend (in that particular example that was waiting for +reading of extent pages), so there is no need to leave any traces of +freezer in this kthread. + +Fixes: 80ad623edd2d ("Revert "btrfs: clear PF_NOFREEZE in cleaner_kthread()") +Fixes: 696249132158 ("btrfs: clear PF_NOFREEZE in cleaner_kthread()") +Signed-off-by: Jiri Kosina +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + +--- + fs/btrfs/disk-io.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/btrfs/disk-io.c ++++ b/fs/btrfs/disk-io.c +@@ -1830,7 +1830,7 @@ static int cleaner_kthread(void *arg) + */ + btrfs_delete_unused_bgs(root->fs_info); + sleep: +- if (!try_to_freeze() && !again) { ++ if (!again) { + set_current_state(TASK_INTERRUPTIBLE); + if (!kthread_should_stop()) + schedule(); diff --git a/queue-4.5/btrfs-fix-memory-leak-of-fs_info-in-block-group-cache.patch b/queue-4.5/btrfs-fix-memory-leak-of-fs_info-in-block-group-cache.patch new file mode 100644 index 00000000000..b823c7819ee --- /dev/null +++ b/queue-4.5/btrfs-fix-memory-leak-of-fs_info-in-block-group-cache.patch @@ -0,0 +1,89 @@ +From aa66b0bb08869d93492bd817d2eae694ca743a3d Mon Sep 17 00:00:00 2001 +From: Kinglong Mee +Date: Fri, 29 Jan 2016 21:36:00 +0800 +Subject: btrfs: fix memory leak of fs_info in block group cache + +From: Kinglong Mee + +commit aa66b0bb08869d93492bd817d2eae694ca743a3d upstream. + +When starting up linux with btrfs filesystem, I got many memory leak +messages by kmemleak as, + +unreferenced object 0xffff880066882000 (size 4096): + comm "modprobe", pid 730, jiffies 4294690024 (age 196.599s) + hex dump (first 32 bytes): + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [] kmemleak_alloc+0x4e/0xb0 + [] kmem_cache_alloc_trace+0xea/0x1e0 + [] btrfs_alloc_dummy_fs_info+0x6b/0x2a0 [btrfs] + [] btrfs_alloc_dummy_block_group+0x5c/0x120 [btrfs] + [] btrfs_test_free_space_cache+0x39/0xed0 [btrfs] + [] trace_raw_output_xfs_attr_class+0x54/0xe0 [xfs] + [] do_one_initcall+0xb2/0x1f0 + [] do_init_module+0x5e/0x1e9 + [] load_module+0x20a9/0x2690 + [] SyS_finit_module+0xb9/0xf0 + [] entry_SYSCALL_64_fastpath+0x12/0x76 + [] 0xffffffffffffffff +unreferenced object 0xffff8800573f8000 (size 10256): + comm "modprobe", pid 730, jiffies 4294690185 (age 196.460s) + hex dump (first 32 bytes): + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + backtrace: + [] kmemleak_alloc+0x4e/0xb0 + [] kmalloc_order+0x5e/0x70 + [] kmalloc_order_trace+0x24/0x90 + [] btrfs_alloc_dummy_fs_info+0x23/0x2a0 [btrfs] + [] btrfs_alloc_dummy_block_group+0x5c/0x120 [btrfs] + [] run_test+0xfd/0x320 [btrfs] + [] btrfs_test_free_space_tree+0x94/0xee [btrfs] + [] trace_raw_output_xfs_attr_class+0x8b/0xe0 [xfs] + [] do_one_initcall+0xb2/0x1f0 + [] do_init_module+0x5e/0x1e9 + [] load_module+0x20a9/0x2690 + [] SyS_finit_module+0xb9/0xf0 + [] entry_SYSCALL_64_fastpath+0x12/0x76 + [] 0xffffffffffffffff + +This patch lets btrfs using fs_info stored in btrfs_root for +block group cache directly without allocating a new one. + +Fixes: d0bd456074 ("Btrfs: add fragment=* debug mount option") +Signed-off-by: Kinglong Mee +Signed-off-by: David Sterba +Signed-off-by: Greg Kroah-Hartman + +--- + fs/btrfs/tests/btrfs-tests.c | 6 ------ + fs/btrfs/tests/free-space-tree-tests.c | 1 + + 2 files changed, 1 insertion(+), 6 deletions(-) + +--- a/fs/btrfs/tests/btrfs-tests.c ++++ b/fs/btrfs/tests/btrfs-tests.c +@@ -189,12 +189,6 @@ btrfs_alloc_dummy_block_group(unsigned l + kfree(cache); + return NULL; + } +- cache->fs_info = btrfs_alloc_dummy_fs_info(); +- if (!cache->fs_info) { +- kfree(cache->free_space_ctl); +- kfree(cache); +- return NULL; +- } + + cache->key.objectid = 0; + cache->key.offset = length; +--- a/fs/btrfs/tests/free-space-tree-tests.c ++++ b/fs/btrfs/tests/free-space-tree-tests.c +@@ -485,6 +485,7 @@ static int run_test(test_func_t test_fun + cache->bitmap_low_thresh = 0; + cache->bitmap_high_thresh = (u32)-1; + cache->needs_free_space = 1; ++ cache->fs_info = root->fs_info; + + btrfs_init_dummy_trans(&trans); + diff --git a/queue-4.5/megaraid_sas-add-missing-curly-braces-in-ioctl-handler.patch b/queue-4.5/megaraid_sas-add-missing-curly-braces-in-ioctl-handler.patch new file mode 100644 index 00000000000..0d6f80dc2ed --- /dev/null +++ b/queue-4.5/megaraid_sas-add-missing-curly-braces-in-ioctl-handler.patch @@ -0,0 +1,54 @@ +From 3deb9438d34a09f6796639b652a01d110aca9f75 Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Mon, 14 Mar 2016 15:29:45 +0100 +Subject: megaraid_sas: add missing curly braces in ioctl handler + +From: Arnd Bergmann + +commit 3deb9438d34a09f6796639b652a01d110aca9f75 upstream. + +gcc-6 found a dubious indentation in the megasas_mgmt_fw_ioctl +function: + +drivers/scsi/megaraid/megaraid_sas_base.c: In function 'megasas_mgmt_fw_ioctl': +drivers/scsi/megaraid/megaraid_sas_base.c:6658:4: warning: statement is indented as if it were guarded by... [-Wmisleading-indentation] + kbuff_arr[i] = NULL; + ^~~~~~~~~ +drivers/scsi/megaraid/megaraid_sas_base.c:6653:3: note: ...this 'if' clause, but it is not + if (kbuff_arr[i]) + ^~ + +The code is actually correct, as there is no downside in clearing a NULL +pointer again. + +This clarifies the code and avoids the warning by adding extra curly +braces. + +Signed-off-by: Arnd Bergmann +Fixes: 90dc9d98f01b ("megaraid_sas : MFI MPT linked list corruption fix") +Reviewed-by: Hannes Reinecke +Acked-by: Sumit Saxena +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/megaraid/megaraid_sas_base.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/scsi/megaraid/megaraid_sas_base.c ++++ b/drivers/scsi/megaraid/megaraid_sas_base.c +@@ -6282,12 +6282,13 @@ out: + } + + for (i = 0; i < ioc->sge_count; i++) { +- if (kbuff_arr[i]) ++ if (kbuff_arr[i]) { + dma_free_coherent(&instance->pdev->dev, + le32_to_cpu(kern_sge32[i].length), + kbuff_arr[i], + le32_to_cpu(kern_sge32[i].phys_addr)); + kbuff_arr[i] = NULL; ++ } + } + + megasas_return_cmd(instance, cmd); diff --git a/queue-4.5/series b/queue-4.5/series index e558b6c3269..fe03cf7861a 100644 --- a/queue-4.5/series +++ b/queue-4.5/series @@ -188,3 +188,9 @@ arm-dts-pxa-fix-dma-engine-node-to-pxa3xx-nand.patch arm-dts-am33xx-fix-gpmc-dma-properties.patch arm-dts-am437x-fix-gpmc-dma-properties.patch bus-imx-weim-take-the-status-property-value-into-account.patch +btrfs-fix-memory-leak-of-fs_info-in-block-group-cache.patch +btrfs-cleaner_kthread-doesn-t-need-explicit-freeze.patch +unbreak-allmodconfig-kconfig_allconfig.patch +thermal-rockchip-fix-a-impossible-condition-caused-by-the-warning.patch +sunrpc-cache-drop-reference-when-sunrpc_cache_pipe_upcall-detects-a-race.patch +megaraid_sas-add-missing-curly-braces-in-ioctl-handler.patch diff --git a/queue-4.5/sunrpc-cache-drop-reference-when-sunrpc_cache_pipe_upcall-detects-a-race.patch b/queue-4.5/sunrpc-cache-drop-reference-when-sunrpc_cache_pipe_upcall-detects-a-race.patch new file mode 100644 index 00000000000..6ad75e2dcd4 --- /dev/null +++ b/queue-4.5/sunrpc-cache-drop-reference-when-sunrpc_cache_pipe_upcall-detects-a-race.patch @@ -0,0 +1,45 @@ +From a6ab1e8126d205238defbb55d23661a3a5c6a0d8 Mon Sep 17 00:00:00 2001 +From: NeilBrown +Date: Fri, 4 Mar 2016 17:20:13 +1100 +Subject: sunrpc/cache: drop reference when sunrpc_cache_pipe_upcall() detects a race + +From: NeilBrown + +commit a6ab1e8126d205238defbb55d23661a3a5c6a0d8 upstream. + +sunrpc_cache_pipe_upcall() can detect a race if CACHE_PENDING is no longer +set. In this case it aborts the queuing of the upcall. +However it has already taken a new counted reference on "h" and +doesn't "put" it, even though it frees the data structure holding the reference. + +So let's delay the "cache_get" until we know we need it. + +Fixes: f9e1aedc6c79 ("sunrpc/cache: remove races with queuing an upcall.") +Signed-off-by: NeilBrown +Signed-off-by: J. Bruce Fields +Signed-off-by: Greg Kroah-Hartman + +--- + net/sunrpc/cache.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/net/sunrpc/cache.c ++++ b/net/sunrpc/cache.c +@@ -1182,14 +1182,14 @@ int sunrpc_cache_pipe_upcall(struct cach + } + + crq->q.reader = 0; +- crq->item = cache_get(h); + crq->buf = buf; + crq->len = 0; + crq->readers = 0; + spin_lock(&queue_lock); +- if (test_bit(CACHE_PENDING, &h->flags)) ++ if (test_bit(CACHE_PENDING, &h->flags)) { ++ crq->item = cache_get(h); + list_add_tail(&crq->q.list, &detail->queue); +- else ++ } else + /* Lost a race, no longer PENDING, so don't enqueue */ + ret = -EAGAIN; + spin_unlock(&queue_lock); diff --git a/queue-4.5/thermal-rockchip-fix-a-impossible-condition-caused-by-the-warning.patch b/queue-4.5/thermal-rockchip-fix-a-impossible-condition-caused-by-the-warning.patch new file mode 100644 index 00000000000..b7356ef9d19 --- /dev/null +++ b/queue-4.5/thermal-rockchip-fix-a-impossible-condition-caused-by-the-warning.patch @@ -0,0 +1,54 @@ +From 43b4eb9fe719b107c8e5d49d1edbff0c135a42cb Mon Sep 17 00:00:00 2001 +From: Caesar Wang +Date: Mon, 15 Feb 2016 15:33:28 +0800 +Subject: thermal: rockchip: fix a impossible condition caused by the warning + +From: Caesar Wang + +commit 43b4eb9fe719b107c8e5d49d1edbff0c135a42cb upstream. + +As the Dan report the smatch check the thermal driver warning: +drivers/thermal/rockchip_thermal.c:551 rockchip_configure_from_dt() +warn: impossible condition '(thermal->tshut_temp > ((~0 >> 1))) => +(s32min-s32max > s32max)' + +Although The shut_temp read from DT is u32,the temperature is currently +represented as int not long in the thermal driver. +Let's change to make shut_temp instead of the thermal->tshut_temp for +the condition. + +Fixes: commit 437df2172e8d +("thermal: rockchip: consistently use int for temperatures") + +Reported-by: Dan Carpenter +Signed-off-by: Caesar Wang +Signed-off-by: Eduardo Valentin +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/thermal/rockchip_thermal.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +--- a/drivers/thermal/rockchip_thermal.c ++++ b/drivers/thermal/rockchip_thermal.c +@@ -693,15 +693,14 @@ static int rockchip_configure_from_dt(st + thermal->chip->tshut_temp); + thermal->tshut_temp = thermal->chip->tshut_temp; + } else { ++ if (shut_temp > INT_MAX) { ++ dev_err(dev, "Invalid tshut temperature specified: %d\n", ++ shut_temp); ++ return -ERANGE; ++ } + thermal->tshut_temp = shut_temp; + } + +- if (thermal->tshut_temp > INT_MAX) { +- dev_err(dev, "Invalid tshut temperature specified: %d\n", +- thermal->tshut_temp); +- return -ERANGE; +- } +- + if (of_property_read_u32(np, "rockchip,hw-tshut-mode", &tshut_mode)) { + dev_warn(dev, + "Missing tshut mode property, using default (%s)\n", diff --git a/queue-4.5/unbreak-allmodconfig-kconfig_allconfig.patch b/queue-4.5/unbreak-allmodconfig-kconfig_allconfig.patch new file mode 100644 index 00000000000..e303b61ed9f --- /dev/null +++ b/queue-4.5/unbreak-allmodconfig-kconfig_allconfig.patch @@ -0,0 +1,76 @@ +From 6b87b70c5339f30e3c5b32085e69625906513dc2 Mon Sep 17 00:00:00 2001 +From: Al Viro +Date: Thu, 14 Jan 2016 18:13:49 +0000 +Subject: unbreak allmodconfig KCONFIG_ALLCONFIG=... + +From: Al Viro + +commit 6b87b70c5339f30e3c5b32085e69625906513dc2 upstream. + + Prior to 3.13 make allmodconfig KCONFIG_ALLCONFIG=/dev/null used +to be equivalent to make allmodconfig; these days it hardwires MODULES to n. +In fact, any KCONFIG_ALLCONFIG that doesn't set MODULES explicitly is +treated as if it set it to n. + + Regression had been introduced by commit cfa98f ("kconfig: do not +override symbols already set"); what happens is that conf_read_simple() +does sym_calc_value(modules_sym) on exit, which leaves SYMBOL_VALID set and +has conf_set_all_new_symbols() skip modules_sym. + + It's pretty easy to fix - simply move that call of sym_calc_value() +into the callers, except for the ones in KCONFIG_ALLCONFIG handling. +Objections? + +Signed-off-by: Al Viro +Fixes: cfa98f2e0ae9 ("kconfig: do not override symbols already set") +Signed-off-by: Michal Marek +Signed-off-by: Greg Kroah-Hartman + +--- + scripts/kconfig/confdata.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +--- a/scripts/kconfig/confdata.c ++++ b/scripts/kconfig/confdata.c +@@ -267,10 +267,8 @@ int conf_read_simple(const char *name, i + if (in) + goto load; + sym_add_change_count(1); +- if (!sym_defconfig_list) { +- sym_calc_value(modules_sym); ++ if (!sym_defconfig_list) + return 1; +- } + + for_all_defaults(sym_defconfig_list, prop) { + if (expr_calc_value(prop->visible.expr) == no || +@@ -403,7 +401,6 @@ setsym: + } + free(line); + fclose(in); +- sym_calc_value(modules_sym); + return 0; + } + +@@ -414,8 +411,12 @@ int conf_read(const char *name) + + sym_set_change_count(0); + +- if (conf_read_simple(name, S_DEF_USER)) ++ if (conf_read_simple(name, S_DEF_USER)) { ++ sym_calc_value(modules_sym); + return 1; ++ } ++ ++ sym_calc_value(modules_sym); + + for_all_symbols(i, sym) { + sym_calc_value(sym); +@@ -846,6 +847,7 @@ static int conf_split_config(void) + + name = conf_get_autoconfig_name(); + conf_read_simple(name, S_DEF_AUTO); ++ sym_calc_value(modules_sym); + + if (chdir("include/config")) + return 1;