All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths
@ 2016-10-07 10:51 Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl Jiri Slaby
                   ` (35 more replies)
  0 siblings, 36 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Michael Ellerman, Jiri Slaby

From: Michael Ellerman <mpe@ellerman.id.au>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit e8a4fd0afe05d5213d809fa686d3b8319464acfd upstream.

The encoding of the lengths in the ibm_architecture_vec array is
"interesting" to say the least. It's non-obvious how the number of bytes
we provide relates to the length value.

In fact we already got it wrong once, see 11e9ed43ca8a "Fix up
ibm_architecture_vec definition".

So add some macros to make it (hopefully) clearer. These at least have
the property that the integer present in the code is equal to the number
of bytes that follows it.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/kernel/prom_init.c | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 5fe2842e8bab..6e4114a64399 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -642,6 +642,15 @@ static void __init early_cmdline_parse(void)
 #define W(x)	((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \
 		((x) >> 8) & 0xff, (x) & 0xff
 
+/* Firmware expects the value to be n - 1, where n is the # of vectors */
+#define NUM_VECTORS(n)		((n) - 1)
+
+/*
+ * Firmware expects 1 + n - 2, where n is the length of the option vector in
+ * bytes. The 1 accounts for the length byte itself, the - 2 .. ?
+ */
+#define VECTOR_LENGTH(n)	(1 + (n) - 2)
+
 unsigned char ibm_architecture_vec[] = {
 	W(0xfffe0000), W(0x003a0000),	/* POWER5/POWER5+ */
 	W(0xffff0000), W(0x003e0000),	/* POWER6 */
@@ -652,16 +661,16 @@ unsigned char ibm_architecture_vec[] = {
 	W(0xffffffff), W(0x0f000003),	/* all 2.06-compliant */
 	W(0xffffffff), W(0x0f000002),	/* all 2.05-compliant */
 	W(0xfffffffe), W(0x0f000001),	/* all 2.04-compliant and earlier */
-	6 - 1,				/* 6 option vectors */
+	NUM_VECTORS(6),			/* 6 option vectors */
 
 	/* option vector 1: processor architectures supported */
-	3 - 2,				/* length */
+	VECTOR_LENGTH(2),		/* length */
 	0,				/* don't ignore, don't halt */
 	OV1_PPC_2_00 | OV1_PPC_2_01 | OV1_PPC_2_02 | OV1_PPC_2_03 |
 	OV1_PPC_2_04 | OV1_PPC_2_05 | OV1_PPC_2_06 | OV1_PPC_2_07,
 
 	/* option vector 2: Open Firmware options supported */
-	34 - 2,				/* length */
+	VECTOR_LENGTH(33),		/* length */
 	OV2_REAL_MODE,
 	0, 0,
 	W(0xffffffff),			/* real_base */
@@ -675,17 +684,17 @@ unsigned char ibm_architecture_vec[] = {
 	48,				/* max log_2(hash table size) */
 
 	/* option vector 3: processor options supported */
-	3 - 2,				/* length */
+	VECTOR_LENGTH(2),		/* length */
 	0,				/* don't ignore, don't halt */
 	OV3_FP | OV3_VMX | OV3_DFP,
 
 	/* option vector 4: IBM PAPR implementation */
-	3 - 2,				/* length */
+	VECTOR_LENGTH(2),		/* length */
 	0,				/* don't halt */
 	OV4_MIN_ENT_CAP,		/* minimum VP entitled capacity */
 
 	/* option vector 5: PAPR/OF options */
-	19 - 2,				/* length */
+	VECTOR_LENGTH(18),		/* length */
 	0,				/* don't ignore, don't halt */
 	OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) |
 	OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) |
@@ -718,12 +727,12 @@ unsigned char ibm_architecture_vec[] = {
 	OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) |
 	OV5_FEAT(OV5_PFO_HW_842),
 	OV5_FEAT(OV5_SUB_PROCESSORS),
+
 	/* option vector 6: IBM PAPR hints */
-	4 - 2,				/* length */
+	VECTOR_LENGTH(3),		/* length */
 	0,
 	0,
 	OV6_LINUX,
-
 };
 
 /* Old method - ELF header with PT_NOTE sections only works on BE */
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] mm,ksm: fix endless looping in allocating memory when ksm enable Jiri Slaby
                   ` (34 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Karl Beldan, Brian Norris, Jiri Slaby

From: Karl Beldan <kbeldan@baylibre.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit f6d7c1b5598b6407c3f1da795dd54acf99c1990c upstream.

This fixes subpage writes when using 4-bit HW ECC.

There has been numerous reports about ECC errors with devices using this
driver for a while.  Also the 4-bit ECC has been reported as broken with
subpages in [1] and with 16 bits NANDs in the driver and in mach* board
files both in mainline and in the vendor BSPs.

What I saw with 4-bit ECC on a 16bits NAND (on an LCDK) which got me to
try reinitializing the ECC engine:
- R/W on whole pages properly generates/checks RS code
- try writing the 1st subpage only of a blank page, the subpage is well
  written and the RS code properly generated, re-reading the same page
  the HW detects some ECC error, reading the same page again no ECC
  error is detected

Note that the ECC engine is already reinitialized in the 1-bit case.

Tested on my LCDK with UBI+UBIFS using subpages.
This could potentially get rid of the issue workarounded in [1].

[1] 28c015a9daab ("mtd: davinci-nand: disable subpage write for keystone-nand")

Fixes: 6a4123e581b3 ("mtd: nand: davinci_nand, 4-bit ECC for smallpage")
Signed-off-by: Karl Beldan <kbeldan@baylibre.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mtd/nand/davinci_nand.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index b77a01efb483..c56a957e92e1 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -241,6 +241,9 @@ static void nand_davinci_hwctl_4bit(struct mtd_info *mtd, int mode)
 	unsigned long flags;
 	u32 val;
 
+	/* Reset ECC hardware */
+	davinci_nand_readl(info, NAND_4BIT_ECC1_OFFSET);
+
 	spin_lock_irqsave(&davinci_nand_lock, flags);
 
 	/* Start 4-bit ECC calculation for read/write */
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] mm,ksm: fix endless looping in allocating memory when ksm enable
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] can: dev: fix deadlock reported after bus-off Jiri Slaby
                   ` (33 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: zhong jiang, Andrew Morton, Linus Torvalds, Jiri Slaby

From: zhong jiang <zhongjiang@huawei.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 5b398e416e880159fe55eefd93c6588fa072cd66 upstream.

I hit the following hung task when runing a OOM LTP test case with 4.1
kernel.

Call trace:
[<ffffffc000086a88>] __switch_to+0x74/0x8c
[<ffffffc000a1bae0>] __schedule+0x23c/0x7bc
[<ffffffc000a1c09c>] schedule+0x3c/0x94
[<ffffffc000a1eb84>] rwsem_down_write_failed+0x214/0x350
[<ffffffc000a1e32c>] down_write+0x64/0x80
[<ffffffc00021f794>] __ksm_exit+0x90/0x19c
[<ffffffc0000be650>] mmput+0x118/0x11c
[<ffffffc0000c3ec4>] do_exit+0x2dc/0xa74
[<ffffffc0000c46f8>] do_group_exit+0x4c/0xe4
[<ffffffc0000d0f34>] get_signal+0x444/0x5e0
[<ffffffc000089fcc>] do_signal+0x1d8/0x450
[<ffffffc00008a35c>] do_notify_resume+0x70/0x78

The oom victim cannot terminate because it needs to take mmap_sem for
write while the lock is held by ksmd for read which loops in the page
allocator

ksm_do_scan
	scan_get_next_rmap_item
		down_read
		get_next_rmap_item
			alloc_rmap_item   #ksmd will loop permanently.

There is no way forward because the oom victim cannot release any memory
in 4.1 based kernel.  Since 4.6 we have the oom reaper which would solve
this problem because it would release the memory asynchronously.
Nevertheless we can relax alloc_rmap_item requirements and use
__GFP_NORETRY because the allocation failure is acceptable as ksm_do_scan
would just retry later after the lock got dropped.

Such a patch would be also easy to backport to older stable kernels which
do not have oom_reaper.

While we are at it add GFP_NOWARN so the admin doesn't have to be alarmed
by the allocation failure.

Link: http://lkml.kernel.org/r/1474165570-44398-1-git-send-email-zhongjiang@huawei.com
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Suggested-by: Hugh Dickins <hughd@google.com>
Suggested-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/ksm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/ksm.c b/mm/ksm.c
index b61ad555184f..9975e218a8b0 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -283,7 +283,8 @@ static inline struct rmap_item *alloc_rmap_item(void)
 {
 	struct rmap_item *rmap_item;
 
-	rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL);
+	rmap_item = kmem_cache_zalloc(rmap_item_cache, GFP_KERNEL |
+						__GFP_NORETRY | __GFP_NOWARN);
 	if (rmap_item)
 		ksm_rmap_items++;
 	return rmap_item;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] can: dev: fix deadlock reported after bus-off
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] mm,ksm: fix endless looping in allocating memory when ksm enable Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] drm/radeon/si/dpm: add workaround for for Jet parts Jiri Slaby
                   ` (32 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Sergei Miroshnichenko, Marc Kleine-Budde, Jiri Slaby

From: Sergei Miroshnichenko <sergeimir@emcraft.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 9abefcb1aaa58b9d5aa40a8bb12c87d02415e4c8 upstream.

A timer was used to restart after the bus-off state, leading to a
relatively large can_restart() executed in an interrupt context,
which in turn sets up pinctrl. When this happens during system boot,
there is a high probability of grabbing the pinctrl_list_mutex,
which is locked already by the probe() of other device, making the
kernel suspect a deadlock condition [1].

To resolve this issue, the restart_timer is replaced by a delayed
work.

[1] https://github.com/victronenergy/venus/issues/24

Signed-off-by: Sergei Miroshnichenko <sergeimir@emcraft.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/can/dev.c   | 27 +++++++++++++++++----------
 include/linux/can/dev.h |  3 ++-
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 464e5f66b66d..284d751ea97f 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -22,6 +22,7 @@
 #include <linux/slab.h>
 #include <linux/netdevice.h>
 #include <linux/if_arp.h>
+#include <linux/workqueue.h>
 #include <linux/can.h>
 #include <linux/can/dev.h>
 #include <linux/can/skb.h>
@@ -394,9 +395,8 @@ EXPORT_SYMBOL_GPL(can_free_echo_skb);
 /*
  * CAN device restart for bus-off recovery
  */
-static void can_restart(unsigned long data)
+static void can_restart(struct net_device *dev)
 {
-	struct net_device *dev = (struct net_device *)data;
 	struct can_priv *priv = netdev_priv(dev);
 	struct net_device_stats *stats = &dev->stats;
 	struct sk_buff *skb;
@@ -436,6 +436,14 @@ restart:
 		netdev_err(dev, "Error %d during restart", err);
 }
 
+static void can_restart_work(struct work_struct *work)
+{
+	struct delayed_work *dwork = to_delayed_work(work);
+	struct can_priv *priv = container_of(dwork, struct can_priv, restart_work);
+
+	can_restart(priv->dev);
+}
+
 int can_restart_now(struct net_device *dev)
 {
 	struct can_priv *priv = netdev_priv(dev);
@@ -449,8 +457,8 @@ int can_restart_now(struct net_device *dev)
 	if (priv->state != CAN_STATE_BUS_OFF)
 		return -EBUSY;
 
-	/* Runs as soon as possible in the timer context */
-	mod_timer(&priv->restart_timer, jiffies);
+	cancel_delayed_work_sync(&priv->restart_work);
+	can_restart(dev);
 
 	return 0;
 }
@@ -472,8 +480,8 @@ void can_bus_off(struct net_device *dev)
 	priv->can_stats.bus_off++;
 
 	if (priv->restart_ms)
-		mod_timer(&priv->restart_timer,
-			  jiffies + (priv->restart_ms * HZ) / 1000);
+		schedule_delayed_work(&priv->restart_work,
+				      msecs_to_jiffies(priv->restart_ms));
 }
 EXPORT_SYMBOL_GPL(can_bus_off);
 
