From: Greg Kroah-Hartman Date: Fri, 6 May 2016 18:13:09 +0000 (-0400) Subject: 4.5-stable patches X-Git-Tag: v3.14.69~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=95bd2afe66eaba83995b512a82d75f8fb6560ca5;p=thirdparty%2Fkernel%2Fstable-queue.git 4.5-stable patches added patches: ath9k-ar5008_hw_cmn_spur_mitigate-add-missing-mask_m-mask_p-initialisation.patch gpiolib-acpi-duplicate-con_id-string-when-adding-it-to-the-crs-lookup-list.patch mac80211-fix-statistics-leak-if-dev_alloc_name-fails.patch md-make-bio-mergeable.patch minimal-fix-up-of-bad-hashing-behavior-of-hash_64.patch tracing-don-t-display-trigger-file-for-events-that-can-t-be-enabled.patch --- diff --git a/queue-4.5/ath9k-ar5008_hw_cmn_spur_mitigate-add-missing-mask_m-mask_p-initialisation.patch b/queue-4.5/ath9k-ar5008_hw_cmn_spur_mitigate-add-missing-mask_m-mask_p-initialisation.patch new file mode 100644 index 00000000000..36356b6985b --- /dev/null +++ b/queue-4.5/ath9k-ar5008_hw_cmn_spur_mitigate-add-missing-mask_m-mask_p-initialisation.patch @@ -0,0 +1,69 @@ +From de478a61389cacafe94dc8b035081b681b878f9d Mon Sep 17 00:00:00 2001 +From: Oleksij Rempel +Date: Tue, 12 Apr 2016 19:37:44 +0200 +Subject: ath9k: ar5008_hw_cmn_spur_mitigate: add missing mask_m & mask_p initialisation + +From: Oleksij Rempel + +commit de478a61389cacafe94dc8b035081b681b878f9d upstream. + +by moving common code to ar5008_hw_cmn_spur_mitigate i forgot to move +mask_m & mask_p initialisation. This coused a performance regression +on ar9281. + +Fixes: f911085ffa88 ("ath9k: split ar5008_hw_spur_mitigate and reuse common code in ar9002_hw_spur_mitigate.") +Reported-by: Gustav Frederiksen +Tested-by: Gustav Frederiksen +Signed-off-by: Oleksij Rempel +Signed-off-by: Kalle Valo +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/wireless/ath/ath9k/ar5008_phy.c | 8 +++----- + drivers/net/wireless/ath/ath9k/ar9002_phy.c | 5 ----- + 2 files changed, 3 insertions(+), 10 deletions(-) + +--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c ++++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c +@@ -274,6 +274,9 @@ void ar5008_hw_cmn_spur_mitigate(struct + }; + static const int inc[4] = { 0, 100, 0, 0 }; + ++ memset(&mask_m, 0, sizeof(int8_t) * 123); ++ memset(&mask_p, 0, sizeof(int8_t) * 123); ++ + cur_bin = -6000; + upper = bin + 100; + lower = bin - 100; +@@ -424,14 +427,9 @@ static void ar5008_hw_spur_mitigate(stru + int tmp, new; + int i; + +- int8_t mask_m[123]; +- int8_t mask_p[123]; + int cur_bb_spur; + bool is2GHz = IS_CHAN_2GHZ(chan); + +- memset(&mask_m, 0, sizeof(int8_t) * 123); +- memset(&mask_p, 0, sizeof(int8_t) * 123); +- + for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) { + cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz); + if (AR_NO_SPUR == cur_bb_spur) +--- a/drivers/net/wireless/ath/ath9k/ar9002_phy.c ++++ b/drivers/net/wireless/ath/ath9k/ar9002_phy.c +@@ -178,14 +178,9 @@ static void ar9002_hw_spur_mitigate(stru + int i; + struct chan_centers centers; + +- int8_t mask_m[123]; +- int8_t mask_p[123]; + int cur_bb_spur; + bool is2GHz = IS_CHAN_2GHZ(chan); + +- memset(&mask_m, 0, sizeof(int8_t) * 123); +- memset(&mask_p, 0, sizeof(int8_t) * 123); +- + ath9k_hw_get_channel_centers(ah, chan, ¢ers); + freq = centers.synth_center; + diff --git a/queue-4.5/gpiolib-acpi-duplicate-con_id-string-when-adding-it-to-the-crs-lookup-list.patch b/queue-4.5/gpiolib-acpi-duplicate-con_id-string-when-adding-it-to-the-crs-lookup-list.patch new file mode 100644 index 00000000000..bc88f932923 --- /dev/null +++ b/queue-4.5/gpiolib-acpi-duplicate-con_id-string-when-adding-it-to-the-crs-lookup-list.patch @@ -0,0 +1,117 @@ +From 7df89e92a56a3d2c8f84aa76c61471e4a7bc24f9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= +Date: Mon, 25 Apr 2016 16:01:19 +0300 +Subject: gpiolib-acpi: Duplicate con_id string when adding it to the crs lookup list +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Ville Syrjälä + +commit 7df89e92a56a3d2c8f84aa76c61471e4a7bc24f9 upstream. + +Calling gpiod_get() from a module and then unloading the module leads to an +oops due to acpi_can_fallback_to_crs() storing the pointer to the passed +'con_id' string onto acpi_crs_lookup_list. The next guy to come along will then +try to access the string but the memory may now be gone with the module. +Make a copy of the passed string instead, and store the copy on the list. + +BUG: unable to handle kernel paging request at ffffffffa03e7855 +IP: [] strcmp+0x12/0x30 +PGD 2a07067 PUD 2a08063 PMD 74720067 PTE 0 +Oops: 0000 [#1] PREEMPT SMP +Modules linked in: i915(+) drm_kms_helper drm intel_gtt snd_hda_codec snd_hda_core i2c_algo_bit syscopya +rea sysfillrect sysimgblt fb_sys_fops agpgart snd_soc_sst_bytcr_rt5640 coretemp hwmon intel_rapl intel_soc_dts_thermal +punit_atom_debug snd_soc_rt5640 snd_soc_rl6231 serio snd_intel_sst_acpi snd_intel_sst_core video snd_soc_sst_mfld_platf +orm snd_soc_sst_match backlight int3402_thermal processor_thermal_device int3403_thermal int3400_thermal acpi_thermal_r +el snd_soc_core intel_soc_dts_iosf int340x_thermal_zone snd_compress i2c_hid hid snd_pcm snd_timer snd soundcore evdev +sch_fq_codel efivarfs ipv6 autofs4 [last unloaded: drm] +CPU: 2 PID: 3064 Comm: modprobe Tainted: G U W 4.6.0-rc3-ffrd-ipvr+ #302 +Hardware name: Intel Corp. VALLEYVIEW C0 PLATFORM/BYT-T FFD8, BIOS BLAKFF81.X64.0088.R10.1403240443 FFD8 +_X64_R_2014_13_1_00 03/24/2014 +task: ffff8800701cd200 ti: ffff880070034000 task.ti: ffff880070034000 +RIP: 0010:[] [] strcmp+0x12/0x30 +RSP: 0000:ffff880070037748 EFLAGS: 00010286 +RAX: 0000000080000000 RBX: ffff88007a342800 RCX: 0000000000000006 +RDX: 0000000000000006 RSI: ffffffffa054f856 RDI: ffffffffa03e7856 +RBP: ffff880070037748 R08: 0000000000000000 R09: 0000000000000001 +R10: 0000000000000000 R11: 0000000000000000 R12: ffffffffa054f855 +R13: ffff88007281cae0 R14: 0000000000000010 R15: ffffffffffffffea +FS: 00007faa51447700(0000) GS:ffff880079300000(0000) knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: ffffffffa03e7855 CR3: 0000000041eba000 CR4: 00000000001006e0 +Stack: + ffff880070037770 ffffffff8136ad28 ffffffffa054f855 0000000000000000 + ffff88007a0a2098 ffff8800700377e8 ffffffff8136852e ffff88007a342800 + 00000007700377a0 ffff8800700377a0 ffffffff81412442 70672d6c656e6170 +Call Trace: + [] acpi_can_fallback_to_crs+0x88/0x100 + [] gpiod_get_index+0x25e/0x310 + [] ? mipi_dsi_attach+0x22/0x30 + [] gpiod_get+0x12/0x20 + [] intel_dsi_init+0x421/0x480 [i915] + [] intel_modeset_init+0x853/0x16b0 [i915] + [] ? intel_setup_gmbus+0x214/0x260 [i915] + [] i915_driver_load+0xdc8/0x19b0 [i915] + [] ? _raw_spin_unlock_irqrestore+0x43/0x70 + [] drm_dev_register+0xab/0xc0 [drm] + [] drm_get_pci_dev+0x93/0x1f0 [drm] + [] ? _raw_spin_unlock_irqrestore+0x43/0x70 + [] i915_pci_probe+0x34/0x50 [i915] + [] pci_device_probe+0x91/0x100 + [] driver_probe_device+0x20a/0x2d0 + [] __driver_attach+0x9e/0xb0 + [] ? driver_probe_device+0x2d0/0x2d0 + [] bus_for_each_dev+0x69/0xa0 + [] driver_attach+0x1e/0x20 + [] bus_add_driver+0x1c0/0x240 + [] driver_register+0x60/0xe0 + [] __pci_register_driver+0x60/0x70 + [] drm_pci_init+0xe4/0x110 [drm] + [] ? trace_hardirqs_on+0xe/0x10 + [] ? 0xffffffffa02f1000 + [] i915_init+0x94/0x9b [i915] + [] do_one_initcall+0x8b/0x1c0 + [] ? rcu_read_lock_sched_held+0x86/0x90 + [] ? kmem_cache_alloc_trace+0x1f6/0x270 + [] do_init_module+0x60/0x1dc + [] load_module+0x1d0d/0x2390 + [] ? __symbol_put+0x70/0x70 + [] ? kernel_read_file+0x92/0x120 + [] SYSC_finit_module+0xa4/0xb0 + [] SyS_finit_module+0xe/0x10 + [] do_syscall_64+0x63/0x350 + [] entry_SYSCALL64_slow_path+0x25/0x25 +Code: f7 48 8d 76 01 48 8d 52 01 0f b6 4e ff 84 c9 88 4a ff 75 ed 5d c3 0f 1f 00 55 48 89 e5 eb 04 84 c0 + 74 18 48 8d 7f 01 48 8d 76 01 <0f> b6 47 ff 3a 46 ff 74 eb 19 c0 83 c8 01 5d c3 31 c0 5d c3 66 +RIP [] strcmp+0x12/0x30 + RSP +CR2: ffffffffa03e7855 + +v2: Make the copied con_id const + +Cc: Dmitry Torokhov +Cc: Mika Westerberg +Cc: Alexandre Courbot +Fixes: 10cf4899f8af ("gpiolib: tighten up ACPI legacy gpio lookups") +Signed-off-by: Ville Syrjälä +Acked-by: Mika Westerberg +Reviewed-by: Dmitry Torokhov +Signed-off-by: Linus Walleij +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/gpio/gpiolib-acpi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpio/gpiolib-acpi.c ++++ b/drivers/gpio/gpiolib-acpi.c +@@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acp + lookup = kmalloc(sizeof(*lookup), GFP_KERNEL); + if (lookup) { + lookup->adev = adev; +- lookup->con_id = con_id; ++ lookup->con_id = kstrdup(con_id, GFP_KERNEL); + list_add_tail(&lookup->node, &acpi_crs_lookup_list); + } + } diff --git a/queue-4.5/mac80211-fix-statistics-leak-if-dev_alloc_name-fails.patch b/queue-4.5/mac80211-fix-statistics-leak-if-dev_alloc_name-fails.patch new file mode 100644 index 00000000000..52c2512d631 --- /dev/null +++ b/queue-4.5/mac80211-fix-statistics-leak-if-dev_alloc_name-fails.patch @@ -0,0 +1,41 @@ +From e6436be21e77e3659b4ff7e357ab5a8342d132d2 Mon Sep 17 00:00:00 2001 +From: Johannes Berg +Date: Tue, 26 Apr 2016 13:47:08 +0200 +Subject: mac80211: fix statistics leak if dev_alloc_name() fails + +From: Johannes Berg + +commit e6436be21e77e3659b4ff7e357ab5a8342d132d2 upstream. + +In the case that dev_alloc_name() fails, e.g. because the name was +given by the user and already exists, we need to clean up properly +and free the per-CPU statistics. Fix that. + +Fixes: 5a490510ba5f ("mac80211: use per-CPU TX/RX statistics") +Signed-off-by: Johannes Berg +Signed-off-by: Greg Kroah-Hartman + +--- + net/mac80211/iface.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/net/mac80211/iface.c ++++ b/net/mac80211/iface.c +@@ -1750,7 +1750,7 @@ int ieee80211_if_add(struct ieee80211_lo + + ret = dev_alloc_name(ndev, ndev->name); + if (ret < 0) { +- free_netdev(ndev); ++ ieee80211_if_free(ndev); + return ret; + } + +@@ -1836,7 +1836,7 @@ int ieee80211_if_add(struct ieee80211_lo + + ret = register_netdevice(ndev); + if (ret) { +- free_netdev(ndev); ++ ieee80211_if_free(ndev); + return ret; + } + } diff --git a/queue-4.5/md-make-bio-mergeable.patch b/queue-4.5/md-make-bio-mergeable.patch new file mode 100644 index 00000000000..7fdb910344b --- /dev/null +++ b/queue-4.5/md-make-bio-mergeable.patch @@ -0,0 +1,39 @@ +From 9c573de3283af007ea11c17bde1e4568d9417328 Mon Sep 17 00:00:00 2001 +From: Shaohua Li +Date: Mon, 25 Apr 2016 16:52:38 -0700 +Subject: MD: make bio mergeable + +From: Shaohua Li + +commit 9c573de3283af007ea11c17bde1e4568d9417328 upstream. + +blk_queue_split marks bio unmergeable, which makes sense for normal bio. +But if dispatching the bio to underlayer disk, the blk_queue_split +checks are invalid, hence it's possible the bio becomes mergeable. + +In the reported bug, this bug causes trim against raid0 performance slash +https://bugzilla.kernel.org/show_bug.cgi?id=117051 + +Reported-and-tested-by: Park Ju Hyung +Fixes: 6ac45aeb6bca(block: avoid to merge splitted bio) +Cc: Ming Lei +Cc: Neil Brown +Reviewed-by: Jens Axboe +Signed-off-by: Shaohua Li +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/md.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/md/md.c ++++ b/drivers/md/md.c +@@ -284,6 +284,8 @@ static blk_qc_t md_make_request(struct r + * go away inside make_request + */ + sectors = bio_sectors(bio); ++ /* bio could be mergeable after passing to underlayer */ ++ bio->bi_rw &= ~REQ_NOMERGE; + mddev->pers->make_request(mddev, bio); + + cpu = part_stat_lock(); diff --git a/queue-4.5/minimal-fix-up-of-bad-hashing-behavior-of-hash_64.patch b/queue-4.5/minimal-fix-up-of-bad-hashing-behavior-of-hash_64.patch new file mode 100644 index 00000000000..50c1b7bdff4 --- /dev/null +++ b/queue-4.5/minimal-fix-up-of-bad-hashing-behavior-of-hash_64.patch @@ -0,0 +1,76 @@ +From 689de1d6ca95b3b5bd8ee446863bf81a4883ea25 Mon Sep 17 00:00:00 2001 +From: Linus Torvalds +Date: Mon, 2 May 2016 12:46:42 -0700 +Subject: Minimal fix-up of bad hashing behavior of hash_64() + +From: Linus Torvalds + +commit 689de1d6ca95b3b5bd8ee446863bf81a4883ea25 upstream. + +This is a fairly minimal fixup to the horribly bad behavior of hash_64() +with certain input patterns. + +In particular, because the multiplicative value used for the 64-bit hash +was intentionally bit-sparse (so that the multiply could be done with +shifts and adds on architectures without hardware multipliers), some +bits did not get spread out very much. In particular, certain fairly +common bit ranges in the input (roughly bits 12-20: commonly with the +most information in them when you hash things like byte offsets in files +or memory that have block factors that mean that the low bits are often +zero) would not necessarily show up much in the result. + +There's a bigger patch-series brewing to fix up things more completely, +but this is the fairly minimal fix for the 64-bit hashing problem. It +simply picks a much better constant multiplier, spreading the bits out a +lot better. + +NOTE! For 32-bit architectures, the bad old hash_64() remains the same +for now, since 64-bit multiplies are expensive. The bigger hashing +cleanup will replace the 32-bit case with something better. + +The new constants were picked by George Spelvin who wrote that bigger +cleanup series. I just picked out the constants and part of the comment +from that series. + +Cc: George Spelvin +Cc: Thomas Gleixner +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/hash.h | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +--- a/include/linux/hash.h ++++ b/include/linux/hash.h +@@ -32,12 +32,28 @@ + #error Wordsize not 32 or 64 + #endif + ++/* ++ * The above primes are actively bad for hashing, since they are ++ * too sparse. The 32-bit one is mostly ok, the 64-bit one causes ++ * real problems. Besides, the "prime" part is pointless for the ++ * multiplicative hash. ++ * ++ * Although a random odd number will do, it turns out that the golden ++ * ratio phi = (sqrt(5)-1)/2, or its negative, has particularly nice ++ * properties. ++ * ++ * These are the negative, (1 - phi) = (phi^2) = (3 - sqrt(5))/2. ++ * (See Knuth vol 3, section 6.4, exercise 9.) ++ */ ++#define GOLDEN_RATIO_32 0x61C88647 ++#define GOLDEN_RATIO_64 0x61C8864680B583EBull ++ + static __always_inline u64 hash_64(u64 val, unsigned int bits) + { + u64 hash = val; + +-#if defined(CONFIG_ARCH_HAS_FAST_MULTIPLIER) && BITS_PER_LONG == 64 +- hash = hash * GOLDEN_RATIO_PRIME_64; ++#if BITS_PER_LONG == 64 ++ hash = hash * GOLDEN_RATIO_64; + #else + /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ + u64 n = hash; diff --git a/queue-4.5/series b/queue-4.5/series index 59b39d26040..0fc7b66027e 100644 --- a/queue-4.5/series +++ b/queue-4.5/series @@ -29,3 +29,9 @@ pwm-omap-dmtimer-fix-inaccurate-period-and-duty-cycle-calculations.patch pwm-omap-dmtimer-add-sanity-checking-for-load-and-match-values.patch pwm-omap-dmtimer-round-load-and-match-values-rather-than-truncate.patch lpfc-fix-misleading-indentation.patch +gpiolib-acpi-duplicate-con_id-string-when-adding-it-to-the-crs-lookup-list.patch +ath9k-ar5008_hw_cmn_spur_mitigate-add-missing-mask_m-mask_p-initialisation.patch +mac80211-fix-statistics-leak-if-dev_alloc_name-fails.patch +tracing-don-t-display-trigger-file-for-events-that-can-t-be-enabled.patch +md-make-bio-mergeable.patch +minimal-fix-up-of-bad-hashing-behavior-of-hash_64.patch diff --git a/queue-4.5/tracing-don-t-display-trigger-file-for-events-that-can-t-be-enabled.patch b/queue-4.5/tracing-don-t-display-trigger-file-for-events-that-can-t-be-enabled.patch new file mode 100644 index 00000000000..0601ed659a3 --- /dev/null +++ b/queue-4.5/tracing-don-t-display-trigger-file-for-events-that-can-t-be-enabled.patch @@ -0,0 +1,50 @@ +From 854145e0a8e9a05f7366d240e2f99d9c1ca6d6dd Mon Sep 17 00:00:00 2001 +From: Chunyu Hu +Date: Tue, 3 May 2016 19:34:34 +0800 +Subject: tracing: Don't display trigger file for events that can't be enabled + +From: Chunyu Hu + +commit 854145e0a8e9a05f7366d240e2f99d9c1ca6d6dd upstream. + +Currently register functions for events will be called +through the 'reg' field of event class directly without +any check when seting up triggers. + +Triggers for events that don't support register through +debug fs (events under events/ftrace are for trace-cmd to +read event format, and most of them don't have a register +function except events/ftrace/functionx) can't be enabled +at all, and an oops will be hit when setting up trigger +for those events, so just not creating them is an easy way +to avoid the oops. + +Link: http://lkml.kernel.org/r/1462275274-3911-1-git-send-email-chuhu@redhat.com + +Fixes: 85f2b08268c01 ("tracing: Add basic event trigger framework") +Signed-off-by: Chunyu Hu +Signed-off-by: Steven Rostedt +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/trace/trace_events.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/kernel/trace/trace_events.c ++++ b/kernel/trace/trace_events.c +@@ -2095,8 +2095,13 @@ event_create_dir(struct dentry *parent, + trace_create_file("filter", 0644, file->dir, file, + &ftrace_event_filter_fops); + +- trace_create_file("trigger", 0644, file->dir, file, +- &event_trigger_fops); ++ /* ++ * Only event directories that can be enabled should have ++ * triggers. ++ */ ++ if (!(call->flags & TRACE_EVENT_FL_IGNORE_ENABLE)) ++ trace_create_file("trigger", 0644, file->dir, file, ++ &event_trigger_fops); + + trace_create_file("format", 0444, file->dir, call, + &ftrace_event_format_fops);