From: Greg Kroah-Hartman Date: Sat, 22 Jul 2017 14:16:11 +0000 (+0200) Subject: 3.18-stable patches X-Git-Tag: v3.18.63~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ebe2845f0d4459017dbbb2e54760202a045ba88c;p=thirdparty%2Fkernel%2Fstable-queue.git 3.18-stable patches added patches: asoc-compress-derive-substream-from-stream-based-on-direction.patch pm-domains-fix-unsafe-iteration-over-modified-list-of-device-links.patch pm-domains-fix-unsafe-iteration-over-modified-list-of-domain-providers.patch powerpc-64-fix-atomic64_inc_not_zero-to-return-an-int.patch powerpc-asm-mark-cr0-as-clobbered-in-mftb.patch powerpc-fix-emulation-of-mcrf-in-emulate_step.patch powerpc-fix-emulation-of-mfocrf-in-emulate_step.patch scsi-ses-do-not-add-a-device-to-an-enclosure-if-enclosure_add_links-fails.patch --- diff --git a/queue-3.18/asoc-compress-derive-substream-from-stream-based-on-direction.patch b/queue-3.18/asoc-compress-derive-substream-from-stream-based-on-direction.patch new file mode 100644 index 00000000000..4910733b7e3 --- /dev/null +++ b/queue-3.18/asoc-compress-derive-substream-from-stream-based-on-direction.patch @@ -0,0 +1,47 @@ +From 01b8cedfd0422326caae308641dcadaa85e0ca72 Mon Sep 17 00:00:00 2001 +From: Satish Babu Patakokila +Date: Fri, 16 Jun 2017 17:33:40 -0700 +Subject: ASoC: compress: Derive substream from stream based on direction + +From: Satish Babu Patakokila + +commit 01b8cedfd0422326caae308641dcadaa85e0ca72 upstream. + +Currently compress driver hardcodes direction as playback to get +substream from the stream. This results in getting the incorrect +substream for compressed capture usecase. +To fix this, remove the hardcoding and derive substream based on +the stream direction. + +Signed-off-by: Satish Babu Patakokila +Signed-off-by: Banajit Goswami +Acked-By: Vinod Koul +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + sound/soc/soc-compress.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/sound/soc/soc-compress.c ++++ b/sound/soc/soc-compress.c +@@ -68,7 +68,8 @@ out: + static int soc_compr_open_fe(struct snd_compr_stream *cstream) + { + struct snd_soc_pcm_runtime *fe = cstream->private_data; +- struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream; ++ struct snd_pcm_substream *fe_substream = ++ fe->pcm->streams[cstream->direction].substream; + struct snd_soc_platform *platform = fe->platform; + struct snd_soc_dpcm *dpcm; + struct snd_soc_dapm_widget_list *list; +@@ -415,7 +416,8 @@ static int soc_compr_set_params_fe(struc + struct snd_compr_params *params) + { + struct snd_soc_pcm_runtime *fe = cstream->private_data; +- struct snd_pcm_substream *fe_substream = fe->pcm->streams[0].substream; ++ struct snd_pcm_substream *fe_substream = ++ fe->pcm->streams[cstream->direction].substream; + struct snd_soc_platform *platform = fe->platform; + int ret = 0, stream; + diff --git a/queue-3.18/pm-domains-fix-unsafe-iteration-over-modified-list-of-device-links.patch b/queue-3.18/pm-domains-fix-unsafe-iteration-over-modified-list-of-device-links.patch new file mode 100644 index 00000000000..15aa204d7df --- /dev/null +++ b/queue-3.18/pm-domains-fix-unsafe-iteration-over-modified-list-of-device-links.patch @@ -0,0 +1,43 @@ +From c6e83cac3eda5f7dd32ee1453df2f7abb5c6cd46 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Wed, 28 Jun 2017 16:56:18 +0200 +Subject: PM / Domains: Fix unsafe iteration over modified list of device links + +From: Krzysztof Kozlowski + +commit c6e83cac3eda5f7dd32ee1453df2f7abb5c6cd46 upstream. + +pm_genpd_remove_subdomain() iterates over domain's master_links list and +removes matching element thus it has to use safe version of list +iteration. + +Fixes: f721889ff65a ("PM / Domains: Support for generic I/O PM domains (v8)") +Signed-off-by: Krzysztof Kozlowski +Acked-by: Ulf Hansson +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/power/domain.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/base/power/domain.c ++++ b/drivers/base/power/domain.c +@@ -1673,7 +1673,7 @@ int pm_genpd_add_subdomain_names(const c + int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd, + struct generic_pm_domain *subdomain) + { +- struct gpd_link *link; ++ struct gpd_link *l, *link; + int ret = -EINVAL; + + if (IS_ERR_OR_NULL(genpd) || IS_ERR_OR_NULL(subdomain)) +@@ -1682,7 +1682,7 @@ int pm_genpd_remove_subdomain(struct gen + start: + genpd_acquire_lock(genpd); + +- list_for_each_entry(link, &genpd->master_links, master_node) { ++ list_for_each_entry_safe(link, l, &genpd->master_links, master_node) { + if (link->slave != subdomain) + continue; + diff --git a/queue-3.18/pm-domains-fix-unsafe-iteration-over-modified-list-of-domain-providers.patch b/queue-3.18/pm-domains-fix-unsafe-iteration-over-modified-list-of-domain-providers.patch new file mode 100644 index 00000000000..29685c410de --- /dev/null +++ b/queue-3.18/pm-domains-fix-unsafe-iteration-over-modified-list-of-domain-providers.patch @@ -0,0 +1,38 @@ +From b556b15dc04e9b9b98790f04c21acf5e24f994b2 Mon Sep 17 00:00:00 2001 +From: Krzysztof Kozlowski +Date: Wed, 28 Jun 2017 16:56:19 +0200 +Subject: PM / Domains: Fix unsafe iteration over modified list of domain providers + +From: Krzysztof Kozlowski + +commit b556b15dc04e9b9b98790f04c21acf5e24f994b2 upstream. + +of_genpd_del_provider() iterates over list of domain provides and +removes matching element thus it has to use safe version of list +iteration. + +Fixes: aa42240ab254 (PM / Domains: Add generic OF-based PM domain look-up) +Signed-off-by: Krzysztof Kozlowski +Acked-by: Ulf Hansson +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/base/power/domain.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/base/power/domain.c ++++ b/drivers/base/power/domain.c +@@ -2056,10 +2056,10 @@ EXPORT_SYMBOL_GPL(__of_genpd_add_provide + */ + void of_genpd_del_provider(struct device_node *np) + { +- struct of_genpd_provider *cp; ++ struct of_genpd_provider *cp, *tmp; + + mutex_lock(&of_genpd_mutex); +- list_for_each_entry(cp, &of_genpd_providers, link) { ++ list_for_each_entry_safe(cp, tmp, &of_genpd_providers, link) { + if (cp->node == np) { + list_del(&cp->link); + of_node_put(cp->node); diff --git a/queue-3.18/powerpc-64-fix-atomic64_inc_not_zero-to-return-an-int.patch b/queue-3.18/powerpc-64-fix-atomic64_inc_not_zero-to-return-an-int.patch new file mode 100644 index 00000000000..edf62ecff93 --- /dev/null +++ b/queue-3.18/powerpc-64-fix-atomic64_inc_not_zero-to-return-an-int.patch @@ -0,0 +1,59 @@ +From 01e6a61aceb82e13bec29502a8eb70d9574f97ad Mon Sep 17 00:00:00 2001 +From: Michael Ellerman +Date: Tue, 11 Jul 2017 22:10:54 +1000 +Subject: powerpc/64: Fix atomic64_inc_not_zero() to return an int + +From: Michael Ellerman + +commit 01e6a61aceb82e13bec29502a8eb70d9574f97ad upstream. + +Although it's not documented anywhere, there is an expectation that +atomic64_inc_not_zero() returns a result which fits in an int. This is +the behaviour implemented on all arches except powerpc. + +This has caused at least one bug in practice, in the percpu-refcount +code, where the long result from our atomic64_inc_not_zero() was +truncated to an int leading to lost references and stuck systems. That +was worked around in that code in commit 966d2b04e070 ("percpu-refcount: +fix reference leak during percpu-atomic transition"). + +To the best of my grepping abilities there are no other callers +in-tree which truncate the value, but we should fix it anyway. Because +the breakage is subtle and potentially very harmful I'm also tagging +it for stable. + +Code generation is largely unaffected because in most cases the +callers are just using the result for a test anyway. In particular the +case of fget() that was mentioned in commit a6cf7ed5119f +("powerpc/atomic: Implement atomic*_inc_not_zero") generates exactly +the same code. + +Fixes: a6cf7ed5119f ("powerpc/atomic: Implement atomic*_inc_not_zero") +Noticed-by: Linus Torvalds +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/include/asm/atomic.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/arch/powerpc/include/asm/atomic.h ++++ b/arch/powerpc/include/asm/atomic.h +@@ -453,7 +453,7 @@ static __inline__ int atomic64_add_unles + * Atomically increments @v by 1, so long as @v is non-zero. + * Returns non-zero if @v was non-zero, and zero otherwise. + */ +-static __inline__ long atomic64_inc_not_zero(atomic64_t *v) ++static __inline__ int atomic64_inc_not_zero(atomic64_t *v) + { + long t1, t2; + +@@ -472,7 +472,7 @@ static __inline__ long atomic64_inc_not_ + : "r" (&v->counter) + : "cc", "xer", "memory"); + +- return t1; ++ return t1 != 0; + } + + #endif /* __powerpc64__ */ diff --git a/queue-3.18/powerpc-asm-mark-cr0-as-clobbered-in-mftb.patch b/queue-3.18/powerpc-asm-mark-cr0-as-clobbered-in-mftb.patch new file mode 100644 index 00000000000..ddbcdb0d1f0 --- /dev/null +++ b/queue-3.18/powerpc-asm-mark-cr0-as-clobbered-in-mftb.patch @@ -0,0 +1,35 @@ +From 2400fd822f467cb4c886c879d8ad99feac9cf319 Mon Sep 17 00:00:00 2001 +From: Oliver O'Halloran +Date: Thu, 6 Jul 2017 18:46:43 +1000 +Subject: powerpc/asm: Mark cr0 as clobbered in mftb() + +From: Oliver O'Halloran + +commit 2400fd822f467cb4c886c879d8ad99feac9cf319 upstream. + +The workaround for the CELL timebase bug does not correctly mark cr0 as +being clobbered. This means GCC doesn't know that the asm block changes cr0 and +might leave the result of an unrelated comparison in cr0 across the block, which +we then trash, leading to basically random behaviour. + +Fixes: 859deea949c3 ("[POWERPC] Cell timebase bug workaround") +Signed-off-by: Oliver O'Halloran +[mpe: Tweak change log and flag for stable] +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/include/asm/reg.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/powerpc/include/asm/reg.h ++++ b/arch/powerpc/include/asm/reg.h +@@ -1231,7 +1231,7 @@ static inline unsigned long mfvtb (void) + " .llong 0\n" \ + ".previous" \ + : "=r" (rval) \ +- : "i" (CPU_FTR_CELL_TB_BUG), "i" (SPRN_TBRL)); \ ++ : "i" (CPU_FTR_CELL_TB_BUG), "i" (SPRN_TBRL) : "cr0"); \ + rval;}) + #else + #define mftb() ({unsigned long rval; \ diff --git a/queue-3.18/powerpc-fix-emulation-of-mcrf-in-emulate_step.patch b/queue-3.18/powerpc-fix-emulation-of-mcrf-in-emulate_step.patch new file mode 100644 index 00000000000..0b5e0f5f36e --- /dev/null +++ b/queue-3.18/powerpc-fix-emulation-of-mcrf-in-emulate_step.patch @@ -0,0 +1,39 @@ +From 87c4b83e0fe234a1f0eed131ab6fa232036860d5 Mon Sep 17 00:00:00 2001 +From: Anton Blanchard +Date: Thu, 15 Jun 2017 09:46:38 +1000 +Subject: powerpc: Fix emulation of mcrf in emulate_step() + +From: Anton Blanchard + +commit 87c4b83e0fe234a1f0eed131ab6fa232036860d5 upstream. + +The mcrf emulation code was using the CR field number directly as the shift +value, without taking into account that CR fields are numbered from 0-7 starting +at the high bits. That meant it was looking at the CR fields in the reverse +order. + +Fixes: cf87c3f6b647 ("powerpc: Emulate icbi, mcrf and conditional-trap instructions") +Signed-off-by: Anton Blanchard +Acked-by: Naveen N. Rao +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/lib/sstep.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/arch/powerpc/lib/sstep.c ++++ b/arch/powerpc/lib/sstep.c +@@ -687,8 +687,10 @@ int __kprobes analyse_instr(struct instr + case 19: + switch ((instr >> 1) & 0x3ff) { + case 0: /* mcrf */ +- rd = (instr >> 21) & 0x1c; +- ra = (instr >> 16) & 0x1c; ++ rd = 7 - ((instr >> 23) & 0x7); ++ ra = 7 - ((instr >> 18) & 0x7); ++ rd *= 4; ++ ra *= 4; + val = (regs->ccr >> ra) & 0xf; + regs->ccr = (regs->ccr & ~(0xfUL << rd)) | (val << rd); + goto instr_done; diff --git a/queue-3.18/powerpc-fix-emulation-of-mfocrf-in-emulate_step.patch b/queue-3.18/powerpc-fix-emulation-of-mfocrf-in-emulate_step.patch new file mode 100644 index 00000000000..f2958c0da39 --- /dev/null +++ b/queue-3.18/powerpc-fix-emulation-of-mfocrf-in-emulate_step.patch @@ -0,0 +1,48 @@ +From 64e756c55aa46fc18fd53e8f3598b73b528d8637 Mon Sep 17 00:00:00 2001 +From: Anton Blanchard +Date: Thu, 15 Jun 2017 09:46:39 +1000 +Subject: powerpc: Fix emulation of mfocrf in emulate_step() + +From: Anton Blanchard + +commit 64e756c55aa46fc18fd53e8f3598b73b528d8637 upstream. + +From POWER4 onwards, mfocrf() only places the specified CR field into +the destination GPR, and the rest of it is set to 0. The PowerPC AS +from version 3.0 now requires this behaviour. + +The emulation code currently puts the entire CR into the destination GPR. +Fix it. + +Fixes: 6888199f7fe5 ("[POWERPC] Emulate more instructions in software") +Signed-off-by: Anton Blanchard +Acked-by: Naveen N. Rao +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/lib/sstep.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +--- a/arch/powerpc/lib/sstep.c ++++ b/arch/powerpc/lib/sstep.c +@@ -969,6 +969,19 @@ int __kprobes analyse_instr(struct instr + #endif + + case 19: /* mfcr */ ++ if ((instr >> 20) & 1) { ++ imm = 0xf0000000UL; ++ for (sh = 0; sh < 8; ++sh) { ++ if (instr & (0x80000 >> sh)) { ++ regs->gpr[rd] = regs->ccr & imm; ++ break; ++ } ++ imm >>= 4; ++ } ++ ++ goto instr_done; ++ } ++ + regs->gpr[rd] = regs->ccr; + regs->gpr[rd] &= 0xffffffffUL; + goto instr_done; diff --git a/queue-3.18/scsi-ses-do-not-add-a-device-to-an-enclosure-if-enclosure_add_links-fails.patch b/queue-3.18/scsi-ses-do-not-add-a-device-to-an-enclosure-if-enclosure_add_links-fails.patch new file mode 100644 index 00000000000..bfbe143dbac --- /dev/null +++ b/queue-3.18/scsi-ses-do-not-add-a-device-to-an-enclosure-if-enclosure_add_links-fails.patch @@ -0,0 +1,54 @@ +From 62e62ffd95539b9220894a7900a619e0f3ef4756 Mon Sep 17 00:00:00 2001 +From: Maurizio Lombardi +Date: Tue, 27 Jun 2017 11:53:27 +0200 +Subject: scsi: ses: do not add a device to an enclosure if enclosure_add_links() fails. + +From: Maurizio Lombardi + +commit 62e62ffd95539b9220894a7900a619e0f3ef4756 upstream. + +The enclosure_add_device() function should fail if it can't create the +relevant sysfs links. + +Signed-off-by: Maurizio Lombardi +Tested-by: Douglas Miller +Acked-by: James Bottomley +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/misc/enclosure.c | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +--- a/drivers/misc/enclosure.c ++++ b/drivers/misc/enclosure.c +@@ -320,6 +320,7 @@ int enclosure_add_device(struct enclosur + struct device *dev) + { + struct enclosure_component *cdev; ++ int err; + + if (!edev || component >= edev->components) + return -EINVAL; +@@ -329,12 +330,17 @@ int enclosure_add_device(struct enclosur + if (cdev->dev == dev) + return -EEXIST; + +- if (cdev->dev) ++ if (cdev->dev) { + enclosure_remove_links(cdev); +- +- put_device(cdev->dev); ++ put_device(cdev->dev); ++ } + cdev->dev = get_device(dev); +- return enclosure_add_links(cdev); ++ err = enclosure_add_links(cdev); ++ if (err) { ++ put_device(cdev->dev); ++ cdev->dev = NULL; ++ } ++ return err; + } + EXPORT_SYMBOL_GPL(enclosure_add_device); + diff --git a/queue-3.18/series b/queue-3.18/series index d5fef6498ef..6b370aa0483 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -13,3 +13,11 @@ stddef.h-move-offsetofend-inside-ifndef-endif-guard-neaten.patch nfc-add-sockaddr-length-checks-before-accessing-sa_family-in-bind-handlers.patch bluetooth-use-constant-time-memory-comparison-for-secret-values.patch wlcore-fix-64k-page-support.patch +asoc-compress-derive-substream-from-stream-based-on-direction.patch +pm-domains-fix-unsafe-iteration-over-modified-list-of-device-links.patch +pm-domains-fix-unsafe-iteration-over-modified-list-of-domain-providers.patch +scsi-ses-do-not-add-a-device-to-an-enclosure-if-enclosure_add_links-fails.patch +powerpc-64-fix-atomic64_inc_not_zero-to-return-an-int.patch +powerpc-fix-emulation-of-mcrf-in-emulate_step.patch +powerpc-fix-emulation-of-mfocrf-in-emulate_step.patch +powerpc-asm-mark-cr0-as-clobbered-in-mftb.patch