@@ -556,6 +564,7 @@ struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max)
 		return NULL;
 
 	priv = netdev_priv(dev);
+	priv->dev = dev;
 
 	if (echo_skb_max) {
 		priv->echo_skb_max = echo_skb_max;
@@ -565,7 +574,7 @@ struct net_device *alloc_candev(int sizeof_priv, unsigned int echo_skb_max)
 
 	priv->state = CAN_STATE_STOPPED;
 
-	init_timer(&priv->restart_timer);
+	INIT_DELAYED_WORK(&priv->restart_work, can_restart_work);
 
 	return dev;
 }
@@ -599,8 +608,6 @@ int open_candev(struct net_device *dev)
 	if (!netif_carrier_ok(dev))
 		netif_carrier_on(dev);
 
-	setup_timer(&priv->restart_timer, can_restart, (unsigned long)dev);
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(open_candev);
@@ -615,7 +622,7 @@ void close_candev(struct net_device *dev)
 {
 	struct can_priv *priv = netdev_priv(dev);
 
-	del_timer_sync(&priv->restart_timer);
+	cancel_delayed_work_sync(&priv->restart_work);
 	can_flush_echo_skb(dev);
 }
 EXPORT_SYMBOL_GPL(close_candev);
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index fb0ab651a041..fb9fbe2f63e7 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -31,6 +31,7 @@ enum can_mode {
  * CAN common private data
  */
 struct can_priv {
+	struct net_device *dev;
 	struct can_device_stats can_stats;
 
 	struct can_bittiming bittiming;
@@ -42,7 +43,7 @@ struct can_priv {
 	u32 ctrlmode_supported;
 
 	int restart_ms;
-	struct timer_list restart_timer;
+	struct delayed_work restart_work;
 
 	int (*do_set_bittiming)(struct net_device *dev);
 	int (*do_set_mode)(struct net_device *dev, enum can_mode mode);
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] drm/radeon/si/dpm: add workaround for for Jet parts
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (2 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] can: dev: fix deadlock reported after bus-off Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: 8616/1: dt: Respect property size when parsing CPUs Jiri Slaby
                   ` (31 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Alex Deucher, Jiri Slaby

From: Alex Deucher <alexander.deucher@amd.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 670bb4fd21c966d0d2a59ad4a99bb4889f9a2987 upstream.

Add clock quirks for Jet parts.

Reviewed-by: Sonny Jiang <sonny.jiang@amd.com>
Tested-by: Sonny Jiang <sonny.jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/si_dpm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
index 393217886d98..db9c7d26ed16 100644
--- a/drivers/gpu/drm/radeon/si_dpm.c
+++ b/drivers/gpu/drm/radeon/si_dpm.c
@@ -3012,6 +3012,12 @@ static void si_apply_state_adjust_rules(struct radeon_device *rdev,
 	if (rdev->pdev->device == 0x6811 &&
 	    rdev->pdev->revision == 0x81)
 		max_mclk = 120000;
+	/* limit sclk/mclk on Jet parts for stability */
+	if (rdev->pdev->device == 0x6665 &&
+	    rdev->pdev->revision == 0xc3) {
+		max_sclk = 75000;
+		max_mclk = 80000;
+	}
 
 	/* XXX validate the min clocks required for display */
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] ARM: 8616/1: dt: Respect property size when parsing CPUs
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (3 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] drm/radeon/si/dpm: add workaround for for Jet parts Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] tools/vm/slabinfo: fix an unintentional printf Jiri Slaby
                   ` (30 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Robin Murphy, Russell King, Russell King, Jiri Slaby

From: Robin Murphy <robin.murphy@arm.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit ba6dea4f7cedb4b1c17e36f4087675d817c2e24b upstream.

Whilst MPIDR values themselves are less than 32 bits, it is still
perfectly valid for a DT to have #address-cells > 1 in the CPUs node,
resulting in the "reg" property having leading zero cell(s). In that
situation, the big-endian nature of the data conspires with the current
behaviour of only reading the first cell to cause the kernel to think
all CPUs have ID 0, and become resoundingly unhappy as a consequence.

Take the full property length into account when parsing CPUs so as to
be correct under any circumstances.

Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/kernel/devtree.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/arm/kernel/devtree.c b/arch/arm/kernel/devtree.c
index 41960fb0daff..68ff9e6473be 100644
--- a/arch/arm/kernel/devtree.c
+++ b/arch/arm/kernel/devtree.c
@@ -90,6 +90,8 @@ void __init arm_dt_init_cpu_maps(void)
 		return;
 
 	for_each_child_of_node(cpus, cpu) {
+		const __be32 *cell;
+		int prop_bytes;
 		u32 hwid;
 
 		if (of_node_cmp(cpu->type, "cpu"))
@@ -101,17 +103,23 @@ void __init arm_dt_init_cpu_maps(void)
 		 * properties is considered invalid to build the
 		 * cpu_logical_map.
 		 */
-		if (of_property_read_u32(cpu, "reg", &hwid)) {
+		cell = of_get_property(cpu, "reg", &prop_bytes);
+		if (!cell || prop_bytes < sizeof(*cell)) {
 			pr_debug(" * %s missing reg property\n",
 				     cpu->full_name);
 			return;
 		}
 
 		/*
-		 * 8 MSBs must be set to 0 in the DT since the reg property
+		 * Bits n:24 must be set to 0 in the DT since the reg property
 		 * defines the MPIDR[23:0].
 		 */
-		if (hwid & ~MPIDR_HWID_BITMASK)
+		do {
+			hwid = be32_to_cpu(*cell++);
+			prop_bytes -= sizeof(*cell);
+		} while (!hwid && prop_bytes > 0);
+
+		if (prop_bytes || (hwid & ~MPIDR_HWID_BITMASK))
 			return;
 
 		/*
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] tools/vm/slabinfo: fix an unintentional printf
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (4 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: 8616/1: dt: Respect property size when parsing CPUs Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] hwmon: (adt7411) set bit 3 in CFG1 register Jiri Slaby
                   ` (29 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable
  Cc: Dan Carpenter, Sergey Senozhatsky, Colin Ian King, Laura Abbott,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Dan Carpenter <dan.carpenter@oracle.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 2d6a4d64812bb12dda53704943b61a7496d02098 upstream.

The curly braces are missing here so we print stuff unintentionally.

Fixes: 9da4714a2d44 ('slub: slabinfo update for cmpxchg handling')
Link: http://lkml.kernel.org/r/20160715211243.GE19522@mwanda
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Laura Abbott <labbott@fedoraproject.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 tools/vm/slabinfo.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/vm/slabinfo.c b/tools/vm/slabinfo.c
index 808d5a9d5dcf..bcc6125657e5 100644
--- a/tools/vm/slabinfo.c
+++ b/tools/vm/slabinfo.c
@@ -493,10 +493,11 @@ static void slab_stats(struct slabinfo *s)
 			s->alloc_node_mismatch, (s->alloc_node_mismatch * 100) / total);
 	}
 
-	if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail)
+	if (s->cmpxchg_double_fail || s->cmpxchg_double_cpu_fail) {
 		printf("\nCmpxchg_double Looping\n------------------------\n");
 		printf("Locked Cmpxchg Double redos   %lu\nUnlocked Cmpxchg Double redos %lu\n",
 			s->cmpxchg_double_fail, s->cmpxchg_double_cpu_fail);
+	}
 }
 
 static void report(struct slabinfo *s)
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] hwmon: (adt7411) set bit 3 in CFG1 register
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (5 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] tools/vm/slabinfo: fix an unintentional printf Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] iwlwifi: pcie: fix access to scratch buffer Jiri Slaby
                   ` (28 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Michael Walle, Guenter Roeck, Jiri Slaby

From: Michael Walle <michael@walle.cc>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit b53893aae441a034bf4dbbad42fe218561d7d81f upstream.

According to the datasheet you should only write 1 to this bit. If it is
not set, at least AIN3 will return bad values on newer silicon revisions.

Fixes: d84ca5b345c2 ("hwmon: Add driver for ADT7411 voltage and temperature sensor")
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hwmon/adt7411.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/adt7411.c b/drivers/hwmon/adt7411.c
index d9299dee37d1..dddaa161aadb 100644
--- a/drivers/hwmon/adt7411.c
+++ b/drivers/hwmon/adt7411.c
@@ -30,6 +30,7 @@
 
 #define ADT7411_REG_CFG1			0x18
 #define ADT7411_CFG1_START_MONITOR		(1 << 0)
+#define ADT7411_CFG1_RESERVED_BIT3		(1 << 3)
 
 #define ADT7411_REG_CFG2			0x19
 #define ADT7411_CFG2_DISABLE_AVG		(1 << 5)
@@ -292,8 +293,10 @@ static int adt7411_probe(struct i2c_client *client,
 	mutex_init(&data->device_lock);
 	mutex_init(&data->update_lock);
 
+	/* According to the datasheet, we must only write 1 to bit 3 */
 	ret = adt7411_modify_bit(client, ADT7411_REG_CFG1,
-				 ADT7411_CFG1_START_MONITOR, 1);
+				 ADT7411_CFG1_RESERVED_BIT3
+				 | ADT7411_CFG1_START_MONITOR, 1);
 	if (ret < 0)
 		return ret;
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] iwlwifi: pcie: fix access to scratch buffer
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (6 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] hwmon: (adt7411) set bit 3 in CFG1 register Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame() Jiri Slaby
                   ` (27 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Sara Sharon, Luca Coelho, Jiri Slaby

From: Sara Sharon <sara.sharon@intel.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit d5d0689aefc59c6a5352ca25d7e6d47d03f543ce upstream.

This fixes a pretty ancient bug that hasn't manifested itself
until now.
The scratchbuf for command queue is allocated only for 32 slots
but is accessed with the queue write pointer - which can be
up to 256.
Since the scratch buf size was 16 and there are up to 256 TFDs
we never passed a page boundary when accessing the scratch buffer,
but when attempting to increase the size of the scratch buffer a
panic was quick to follow when trying to access the address resulted
in a page boundary.

Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Fixes: 38c0f334b359 ("iwlwifi: use coherent DMA memory for command header")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/iwlwifi/pcie/tx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/pcie/tx.c b/drivers/net/wireless/iwlwifi/pcie/tx.c
index 911a15074ffb..6c769009587b 100644
--- a/drivers/net/wireless/iwlwifi/pcie/tx.c
+++ b/drivers/net/wireless/iwlwifi/pcie/tx.c
@@ -1328,9 +1328,9 @@ static int iwl_pcie_enqueue_hcmd(struct iwl_trans *trans,
 
 	/* start the TFD with the scratchbuf */
 	scratch_size = min_t(int, copy_size, IWL_HCMD_SCRATCHBUF_SIZE);
-	memcpy(&txq->scratchbufs[q->write_ptr], &out_cmd->hdr, scratch_size);
+	memcpy(&txq->scratchbufs[idx], &out_cmd->hdr, scratch_size);
 	iwl_pcie_txq_build_tfd(trans, txq,
-			       iwl_pcie_get_scratchbuf_dma(txq, q->write_ptr),
+			       iwl_pcie_get_scratchbuf_dma(txq, idx),
 			       scratch_size, 1);
 
 	/* map first command fragment, if any remains */
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame()
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (7 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] iwlwifi: pcie: fix access to scratch buffer Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: 8618/1: decompressor: reset ttbcr fields to use TTBR0 on ARMv7 Jiri Slaby
                   ` (26 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Dan Carpenter, Felipe Balbi, Jiri Slaby

From: Dan Carpenter <dan.carpenter@oracle.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit f4693b08cc901912a87369c46537b94ed4084ea0 upstream.

We can't assign -EINVAL to a u16.

Fixes: 3948f0e0c999 ('usb: add Freescale QE/CPM USB peripheral controller driver')
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/gadget/fsl_qe_udc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/gadget/fsl_qe_udc.c b/drivers/usb/gadget/fsl_qe_udc.c
index f3bb363f1d4a..9d81d390e124 100644
--- a/drivers/usb/gadget/fsl_qe_udc.c
+++ b/drivers/usb/gadget/fsl_qe_udc.c
@@ -1881,11 +1881,8 @@ static int qe_get_frame(struct usb_gadget *gadget)
 
 	tmp = in_be16(&udc->usb_param->frame_n);
 	if (tmp & 0x8000)
-		tmp = tmp & 0x07ff;
-	else
-		tmp = -EINVAL;
-
-	return (int)tmp;
+		return tmp & 0x07ff;
+	return -EINVAL;
 }
 
 static int fsl_qe_start(struct usb_gadget *gadget,
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] ARM: 8618/1: decompressor: reset ttbcr fields to use TTBR0 on ARMv7
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (8 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame() Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] arm64: debug: avoid resetting stepping state machine when TIF_SINGLESTEP Jiri Slaby
                   ` (25 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Srinivas Ramana, Russell King, Jiri Slaby

From: Srinivas Ramana <sramana@codeaurora.org>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 117e5e9c4cfcb7628f08de074fbfefec1bb678b7 upstream.

If the bootloader uses the long descriptor format and jumps to
kernel decompressor code, TTBCR may not be in a right state.
Before enabling the MMU, it is required to clear the TTBCR.PD0
field to use TTBR0 for translation table walks.

The commit dbece45894d3a ("ARM: 7501/1: decompressor:
reset ttbcr for VMSA ARMv7 cores") does the reset of TTBCR.N, but
doesn't consider all the bits for the size of TTBCR.N.

Clear TTBCR.PD0 field and reset all the three bits of TTBCR.N to
indicate the use of TTBR0 and the correct base address width.

Fixes: dbece45894d3 ("ARM: 7501/1: decompressor: reset ttbcr for VMSA ARMv7 cores")
Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Srinivas Ramana <sramana@codeaurora.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/boot/compressed/head.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index de5143e4ad04..b10875e41e40 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -734,7 +734,7 @@ __armv7_mmu_cache_on:
 		orrne	r0, r0, #1		@ MMU enabled
 		movne	r1, #0xfffffffd		@ domain 0 = client
 		bic     r6, r6, #1 << 31        @ 32-bit translation system
-		bic     r6, r6, #3 << 0         @ use only ttbr0
+		bic     r6, r6, #(7 << 0) | (1 << 4)	@ use only ttbr0
 		mcrne	p15, 0, r3, c2, c0, 0	@ load page table pointer
 		mcrne	p15, 0, r1, c3, c0, 0	@ load domain access control
 		mcrne   p15, 0, r6, c2, c0, 2   @ load ttb control
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] arm64: debug: avoid resetting stepping state machine when TIF_SINGLESTEP
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (9 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: 8618/1: decompressor: reset ttbcr fields to use TTBR0 on ARMv7 Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] MIPS: Malta: Fix IOCU disable switch read for MIPS64 Jiri Slaby
                   ` (24 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Will Deacon, Jiri Slaby

From: Will Deacon <will.deacon@arm.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 3a402a709500c5a3faca2111668c33d96555e35a upstream.

When TIF_SINGLESTEP is set for a task, the single-step state machine is
enabled and we must take care not to reset it to the active-not-pending
state if it is already in the active-pending state.

Unfortunately, that's exactly what user_enable_single_step does, by
unconditionally setting the SS bit in the SPSR for the current task.
This causes failures in the GDB testsuite, where GDB ends up missing
expected step traps if the instruction being stepped generates another
trap, e.g. PTRACE_EVENT_FORK from an SVC instruction.

This patch fixes the problem by preserving the current state of the
stepping state machine when TIF_SINGLESTEP is set on the current thread.

Cc: <stable@vger.kernel.org>
Reported-by: Yao Qi <yao.qi@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kernel/debug-monitors.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kernel/debug-monitors.c b/arch/arm64/kernel/debug-monitors.c
index cbfacf7fb438..e20114baf8d5 100644
--- a/arch/arm64/kernel/debug-monitors.c
+++ b/arch/arm64/kernel/debug-monitors.c
@@ -338,8 +338,10 @@ int kernel_active_single_step(void)
 /* ptrace API */
 void user_enable_single_step(struct task_struct *task)
 {
-	set_ti_thread_flag(task_thread_info(task), TIF_SINGLESTEP);
-	set_regs_spsr_ss(task_pt_regs(task));
+	struct thread_info *ti = task_thread_info(task);
+
+	if (!test_and_set_ti_thread_flag(ti, TIF_SINGLESTEP))
+		set_regs_spsr_ss(task_pt_regs(task));
 }
 
 void user_disable_single_step(struct task_struct *task)
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] MIPS: Malta: Fix IOCU disable switch read for MIPS64
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (10 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] arm64: debug: avoid resetting stepping state machine when TIF_SINGLESTEP Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] printk: fix parsing of "brl=" option Jiri Slaby
                   ` (23 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable
  Cc: Paul Burton, Matt Redfearn, Masahiro Yamada, Kees Cook,
	linux-mips, linux-kernel, Ralf Baechle, Jiri Slaby

From: Paul Burton <paul.burton@imgtec.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 305723ab439e14debc1d339aa04e835d488b8253 upstream.

Malta boards used with CPU emulators feature a switch to disable use of
an IOCU. Software has to check this switch & ignore any present IOCU if
the switch is closed. The read used to do this was unsafe for 64 bit
kernels, as it simply casted the address 0xbf403000 to a pointer &
dereferenced it. Whilst in a 32 bit kernel this would access kseg1, in a
64 bit kernel this attempts to access xuseg & results in an address
error exception.

Fix by accessing a correctly formed ckseg1 address generated using the
CKSEG1ADDR macro.

Whilst modifying this code, define the name of the register and the bit
we care about within it, which indicates whether PCI DMA is routed to
the IOCU or straight to DRAM. The code previously checked that bit 0 was
also set, but the least significant 7 bits of the CONFIG_GEN0 register
contain the value of the MReqInfo signal provided to the IOCU OCP bus,
so singling out bit 0 makes little sense & that part of the check is
dropped.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Fixes: b6d92b4a6bdb ("MIPS: Add option to disable software I/O coherency.")
Cc: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14187/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/mti-malta/malta-setup.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/mips/mti-malta/malta-setup.c b/arch/mips/mti-malta/malta-setup.c
index c72a06936781..2046e1c385d4 100644
--- a/arch/mips/mti-malta/malta-setup.c
+++ b/arch/mips/mti-malta/malta-setup.c
@@ -36,6 +36,9 @@
 #include <linux/console.h>
 #endif
 
+#define ROCIT_CONFIG_GEN0		0x1f403000
+#define  ROCIT_CONFIG_GEN0_PCI_IOCU	BIT(7)
+
 extern void malta_be_init(void);
 extern int malta_be_handler(struct pt_regs *regs, int is_fixup);
 
@@ -108,6 +111,8 @@ static void __init fd_activate(void)
 static int __init plat_enable_iocoherency(void)
 {
 	int supported = 0;
+	u32 cfg;
+
 	if (mips_revision_sconid == MIPS_REVISION_SCON_BONITO) {
 		if (BONITO_PCICACHECTRL & BONITO_PCICACHECTRL_CPUCOH_PRES) {
 			BONITO_PCICACHECTRL |= BONITO_PCICACHECTRL_CPUCOH_EN;
@@ -130,7 +135,8 @@ static int __init plat_enable_iocoherency(void)
 	} else if (gcmp_niocu() != 0) {
 		/* Nothing special needs to be done to enable coherency */
 		pr_info("CMP IOCU detected\n");
-		if ((*(unsigned int *)0xbf403000 & 0x81) != 0x81) {
+		cfg = __raw_readl((u32 *)CKSEG1ADDR(ROCIT_CONFIG_GEN0));
+		if (!(cfg & ROCIT_CONFIG_GEN0_PCI_IOCU)) {
 			pr_crit("IOCU OPERATION DISABLED BY SWITCH - DEFAULTING TO SW IO COHERENCY\n");
 			return 0;
 		}
-- 
2.10.1

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] printk: fix parsing of "brl=" option
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (11 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] MIPS: Malta: Fix IOCU disable switch read for MIPS64 Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: sa1100: clear reset status prior to reboot Jiri Slaby
                   ` (22 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable
  Cc: Nicolas Iooss, Joe Perches, Andrew Morton, Linus Torvalds, Jiri Slaby

From: Nicolas Iooss <nicolas.iooss_linux@m4x.org>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit ae6c33ba6e37eea3012fe2640b22400ef3f2d0f3 upstream.

Commit bbeddf52adc1 ("printk: move braille console support into separate
braille.[ch] files") moved the parsing of braille-related options into
_braille_console_setup(), changing the type of variable str from char*
to char**.  In this commit, memcmp(str, "brl,", 4) was correctly updated
to memcmp(*str, "brl,", 4) but not memcmp(str, "brl=", 4).

Update the code to make "brl=" option work again and replace memcmp()
with strncmp() to make the compiler able to detect such an issue.

Fixes: bbeddf52adc1 ("printk: move braille console support into separate braille.[ch] files")
Link: http://lkml.kernel.org/r/20160823165700.28952-1-nicolas.iooss_linux@m4x.org
Signed-off-by: Nicolas Iooss <nicolas.iooss_linux@m4x.org>
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/printk/braille.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/printk/braille.c b/kernel/printk/braille.c
index 276762f3a460..d5760c42f042 100644
--- a/kernel/printk/braille.c
+++ b/kernel/printk/braille.c
@@ -9,10 +9,10 @@
 
 char *_braille_console_setup(char **str, char **brl_options)
 {
-	if (!memcmp(*str, "brl,", 4)) {
+	if (!strncmp(*str, "brl,", 4)) {
 		*brl_options = "";
 		*str += 4;
-	} else if (!memcmp(str, "brl=", 4)) {
+	} else if (!strncmp(*str, "brl=", 4)) {
 		*brl_options = *str + 4;
 		*str = strchr(*brl_options, ',');
 		if (!*str)
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] ARM: sa1100: clear reset status prior to reboot
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (12 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] printk: fix parsing of "brl=" option Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: sa1111: fix pcmcia suspend/resume Jiri Slaby
                   ` (21 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Russell King, Jiri Slaby

From: Russell King <rmk+kernel@armlinux.org.uk>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit da60626e7d02a4f385cae80e450afc8b07035368 upstream.

Clear the current reset status prior to rebooting the platform.  This
adds the bit missing from 04fef228fb00 ("[ARM] pxa: introduce
reset_status and clear_reset_status for driver's usage").

Fixes: 04fef228fb00 ("[ARM] pxa: introduce reset_status and clear_reset_status for driver's usage")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mach-sa1100/generic.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index f25b6119e028..534f2d83b1ec 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -31,6 +31,7 @@
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
+#include <mach/reset.h>
 
 #include "generic.h"
 
@@ -134,6 +135,8 @@ static void sa1100_power_off(void)
 
 void sa11x0_restart(enum reboot_mode mode, const char *cmd)
 {
+	clear_reset_status(RESET_STATUS_ALL);
+
 	if (mode == REBOOT_SOFT) {
 		/* Jump into ROM at address 0 */
 		soft_restart(0);
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] ARM: sa1111: fix pcmcia suspend/resume
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (13 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: sa1100: clear reset status prior to reboot Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] hwrng: omap - Fix assumption that runtime_get_sync will always succeed Jiri Slaby
                   ` (20 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Russell King, Jiri Slaby

From: Russell King <rmk+kernel@armlinux.org.uk>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 06dfe5cc0cc684e735cb0232fdb756d30780b05d upstream.

SA1111 PCMCIA was broken when PCMCIA switched to using dev_pm_ops for
the PCMCIA socket class.  PCMCIA used to handle suspend/resume via the
socket hosting device, which happened at normal device suspend/resume
time.

However, the referenced commit changed this: much of the resume now
happens much earlier, in the noirq resume handler of dev_pm_ops.

However, on SA1111, the PCMCIA device is not accessible as the SA1111
has not been resumed at _noirq time.  It's slightly worse than that,
because the SA1111 has already been put to sleep at _noirq time, so
suspend doesn't work properly.

Fix this by converting the core SA1111 code to use dev_pm_ops as well,
and performing its own suspend/resume at noirq time.

This fixes these errors in the kernel log:

pcmcia_socket pcmcia_socket0: time out after reset
pcmcia_socket pcmcia_socket1: time out after reset

and the resulting lack of PCMCIA cards after a S2RAM cycle.

Fixes: d7646f7632549 ("pcmcia: use dev_pm_ops for class pcmcia_socket_class")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/common/sa1111.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index e57d7e5bf96a..932125a20877 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -872,9 +872,9 @@ struct sa1111_save_data {
 
 #ifdef CONFIG_PM
 
-static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
+static int sa1111_suspend_noirq(struct device *dev)
 {
-	struct sa1111 *sachip = platform_get_drvdata(dev);
+	struct sa1111 *sachip = dev_get_drvdata(dev);
 	struct sa1111_save_data *save;
 	unsigned long flags;
 	unsigned int val;
@@ -937,9 +937,9 @@ static int sa1111_suspend(struct platform_device *dev, pm_message_t state)
  *	restored by their respective drivers, and must be called
  *	via LDM after this function.
  */
-static int sa1111_resume(struct platform_device *dev)
+static int sa1111_resume_noirq(struct device *dev)
 {
-	struct sa1111 *sachip = platform_get_drvdata(dev);
+	struct sa1111 *sachip = dev_get_drvdata(dev);
 	struct sa1111_save_data *save;
 	unsigned long flags, id;
 	void __iomem *base;
@@ -955,7 +955,7 @@ static int sa1111_resume(struct platform_device *dev)
 	id = sa1111_readl(sachip->base + SA1111_SKID);
 	if ((id & SKID_ID_MASK) != SKID_SA1111_ID) {
 		__sa1111_remove(sachip);
-		platform_set_drvdata(dev, NULL);
+		dev_set_drvdata(dev, NULL);
 		kfree(save);
 		return 0;
 	}
@@ -1006,8 +1006,8 @@ static int sa1111_resume(struct platform_device *dev)
 }
 
 #else
-#define sa1111_suspend NULL
-#define sa1111_resume  NULL
+#define sa1111_suspend_noirq NULL
+#define sa1111_resume_noirq  NULL
 #endif
 
 static int sa1111_probe(struct platform_device *pdev)
@@ -1041,6 +1041,11 @@ static int sa1111_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static struct dev_pm_ops sa1111_pm_ops = {
+	.suspend_noirq = sa1111_suspend_noirq,
+	.resume_noirq = sa1111_resume_noirq,
+};
+
 /*
  *	Not sure if this should be on the system bus or not yet.
  *	We really want some way to register a system device at
@@ -1053,11 +1058,10 @@ static int sa1111_remove(struct platform_device *pdev)
 static struct platform_driver sa1111_device_driver = {
 	.probe		= sa1111_probe,
 	.remove		= sa1111_remove,
-	.suspend	= sa1111_suspend,
-	.resume		= sa1111_resume,
 	.driver		= {
 		.name	= "sa1111",
 		.owner	= THIS_MODULE,
+		.pm	= &sa1111_pm_ops,
 	},
 };
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] hwrng: omap - Fix assumption that runtime_get_sync will always succeed
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (14 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: sa1111: fix pcmcia suspend/resume Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] tile: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO Jiri Slaby
                   ` (19 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Nishanth Menon, Paul Walmsley, Herbert Xu, Jiri Slaby

From: Nishanth Menon <nm@ti.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 61dc0a446e5d08f2de8a24b45f69a1e302bb1b1b upstream.

pm_runtime_get_sync does return a error value that must be checked for
error conditions, else, due to various reasons, the device maynot be
enabled and the system will crash due to lack of clock to the hardware
module.

Before:
12.562784] [00000000] *pgd=fe193835
12.562792] Internal error: : 1406 [#1] SMP ARM
[...]
12.562864] CPU: 1 PID: 241 Comm: modprobe Not tainted 4.7.0-rc4-next-20160624 #2
12.562867] Hardware name: Generic DRA74X (Flattened Device Tree)
12.562872] task: ed51f140 ti: ed44c000 task.ti: ed44c000
12.562886] PC is at omap4_rng_init+0x20/0x84 [omap_rng]
12.562899] LR is at set_current_rng+0xc0/0x154 [rng_core]
[...]

After the proper checks:
[   94.366705] omap_rng 48090000.rng: _od_fail_runtime_resume: FIXME:
missing hwmod/omap_dev info
[   94.375767] omap_rng 48090000.rng: Failed to runtime_get device -19
[   94.382351] omap_rng 48090000.rng: initialization failed.

Fixes: 665d92fa85b5 ("hwrng: OMAP: convert to use runtime PM")
Cc: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/char/hw_random/omap-rng.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 9b89ff4881de..d9c1fa0e3648 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -386,7 +386,12 @@ static int omap_rng_probe(struct platform_device *pdev)
 	}
 
 	pm_runtime_enable(&pdev->dev);
-	pm_runtime_get_sync(&pdev->dev);
+	ret = pm_runtime_get_sync(&pdev->dev);
+	if (ret) {
+		dev_err(&pdev->dev, "Failed to runtime_get device: %d\n", ret);
+		pm_runtime_put_noidle(&pdev->dev);
+		goto err_ioremap;
+	}
 
 	ret = (dev->of_node) ? of_get_omap_rng_device_details(priv, pdev) :
 				get_omap_rng_device_details(priv);
@@ -439,8 +444,15 @@ static int omap_rng_suspend(struct device *dev)
 static int omap_rng_resume(struct device *dev)
 {
 	struct omap_rng_dev *priv = dev_get_drvdata(dev);
+	int ret;
+
+	ret = pm_runtime_get_sync(dev);
+	if (ret) {
+		dev_err(dev, "Failed to runtime_get device: %d\n", ret);
+		pm_runtime_put_noidle(dev);
+		return ret;
+	}
 
-	pm_runtime_get_sync(dev);
 	priv->pdata->init(priv);
 
 	return 0;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] tile: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (15 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] hwrng: omap - Fix assumption that runtime_get_sync will always succeed Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] em28xx-i2c: rt_mutex_trylock() returns zero on failure Jiri Slaby
                   ` (18 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: James Hogan, Chris Metcalf, Jiri Slaby

From: James Hogan <james.hogan@imgtec.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit cdf8b4633075f2171d440d2e37c9c2609019a81a upstream.

AT_VECTOR_SIZE_ARCH should be defined with the maximum number of
NEW_AUX_ENT entries that ARCH_DLINFO can contain, but it wasn't defined
for tile at all even though ARCH_DLINFO will contain one NEW_AUX_ENT for
the VDSO address.

This shouldn't be a problem as AT_VECTOR_SIZE_BASE includes space for
AT_BASE_PLATFORM which tile doesn't use, but lets define it now and add
the comment above ARCH_DLINFO as found in several other architectures to
remind future modifiers of ARCH_DLINFO to keep AT_VECTOR_SIZE_ARCH up to
date.

Fixes: 4a556f4f56da ("tile: implement gettimeofday() via vDSO")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/tile/include/asm/elf.h         | 1 +
 arch/tile/include/uapi/asm/auxvec.h | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/arch/tile/include/asm/elf.h b/arch/tile/include/asm/elf.h
index 41d9878a9686..581f1414b6ca 100644
--- a/arch/tile/include/asm/elf.h
+++ b/arch/tile/include/asm/elf.h
@@ -131,6 +131,7 @@ extern int dump_task_regs(struct task_struct *, elf_gregset_t *);
 struct linux_binprm;
 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
 				       int executable_stack);
+/* update AT_VECTOR_SIZE_ARCH if the number of NEW_AUX_ENT entries changes */
 #define ARCH_DLINFO \
 do { \
 	NEW_AUX_ENT(AT_SYSINFO_EHDR, VDSO_BASE); \
diff --git a/arch/tile/include/uapi/asm/auxvec.h b/arch/tile/include/uapi/asm/auxvec.h
index c93e92709f14..f497123ed980 100644
--- a/arch/tile/include/uapi/asm/auxvec.h
+++ b/arch/tile/include/uapi/asm/auxvec.h
@@ -18,4 +18,6 @@
 /* The vDSO location. */
 #define AT_SYSINFO_EHDR         33
 
+#define AT_VECTOR_SIZE_ARCH 1 /* entries in ARCH_DLINFO */
+
 #endif /* _ASM_TILE_AUXVEC_H */
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] em28xx-i2c: rt_mutex_trylock() returns zero on failure
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (16 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] tile: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] gspca: avoid unused variable warnings Jiri Slaby
                   ` (17 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Dan Carpenter, Mauro Carvalho Chehab, Jiri Slaby

From: Dan Carpenter <dan.carpenter@oracle.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit e44c153b30c9a0580fc2b5a93f3c6d593def2278 upstream.

The code is checking for negative returns but it should be checking for
zero.

Fixes: aab3125c43d8 ('[media] em28xx: add support for registering multiple i2c buses')

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/media/usb/em28xx/em28xx-i2c.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index c4ff9739a7ae..d28d9068396f 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -469,9 +469,8 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
 	int addr, rc, i;
 	u8 reg;
 
-	rc = rt_mutex_trylock(&dev->i2c_bus_lock);
-	if (rc < 0)
-		return rc;
+	if (!rt_mutex_trylock(&dev->i2c_bus_lock))
+		return -EAGAIN;
 
 	/* Switch I2C bus if needed */
 	if (bus != dev->cur_i2c_bus &&
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] gspca: avoid unused variable warnings
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (17 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] em28xx-i2c: rt_mutex_trylock() returns zero on failure Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] avr32: off by one in at32_init_pio() Jiri Slaby
                   ` (16 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Arnd Bergmann, Hans Verkuil, Mauro Carvalho Chehab, Jiri Slaby

From: Arnd Bergmann <arnd@arndb.de>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit d7e92e15e92fc987640772bf110586898b5f15aa upstream.

When CONFIG_INPUT is disabled, multiple gspca backend drivers
print compile-time warnings about unused variables:

media/usb/gspca/cpia1.c: In function 'sd_stopN':
media/usb/gspca/cpia1.c:1627:13: error: unused variable 'sd' [-Werror=unused-variable]
media/usb/gspca/konica.c: In function 'sd_stopN':
media/usb/gspca/konica.c:246:13: error: unused variable 'sd' [-Werror=unused-variable]

This annotates the variables as __maybe_unused, to let the compiler
know that they are declared intentionally.

Fixes: ee186fd96a5f ("[media] gscpa_t613: Add support for the camera button")
Fixes: c2f644aeeba3 ("[media] gspca_cpia1: Add support for button")
Fixes: b517af722860 ("V4L/DVB: gspca_konica: New gspca subdriver for konica chipset using cams")

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/media/usb/gspca/cpia1.c  | 2 +-
 drivers/media/usb/gspca/konica.c | 2 +-
 drivers/media/usb/gspca/t613.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/gspca/cpia1.c b/drivers/media/usb/gspca/cpia1.c
index 064b53043b15..78a4c1a9b98e 100644
--- a/drivers/media/usb/gspca/cpia1.c
+++ b/drivers/media/usb/gspca/cpia1.c
@@ -1624,7 +1624,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
 
 static void sd_stopN(struct gspca_dev *gspca_dev)
 {
-	struct sd *sd = (struct sd *) gspca_dev;
+	struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
 
 	command_pause(gspca_dev);
 
diff --git a/drivers/media/usb/gspca/konica.c b/drivers/media/usb/gspca/konica.c
index 39c96bb4c985..0712b1bc90b4 100644
--- a/drivers/media/usb/gspca/konica.c
+++ b/drivers/media/usb/gspca/konica.c
@@ -243,7 +243,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
 
 static void sd_stopN(struct gspca_dev *gspca_dev)
 {
-	struct sd *sd = (struct sd *) gspca_dev;
+	struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
 
 	konica_stream_off(gspca_dev);
 #if IS_ENABLED(CONFIG_INPUT)
diff --git a/drivers/media/usb/gspca/t613.c b/drivers/media/usb/gspca/t613.c
index e2cc4e5a0ccb..bb52fc1fe598 100644
--- a/drivers/media/usb/gspca/t613.c
+++ b/drivers/media/usb/gspca/t613.c
@@ -837,7 +837,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
 			u8 *data,			/* isoc packet */
 			int len)			/* iso packet length */
 {
-	struct sd *sd = (struct sd *) gspca_dev;
+	struct sd *sd __maybe_unused = (struct sd *) gspca_dev;
 	int pkt_type;
 
 	if (data[0] == 0x5a) {
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] avr32: off by one in at32_init_pio()
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (18 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] gspca: avoid unused variable warnings Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] svc: Avoid garbage replies when pc_func() returns rpc_drop_reply Jiri Slaby
                   ` (15 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Dan Carpenter, Jiri Slaby

From: Dan Carpenter <dan.carpenter@oracle.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 55f1cf83d5cf885c75267269729805852039c834 upstream.

The pio_dev[] array has MAX_NR_PIO_DEVICES elements so the > should be
>=.

Fixes: 5f97f7f9400d ('[PATCH] avr32 architecture')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/avr32/mach-at32ap/pio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/avr32/mach-at32ap/pio.c b/arch/avr32/mach-at32ap/pio.c
index 903c7d81d0d5..a8e208eaf2a4 100644
--- a/arch/avr32/mach-at32ap/pio.c
+++ b/arch/avr32/mach-at32ap/pio.c
@@ -435,7 +435,7 @@ void __init at32_init_pio(struct platform_device *pdev)
 	struct resource *regs;
 	struct pio_device *pio;
 
-	if (pdev->id > MAX_NR_PIO_DEVICES) {
+	if (pdev->id >= MAX_NR_PIO_DEVICES) {
 		dev_err(&pdev->dev, "only %d PIO devices supported\n",
 			MAX_NR_PIO_DEVICES);
 		return;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] svc: Avoid garbage replies when pc_func() returns rpc_drop_reply
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (19 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] avr32: off by one in at32_init_pio() Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] NFS: Don't drop CB requests with invalid principals Jiri Slaby
                   ` (14 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Chuck Lever, Anna Schumaker, Jiri Slaby

From: Chuck Lever <chuck.lever@oracle.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 0533b13072f4bf35738290d2cf9e299c7bc6c42a upstream.

If an RPC program does not set vs_dispatch and pc_func() returns
rpc_drop_reply, the server sends a reply anyway containing a single
word containing the value RPC_DROP_REPLY (in network byte-order, of
course). This is a nonsense RPC message.

Fixes: 9e701c610923 ("svcrpc: simpler request dropping")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/sunrpc/svc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index b974571126fe..e7e552a07f6f 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1182,7 +1182,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
 		*statp = procp->pc_func(rqstp, rqstp->rq_argp, rqstp->rq_resp);
 
 		/* Encode reply */
-		if (rqstp->rq_dropme) {
+		if (*statp == rpc_drop_reply ||
+		    rqstp->rq_dropme) {
 			if (procp->pc_release)
 				procp->pc_release(rqstp, NULL, rqstp->rq_resp);
 			goto dropit;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] NFS: Don't drop CB requests with invalid principals
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (20 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] svc: Avoid garbage replies when pc_func() returns rpc_drop_reply Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] brcmsmac: Free packet if dma_mapping_error() fails in dma_rxfill Jiri Slaby
                   ` (13 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Chuck Lever, Anna Schumaker, Jiri Slaby

From: Chuck Lever <chuck.lever@oracle.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit a4e187d83d88eeaba6252aac0a2ffe5eaa73a818 upstream.

Before commit 778be232a207 ("NFS do not find client in NFSv4
pg_authenticate"), the Linux callback server replied with
RPC_AUTH_ERROR / RPC_AUTH_BADCRED, instead of dropping the CB
request. Let's restore that behavior so the server has a chance to
do something useful about it, and provide a warning that helps
admins correct the problem.

Fixes: 778be232a207 ("NFS do not find client in NFSv4 ...")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Tested-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/callback_xdr.c | 6 +++++-
 net/sunrpc/svc.c      | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 02f8d09e119f..b06c6ba9765d 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -915,7 +915,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
 	if (hdr_arg.minorversion == 0) {
 		cps.clp = nfs4_find_client_ident(SVC_NET(rqstp), hdr_arg.cb_ident);
 		if (!cps.clp || !check_gss_callback_principal(cps.clp, rqstp))
-			return rpc_drop_reply;
+			goto out_invalidcred;
 	}
 
 	cps.minorversion = hdr_arg.minorversion;
@@ -943,6 +943,10 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
 	nfs_put_client(cps.clp);
 	dprintk("%s: done, status = %u\n", __func__, ntohl(status));
 	return rpc_success;
+
+out_invalidcred:
+	pr_warn_ratelimited("NFS: NFSv4 callback contains invalid cred\n");
+	return rpc_autherr_badcred;
 }
 
 /*
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index e7e552a07f6f..31154dfe314d 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1188,6 +1188,11 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *argv, struct kvec *resv)
 				procp->pc_release(rqstp, NULL, rqstp->rq_resp);
 			goto dropit;
 		}
+		if (*statp == rpc_autherr_badcred) {
+			if (procp->pc_release)
+				procp->pc_release(rqstp, NULL, rqstp->rq_resp);
+			goto err_bad_auth;
+		}
 		if (*statp == rpc_success &&
 		    (xdr = procp->pc_encode) &&
 		    !xdr(rqstp, resv->iov_base+resv->iov_len, rqstp->rq_resp)) {
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] brcmsmac: Free packet if dma_mapping_error() fails in dma_rxfill
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (21 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] NFS: Don't drop CB requests with invalid principals Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] brcmsmac: Initialize power in brcms_c_stf_ss_algo_channel_get() Jiri Slaby
                   ` (12 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Florian Fainelli, Kalle Valo, Jiri Slaby

From: Florian Fainelli <f.fainelli@gmail.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 5c5fa1f464ac954982df1d96b9f9a5103d21aedd upstream.

In case dma_mapping_error() returns an error in dma_rxfill, we would be
leaking a packet that we allocated with brcmu_pkt_buf_get_skb().

Reported-by: coverity (CID 1081819)
Fixes: 67d0cf50bd32 ("brcmsmac: Fix WARNING caused by lack of calls to dma_mapping_error()")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/brcm80211/brcmsmac/dma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index 4fb9635d3919..7660b523dcf1 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -1079,8 +1079,10 @@ bool dma_rxfill(struct dma_pub *pub)
 
 		pa = dma_map_single(di->dmadev, p->data, di->rxbufsize,
 				    DMA_FROM_DEVICE);
-		if (dma_mapping_error(di->dmadev, pa))
+		if (dma_mapping_error(di->dmadev, pa)) {
+			brcmu_pkt_buf_free_skb(p);
 			return false;
+		}
 
 		/* save the free packet pointer */
 		di->rxp[rxout] = p;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] brcmsmac: Initialize power in brcms_c_stf_ss_algo_channel_get()
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (22 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] brcmsmac: Free packet if dma_mapping_error() fails in dma_rxfill Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] powerpc/prom: Fix sub-processor option passed to ibm, client-architecture-support Jiri Slaby
                   ` (11 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Florian Fainelli, Kalle Valo, Jiri Slaby

From: Florian Fainelli <f.fainelli@gmail.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit f823a2aa8f4674c095a5413b9e3ba12d82df06f2 upstream.

wlc_phy_txpower_get_current() does a logical OR of power->flags, which
presumes that power.flags was initiliazed earlier by the caller,
unfortunately, this is not the case, so make sure we zero out the struct
tx_power before calling into wlc_phy_txpower_get_current().

Reported-by: coverity (CID 146011)
Fixes: 5b435de0d7868 ("net: wireless: add brcm80211 drivers")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/brcm80211/brcmsmac/stf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/stf.c b/drivers/net/wireless/brcm80211/brcmsmac/stf.c
index dd9162722495..0ab865de1491 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/stf.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/stf.c
@@ -87,7 +87,7 @@ void
 brcms_c_stf_ss_algo_channel_get(struct brcms_c_info *wlc, u16 *ss_algo_channel,
 			    u16 chanspec)
 {
-	struct tx_power power;
+	struct tx_power power = { };
 	u8 siso_mcs_id, cdd_mcs_id, stbc_mcs_id;
 
 	/* Clear previous settings */
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] powerpc/prom: Fix sub-processor option passed to ibm, client-architecture-support
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (23 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] brcmsmac: Initialize power in brcms_c_stf_ss_algo_channel_get() Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] ASoC: omap-mcpdm: Fix irq resource handling Jiri Slaby
                   ` (10 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Michael Ellerman, Benjamin Herrenschmidt, Jiri Slaby

From: Michael Ellerman <mpe@ellerman.id.au>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 66443efa83dc73775100b7442962ce2cb0d4472e upstream.

When booting from an OpenFirmware which supports it, we use the
"ibm,client-architecture-support" firmware call to communicate
our capabilities to firmware.

The format of the structure we pass to firmware is specified in
PAPR (Power Architecture Platform Requirements), or the public version
LoPAPR (Linux on Power Architecture Platform Reference).

Referring to table 244 in LoPAPR v1.1, option vector 5 contains a 4 byte
field at bytes 17-20 for the "Platform Facilities Enable". This is
followed by a 1 byte field at byte 21 for "Sub-Processor Represenation
Level".

Comparing to the code, there we have the Platform Facilities
options (OV5_PFO_*) at byte 17, but we fail to pad that field out to its
full width of 4 bytes. This means the OV5_SUB_PROCESSORS option is
incorrectly placed at byte 18.

Fix it by adding zero bytes for bytes 18, 19, 20, and comment the bytes
to hopefully make it clearer in future.

As far as I'm aware nothing actually consumes this value at this time,
so the effect of this bug is nil in practice.

It does mean we've been incorrectly setting bit 15 of the "Platform
Facilities Enable" option for the past ~3 1/2 years, so we should avoid
allocating that bit to anything else in future.

Fixes: df77c7992029 ("powerpc/pseries: Update ibm,architecture.vec for PAPR 2.7/POWER8")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/kernel/prom_init.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 6e4114a64399..8bb88cccbf01 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -694,7 +694,7 @@ unsigned char ibm_architecture_vec[] = {
 	OV4_MIN_ENT_CAP,		/* minimum VP entitled capacity */
 
 	/* option vector 5: PAPR/OF options */
-	VECTOR_LENGTH(18),		/* length */
+	VECTOR_LENGTH(21),		/* length */
 	0,				/* don't ignore, don't halt */
 	OV5_FEAT(OV5_LPAR) | OV5_FEAT(OV5_SPLPAR) | OV5_FEAT(OV5_LARGE_PAGES) |
 	OV5_FEAT(OV5_DRCONF_MEMORY) | OV5_FEAT(OV5_DONATE_DEDICATE_CPU) |
@@ -725,8 +725,11 @@ unsigned char ibm_architecture_vec[] = {
 	0,
 	0,
 	OV5_FEAT(OV5_PFO_HW_RNG) | OV5_FEAT(OV5_PFO_HW_ENCR) |
-	OV5_FEAT(OV5_PFO_HW_842),
-	OV5_FEAT(OV5_SUB_PROCESSORS),
+	OV5_FEAT(OV5_PFO_HW_842),				/* Byte 17 */
+	0,							/* Byte 18 */
+	0,							/* Byte 19 */
+	0,							/* Byte 20 */
+	OV5_FEAT(OV5_SUB_PROCESSORS),				/* Byte 21 */
 
 	/* option vector 6: IBM PAPR hints */
 	VECTOR_LENGTH(3),		/* length */
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] ASoC: omap-mcpdm: Fix irq resource handling
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (24 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] powerpc/prom: Fix sub-processor option passed to ibm, client-architecture-support Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] KVM: nVMX: postpone VMCS changes on MSR_IA32_APICBASE write Jiri Slaby
                   ` (9 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Peter Ujfalusi, Mark Brown, Jiri Slaby

From: Peter Ujfalusi <peter.ujfalusi@ti.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit a8719670687c46ed2e904c0d05fa4cd7e4950cd1 upstream.

Fixes: ddd17531ad908 ("ASoC: omap-mcpdm: Clean up with devm_* function")

Managed irq request will not doing any good in ASoC probe level as it is
not going to free up the irq when the driver is unbound from the sound
card.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reported-by: Russell King <linux@armlinux.org.uk>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/omap/omap-mcpdm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index 90d2a7cd2563..e2ab91fbc528 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -392,8 +392,8 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai)
 	pm_runtime_get_sync(mcpdm->dev);
 	omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, 0x00);
 
-	ret = devm_request_irq(mcpdm->dev, mcpdm->irq, omap_mcpdm_irq_handler,
-				0, "McPDM", (void *)mcpdm);
+	ret = request_irq(mcpdm->irq, omap_mcpdm_irq_handler, 0, "McPDM",
+			  (void *)mcpdm);
 
 	pm_runtime_put_sync(mcpdm->dev);
 
@@ -413,6 +413,7 @@ static int omap_mcpdm_remove(struct snd_soc_dai *dai)
 {
 	struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
 
+	free_irq(mcpdm->irq, (void *)mcpdm);
 	pm_runtime_disable(mcpdm->dev);
 
 	return 0;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] KVM: nVMX: postpone VMCS changes on MSR_IA32_APICBASE write
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (25 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] ASoC: omap-mcpdm: Fix irq resource handling Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] IB/ipoib: Fix memory corruption in ipoib cm mode connect flow Jiri Slaby
                   ` (8 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Radim Krčmář, Jiri Slaby

From: Radim Krčmář <rkrcmar@redhat.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit dccbfcf52cebb8963246eba5b177b77f26b34da0 upstream.

If vmcs12 does not intercept APIC_BASE writes, then KVM will handle the
write with vmcs02 as the current VMCS.
This will incorrectly apply modifications intended for vmcs01 to vmcs02
and L2 can use it to gain access to L0's x2APIC registers by disabling
virtualized x2APIC while using msr bitmap that assumes enabled.

Postpone execution of vmx_set_virtual_x2apic_mode until vmcs01 is the
current VMCS.  An alternative solution would temporarily make vmcs01 the
current VMCS, but it requires more care.

Fixes: 8d14695f9542 ("x86, apicv: add virtual x2apic support")
Reported-by: Jim Mattson <jmattson@google.com>
Reviewed-by: Wanpeng Li <wanpeng.li@hotmail.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kvm/vmx.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 92f9e2abf710..b81c81bce181 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -366,6 +366,7 @@ struct nested_vmx {
 	struct list_head vmcs02_pool;
 	int vmcs02_num;
 	u64 vmcs01_tsc_offset;
+	bool change_vmcs01_virtual_x2apic_mode;
 	/* L2 must run next, and mustn't decide to exit to L1. */
 	bool nested_run_pending;
 	/*
@@ -6861,6 +6862,12 @@ static void vmx_set_virtual_x2apic_mode(struct kvm_vcpu *vcpu, bool set)
 {
 	u32 sec_exec_control;
 
+	/* Postpone execution until vmcs01 is the current VMCS. */
+	if (is_guest_mode(vcpu)) {
+		to_vmx(vcpu)->nested.change_vmcs01_virtual_x2apic_mode = true;
+		return;
+	}
+
 	/*
 	 * There is not point to enable virtualize x2apic without enable
 	 * apicv
@@ -8367,6 +8374,12 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
 	/* Update TSC_OFFSET if TSC was changed while L2 ran */
 	vmcs_write64(TSC_OFFSET, vmx->nested.vmcs01_tsc_offset);
 
+	if (vmx->nested.change_vmcs01_virtual_x2apic_mode) {
+		vmx->nested.change_vmcs01_virtual_x2apic_mode = false;
+		vmx_set_virtual_x2apic_mode(vcpu,
+				vcpu->arch.apic_base & X2APIC_ENABLE);
+	}
+
 	/* This is needed for same reason as it was needed in prepare_vmcs02 */
 	vmx->host_rsp = 0;
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] IB/ipoib: Fix memory corruption in ipoib cm mode connect flow
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (26 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] KVM: nVMX: postpone VMCS changes on MSR_IA32_APICBASE write Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] IB/core: Fix use after free in send_leave function Jiri Slaby
                   ` (7 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Erez Shitrit, Leon Romanovsky, Doug Ledford, Jiri Slaby

From: Erez Shitrit <erezsh@mellanox.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 546481c2816ea3c061ee9d5658eb48070f69212e upstream.

When a new CM connection is being requested, ipoib driver copies data
from the path pointer in the CM/tx object, the path object might be
invalid at the point and memory corruption will happened later when now
the CM driver will try using that data.

The next scenario demonstrates it:
	neigh_add_path --> ipoib_cm_create_tx -->
	queue_work (pointer to path is in the cm/tx struct)
	#while the work is still in the queue,
	#the port goes down and causes the ipoib_flush_paths:
	ipoib_flush_paths --> path_free --> kfree(path)
	#at this point the work scheduled starts.
	ipoib_cm_tx_start --> copy from the (invalid)path pointer:
	(memcpy(&pathrec, &p->path->pathrec, sizeof pathrec);)
	 -> memory corruption.

To fix that the driver now starts the CM/tx connection only if that
specific path exists in the general paths database.
This check is protected with the relevant locks, and uses the gid from
the neigh member in the CM/tx object which is valid according to the ref
count that was taken by the CM/tx.

Fixes: 839fcaba35 ('IPoIB: Connected mode experimental support')
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/ulp/ipoib/ipoib.h      |  1 +
 drivers/infiniband/ulp/ipoib/ipoib_cm.c   | 16 ++++++++++++++++
 drivers/infiniband/ulp/ipoib/ipoib_main.c |  2 +-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h b/drivers/infiniband/ulp/ipoib/ipoib.h
index eb71aaa26a9a..fb9a7b340f1f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -460,6 +460,7 @@ void ipoib_send(struct net_device *dev, struct sk_buff *skb,
 		struct ipoib_ah *address, u32 qpn);
 void ipoib_reap_ah(struct work_struct *work);
 
+struct ipoib_path *__path_find(struct net_device *dev, void *gid);
 void ipoib_mark_paths_invalid(struct net_device *dev);
 void ipoib_flush_paths(struct net_device *dev);
 struct ipoib_dev_priv *ipoib_intf_alloc(const char *format);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 7a3175400b2a..9474cb021c41 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -1288,6 +1288,8 @@ void ipoib_cm_destroy_tx(struct ipoib_cm_tx *tx)
 	}
 }
 
+#define QPN_AND_OPTIONS_OFFSET	4
+
 static void ipoib_cm_tx_start(struct work_struct *work)
 {
 	struct ipoib_dev_priv *priv = container_of(work, struct ipoib_dev_priv,
@@ -1296,6 +1298,7 @@ static void ipoib_cm_tx_start(struct work_struct *work)
 	struct ipoib_neigh *neigh;
 	struct ipoib_cm_tx *p;
 	unsigned long flags;
+	struct ipoib_path *path;
 	int ret;
 
 	struct ib_sa_path_rec pathrec;
@@ -1308,7 +1311,19 @@ static void ipoib_cm_tx_start(struct work_struct *work)
 		p = list_entry(priv->cm.start_list.next, typeof(*p), list);
 		list_del_init(&p->list);
 		neigh = p->neigh;
+
 		qpn = IPOIB_QPN(neigh->daddr);
+		/*
+		 * As long as the search is with these 2 locks,
+		 * path existence indicates its validity.
+		 */
+		path = __path_find(dev, neigh->daddr + QPN_AND_OPTIONS_OFFSET);
+		if (!path) {
+			pr_info("%s ignore not valid path %pI6\n",
+				__func__,
+				neigh->daddr + QPN_AND_OPTIONS_OFFSET);
+			goto free_neigh;
+		}
 		memcpy(&pathrec, &p->path->pathrec, sizeof pathrec);
 
 		spin_unlock_irqrestore(&priv->lock, flags);
@@ -1320,6 +1335,7 @@ static void ipoib_cm_tx_start(struct work_struct *work)
 		spin_lock_irqsave(&priv->lock, flags);
 
 		if (ret) {
+free_neigh:
 			neigh = p->neigh;
 			if (neigh) {
 				neigh->cm = NULL;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 9cd105ff2427..469f98156b28 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -251,7 +251,7 @@ int ipoib_set_mode(struct net_device *dev, const char *buf)
 	return -EINVAL;
 }
 
-static struct ipoib_path *__path_find(struct net_device *dev, void *gid)
+struct ipoib_path *__path_find(struct net_device *dev, void *gid)
 {
 	struct ipoib_dev_priv *priv = netdev_priv(dev);
 	struct rb_node *n = priv->path_tree.rb_node;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] IB/core: Fix use after free in send_leave function
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (27 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] IB/ipoib: Fix memory corruption in ipoib cm mode connect flow Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] IB/ipoib: Don't allow MC joins during light MC flush Jiri Slaby
                   ` (6 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Erez Shitrit, Leon Romanovsky, Doug Ledford, Jiri Slaby

From: Erez Shitrit <erezsh@mellanox.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 68c6bcdd8bd00394c234b915ab9b97c74104130c upstream.

The function send_leave sets the member: group->query_id
(group->query_id = ret) after calling the sa_query, but leave_handler
can be executed before the setting and it might delete the group object,
and will get a memory corruption.

Additionally, this patch gets rid of group->query_id variable which is
not used.

Fixes: faec2f7b96b5 ('IB/sa: Track multicast join/leave requests')
Signed-off-by: Erez Shitrit <erezsh@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/core/multicast.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/core/multicast.c b/drivers/infiniband/core/multicast.c
index d2360a8ef0b2..180d7f436ed5 100644
--- a/drivers/infiniband/core/multicast.c
+++ b/drivers/infiniband/core/multicast.c
@@ -106,7 +106,6 @@ struct mcast_group {
 	atomic_t		refcount;
 	enum mcast_group_state	state;
 	struct ib_sa_query	*query;
-	int			query_id;
 	u16			pkey_index;
 	u8			leave_state;
 	int			retries;
@@ -339,11 +338,7 @@ static int send_join(struct mcast_group *group, struct mcast_member *member)
 				       member->multicast.comp_mask,
 				       3000, GFP_KERNEL, join_handler, group,
 				       &group->query);
-	if (ret >= 0) {
-		group->query_id = ret;
-		ret = 0;
-	}
-	return ret;
+	return (ret > 0) ? 0 : ret;
 }
 
 static int send_leave(struct mcast_group *group, u8 leave_state)
@@ -363,11 +358,7 @@ static int send_leave(struct mcast_group *group, u8 leave_state)
 				       IB_SA_MCMEMBER_REC_JOIN_STATE,
 				       3000, GFP_KERNEL, leave_handler,
 				       group, &group->query);
-	if (ret >= 0) {
-		group->query_id = ret;
-		ret = 0;
-	}
-	return ret;
+	return (ret > 0) ? 0 : ret;
 }
 
 static void join_group(struct mcast_group *group, struct mcast_member *member,
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] IB/ipoib: Don't allow MC joins during light MC flush
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (28 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] IB/core: Fix use after free in send_leave function Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] IB/mlx4: Fix incorrect MC join state bit-masking on SR-IOV Jiri Slaby
                   ` (5 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Alex Vesker, Leon Romanovsky, Doug Ledford, Jiri Slaby

From: Alex Vesker <valex@mellanox.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 344bacca8cd811809fc33a249f2738ab757d327f upstream.

This fix solves a race between light flush and on the fly joins.
Light flush doesn't set the device to down and unset IPOIB_OPER_UP
flag, this means that if while flushing we have a MC join in progress
and the QP was attached to BC MGID we can have a mismatches when
re-attaching a QP to the BC MGID.

The light flush would set the broadcast group to NULL causing an on
the fly join to rejoin and reattach to the BC MCG as well as adding
the BC MGID to the multicast list. The flush process would later on
remove the BC MGID and detach it from the QP. On the next flush
the BC MGID is present in the multicast list but not found when trying
to detach it because of the previous double attach and single detach.

[18332.714265] ------------[ cut here ]------------
[18332.717775] WARNING: CPU: 6 PID: 3767 at drivers/infiniband/core/verbs.c:280 ib_dealloc_pd+0xff/0x120 [ib_core]
...
[18332.775198] Hardware name: Red Hat KVM, BIOS Bochs 01/01/2011
[18332.779411]  0000000000000000 ffff8800b50dfbb0 ffffffff813fed47 0000000000000000
[18332.784960]  0000000000000000 ffff8800b50dfbf0 ffffffff8109add1 0000011832f58300
[18332.790547]  ffff880226a596c0 ffff880032482000 ffff880032482830 ffff880226a59280
[18332.796199] Call Trace:
[18332.798015]  [<ffffffff813fed47>] dump_stack+0x63/0x8c
[18332.801831]  [<ffffffff8109add1>] __warn+0xd1/0xf0
[18332.805403]  [<ffffffff8109aebd>] warn_slowpath_null+0x1d/0x20
[18332.809706]  [<ffffffffa025d90f>] ib_dealloc_pd+0xff/0x120 [ib_core]
[18332.814384]  [<ffffffffa04f3d7c>] ipoib_transport_dev_cleanup+0xfc/0x1d0 [ib_ipoib]
[18332.820031]  [<ffffffffa04ed648>] ipoib_ib_dev_cleanup+0x98/0x110 [ib_ipoib]
[18332.825220]  [<ffffffffa04e62c8>] ipoib_dev_cleanup+0x2d8/0x550 [ib_ipoib]
[18332.830290]  [<ffffffffa04e656f>] ipoib_uninit+0x2f/0x40 [ib_ipoib]
[18332.834911]  [<ffffffff81772a8a>] rollback_registered_many+0x1aa/0x2c0
[18332.839741]  [<ffffffff81772bd1>] rollback_registered+0x31/0x40
[18332.844091]  [<ffffffff81773b18>] unregister_netdevice_queue+0x48/0x80
[18332.848880]  [<ffffffffa04f489b>] ipoib_vlan_delete+0x1fb/0x290 [ib_ipoib]
[18332.853848]  [<ffffffffa04df1cd>] delete_child+0x7d/0xf0 [ib_ipoib]
[18332.858474]  [<ffffffff81520c08>] dev_attr_store+0x18/0x30
[18332.862510]  [<ffffffff8127fe4a>] sysfs_kf_write+0x3a/0x50
[18332.866349]  [<ffffffff8127f4e0>] kernfs_fop_write+0x120/0x170
[18332.870471]  [<ffffffff81207198>] __vfs_write+0x28/0xe0
[18332.874152]  [<ffffffff810e09bf>] ? percpu_down_read+0x1f/0x50
[18332.878274]  [<ffffffff81208062>] vfs_write+0xa2/0x1a0
[18332.881896]  [<ffffffff812093a6>] SyS_write+0x46/0xa0
[18332.885632]  [<ffffffff810039b7>] do_syscall_64+0x57/0xb0
[18332.889709]  [<ffffffff81883321>] entry_SYSCALL64_slow_path+0x25/0x25
[18332.894727] ---[ end trace 09ebbe31f831ef17 ]---

Fixes: ee1e2c82c245 ("IPoIB: Refresh paths instead of flushing them on SM change events")
Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/ulp/ipoib/ipoib_ib.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_ib.c b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
index 196b1d13cbcb..70c53e5486d1 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_ib.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_ib.c
@@ -1029,8 +1029,17 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv,
 	}
 
 	if (level == IPOIB_FLUSH_LIGHT) {
+		int oper_up;
 		ipoib_mark_paths_invalid(dev);
+		/* Set IPoIB operation as down to prevent races between:
+		 * the flush flow which leaves MCG and on the fly joins
+		 * which can happen during that time. mcast restart task
+		 * should deal with join requests we missed.
+		 */
+		oper_up = test_and_clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags);
 		ipoib_mcast_dev_flush(dev);
+		if (oper_up)
+			set_bit(IPOIB_FLAG_OPER_UP, &priv->flags);
 	}
 
 	if (level >= IPOIB_FLUSH_NORMAL)
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] IB/mlx4: Fix incorrect MC join state bit-masking on SR-IOV
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (29 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] IB/ipoib: Don't allow MC joins during light MC flush Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] USB: serial: cp210x: fix hardware flow-control disable Jiri Slaby
                   ` (4 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Alex Vesker, Leon Romanovsky, Doug Ledford, Jiri Slaby

From: Alex Vesker <valex@mellanox.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit e5ac40cd66c2f3cd11bc5edc658f012661b16347 upstream.

Because of an incorrect bit-masking done on the join state bits, when
handling a join request we failed to detect a difference between the
group join state and the request join state when joining as send only
full member (0x8). This caused the MC join request not to be sent.
This issue is relevant only when SRIOV is enabled and SM supports
send only full member.

This fix separates scope bits and join states bits a nibble each.

Fixes: b9c5d6a64358 ('IB/mlx4: Add multicast group (MCG) paravirtualization for SR-IOV')
Signed-off-by: Alex Vesker <valex@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/hw/mlx4/mcg.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
index 25b2cdff00f8..27bedc39b47c 100644
--- a/drivers/infiniband/hw/mlx4/mcg.c
+++ b/drivers/infiniband/hw/mlx4/mcg.c
@@ -483,7 +483,7 @@ static u8 get_leave_state(struct mcast_group *group)
 		if (!group->members[i])
 			leave_state |= (1 << i);
 
-	return leave_state & (group->rec.scope_join_state & 7);
+	return leave_state & (group->rec.scope_join_state & 0xf);
 }
 
 static int join_group(struct mcast_group *group, int slave, u8 join_mask)
@@ -558,8 +558,8 @@ static void mlx4_ib_mcg_timeout_handler(struct work_struct *work)
 		} else
 			mcg_warn_group(group, "DRIVER BUG\n");
 	} else if (group->state == MCAST_LEAVE_SENT) {
-		if (group->rec.scope_join_state & 7)
-			group->rec.scope_join_state &= 0xf8;
+		if (group->rec.scope_join_state & 0xf)
+			group->rec.scope_join_state &= 0xf0;
 		group->state = MCAST_IDLE;
 		mutex_unlock(&group->lock);
 		if (release_group(group, 1))
@@ -599,7 +599,7 @@ static int handle_leave_req(struct mcast_group *group, u8 leave_mask,
 static int handle_join_req(struct mcast_group *group, u8 join_mask,
 			   struct mcast_req *req)
 {
-	u8 group_join_state = group->rec.scope_join_state & 7;
+	u8 group_join_state = group->rec.scope_join_state & 0xf;
 	int ref = 0;
 	u16 status;
 	struct ib_sa_mcmember_data *sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
@@ -684,8 +684,8 @@ static void mlx4_ib_mcg_work_handler(struct work_struct *work)
 			u8 cur_join_state;
 
 			resp_join_state = ((struct ib_sa_mcmember_data *)
-						group->response_sa_mad.data)->scope_join_state & 7;
-			cur_join_state = group->rec.scope_join_state & 7;
+						group->response_sa_mad.data)->scope_join_state & 0xf;
+			cur_join_state = group->rec.scope_join_state & 0xf;
 
 			if (method == IB_MGMT_METHOD_GET_RESP) {
 				/* successfull join */
@@ -704,7 +704,7 @@ process_requests:
 		req = list_first_entry(&group->pending_list, struct mcast_req,
 				       group_list);
 		sa_data = (struct ib_sa_mcmember_data *)req->sa_mad.data;
-		req_join_state = sa_data->scope_join_state & 0x7;
+		req_join_state = sa_data->scope_join_state & 0xf;
 
 		/* For a leave request, we will immediately answer the VF, and
 		 * update our internal counters. The actual leave will be sent
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] USB: serial: cp210x: fix hardware flow-control disable
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (30 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] IB/mlx4: Fix incorrect MC join state bit-masking on SR-IOV Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] usb: misc: legousbtower: Fix NULL pointer deference Jiri Slaby
                   ` (3 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Konstantin Shkolnyy, Johan Hovold, Jiri Slaby

From: Konstantin Shkolnyy <konstantin.shkolnyy@gmail.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit a377f9e906af4df9071ba8ddba60188cb4013d93 upstream.

A bug in the CRTSCTS handling caused RTS to alternate between

CRTSCTS=0 => "RTS is transmit active signal" and
CRTSCTS=1 => "RTS is used for receive flow control"

instead of

CRTSCTS=0 => "RTS is statically active" and
CRTSCTS=1 => "RTS is used for receive flow control"

This only happened after first having enabled CRTSCTS.

Signed-off-by: Konstantin Shkolnyy <konstantin.shkolnyy@gmail.com>
Fixes: 39a66b8d22a3 ("[PATCH] USB: CP2101 Add support for flow control")
[johan: reword commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>
[johan: backport to 4.4 ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/cp210x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 4063099f429a..17f737222b58 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -858,7 +858,7 @@ static void cp210x_set_termios(struct tty_struct *tty,
 		} else {
 			modem_ctl[0] &= ~0x7B;
 			modem_ctl[0] |= 0x01;
-			modem_ctl[1] |= 0x40;
+			modem_ctl[1] = 0x40;
 			dev_dbg(dev, "%s - flow control = NONE\n", __func__);
 		}
 
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] usb: misc: legousbtower: Fix NULL pointer deference
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (31 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] USB: serial: cp210x: fix hardware flow-control disable Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] USB: serial: cp210x: Add ID for a Juniper console Jiri Slaby
                   ` (2 subsequent siblings)
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, James Patrick-Evans, Jiri Slaby

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit 2fae9e5a7babada041e2e161699ade2447a01989 upstream.

This patch fixes a NULL pointer dereference caused by a race codition in
the probe function of the legousbtower driver. It re-structures the
probe function to only register the interface after successfully reading
the board's firmware ID.

The probe function does not deregister the usb interface after an error
receiving the devices firmware ID. The device file registered
(/dev/usb/legousbtower%d) may be read/written globally before the probe
function returns. When tower_delete is called in the probe function
(after an r/w has been initiated), core dev structures are deleted while
the file operation functions are still running. If the 0 address is
mappable on the machine, this vulnerability can be used to create a
Local Priviege Escalation exploit via a write-what-where condition by
remapping dev->interrupt_out_buffer in tower_write. A forged USB device
and local program execution would be required for LPE. The USB device
would have to delay the control message in tower_probe and accept
the control urb in tower_open whilst guest code initiated a write to the
device file as tower_delete is called from the error in tower_probe.

This bug has existed since 2003. Patch tested by emulated device.

Reported-by: James Patrick-Evans <james@jmp-e.com>
Tested-by: James Patrick-Evans <james@jmp-e.com>
Signed-off-by: James Patrick-Evans <james@jmp-e.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/misc/legousbtower.c | 35 +++++++++++++++++------------------
 1 file changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c
index eb37c9542052..ae7a2f18b993 100644
--- a/drivers/usb/misc/legousbtower.c
+++ b/drivers/usb/misc/legousbtower.c
@@ -899,24 +899,6 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
 	dev->interrupt_in_interval = interrupt_in_interval ? interrupt_in_interval : dev->interrupt_in_endpoint->bInterval;
 	dev->interrupt_out_interval = interrupt_out_interval ? interrupt_out_interval : dev->interrupt_out_endpoint->bInterval;
 
-	/* we can register the device now, as it is ready */
-	usb_set_intfdata (interface, dev);
-
-	retval = usb_register_dev (interface, &tower_class);
-
-	if (retval) {
-		/* something prevented us from registering this driver */
-		dev_err(idev, "Not able to get a minor for this device.\n");
-		usb_set_intfdata (interface, NULL);
-		goto error;
-	}
-	dev->minor = interface->minor;
-
-	/* let the user know what node this device is now attached to */
-	dev_info(&interface->dev, "LEGO USB Tower #%d now attached to major "
-		 "%d minor %d\n", (dev->minor - LEGO_USB_TOWER_MINOR_BASE),
-		 USB_MAJOR, dev->minor);
-
 	/* get the firmware version and log it */
 	result = usb_control_msg (udev,
 				  usb_rcvctrlpipe(udev, 0),
@@ -937,6 +919,23 @@ static int tower_probe (struct usb_interface *interface, const struct usb_device
 		 get_version_reply.minor,
 		 le16_to_cpu(get_version_reply.build_no));
 
+	/* we can register the device now, as it is ready */
+	usb_set_intfdata (interface, dev);
+
+	retval = usb_register_dev (interface, &tower_class);
+
+	if (retval) {
+		/* something prevented us from registering this driver */
+		dev_err(idev, "Not able to get a minor for this device.\n");
+		usb_set_intfdata (interface, NULL);
+		goto error;
+	}
+	dev->minor = interface->minor;
+
+	/* let the user know what node this device is now attached to */
+	dev_info(&interface->dev, "LEGO USB Tower #%d now attached to major "
+		 "%d minor %d\n", (dev->minor - LEGO_USB_TOWER_MINOR_BASE),
+		 USB_MAJOR, dev->minor);
 
 exit:
 	return retval;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] USB: serial: cp210x: Add ID for a Juniper console
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (32 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] usb: misc: legousbtower: Fix NULL pointer deference Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] Revert "usbtmc: convert to devm_kzalloc" Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] ACPICA: acpi_get_sleep_type_data: Reduce warnings Jiri Slaby
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Kyle Jones, Jiri Slaby

From: Kyle Jones <kyle@kf5jwc.us>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit decc5360f23e9efe0252094f47f57f254dcbb3a9 upstream.

Signed-off-by: Kyle Jones <kyle@kf5jwc.us>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 17f737222b58..f5e4fda7f902 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -117,6 +117,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x10C4, 0x8411) }, /* Kyocera GPS Module */
 	{ USB_DEVICE(0x10C4, 0x8418) }, /* IRZ Automation Teleport SG-10 GSM/GPRS Modem */
 	{ USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
+	{ USB_DEVICE(0x10C4, 0x8470) }, /* Juniper Networks BX Series System Console */
 	{ USB_DEVICE(0x10C4, 0x8477) }, /* Balluff RFID */
 	{ USB_DEVICE(0x10C4, 0x84B6) }, /* Starizona Hyperion */
 	{ USB_DEVICE(0x10C4, 0x85EA) }, /* AC-Services IBUS-IF */
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] Revert "usbtmc: convert to devm_kzalloc"
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (33 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] USB: serial: cp210x: Add ID for a Juniper console Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  2016-10-07 10:51 ` [patch added to 3.12-stable] ACPICA: acpi_get_sleep_type_data: Reduce warnings Jiri Slaby
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable; +Cc: Greg Kroah-Hartman, Andy Shevchenko, Jiri Slaby

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit ab21b63e8aedfc73565dd9cdd51eb338341177cb upstream.

This reverts commit e6c7efdcb76f11b04e3d3f71c8d764ab75c9423b.

Turns out it was totally wrong.  The memory is supposed to be bound to
the kref, as the original code was doing correctly, not the
device/driver binding as the devm_kzalloc() would cause.

This fixes an oops when read would be called after the device was
unbound from the driver.

Reported-by: Ladislav Michl <ladis@linux-mips.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/class/usbtmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index c997ee9122bc..72ed4ac2cfad 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -122,6 +122,7 @@ static void usbtmc_delete(struct kref *kref)
 	struct usbtmc_device_data *data = to_usbtmc_data(kref);
 
 	usb_put_dev(data->usb_dev);
+	kfree(data);
 }
 
 static int usbtmc_open(struct inode *inode, struct file *filp)
@@ -1101,7 +1102,7 @@ static int usbtmc_probe(struct usb_interface *intf,
 
 	dev_dbg(&intf->dev, "%s called\n", __func__);
 
-	data = devm_kzalloc(&intf->dev, sizeof(*data), GFP_KERNEL);
+	data = kmalloc(sizeof(*data), GFP_KERNEL);
 	if (!data) {
 		dev_err(&intf->dev, "Unable to allocate kernel memory\n");
 		return -ENOMEM;
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [patch added to 3.12-stable] ACPICA: acpi_get_sleep_type_data: Reduce warnings
  2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
                   ` (34 preceding siblings ...)
  2016-10-07 10:51 ` [patch added to 3.12-stable] Revert "usbtmc: convert to devm_kzalloc" Jiri Slaby
@ 2016-10-07 10:51 ` Jiri Slaby
  35 siblings, 0 replies; 37+ messages in thread
From: Jiri Slaby @ 2016-10-07 10:51 UTC (permalink / raw)
  To: stable
  Cc: Prarit Bhargava, Bob Moore, Lv Zheng, Rafael J . Wysocki,
	Charles (Chas) Williams, Jiri Slaby

From: Prarit Bhargava <prarit@redhat.com>

This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.

===============

commit a59b679ab85635737947310323f2f2bcfa0664a7 upstream.

ACPICA commit 7bb77313091e52a846df4c9c2bea90be31bfb9d8

Eliminate warnings for "not found" _Sx errors, since these
are optional. Original NOT_FOUND status is still returned.

Original changes by Prarit Bhargava.
ACPICA BZ 1208.

Link: https://github.com/acpica/acpica/commit/7bb77313
Link: https://bugs.acpica.org/show_bug.cgi?id=1208
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: "Charles (Chas) Williams" <ciwillia@brocade.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/acpica/hwxface.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/acpica/hwxface.c b/drivers/acpi/acpica/hwxface.c
index 5ee7a814cd92..3f7881174ab4 100644
--- a/drivers/acpi/acpica/hwxface.c
+++ b/drivers/acpi/acpica/hwxface.c
@@ -495,11 +495,20 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
 	 * Evaluate the \_Sx namespace object containing the register values
 	 * for this state
 	 */
-	info->relative_pathname =
-	    ACPI_CAST_PTR(char, acpi_gbl_sleep_state_names[sleep_state]);
+	info->relative_pathname = ACPI_CAST_PTR(char,
+						acpi_gbl_sleep_state_names
+						[sleep_state]);
+
 	status = acpi_ns_evaluate(info);
 	if (ACPI_FAILURE(status)) {
-		goto cleanup;
+		if (status == AE_NOT_FOUND) {
+
+			/* The _Sx states are optional, ignore NOT_FOUND */
+
+			goto final_cleanup;
+		}
+
+		goto warning_cleanup;
 	}
 
 	/* Must have a return object */
@@ -508,7 +517,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
 		ACPI_ERROR((AE_INFO, "No Sleep State object returned from [%s]",
 			    info->relative_pathname));
 		status = AE_AML_NO_RETURN_VALUE;
-		goto cleanup;
+		goto warning_cleanup;
 	}
 
 	/* Return object must be of type Package */
@@ -517,7 +526,7 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
 		ACPI_ERROR((AE_INFO,
 			    "Sleep State return object is not a Package"));
 		status = AE_AML_OPERAND_TYPE;
-		goto cleanup1;
+		goto return_value_cleanup;
 	}
 
 	/*
@@ -561,16 +570,17 @@ acpi_get_sleep_type_data(u8 sleep_state, u8 *sleep_type_a, u8 *sleep_type_b)
 		break;
 	}
 
-      cleanup1:
+return_value_cleanup:
 	acpi_ut_remove_reference(info->return_object);
 
-      cleanup:
+warning_cleanup:
 	if (ACPI_FAILURE(status)) {
 		ACPI_EXCEPTION((AE_INFO, status,
 				"While evaluating Sleep State [%s]",
 				info->relative_pathname));
 	}
 
+final_cleanup:
 	ACPI_FREE(info);
 	return_ACPI_STATUS(status);
 }
-- 
2.10.1


^ permalink raw reply related	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2016-10-07 10:52 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-07 10:51 [patch added to 3.12-stable] powerpc: Add macros for the ibm_architecture_vec[] lengths Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] mtd: nand: davinci: Reinitialize the HW ECC engine in 4bit hwctl Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] mm,ksm: fix endless looping in allocating memory when ksm enable Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] can: dev: fix deadlock reported after bus-off Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] drm/radeon/si/dpm: add workaround for for Jet parts Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: 8616/1: dt: Respect property size when parsing CPUs Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] tools/vm/slabinfo: fix an unintentional printf Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] hwmon: (adt7411) set bit 3 in CFG1 register Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] iwlwifi: pcie: fix access to scratch buffer Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame() Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: 8618/1: decompressor: reset ttbcr fields to use TTBR0 on ARMv7 Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] arm64: debug: avoid resetting stepping state machine when TIF_SINGLESTEP Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] MIPS: Malta: Fix IOCU disable switch read for MIPS64 Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] printk: fix parsing of "brl=" option Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: sa1100: clear reset status prior to reboot Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] ARM: sa1111: fix pcmcia suspend/resume Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] hwrng: omap - Fix assumption that runtime_get_sync will always succeed Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] tile: Define AT_VECTOR_SIZE_ARCH for ARCH_DLINFO Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] em28xx-i2c: rt_mutex_trylock() returns zero on failure Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] gspca: avoid unused variable warnings Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] avr32: off by one in at32_init_pio() Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] svc: Avoid garbage replies when pc_func() returns rpc_drop_reply Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] NFS: Don't drop CB requests with invalid principals Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] brcmsmac: Free packet if dma_mapping_error() fails in dma_rxfill Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] brcmsmac: Initialize power in brcms_c_stf_ss_algo_channel_get() Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] powerpc/prom: Fix sub-processor option passed to ibm, client-architecture-support Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] ASoC: omap-mcpdm: Fix irq resource handling Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] KVM: nVMX: postpone VMCS changes on MSR_IA32_APICBASE write Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] IB/ipoib: Fix memory corruption in ipoib cm mode connect flow Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] IB/core: Fix use after free in send_leave function Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] IB/ipoib: Don't allow MC joins during light MC flush Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] IB/mlx4: Fix incorrect MC join state bit-masking on SR-IOV Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] USB: serial: cp210x: fix hardware flow-control disable Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] usb: misc: legousbtower: Fix NULL pointer deference Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] USB: serial: cp210x: Add ID for a Juniper console Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] Revert "usbtmc: convert to devm_kzalloc" Jiri Slaby
2016-10-07 10:51 ` [patch added to 3.12-stable] ACPICA: acpi_get_sleep_type_data: Reduce warnings Jiri Slaby

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.