stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.12 01/84] PCI: Add dev_flags bit to access VPD through function 0
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 02/84] PCI: Add VPD function 0 quirk for Intel Ethernet devices Jiri Slaby
                   ` (58 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mark Rustad, Bjorn Helgaas, Jiri Slaby

From: Mark Rustad <mark.d.rustad@intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 932c435caba8a2ce473a91753bad0173269ef334 upstream.

Add a dev_flags bit, PCI_DEV_FLAGS_VPD_REF_F0, to access VPD through
function 0 to provide VPD access on other functions.  This is for hardware
devices that provide copies of the same VPD capability registers in
multiple functions.  Because the kernel expects that each function has its
own registers, both the locking and the state tracking are affected by VPD
accesses to different functions.

On such devices for example, if a VPD write is performed on function 0,
*any* later attempt to read VPD from any other function of that device will
hang.  This has to do with how the kernel tracks the expected value of the
F bit per function.

Concurrent accesses to different functions of the same device can not only
hang but also corrupt both read and write VPD data.

When hangs occur, typically the error message:

  vpd r/w failed.  This is likely a firmware bug on this device.

will be seen.

Never set this bit on function 0 or there will be an infinite recursion.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/access.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 include/linux/pci.h  |  2 ++
 2 files changed, 62 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 0857ca981fae..6bc9b12ba42a 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -359,6 +359,56 @@ static const struct pci_vpd_ops pci_vpd_pci22_ops = {
 	.release = pci_vpd_pci22_release,
 };
 
+static ssize_t pci_vpd_f0_read(struct pci_dev *dev, loff_t pos, size_t count,
+			       void *arg)
+{
+	struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
+	ssize_t ret;
+
+	if (!tdev)
+		return -ENODEV;
+
+	ret = pci_read_vpd(tdev, pos, count, arg);
+	pci_dev_put(tdev);
+	return ret;
+}
+
+static ssize_t pci_vpd_f0_write(struct pci_dev *dev, loff_t pos, size_t count,
+				const void *arg)
+{
+	struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
+	ssize_t ret;
+
+	if (!tdev)
+		return -ENODEV;
+
+	ret = pci_write_vpd(tdev, pos, count, arg);
+	pci_dev_put(tdev);
+	return ret;
+}
+
+static const struct pci_vpd_ops pci_vpd_f0_ops = {
+	.read = pci_vpd_f0_read,
+	.write = pci_vpd_f0_write,
+	.release = pci_vpd_pci22_release,
+};
+
+static int pci_vpd_f0_dev_check(struct pci_dev *dev)
+{
+	struct pci_dev *tdev = pci_get_slot(dev->bus, PCI_SLOT(dev->devfn));
+	int ret = 0;
+
+	if (!tdev)
+		return -ENODEV;
+	if (!tdev->vpd || !tdev->multifunction ||
+	    dev->class != tdev->class || dev->vendor != tdev->vendor ||
+	    dev->device != tdev->device)
+		ret = -ENODEV;
+
+	pci_dev_put(tdev);
+	return ret;
+}
+
 int pci_vpd_pci22_init(struct pci_dev *dev)
 {
 	struct pci_vpd_pci22 *vpd;
@@ -367,12 +417,21 @@ int pci_vpd_pci22_init(struct pci_dev *dev)
 	cap = pci_find_capability(dev, PCI_CAP_ID_VPD);
 	if (!cap)
 		return -ENODEV;
+	if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0) {
+		int ret = pci_vpd_f0_dev_check(dev);
+
+		if (ret)
+			return ret;
+	}
 	vpd = kzalloc(sizeof(*vpd), GFP_ATOMIC);
 	if (!vpd)
 		return -ENOMEM;
 
 	vpd->base.len = PCI_VPD_PCI22_SIZE;
-	vpd->base.ops = &pci_vpd_pci22_ops;
+	if (dev->dev_flags & PCI_DEV_FLAGS_VPD_REF_F0)
+		vpd->base.ops = &pci_vpd_f0_ops;
+	else
+		vpd->base.ops = &pci_vpd_pci22_ops;
 	mutex_init(&vpd->lock);
 	vpd->cap = cap;
 	vpd->busy = false;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 573c04929bd1..b11e6e280f15 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -170,6 +170,8 @@ enum pci_dev_flags {
 	PCI_DEV_FLAGS_NO_D3 = (__force pci_dev_flags_t) 2,
 	/* Provide indication device is assigned by a Virtual Machine Manager */
 	PCI_DEV_FLAGS_ASSIGNED = (__force pci_dev_flags_t) 4,
+	/* Get VPD from function 0 VPD */
+	PCI_DEV_FLAGS_VPD_REF_F0 = (__force pci_dev_flags_t) (1 << 8),
 };
 
 enum pci_irq_reroute_variant {
-- 
2.6.0


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

* [PATCH 3.12 02/84] PCI: Add VPD function 0 quirk for Intel Ethernet devices
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 01/84] PCI: Add dev_flags bit to access VPD through function 0 Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 03/84] staging: comedi: usbduxsigma: don't clobber ai_timer in command test Jiri Slaby
                   ` (57 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mark Rustad, Bjorn Helgaas, Jiri Slaby

From: Mark Rustad <mark.d.rustad@intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 7aa6ca4d39edf01f997b9e02cf6d2fdeb224f351 upstream.

Set the PCI_DEV_FLAGS_VPD_REF_F0 flag on all Intel Ethernet device
functions other than function 0, so that on multi-function devices, we will
always read VPD from function 0 instead of from the other functions.

[bhelgaas: changelog]
Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Alexander Duyck <alexander.h.duyck@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/quirks.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index a7b7eeaf35e8..877bfbb4e55c 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -1849,6 +1849,15 @@ static void quirk_netmos(struct pci_dev *dev)
 DECLARE_PCI_FIXUP_CLASS_HEADER(PCI_VENDOR_ID_NETMOS, PCI_ANY_ID,
 			 PCI_CLASS_COMMUNICATION_SERIAL, 8, quirk_netmos);
 
+static void quirk_f0_vpd_link(struct pci_dev *dev)
+{
+	if (!dev->multifunction || !PCI_FUNC(dev->devfn))
+		return;
+	dev->dev_flags |= PCI_DEV_FLAGS_VPD_REF_F0;
+}
+DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
+			      PCI_CLASS_NETWORK_ETHERNET, 8, quirk_f0_vpd_link);
+
 static void quirk_e100_interrupt(struct pci_dev *dev)
 {
 	u16 command, pmcsr;
-- 
2.6.0


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

* [PATCH 3.12 03/84] staging: comedi: usbduxsigma: don't clobber ai_timer in command test
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 01/84] PCI: Add dev_flags bit to access VPD through function 0 Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 02/84] PCI: Add VPD function 0 quirk for Intel Ethernet devices Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 04/84] staging: comedi: usbduxsigma: don't clobber ao_timer " Jiri Slaby
                   ` (56 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ian Abbott, Jiri Slaby

From: Ian Abbott <abbotti@mev.co.uk>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 423b24c37dd5794a674c74b0ed56392003a69891 upstream

`devpriv->ai_timer` is used while an asynchronous command is running on
the AI subdevice.  It also gets modified by the subdevice's `cmdtest`
handler for checking new asynchronous commands
(`usbduxsigma_ai_cmdtest()`), which is not correct as it's allowed to
check new commands while an old command is still running.  Fix it by
moving the code which sets up `devpriv->ai_timer` and
`devpriv->ai_interval` into the subdevice's `cmd` handler,
`usbduxsigma_ai_cmd()`.

** This backported patch also moves the code that sets up
`devpriv->ai_sample_count` and `devpriv->ai_continuous` from
`usbduxsigma_ai_cmdtest()` to `usbduxsigma_ai_cmd()` for the same reason
as above. (This was not needed in the upstream commit.) **

Note that the removed code in `usbduxsigma_ai_cmdtest()` checked that
`devpriv->ai_timer` did not end up less than than 1, but that could not
happen because `cmd->scan_begin_arg` had already been checked to be at
least the minimum required value (at least when `cmd->scan_begin_src ==
TRIG_TIMER`, which had also been checked to be the case).

Fixes: b986be8527c7 ("staging: comedi: usbduxsigma: tidy up analog input command support)
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 58 +++++++++++++---------------
 1 file changed, 27 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
index c47f4087568f..c61a1b9d7cd8 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -575,37 +575,6 @@ static int usbduxsigma_ai_cmdtest(struct comedi_device *dev,
 	if (err)
 		return 3;
 
-	/* Step 4: fix up any arguments */
-
-	if (high_speed) {
-		/*
-		 * every 2 channels get a time window of 125us. Thus, if we
-		 * sample all 16 channels we need 1ms. If we sample only one
-		 * channel we need only 125us
-		 */
-		devpriv->ai_interval = interval;
-		devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval);
-	} else {
-		/* interval always 1ms */
-		devpriv->ai_interval = 1;
-		devpriv->ai_timer = cmd->scan_begin_arg / 1000000;
-	}
-	if (devpriv->ai_timer < 1)
-		err |= -EINVAL;
-
-	if (cmd->stop_src == TRIG_COUNT) {
-		/* data arrives as one packet */
-		devpriv->ai_sample_count = cmd->stop_arg;
-		devpriv->ai_continuous = 0;
-	} else {
-		/* continuous acquisition */
-		devpriv->ai_continuous = 1;
-		devpriv->ai_sample_count = 0;
-	}
-
-	if (err)
-		return 4;
-
 	return 0;
 }
 
@@ -704,6 +673,33 @@ static int usbduxsigma_ai_cmd(struct comedi_device *dev,
 
 	/* set current channel of the running acquisition to zero */
 	s->async->cur_chan = 0;
+
+	if (devpriv->high_speed) {
+		/*
+		 * every 2 channels get a time window of 125us. Thus, if we
+		 * sample all 16 channels we need 1ms. If we sample only one
+		 * channel we need only 125us
+		 */
+		unsigned int interval = usbduxsigma_chans_to_interval(len);
+
+		devpriv->ai_interval = interval;
+		devpriv->ai_timer = cmd->scan_begin_arg / (125000 * interval);
+	} else {
+		/* interval always 1ms */
+		devpriv->ai_interval = 1;
+		devpriv->ai_timer = cmd->scan_begin_arg / 1000000;
+	}
+
+	if (cmd->stop_src == TRIG_COUNT) {
+		/* data arrives as one packet */
+		devpriv->ai_sample_count = cmd->stop_arg;
+		devpriv->ai_continuous = 0;
+	} else {
+		/* continuous acquisition */
+		devpriv->ai_continuous = 1;
+		devpriv->ai_sample_count = 0;
+	}
+
 	for (i = 0; i < len; i++) {
 		unsigned int chan  = CR_CHAN(cmd->chanlist[i]);
 
-- 
2.6.0


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

* [PATCH 3.12 04/84] staging: comedi: usbduxsigma: don't clobber ao_timer in command test
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (2 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 03/84] staging: comedi: usbduxsigma: don't clobber ai_timer in command test Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 05/84] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 Jiri Slaby
                   ` (55 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ian Abbott, Jiri Slaby

From: Ian Abbott <abbotti@mev.co.uk>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit c04a1f17803e0d3eeada586ca34a6b436959bc20 upstream

`devpriv->ao_timer` is used while an asynchronous command is running on
the AO subdevice.  It also gets modified by the subdevice's `cmdtest`
handler for checking new asynchronous commands,
`usbduxsigma_ao_cmdtest()`, which is not correct as it's allowed to
check new commands while an old command is still running.  Fix it by
moving the code which sets up `devpriv->ao_timer` into the subdevice's
`cmd` handler, `usbduxsigma_ao_cmd()`.

** This backported patch also moves the code that sets up
`devpriv->ao_sample_count` and `devpriv->ao_continuous` from
`usbduxsigma_ao_cmdtest()` to `usbduxsigma_ao_cmd()` for the same reason
as above.  (This was not needed in the upstream commit.) **

Note that the removed code in `usbduxsigma_ao_cmdtest()` checked that
`devpriv->ao_timer` did not end up less that 1, but that could not
happen due because `cmd->scan_begin_arg` or `cmd->convert_arg` had
already been range-checked.

Also note that we tested the `high_speed` variable in the old code, but
that is currently always 0 and means that we always use "scan" timing
(`cmd->scan_begin_src == TRIG_TIMER` and `cmd->convert_src == TRIG_NOW`)
and never "convert" (individual sample) timing (`cmd->scan_begin_src ==
TRIG_FOLLOW` and `cmd->convert_src == TRIG_TIMER`).  The moved code
tests `cmd->convert_src` instead to decide whether "scan" or "convert"
timing is being used, although currently only "scan" timing is
supported.

Fixes: fb1ef622e7a3 ("staging: comedi: usbduxsigma: tidy up analog output command support")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/staging/comedi/drivers/usbduxsigma.c | 41 ++++++++++++----------------
 1 file changed, 17 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c
index c61a1b9d7cd8..580c1358eb84 100644
--- a/drivers/staging/comedi/drivers/usbduxsigma.c
+++ b/drivers/staging/comedi/drivers/usbduxsigma.c
@@ -950,10 +950,24 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev,
 	if (err)
 		return 3;
 
-	/* Step 4: fix up any arguments */
+	return 0;
+}
+
+static int usbduxsigma_ao_cmd(struct comedi_device *dev,
+			      struct comedi_subdevice *s)
+{
+	struct usbduxsigma_private *devpriv = dev->private;
+	struct comedi_cmd *cmd = &s->async->cmd;
+	int ret;
+	int i;
+
+	down(&devpriv->sem);
+
+	/* set current channel of the running acquisition to zero */
+	s->async->cur_chan = 0;
 
 	/* we count in timer steps */
-	if (high_speed) {
+	if (cmd->convert_src == TRIG_TIMER) {
 		/* timing of the conversion itself: every 125 us */
 		devpriv->ao_timer = cmd->convert_arg / 125000;
 	} else {
@@ -963,12 +977,9 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev,
 		 */
 		devpriv->ao_timer = cmd->scan_begin_arg / 1000000;
 	}
-	if (devpriv->ao_timer < 1)
-		err |= -EINVAL;
-
 	if (cmd->stop_src == TRIG_COUNT) {
 		/* not continuous, use counter */
-		if (high_speed) {
+		if (cmd->convert_src == TRIG_TIMER) {
 			/* high speed also scans everything at once */
 			devpriv->ao_sample_count = cmd->stop_arg *
 						   cmd->scan_end_arg;
@@ -987,24 +998,6 @@ static int usbduxsigma_ao_cmdtest(struct comedi_device *dev,
 		devpriv->ao_sample_count = 0;
 	}
 
-	if (err)
-		return 4;
-
-	return 0;
-}
-
-static int usbduxsigma_ao_cmd(struct comedi_device *dev,
-			      struct comedi_subdevice *s)
-{
-	struct usbduxsigma_private *devpriv = dev->private;
-	struct comedi_cmd *cmd = &s->async->cmd;
-	int ret;
-	int i;
-
-	down(&devpriv->sem);
-
-	/* set current channel of the running acquisition to zero */
-	s->async->cur_chan = 0;
 	for (i = 0; i < cmd->chanlist_len; ++i)
 		devpriv->ao_chanlist[i] = CR_CHAN(cmd->chanlist[i]);
 
-- 
2.6.0


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

* [PATCH 3.12 05/84] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (3 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 04/84] staging: comedi: usbduxsigma: don't clobber ao_timer " Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 06/84] ext4: move check under lock scope to close a race Jiri Slaby
                   ` (54 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ian Abbott, Jiri Slaby

From: Ian Abbott <abbotti@mev.co.uk>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit ad83dbd974feb2e2a8cc071a1d28782bd4d2c70e upstream

The "adl_pci7x3x" driver replaced the "adl_pci7230" and "adl_pci7432"
drivers in commits 8f567c373c4b ("staging: comedi: new adl_pci7x3x
driver") and 657f77d173d3 ("staging: comedi: remove adl_pci7230 and
adl_pci7432 drivers").  Although the new driver code agrees with the
user manuals for the respective boards, digital outputs stopped working
on the PCI-7230.  This has 16 digital output channels and the previous
adl_pci7230 driver shifted the 16 bit output state left by 16 bits
before writing to the hardware register.  The new adl_pci7x3x driver
doesn't do that.  Fix it in `adl_pci7x3x_do_insn_bits()` by checking
for the special case of the subdevice having only 16 channels and
duplicating the 16 bit output state into both halves of the 32-bit
register.  That should work both for what the board actually does and
for what the user manual says it should do.

Fixes: 8f567c373c4b ("staging: comedi: new adl_pci7x3x driver")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/staging/comedi/drivers/adl_pci7x3x.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci7x3x.c b/drivers/staging/comedi/drivers/adl_pci7x3x.c
index 81b7203f824f..c570ede07e94 100644
--- a/drivers/staging/comedi/drivers/adl_pci7x3x.c
+++ b/drivers/staging/comedi/drivers/adl_pci7x3x.c
@@ -116,10 +116,21 @@ static int adl_pci7x3x_do_insn_bits(struct comedi_device *dev,
 	unsigned int bits = data[1];
 
 	if (mask) {
+		unsigned int val;
+
 		s->state &= ~mask;
 		s->state |= (bits & mask);
-
-		outl(s->state, dev->iobase + reg);
+		val = s->state;
+		if (s->n_chan == 16) {
+			/*
+			 * It seems the PCI-7230 needs the 16-bit DO state
+			 * to be shifted left by 16 bits before being written
+			 * to the 32-bit register.  Set the value in both
+			 * halves of the register to be sure.
+			 */
+			val |= val << 16;
+		}
+		outl(val, dev->iobase + reg);
 	}
 
 	/*
-- 
2.6.0


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

* [PATCH 3.12 06/84] ext4: move check under lock scope to close a race.
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (4 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 05/84] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 07/84] libfc: Fix fc_fcp_cleanup_each_cmd() Jiri Slaby
                   ` (53 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Davide Italiano, Theodore Ts'o, Nikolay Borisov,
	Jan Kara, Jiri Slaby

From: Davide Italiano <dccitaliano@gmail.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 280227a75b56ab5d35854f3a77ef74a7ad56a203 upstream

fallocate() checks that the file is extent-based and returns
EOPNOTSUPP in case is not. Other tasks can convert from and to
indirect and extent so it's safe to check only after grabbing
the inode mutex.

[Nikolay Borisov: Bakported to 3.12.47
 - Adjusted context
 - Add the 'out' label]

Signed-off-by: Davide Italiano <dccitaliano@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/extents.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index c9830686cbd5..a9d23daa0d6f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4634,12 +4634,6 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	if (ret)
 		return ret;
 
-	/*
-	 * currently supporting (pre)allocate mode for extent-based
-	 * files _only_
-	 */
-	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)))
-		return -EOPNOTSUPP;
 
 	trace_ext4_fallocate_enter(inode, offset, len, mode);
 	map.m_lblk = offset >> blkbits;
@@ -4654,6 +4648,16 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	 */
 	credits = ext4_chunk_trans_blocks(inode, max_blocks);
 	mutex_lock(&inode->i_mutex);
+
+	/*
+	 * currently supporting (pre)allocate mode for extent-based
+	 * files _only_
+	 */
+	if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) {
+		ret = -EOPNOTSUPP;
+		goto out;
+	}
+
 	ret = inode_newsize_ok(inode, (len + offset));
 	if (ret) {
 		mutex_unlock(&inode->i_mutex);
@@ -4714,6 +4718,7 @@ retry:
 		ret = 0;
 		goto retry;
 	}
+out:
 	mutex_unlock(&inode->i_mutex);
 	trace_ext4_fallocate_exit(inode, offset, max_blocks,
 				ret > 0 ? ret2 : ret);
-- 
2.6.0


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

* [PATCH 3.12 07/84] libfc: Fix fc_fcp_cleanup_each_cmd()
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (5 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 06/84] ext4: move check under lock scope to close a race Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 08/84] regmap: regcache-rbtree: Clean new present bits on present bitmap resize Jiri Slaby
                   ` (52 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bart Van Assche, Vasu Dev, James Bottomley,
	Jiri Slaby

From: Bart Van Assche <bart.vanassche@sandisk.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 8f2777f53e3d5ad8ef2a176a4463a5c8e1a16431 upstream.

Since fc_fcp_cleanup_cmd() can sleep this function must not
be called while holding a spinlock. This patch avoids that
fc_fcp_cleanup_each_cmd() triggers the following bug:

BUG: scheduling while atomic: sg_reset/1512/0x00000202
1 lock held by sg_reset/1512:
 #0:  (&(&fsp->scsi_pkt_lock)->rlock){+.-...}, at: [<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
Preemption disabled at:[<ffffffffc0225cd5>] fc_fcp_cleanup_each_cmd.isra.21+0xa5/0x150 [libfc]
Call Trace:
 [<ffffffff816c612c>] dump_stack+0x4f/0x7b
 [<ffffffff810828bc>] __schedule_bug+0x6c/0xd0
 [<ffffffff816c87aa>] __schedule+0x71a/0xa10
 [<ffffffff816c8ad2>] schedule+0x32/0x80
 [<ffffffffc0217eac>] fc_seq_set_resp+0xac/0x100 [libfc]
 [<ffffffffc0218b11>] fc_exch_done+0x41/0x60 [libfc]
 [<ffffffffc0225cff>] fc_fcp_cleanup_each_cmd.isra.21+0xcf/0x150 [libfc]
 [<ffffffffc0225f43>] fc_eh_device_reset+0x1c3/0x270 [libfc]
 [<ffffffff814a2cc9>] scsi_try_bus_device_reset+0x29/0x60
 [<ffffffff814a3908>] scsi_ioctl_reset+0x258/0x2d0
 [<ffffffff814a2650>] scsi_ioctl+0x150/0x440
 [<ffffffff814b3a9d>] sd_ioctl+0xad/0x120
 [<ffffffff8132f266>] blkdev_ioctl+0x1b6/0x810
 [<ffffffff811da608>] block_ioctl+0x38/0x40
 [<ffffffff811b4e08>] do_vfs_ioctl+0x2f8/0x530
 [<ffffffff811b50c1>] SyS_ioctl+0x81/0xa0
 [<ffffffff816cf8b2>] system_call_fastpath+0x16/0x7a

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/libfc/fc_fcp.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index 5fd0f1fbe586..5fec5db1e329 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -1039,11 +1039,26 @@ restart:
 		fc_fcp_pkt_hold(fsp);
 		spin_unlock_irqrestore(&si->scsi_queue_lock, flags);
 
-		if (!fc_fcp_lock_pkt(fsp)) {
+		spin_lock_bh(&fsp->scsi_pkt_lock);
+		if (!(fsp->state & FC_SRB_COMPL)) {
+			fsp->state |= FC_SRB_COMPL;
+			/*
+			 * TODO: dropping scsi_pkt_lock and then reacquiring
+			 * again around fc_fcp_cleanup_cmd() is required,
+			 * since fc_fcp_cleanup_cmd() calls into
+			 * fc_seq_set_resp() and that func preempts cpu using
+			 * schedule. May be schedule and related code should be
+			 * removed instead of unlocking here to avoid scheduling
+			 * while atomic bug.
+			 */
+			spin_unlock_bh(&fsp->scsi_pkt_lock);
+
 			fc_fcp_cleanup_cmd(fsp, error);
+
+			spin_lock_bh(&fsp->scsi_pkt_lock);
 			fc_io_compl(fsp);
-			fc_fcp_unlock_pkt(fsp);
 		}
+		spin_unlock_bh(&fsp->scsi_pkt_lock);
 
 		fc_fcp_pkt_release(fsp);
 		spin_lock_irqsave(&si->scsi_queue_lock, flags);
-- 
2.6.0


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

* [PATCH 3.12 08/84] regmap: regcache-rbtree: Clean new present bits on present bitmap resize
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (6 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 07/84] libfc: Fix fc_fcp_cleanup_each_cmd() Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 09/84] crypto: caam - fix memory corruption in ahash_final_ctx Jiri Slaby
                   ` (51 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Guenter Roeck, Mark Brown, Jiri Slaby

From: Guenter Roeck <linux@roeck-us.net>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 8ef9724bf9718af81cfc5132253372f79c71b7e2 upstream.

When inserting a new register into a block, the present bit map size is
increased using krealloc. krealloc does not clear the additionally
allocated memory, leaving it filled with random values. Result is that
some registers are considered cached even though this is not the case.

Fix the problem by clearing the additionally allocated memory. Also, if
the bitmap size does not increase, do not reallocate the bitmap at all
to reduce overhead.

Fixes: 3f4ff561bc88 ("regmap: rbtree: Make cache_present bitmap per node")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/base/regmap/regcache-rbtree.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/base/regmap/regcache-rbtree.c b/drivers/base/regmap/regcache-rbtree.c
index 2b946bc4212d..f3f71369adc7 100644
--- a/drivers/base/regmap/regcache-rbtree.c
+++ b/drivers/base/regmap/regcache-rbtree.c
@@ -302,11 +302,20 @@ static int regcache_rbtree_insert_to_block(struct regmap *map,
 	if (!blk)
 		return -ENOMEM;
 
-	present = krealloc(rbnode->cache_present,
-		    BITS_TO_LONGS(blklen) * sizeof(*present), GFP_KERNEL);
-	if (!present) {
-		kfree(blk);
-		return -ENOMEM;
+	if (BITS_TO_LONGS(blklen) > BITS_TO_LONGS(rbnode->blklen)) {
+		present = krealloc(rbnode->cache_present,
+				   BITS_TO_LONGS(blklen) * sizeof(*present),
+				   GFP_KERNEL);
+		if (!present) {
+			kfree(blk);
+			return -ENOMEM;
+		}
+
+		memset(present + BITS_TO_LONGS(rbnode->blklen), 0,
+		       (BITS_TO_LONGS(blklen) - BITS_TO_LONGS(rbnode->blklen))
+		       * sizeof(*present));
+	} else {
+		present = rbnode->cache_present;
 	}
 
 	/* insert the register value in the correct place in the rbnode block */
-- 
2.6.0


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

* [PATCH 3.12 09/84] crypto: caam - fix memory corruption in ahash_final_ctx
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (7 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 08/84] regmap: regcache-rbtree: Clean new present bits on present bitmap resize Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 10/84] arm64: KVM: Fix host crash when injecting a fault into a 32bit guest Jiri Slaby
                   ` (50 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Horia Geant?, Herbert Xu, Jiri Slaby

From: Horia Geant? <horia.geanta@freescale.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit b310c178e6d897f82abb9da3af1cd7c02b09f592 upstream.

When doing pointer operation for accessing the HW S/G table,
a value representing number of entries (and not number of bytes)
must be used.

Fixes: 045e36780f115 ("crypto: caam - ahash hmac support")
Signed-off-by: Horia Geant? <horia.geanta@freescale.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/crypto/caam/caamhash.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index af351f478b14..92d2116bf1ad 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -897,13 +897,14 @@ static int ahash_final_ctx(struct ahash_request *req)
 			  state->buflen_1;
 	u32 *sh_desc = ctx->sh_desc_fin, *desc;
 	dma_addr_t ptr = ctx->sh_desc_fin_dma;
-	int sec4_sg_bytes;
+	int sec4_sg_bytes, sec4_sg_src_index;
 	int digestsize = crypto_ahash_digestsize(ahash);
 	struct ahash_edesc *edesc;
 	int ret = 0;
 	int sh_len;
 
-	sec4_sg_bytes = (1 + (buflen ? 1 : 0)) * sizeof(struct sec4_sg_entry);
+	sec4_sg_src_index = 1 + (buflen ? 1 : 0);
+	sec4_sg_bytes = sec4_sg_src_index * sizeof(struct sec4_sg_entry);
 
 	/* allocate space for base edesc and hw desc commands, link tables */
 	edesc = kmalloc(sizeof(struct ahash_edesc) + DESC_JOB_IO_LEN +
@@ -930,7 +931,7 @@ static int ahash_final_ctx(struct ahash_request *req)
 	state->buf_dma = try_buf_map_to_sec4_sg(jrdev, edesc->sec4_sg + 1,
 						buf, state->buf_dma, buflen,
 						last_buflen);
-	(edesc->sec4_sg + sec4_sg_bytes - 1)->len |= SEC4_SG_LEN_FIN;
+	(edesc->sec4_sg + sec4_sg_src_index - 1)->len |= SEC4_SG_LEN_FIN;
 
 	append_seq_in_ptr(desc, edesc->sec4_sg_dma, ctx->ctx_len + buflen,
 			  LDST_SGF);
-- 
2.6.0


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

* [PATCH 3.12 10/84] arm64: KVM: Fix host crash when injecting a fault into a 32bit guest
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (8 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 09/84] crypto: caam - fix memory corruption in ahash_final_ctx Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 11/84] DRM - radeon: Don't link train DisplayPort on HPD until we get the dpcd Jiri Slaby
                   ` (49 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Marc Zyngier, Will Deacon, Jiri Slaby

From: Marc Zyngier <marc.zyngier@arm.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 126c69a0bd0e441bf6766a5d9bf20de011be9f68 upstream.

When injecting a fault into a misbehaving 32bit guest, it seems
rather idiotic to also inject a 64bit fault that is only going
to corrupt the guest state. This leads to a situation where we
perform an illegal exception return at EL2 causing the host
to crash instead of killing the guest.

Just fix the stupid bug that has been there from day 1.

Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Tested-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kvm/inject_fault.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
index 81a02a8762b0..86825f8883de 100644
--- a/arch/arm64/kvm/inject_fault.c
+++ b/arch/arm64/kvm/inject_fault.c
@@ -168,8 +168,8 @@ void kvm_inject_dabt(struct kvm_vcpu *vcpu, unsigned long addr)
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_abt32(vcpu, false, addr);
-
-	inject_abt64(vcpu, false, addr);
+	else
+		inject_abt64(vcpu, false, addr);
 }
 
 /**
@@ -184,8 +184,8 @@ void kvm_inject_pabt(struct kvm_vcpu *vcpu, unsigned long addr)
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_abt32(vcpu, true, addr);
-
-	inject_abt64(vcpu, true, addr);
+	else
+		inject_abt64(vcpu, true, addr);
 }
 
 /**
@@ -198,6 +198,6 @@ void kvm_inject_undefined(struct kvm_vcpu *vcpu)
 {
 	if (!(vcpu->arch.hcr_el2 & HCR_RW))
 		inject_undef32(vcpu);
-
-	inject_undef64(vcpu);
+	else
+		inject_undef64(vcpu);
 }
-- 
2.6.0


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

* [PATCH 3.12 11/84] DRM - radeon: Don't link train DisplayPort on HPD until we get the dpcd
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (9 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 10/84] arm64: KVM: Fix host crash when injecting a fault into a 32bit guest Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 12/84] drm/qxl: validate monitors config modes Jiri Slaby
                   ` (48 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Stephen Chandler Paul, Alex Deucher, Jiri Slaby

From: Stephen Chandler Paul <cpaul@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 924f92bf12bfbef3662619e3ed24a1cea7c1cbcd upstream.

Most of the time this isn't an issue since hotplugging an adaptor will
trigger a crtc mode change which in turn, causes the driver to probe
every DisplayPort for a dpcd. However, in cases where hotplugging
doesn't cause a mode change (specifically when one unplugs a monitor
from a DisplayPort connector, then plugs that same monitor back in
seconds later on the same port without any other monitors connected), we
never probe for the dpcd before starting the initial link training. What
happens from there looks like this:

	- GPU has only one monitor connected. It's connected via
	  DisplayPort, and does not go through an adaptor of any sort.

	- User unplugs DisplayPort connector from GPU.

	- Change in HPD is detected by the driver, we probe every
	  DisplayPort for a possible connection.

	- Probe the port the user originally had the monitor connected
	  on for it's dpcd. This fails, and we clear the first (and only
	  the first) byte of the dpcd to indicate we no longer have a
	  dpcd for this port.

	- User plugs the previously disconnected monitor back into the
	  same DisplayPort.

	- radeon_connector_hotplug() is called before everyone else,
	  and tries to handle the link training. Since only the first
	  byte of the dpcd is zeroed, the driver is able to complete
	  link training but does so against the wrong dpcd, causing it
	  to initialize the link with the wrong settings.

	- Display stays blank (usually), dpcd is probed after the
	  initial link training, and the driver prints no obvious
	  messages to the log.

In theory, since only one byte of the dpcd is chopped off (specifically,
the byte that contains the revision information for DisplayPort), it's
not entirely impossible that this bug may not show on certain monitors.
For instance, the only reason this bug was visible on my ASUS PB238
monitor was due to the fact that this monitor using the enhanced framing
symbol sequence, the flag for which is ignored if the radeon driver
thinks that the DisplayPort version is below 1.1.

Signed-off-by: Stephen Chandler Paul <cpaul@redhat.com>
Reviewed-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/radeon_connectors.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index fe90b3e28d88..02cd9585ff83 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -78,6 +78,11 @@ void radeon_connector_hotplug(struct drm_connector *connector)
 			if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
 				drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
 			} else if (radeon_dp_needs_link_train(radeon_connector)) {
+				/* Don't try to start link training before we
+				 * have the dpcd */
+				if (!radeon_dp_getdpcd(radeon_connector))
+					return;
+
 				/* set it to OFF so that drm_helper_connector_dpms()
 				 * won't return immediately since the current state
 				 * is ON at this point.
-- 
2.6.0


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

* [PATCH 3.12 12/84] drm/qxl: validate monitors config modes
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (10 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 11/84] DRM - radeon: Don't link train DisplayPort on HPD until we get the dpcd Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 13/84] iio: Add inverse unit conversion macros Jiri Slaby
                   ` (47 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jonathon Jongsma, Dave Airlie, Jiri Slaby

From: Jonathon Jongsma <jjongsma@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit bd3e1c7c6de9f5f70d97cdb6c817151c0477c5e3 upstream.

Due to some recent changes in
drm_helper_probe_single_connector_modes_merge_bits(), old custom modes
were not being pruned properly. In current kernels,
drm_mode_validate_basic() is called to sanity-check each mode in the
list. If the sanity-check passes, the mode's status gets set to to
MODE_OK. In older kernels this check was not done, so old custom modes
would still have a status of MODE_UNVERIFIED at this point, and would
therefore be pruned later in the function.

As a result of this new behavior, the list of modes for a device always
includes every custom mode ever configured for the device, with the
largest one listed first. Since desktop environments usually choose the
first preferred mode when a hotplug event is emitted, this had the
result of making it very difficult for the user to reduce the size of
the display.

The qxl driver did implement the mode_valid connector function, but it
was empty. In order to restore the old behavior where old custom modes
are pruned, we implement a proper mode_valid function for the qxl
driver. This function now checks each mode against the last configured
custom mode and the list of standard modes. If the mode doesn't match
any of these, its status is set to MODE_BAD so that it will be pruned as
expected.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/qxl/qxl_display.c | 66 ++++++++++++++++++++++++---------------
 drivers/gpu/drm/qxl/qxl_drv.h     |  2 ++
 2 files changed, 42 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 5f79e511c2a6..ea0904875c74 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -127,37 +127,40 @@ static int qxl_add_monitors_config_modes(struct drm_connector *connector)
 			    false);
 	mode->type |= DRM_MODE_TYPE_PREFERRED;
 	drm_mode_probed_add(connector, mode);
+	/* remember the last custom size for mode validation */
+	qdev->monitors_config_width = mode->hdisplay;
+	qdev->monitors_config_height = mode->vdisplay;
 	return 1;
 }
 
+static struct mode_size {
+	int w;
+	int h;
+} common_modes[] = {
+	{ 640,  480},
+	{ 720,  480},
+	{ 800,  600},
+	{ 848,  480},
+	{1024,  768},
+	{1152,  768},
+	{1280,  720},
+	{1280,  800},
+	{1280,  854},
+	{1280,  960},
+	{1280, 1024},
+	{1440,  900},
+	{1400, 1050},
+	{1680, 1050},
+	{1600, 1200},
+	{1920, 1080},
+	{1920, 1200}
+};
+
 static int qxl_add_common_modes(struct drm_connector *connector)
 {
 	struct drm_device *dev = connector->dev;
 	struct drm_display_mode *mode = NULL;
 	int i;
-	struct mode_size {
-		int w;
-		int h;
-	} common_modes[] = {
-		{ 640,  480},
-		{ 720,  480},
-		{ 800,  600},
-		{ 848,  480},
-		{1024,  768},
-		{1152,  768},
-		{1280,  720},
-		{1280,  800},
-		{1280,  854},
-		{1280,  960},
-		{1280, 1024},
-		{1440,  900},
-		{1400, 1050},
-		{1680, 1050},
-		{1600, 1200},
-		{1920, 1080},
-		{1920, 1200}
-	};
-
 	for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
 		if (common_modes[i].w < 320 || common_modes[i].h < 200)
 			continue;
@@ -736,11 +739,22 @@ static int qxl_conn_get_modes(struct drm_connector *connector)
 static int qxl_conn_mode_valid(struct drm_connector *connector,
 			       struct drm_display_mode *mode)
 {
+	struct drm_device *ddev = connector->dev;
+	struct qxl_device *qdev = ddev->dev_private;
+	int i;
+
 	/* TODO: is this called for user defined modes? (xrandr --add-mode)
 	 * TODO: check that the mode fits in the framebuffer */
-	DRM_DEBUG("%s: %dx%d status=%d\n", mode->name, mode->hdisplay,
-		  mode->vdisplay, mode->status);
-	return MODE_OK;
+
+	if(qdev->monitors_config_width == mode->hdisplay &&
+	   qdev->monitors_config_height == mode->vdisplay)
+		return MODE_OK;
+
+	for (i = 0; i < ARRAY_SIZE(common_modes); i++) {
+		if (common_modes[i].w == mode->hdisplay && common_modes[i].h == mode->vdisplay)
+			return MODE_OK;
+	}
+	return MODE_BAD;
 }
 
 static struct drm_encoder *qxl_best_encoder(struct drm_connector *connector)
diff --git a/drivers/gpu/drm/qxl/qxl_drv.h b/drivers/gpu/drm/qxl/qxl_drv.h
index f7c9adde46a0..9cfafd7a1af6 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.h
+++ b/drivers/gpu/drm/qxl/qxl_drv.h
@@ -323,6 +323,8 @@ struct qxl_device {
 	struct work_struct gc_work;
 
 	struct work_struct fb_work;
+	int monitors_config_width;
+	int monitors_config_height;
 };
 
 /* forward declaration for QXL_INFO_IO */
-- 
2.6.0


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

* [PATCH 3.12 13/84] iio: Add inverse unit conversion macros
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (11 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 12/84] drm/qxl: validate monitors config modes Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 14/84] iio: adis16480: Fix scale factors Jiri Slaby
                   ` (46 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lars-Peter Clausen, Jonathan Cameron, Jiri Slaby

From: Lars-Peter Clausen <lars@metafoo.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit c689a923c867eac40ed3826c1d9328edea8b6bc7 upstream.

Add inverse unit conversion macro to convert from standard IIO units to
units that might be used by some devices.

Those are useful in combination with scale factors that are specified as
IIO_VAL_FRACTIONAL. Typically the denominator for those specifications will
contain the maximum raw value the sensor will generate and the numerator
the value it maps to in a specific unit. Sometimes datasheets specify those
in different units than the standard IIO units (e.g. degree/s instead of
rad/s) and so we need to do a unit conversion.

>From a mathematical point of view it does not make a difference whether we
apply the unit conversion to the numerator or the inverse unit conversion
to the denominator since (x / y) / z = x / (y * z). But as the denominator
is typically a larger value and we are rounding both the numerator and
denominator to integer values using the later method gives us a better
precision (E.g. the relative error is smaller if we round 8000.3 to 8000
rather than rounding 8.3 to 8).

This is where in inverse unit conversion macros will be used.

Marked for stable as used by some upcoming fixes.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/iio/iio.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 2103cc32a5fb..e94d165a1053 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -623,6 +623,15 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
 #define IIO_DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)
 
 /**
+ * IIO_RAD_TO_DEGREE() - Convert rad to degree
+ * @rad: A value in rad
+ *
+ * Returns the given value converted from rad to degree
+ */
+#define IIO_RAD_TO_DEGREE(rad) \
+	(((rad) * 18000000ULL + 314159ULL / 2) / 314159ULL)
+
+/**
  * IIO_G_TO_M_S_2() - Convert g to meter / second**2
  * @g: A value in g
  *
@@ -630,4 +639,12 @@ int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
  */
 #define IIO_G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL)
 
+/**
+ * IIO_M_S_2_TO_G() - Convert meter / second**2 to g
+ * @ms2: A value in meter / second**2
+ *
+ * Returns the given value converted from meter / second**2 to g
+ */
+#define IIO_M_S_2_TO_G(ms2) (((ms2) * 100000ULL + 980665ULL / 2) / 980665ULL)
+
 #endif /* _INDUSTRIAL_IO_H_ */
-- 
2.6.0


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

* [PATCH 3.12 14/84] iio: adis16480: Fix scale factors
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (12 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 13/84] iio: Add inverse unit conversion macros Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 15/84] clk: versatile: off by one in clk_sp810_timerclken_of_get() Jiri Slaby
                   ` (45 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lars-Peter Clausen, Jonathan Cameron, Jiri Slaby

From: Lars-Peter Clausen <lars@metafoo.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 7abad1063deb0f77d275c61f58863ec319c58c5c upstream.

The different devices support by the adis16480 driver have slightly
different scales for the gyroscope and accelerometer channels.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/iio/imu/adis16480.c | 39 +++++++++++++++++++++++++++++++++------
 1 file changed, 33 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
index dd4206cac62d..5e1b117d4e3b 100644
--- a/drivers/iio/imu/adis16480.c
+++ b/drivers/iio/imu/adis16480.c
@@ -110,6 +110,10 @@
 struct adis16480_chip_info {
 	unsigned int num_channels;
 	const struct iio_chan_spec *channels;
+	unsigned int gyro_max_val;
+	unsigned int gyro_max_scale;
+	unsigned int accel_max_val;
+	unsigned int accel_max_scale;
 };
 
 struct adis16480 {
@@ -533,19 +537,21 @@ static int adis16480_set_filter_freq(struct iio_dev *indio_dev,
 static int adis16480_read_raw(struct iio_dev *indio_dev,
 	const struct iio_chan_spec *chan, int *val, int *val2, long info)
 {
+	struct adis16480 *st = iio_priv(indio_dev);
+
 	switch (info) {
 	case IIO_CHAN_INFO_RAW:
 		return adis_single_conversion(indio_dev, chan, 0, val);
 	case IIO_CHAN_INFO_SCALE:
 		switch (chan->type) {
 		case IIO_ANGL_VEL:
-			*val = 0;
-			*val2 = IIO_DEGREE_TO_RAD(20000); /* 0.02 degree/sec */
-			return IIO_VAL_INT_PLUS_MICRO;
+			*val = st->chip_info->gyro_max_scale;
+			*val2 = st->chip_info->gyro_max_val;
+			return IIO_VAL_FRACTIONAL;
 		case IIO_ACCEL:
-			*val = 0;
-			*val2 = IIO_G_TO_M_S_2(800); /* 0.8 mg */
-			return IIO_VAL_INT_PLUS_MICRO;
+			*val = st->chip_info->accel_max_scale;
+			*val2 = st->chip_info->accel_max_val;
+			return IIO_VAL_FRACTIONAL;
 		case IIO_MAGN:
 			*val = 0;
 			*val2 = 100; /* 0.0001 gauss */
@@ -702,18 +708,39 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
 	[ADIS16375] = {
 		.channels = adis16485_channels,
 		.num_channels = ARRAY_SIZE(adis16485_channels),
+		/*
+		 * storing the value in rad/degree and the scale in degree
+		 * gives us the result in rad and better precession than
+		 * storing the scale directly in rad.
+		 */
+		.gyro_max_val = IIO_RAD_TO_DEGREE(22887),
+		.gyro_max_scale = 300,
+		.accel_max_val = IIO_M_S_2_TO_G(21973),
+		.accel_max_scale = 18,
 	},
 	[ADIS16480] = {
 		.channels = adis16480_channels,
 		.num_channels = ARRAY_SIZE(adis16480_channels),
+		.gyro_max_val = IIO_RAD_TO_DEGREE(22500),
+		.gyro_max_scale = 450,
+		.accel_max_val = IIO_M_S_2_TO_G(12500),
+		.accel_max_scale = 5,
 	},
 	[ADIS16485] = {
 		.channels = adis16485_channels,
 		.num_channels = ARRAY_SIZE(adis16485_channels),
+		.gyro_max_val = IIO_RAD_TO_DEGREE(22500),
+		.gyro_max_scale = 450,
+		.accel_max_val = IIO_M_S_2_TO_G(20000),
+		.accel_max_scale = 5,
 	},
 	[ADIS16488] = {
 		.channels = adis16480_channels,
 		.num_channels = ARRAY_SIZE(adis16480_channels),
+		.gyro_max_val = IIO_RAD_TO_DEGREE(22500),
+		.gyro_max_scale = 450,
+		.accel_max_val = IIO_M_S_2_TO_G(22500),
+		.accel_max_scale = 18,
 	},
 };
 
-- 
2.6.0


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

* [PATCH 3.12 15/84] clk: versatile: off by one in clk_sp810_timerclken_of_get()
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (13 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 14/84] iio: adis16480: Fix scale factors Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 16/84] PCI: Fix TI816X class code quirk Jiri Slaby
                   ` (44 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dan Carpenter, Stephen Boyd, Jiri Slaby

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

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 3294bee87091be5f179474f6c39d1d87769635e2 upstream.

The ">" should be ">=" or we end up reading beyond the end of the array.

Fixes: 6e973d2c4385 ('clk: vexpress: Add separate SP810 driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/clk/versatile/clk-sp810.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index bf9b15a585e1..b9e05bde0c06 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -128,8 +128,8 @@ struct clk *clk_sp810_timerclken_of_get(struct of_phandle_args *clkspec,
 {
 	struct clk_sp810 *sp810 = data;
 
-	if (WARN_ON(clkspec->args_count != 1 || clkspec->args[0] >
-			ARRAY_SIZE(sp810->timerclken)))
+	if (WARN_ON(clkspec->args_count != 1 ||
+		    clkspec->args[0] >=	ARRAY_SIZE(sp810->timerclken)))
 		return NULL;
 
 	return sp810->timerclken[clkspec->args[0]].clk;
-- 
2.6.0


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

* [PATCH 3.12 16/84] PCI: Fix TI816X class code quirk
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (14 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 15/84] clk: versatile: off by one in clk_sp810_timerclken_of_get() Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 17/84] USB: symbolserial: Use usb_get_serial_port_data Jiri Slaby
                   ` (43 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bjorn Helgaas, Hemant Pedanekar, Jiri Slaby

From: Bjorn Helgaas <bhelgaas@google.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit d1541dc977d376406f4584d8eb055488655c98ec upstream.

In fixup_ti816x_class(), we assigned "class = PCI_CLASS_MULTIMEDIA_VIDEO".
But PCI_CLASS_MULTIMEDIA_VIDEO is only the two-byte base class/sub-class
and needs to be shifted to make space for the low-order interface byte.

Shift PCI_CLASS_MULTIMEDIA_VIDEO to set the correct class code.

Fixes: 63c4408074cb ("PCI: Add quirk for setting valid class for TI816X Endpoint")
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Hemant Pedanekar <hemantp@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/quirks.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 877bfbb4e55c..eee40430b0b0 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2803,12 +2803,15 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x3c28, vtd_mask_spec_errors);
 
 static void fixup_ti816x_class(struct pci_dev *dev)
 {
+	u32 class = dev->class;
+
 	/* TI 816x devices do not have class code set when in PCIe boot mode */
-	dev_info(&dev->dev, "Setting PCI class for 816x PCIe device\n");
-	dev->class = PCI_CLASS_MULTIMEDIA_VIDEO;
+	dev->class = PCI_CLASS_MULTIMEDIA_VIDEO << 8;
+	dev_info(&dev->dev, "PCI class overridden (%#08x -> %#08x)\n",
+		 class, dev->class);
 }
 DECLARE_PCI_FIXUP_CLASS_EARLY(PCI_VENDOR_ID_TI, 0xb800,
-				 PCI_CLASS_NOT_DEFINED, 0, fixup_ti816x_class);
+			      PCI_CLASS_NOT_DEFINED, 0, fixup_ti816x_class);
 
 /* Some PCIe devices do not work reliably with the claimed maximum
  * payload size supported.
-- 
2.6.0


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

* [PATCH 3.12 17/84] USB: symbolserial: Use usb_get_serial_port_data
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (15 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 16/84] PCI: Fix TI816X class code quirk Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 18/84] USB: ftdi_sio: Added custom PID for CustomWare products Jiri Slaby
                   ` (42 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Philipp Hachtmann, Jiri Slaby

From: Philipp Hachtmann <hachti@hachti.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 951d3793bbfc0a441d791d820183aa3085c83ea9 upstream.

The driver used usb_get_serial_data(port->serial) which compiled but resulted
in a NULL pointer being returned (and subsequently used). I did not go deeper
into this but I guess this is a regression.

Signed-off-by: Philipp Hachtmann <hachti@hachti.de>
Fixes: a85796ee5149 ("USB: symbolserial: move private-data allocation to
port_probe")
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/symbolserial.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/symbolserial.c b/drivers/usb/serial/symbolserial.c
index 9b1648945e7a..1e2d86d4f539 100644
--- a/drivers/usb/serial/symbolserial.c
+++ b/drivers/usb/serial/symbolserial.c
@@ -97,7 +97,7 @@ exit:
 
 static int symbol_open(struct tty_struct *tty, struct usb_serial_port *port)
 {
-	struct symbol_private *priv = usb_get_serial_data(port->serial);
+	struct symbol_private *priv = usb_get_serial_port_data(port);
 	unsigned long flags;
 	int result = 0;
 
@@ -123,7 +123,7 @@ static void symbol_close(struct usb_serial_port *port)
 static void symbol_throttle(struct tty_struct *tty)
 {
 	struct usb_serial_port *port = tty->driver_data;
-	struct symbol_private *priv = usb_get_serial_data(port->serial);
+	struct symbol_private *priv = usb_get_serial_port_data(port);
 
 	spin_lock_irq(&priv->lock);
 	priv->throttled = true;
@@ -133,7 +133,7 @@ static void symbol_throttle(struct tty_struct *tty)
 static void symbol_unthrottle(struct tty_struct *tty)
 {
 	struct usb_serial_port *port = tty->driver_data;
-	struct symbol_private *priv = usb_get_serial_data(port->serial);
+	struct symbol_private *priv = usb_get_serial_port_data(port);
 	int result;
 	bool was_throttled;
 
-- 
2.6.0


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

* [PATCH 3.12 18/84] USB: ftdi_sio: Added custom PID for CustomWare products
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (16 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 17/84] USB: symbolserial: Use usb_get_serial_port_data Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 19/84] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes Jiri Slaby
                   ` (41 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Matthijs Kooijman, Johan Hovold, Jiri Slaby

From: Matthijs Kooijman <matthijs@stdin.nl>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 1fb8dc36384ae1140ee6ccc470de74397606a9d5 upstream.

CustomWare uses the FTDI VID with custom PIDs for their ShipModul MiniPlex
products.

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/ftdi_sio.c     | 4 ++++
 drivers/usb/serial/ftdi_sio_ids.h | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 75260b2ee420..beb96e997951 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -619,6 +619,10 @@ static struct usb_device_id id_table_combined [] = {
 	{ USB_DEVICE(FTDI_VID, FTDI_NT_ORIONLXM_PID),
 		.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
 	{ USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX2WI_PID) },
+	{ USB_DEVICE(FTDI_VID, FTDI_CUSTOMWARE_MINIPLEX3_PID) },
 	/*
 	 * ELV devices:
 	 */
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 792e054126de..2943b97b2a83 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -568,6 +568,14 @@
  */
 #define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */
 
+/*
+ * CustomWare / ShipModul NMEA multiplexers product ids (FTDI_VID)
+ */
+#define FTDI_CUSTOMWARE_MINIPLEX_PID	0xfd48	/* MiniPlex first generation NMEA Multiplexer */
+#define FTDI_CUSTOMWARE_MINIPLEX2_PID	0xfd49	/* MiniPlex-USB and MiniPlex-2 series */
+#define FTDI_CUSTOMWARE_MINIPLEX2WI_PID	0xfd4a	/* MiniPlex-2Wi */
+#define FTDI_CUSTOMWARE_MINIPLEX3_PID	0xfd4b	/* MiniPlex-3 series */
+
 
 /********************************/
 /** third-party VID/PID combos **/
-- 
2.6.0


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

* [PATCH 3.12 19/84] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (17 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 18/84] USB: ftdi_sio: Added custom PID for CustomWare products Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 20/84] usb: host: ehci-sys: delete useless bus_to_hcd conversion Jiri Slaby
                   ` (40 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Kishon Vijay Abraham I, Felipe Balbi, Jiri Slaby

From: Kishon Vijay Abraham I <kishon@ti.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit b2fb5b1a0f50d3ebc12342c8d8dead245e9c9d4e upstream.

DWC3 uses bounce buffer to handle non max packet aligned OUT transfers and
the size of bounce buffer is 512 bytes. However if the host initiates OUT
transfers of size more than 512 bytes (and non max packet aligned), the
driver throws a WARN dump but still programs the TRB to receive more than
512 bytes. This will cause bounce buffer to overflow and corrupt the
adjacent memory locations which can be fatal.

Fix it by programming the TRB to receive a maximum of DWC3_EP0_BOUNCE_SIZE
(512) bytes.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/dwc3/ep0.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 657c51cf2109..fb78796b0c26 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -793,6 +793,11 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
 		unsigned maxp = ep0->endpoint.maxpacket;
 
 		transfer_size += (maxp - (transfer_size % maxp));
+
+		/* Maximum of DWC3_EP0_BOUNCE_SIZE can only be received */
+		if (transfer_size > DWC3_EP0_BOUNCE_SIZE)
+			transfer_size = DWC3_EP0_BOUNCE_SIZE;
+
 		transferred = min_t(u32, ur->length,
 				transfer_size - length);
 		memcpy(ur->buf, dwc->ep0_bounce, transferred);
@@ -905,11 +910,14 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
 			return;
 		}
 
-		WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE);
-
 		maxpacket = dep->endpoint.maxpacket;
 		transfer_size = roundup(req->request.length, maxpacket);
 
+		if (transfer_size > DWC3_EP0_BOUNCE_SIZE) {
+			dev_WARN(dwc->dev, "bounce buf can't handle req len\n");
+			transfer_size = DWC3_EP0_BOUNCE_SIZE;
+		}
+
 		dwc->ep0_bounced = true;
 
 		/*
-- 
2.6.0


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

* [PATCH 3.12 20/84] usb: host: ehci-sys: delete useless bus_to_hcd conversion
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (18 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 19/84] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 21/84] serial: 8250: don't bind to SMSC IrCC IR port Jiri Slaby
                   ` (39 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Peter Chen, Jiri Slaby

From: Peter Chen <peter.chen@freescale.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 0521cfd06e1ebcd575e7ae36aab068b38df23850 upstream.

The ehci platform device's drvdata is the pointer of struct usb_hcd
already, so we doesn't need to call bus_to_hcd conversion again.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/ehci-sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/ehci-sysfs.c b/drivers/usb/host/ehci-sysfs.c
index 14ced00ba220..0659024290af 100644
--- a/drivers/usb/host/ehci-sysfs.c
+++ b/drivers/usb/host/ehci-sysfs.c
@@ -29,7 +29,7 @@ static ssize_t show_companion(struct device *dev,
 	int			count = PAGE_SIZE;
 	char			*ptr = buf;
 
-	ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
+	ehci = hcd_to_ehci(dev_get_drvdata(dev));
 	nports = HCS_N_PORTS(ehci->hcs_params);
 
 	for (index = 0; index < nports; ++index) {
@@ -54,7 +54,7 @@ static ssize_t store_companion(struct device *dev,
 	struct ehci_hcd		*ehci;
 	int			portnum, new_owner;
 
-	ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
+	ehci = hcd_to_ehci(dev_get_drvdata(dev));
 	new_owner = PORT_OWNER;		/* Owned by companion */
 	if (sscanf(buf, "%d", &portnum) != 1)
 		return -EINVAL;
@@ -85,7 +85,7 @@ static ssize_t show_uframe_periodic_max(struct device *dev,
 	struct ehci_hcd		*ehci;
 	int			n;
 
-	ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
+	ehci = hcd_to_ehci(dev_get_drvdata(dev));
 	n = scnprintf(buf, PAGE_SIZE, "%d\n", ehci->uframe_periodic_max);
 	return n;
 }
@@ -102,7 +102,7 @@ static ssize_t store_uframe_periodic_max(struct device *dev,
 	unsigned long		flags;
 	ssize_t			ret;
 
-	ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev)));
+	ehci = hcd_to_ehci(dev_get_drvdata(dev));
 	if (kstrtouint(buf, 0, &uframe_periodic_max) < 0)
 		return -EINVAL;
 
-- 
2.6.0


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

* [PATCH 3.12 21/84] serial: 8250: don't bind to SMSC IrCC IR port
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (19 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 20/84] usb: host: ehci-sys: delete useless bus_to_hcd conversion Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 22/84] crypto: ghash-clmulni: specify context size for ghash async algorithm Jiri Slaby
                   ` (38 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Maciej S. Szmigiero, Jiri Slaby

From: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit ffa34de03bcfbfa88d8352942bc238bb48e94e2d upstream.

SMSC IrCC SIR/FIR port should not be bound to by
(legacy) serial driver so its own driver (smsc-ircc2)
can bind to it.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/8250/8250_pnp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_pnp.c b/drivers/tty/serial/8250/8250_pnp.c
index 35d9ab95c5cb..91b14202b90b 100644
--- a/drivers/tty/serial/8250/8250_pnp.c
+++ b/drivers/tty/serial/8250/8250_pnp.c
@@ -365,6 +365,11 @@ static const struct pnp_device_id pnp_dev_table[] = {
 	/* Winbond CIR port, should not be probed. We should keep track
 	   of it to prevent the legacy serial driver from probing it */
 	{	"WEC1022",		CIR_PORT	},
+	/*
+	 * SMSC IrCC SIR/FIR port, should not be probed by serial driver
+	 * as well so its own driver can bind to it.
+	 */
+	{	"SMCF010",		CIR_PORT	},
 	{	"",			0	}
 };
 
-- 
2.6.0


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

* [PATCH 3.12 22/84] crypto: ghash-clmulni: specify context size for ghash async algorithm
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (20 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 21/84] serial: 8250: don't bind to SMSC IrCC IR port Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 23/84] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error Jiri Slaby
                   ` (37 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Andrey Ryabinin, Herbert Xu, Jiri Slaby

From: Andrey Ryabinin <aryabinin@odin.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 71c6da846be478a61556717ef1ee1cea91f5d6a8 upstream.

Currently context size (cra_ctxsize) doesn't specified for
ghash_async_alg. Which means it's zero. Thus crypto_create_tfm()
doesn't allocate needed space for ghash_async_ctx, so any
read/write to ctx (e.g. in ghash_async_init_tfm()) is not valid.

Signed-off-by: Andrey Ryabinin <aryabinin@odin.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/crypto/ghash-clmulni-intel_glue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/crypto/ghash-clmulni-intel_glue.c b/arch/x86/crypto/ghash-clmulni-intel_glue.c
index a8d6f69f92a3..4bcf841e4701 100644
--- a/arch/x86/crypto/ghash-clmulni-intel_glue.c
+++ b/arch/x86/crypto/ghash-clmulni-intel_glue.c
@@ -291,6 +291,7 @@ static struct ahash_alg ghash_async_alg = {
 			.cra_name		= "ghash",
 			.cra_driver_name	= "ghash-clmulni",
 			.cra_priority		= 400,
+			.cra_ctxsize		= sizeof(struct ghash_async_ctx),
 			.cra_flags		= CRYPTO_ALG_TYPE_AHASH | CRYPTO_ALG_ASYNC,
 			.cra_blocksize		= GHASH_BLOCK_SIZE,
 			.cra_type		= &crypto_ahash_type,
-- 
2.6.0


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

* [PATCH 3.12 23/84] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (21 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 22/84] crypto: ghash-clmulni: specify context size for ghash async algorithm Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 24/84] KVM: MMU: fix validation of mmio page fault Jiri Slaby
                   ` (36 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Don Zickus, Jiri Kosina, Jiri Slaby

From: Don Zickus <dzickus@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 3af4e5a95184d6d3c1c6a065f163faa174a96a1d upstream.

It was reported that after 10-20 reboots, a usb keyboard plugged
into a docking station would not work unless it was replugged in.

Using usbmon, it turns out the interrupt URBs were streaming with
callback errors of -71 for some reason.  The hid-core.c::hid_io_error was
supposed to retry and then reset, but the reset wasn't really happening.

The check for HID_NO_BANDWIDTH was inverted.  Fix was simple.

Tested by reporter and locally by me by unplugging a keyboard halfway until I
could recreate a stream of errors but no disconnect.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/usbhid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index bcc3193d297c..f44be51e261d 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -180,7 +180,7 @@ static void hid_io_error(struct hid_device *hid)
 	if (time_after(jiffies, usbhid->stop_retry)) {
 
 		/* Retries failed, so do a port reset unless we lack bandwidth*/
-		if (test_bit(HID_NO_BANDWIDTH, &usbhid->iofl)
+		if (!test_bit(HID_NO_BANDWIDTH, &usbhid->iofl)
 		     && !test_and_set_bit(HID_RESET_PENDING, &usbhid->iofl)) {
 
 			schedule_work(&usbhid->reset_work);
-- 
2.6.0


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

* [PATCH 3.12 24/84] KVM: MMU: fix validation of mmio page fault
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (22 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 23/84] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 25/84] xtensa: fix threadptr reload on return to userspace Jiri Slaby
                   ` (35 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Xiao Guangrong, Paolo Bonzini, Jiri Slaby

From: Xiao Guangrong <guangrong.xiao@linux.intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 6f691251c0350ac52a007c54bf3ef62e9d8cdc5e upstream.

We got the bug that qemu complained with "KVM: unknown exit, hardware
reason 31" and KVM shown these info:
[84245.284948] EPT: Misconfiguration.
[84245.285056] EPT: GPA: 0xfeda848
[84245.285154] ept_misconfig_inspect_spte: spte 0x5eaef50107 level 4
[84245.285344] ept_misconfig_inspect_spte: spte 0x5f5fadc107 level 3
[84245.285532] ept_misconfig_inspect_spte: spte 0x5141d18107 level 2
[84245.285723] ept_misconfig_inspect_spte: spte 0x52e40dad77 level 1

This is because we got a mmio #PF and the handler see the mmio spte becomes
normal (points to the ram page)

However, this is valid after introducing fast mmio spte invalidation which
increases the generation-number instead of zapping mmio sptes, a example
is as follows:
1. QEMU drops mmio region by adding a new memslot
2. invalidate all mmio sptes
3.

        VCPU 0                        VCPU 1
    access the invalid mmio spte
                            access the region originally was MMIO before
                            set the spte to the normal ram map

    mmio #PF
    check the spte and see it becomes normal ram mapping !!!

This patch fixes the bug just by dropping the check in mmio handler, it's
good for backport. Full check will be introduced in later patches

Reported-by: Pavel Shirshov <ru.pchel@gmail.com>
Tested-by: Pavel Shirshov <ru.pchel@gmail.com>
Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kvm/mmu.c | 45 ---------------------------------------------
 1 file changed, 45 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index b759853d78fe..caff13e0c993 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -381,12 +381,6 @@ static u64 __get_spte_lockless(u64 *sptep)
 {
 	return ACCESS_ONCE(*sptep);
 }
-
-static bool __check_direct_spte_mmio_pf(u64 spte)
-{
-	/* It is valid if the spte is zapped. */
-	return spte == 0ull;
-}
 #else
 union split_spte {
 	struct {
@@ -502,23 +496,6 @@ retry:
 
 	return spte.spte;
 }
-
-static bool __check_direct_spte_mmio_pf(u64 spte)
-{
-	union split_spte sspte = (union split_spte)spte;
-	u32 high_mmio_mask = shadow_mmio_mask >> 32;
-
-	/* It is valid if the spte is zapped. */
-	if (spte == 0ull)
-		return true;
-
-	/* It is valid if the spte is being zapped. */
-	if (sspte.spte_low == 0ull &&
-	    (sspte.spte_high & high_mmio_mask) == high_mmio_mask)
-		return true;
-
-	return false;
-}
 #endif
 
 static bool spte_is_locklessly_modifiable(u64 spte)
@@ -3219,21 +3196,6 @@ static bool quickly_check_mmio_pf(struct kvm_vcpu *vcpu, u64 addr, bool direct)
 	return vcpu_match_mmio_gva(vcpu, addr);
 }
 
-
-/*
- * On direct hosts, the last spte is only allows two states
- * for mmio page fault:
- *   - It is the mmio spte
- *   - It is zapped or it is being zapped.
- *
- * This function completely checks the spte when the last spte
- * is not the mmio spte.
- */
-static bool check_direct_spte_mmio_pf(u64 spte)
-{
-	return __check_direct_spte_mmio_pf(spte);
-}
-
 static u64 walk_shadow_page_get_mmio_spte(struct kvm_vcpu *vcpu, u64 addr)
 {
 	struct kvm_shadow_walk_iterator iterator;
@@ -3276,13 +3238,6 @@ int handle_mmio_page_fault_common(struct kvm_vcpu *vcpu, u64 addr, bool direct)
 	}
 
 	/*
-	 * It's ok if the gva is remapped by other cpus on shadow guest,
-	 * it's a BUG if the gfn is not a mmio page.
-	 */
-	if (direct && !check_direct_spte_mmio_pf(spte))
-		return RET_MMIO_PF_BUG;
-
-	/*
 	 * If the page table is zapped by other cpus, let CPU fault again on
 	 * the address.
 	 */
-- 
2.6.0


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

* [PATCH 3.12 25/84] xtensa: fix threadptr reload on return to userspace
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (23 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 24/84] KVM: MMU: fix validation of mmio page fault Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 26/84] xtensa: fix kernel register spilling Jiri Slaby
                   ` (34 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Max Filippov, Jiri Slaby

From: Max Filippov <jcmvbkbc@gmail.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 4229fb12a03e5da5882b420b0aa4a02e77447b86 upstream.

Userspace return code may skip restoring THREADPTR register if there are
no registers that need to be zeroed. This leads to spurious failures in
libc NPTL tests.

Always restore THREADPTR on return to userspace.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/xtensa/kernel/entry.S | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 4b8e636e60da..900137e59b20 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -568,12 +568,13 @@ user_exception_exit:
 	 *	 (if we have restored WSBITS-1 frames).
 	 */
 
+2:
 #if XCHAL_HAVE_THREADPTR
 	l32i	a3, a1, PT_THREADPTR
 	wur	a3, threadptr
 #endif
 
-2:	j	common_exception_exit
+	j	common_exception_exit
 
 	/* This is the kernel exception exit.
 	 * We avoided to do a MOVSP when we entered the exception, but we
-- 
2.6.0


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

* [PATCH 3.12 26/84] xtensa: fix kernel register spilling
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (24 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 25/84] xtensa: fix threadptr reload on return to userspace Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 27/84] devres: fix devres_get() Jiri Slaby
                   ` (33 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Max Filippov, Jiri Slaby

From: Max Filippov <jcmvbkbc@gmail.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 77d6273e79e3a86552fcf10cdd31a69b46ed2ce6 upstream.

call12 can't be safely used as the first call in the inline function,
because the compiler does not extend the stack frame of the bounding
function accordingly, which may result in corruption of local variables.

If a call needs to be done, do call8 first followed by call12.

For pure assembly code in _switch_to increase stack frame size of the
bounding function.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/xtensa/include/asm/traps.h | 29 +++++++++++++++++++----------
 arch/xtensa/kernel/entry.S      |  4 ++--
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/arch/xtensa/include/asm/traps.h b/arch/xtensa/include/asm/traps.h
index f2faa58f9a43..03d02df47b9a 100644
--- a/arch/xtensa/include/asm/traps.h
+++ b/arch/xtensa/include/asm/traps.h
@@ -24,30 +24,39 @@ static inline void spill_registers(void)
 {
 #if XCHAL_NUM_AREGS > 16
 	__asm__ __volatile__ (
-		"	call12	1f\n"
+		"	call8	1f\n"
 		"	_j	2f\n"
 		"	retw\n"
 		"	.align	4\n"
 		"1:\n"
+#if XCHAL_NUM_AREGS == 32
+		"	_entry	a1, 32\n"
+		"	addi	a8, a0, 3\n"
+		"	_entry	a1, 16\n"
+		"	mov	a12, a12\n"
+		"	retw\n"
+#else
 		"	_entry	a1, 48\n"
-		"	addi	a12, a0, 3\n"
-#if XCHAL_NUM_AREGS > 32
-		"	.rept	(" __stringify(XCHAL_NUM_AREGS) " - 32) / 12\n"
+		"	call12	1f\n"
+		"	retw\n"
+		"	.align	4\n"
+		"1:\n"
+		"	.rept	(" __stringify(XCHAL_NUM_AREGS) " - 16) / 12\n"
 		"	_entry	a1, 48\n"
 		"	mov	a12, a0\n"
 		"	.endr\n"
-#endif
-		"	_entry	a1, 48\n"
+		"	_entry	a1, 16\n"
 #if XCHAL_NUM_AREGS % 12 == 0
-		"	mov	a8, a8\n"
-#elif XCHAL_NUM_AREGS % 12 == 4
 		"	mov	a12, a12\n"
-#elif XCHAL_NUM_AREGS % 12 == 8
+#elif XCHAL_NUM_AREGS % 12 == 4
 		"	mov	a4, a4\n"
+#elif XCHAL_NUM_AREGS % 12 == 8
+		"	mov	a8, a8\n"
 #endif
 		"	retw\n"
+#endif
 		"2:\n"
-		: : : "a12", "a13", "memory");
+		: : : "a8", "a9", "memory");
 #else
 	__asm__ __volatile__ (
 		"	mov	a12, a12\n"
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 900137e59b20..250c52b14edf 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -1828,7 +1828,7 @@ ENDPROC(system_call)
 	mov	a12, a0
 	.endr
 #endif
-	_entry	a1, 48
+	_entry	a1, 16
 #if XCHAL_NUM_AREGS % 12 == 0
 	mov	a8, a8
 #elif XCHAL_NUM_AREGS % 12 == 4
@@ -1852,7 +1852,7 @@ ENDPROC(system_call)
 
 ENTRY(_switch_to)
 
-	entry	a1, 16
+	entry	a1, 48
 
 	mov	a11, a3			# and 'next' (a3)
 
-- 
2.6.0


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

* [PATCH 3.12 27/84] devres: fix devres_get()
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (25 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 26/84] xtensa: fix kernel register spilling Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 28/84] auxdisplay: ks0108: fix refcount Jiri Slaby
                   ` (32 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Masahiro Yamada, Jiri Slaby

From: Masahiro Yamada <yamada.masahiro@socionext.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 64526370d11ce8868ca495723d595b61e8697fbf upstream.

Currently, devres_get() passes devres_free() the pointer to devres,
but devres_free() should be given with the pointer to resource data.

Fixes: 9ac7849e35f7 ("devres: device resource management")
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/base/devres.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 507379e7b763..4e2fb405da87 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -296,10 +296,10 @@ void * devres_get(struct device *dev, void *new_res,
 	if (!dr) {
 		add_dr(dev, &new_dr->node);
 		dr = new_dr;
-		new_dr = NULL;
+		new_res = NULL;
 	}
 	spin_unlock_irqrestore(&dev->devres_lock, flags);
-	devres_free(new_dr);
+	devres_free(new_res);
 
 	return dr->data;
 }
-- 
2.6.0


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

* [PATCH 3.12 28/84] auxdisplay: ks0108: fix refcount
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (26 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 27/84] devres: fix devres_get() Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 29/84] of/address: Don't loop forever in of_find_matching_node_by_address() Jiri Slaby
                   ` (31 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Sudip Mukherjee, Sudip Mukherjee, Jiri Slaby

From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit bab383de3b84e584b0f09227151020b2a43dc34c upstream.

parport_find_base() will implicitly do parport_get_port() which
increases the refcount. Then parport_register_device() will again
increment the refcount. But while unloading the module we are only
doing parport_unregister_device() decrementing the refcount only once.
We add an parport_put_port() to neutralize the effect of
parport_get_port().

Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/auxdisplay/ks0108.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/auxdisplay/ks0108.c b/drivers/auxdisplay/ks0108.c
index 5b93852392b8..0d752851a1ee 100644
--- a/drivers/auxdisplay/ks0108.c
+++ b/drivers/auxdisplay/ks0108.c
@@ -139,6 +139,7 @@ static int __init ks0108_init(void)
 
 	ks0108_pardevice = parport_register_device(ks0108_parport, KS0108_NAME,
 		NULL, NULL, NULL, PARPORT_DEV_EXCL, NULL);
+	parport_put_port(ks0108_parport);
 	if (ks0108_pardevice == NULL) {
 		printk(KERN_ERR KS0108_NAME ": ERROR: "
 			"parport didn't register new device\n");
-- 
2.6.0


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

* [PATCH 3.12 29/84] of/address: Don't loop forever in of_find_matching_node_by_address().
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (27 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 28/84] auxdisplay: ks0108: fix refcount Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 30/84] ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP Jiri Slaby
                   ` (30 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David Daney, Rob Herring, Jiri Slaby

From: David Daney <david.daney@cavium.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 3a496b00b6f90c41bd21a410871dfc97d4f3c7ab upstream.

If the internal call to of_address_to_resource() fails, we end up
looping forever in of_find_matching_node_by_address().  This can be
caused by a defective device tree, or calling with an incorrect
matches argument.

Fix by calling of_find_matching_node() unconditionally at the end of
the loop.

Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/of/address.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/of/address.c b/drivers/of/address.c
index f5582f3a06a4..3a308877ac90 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -696,10 +696,10 @@ struct device_node *of_find_matching_node_by_address(struct device_node *from,
 	struct resource res;
 
 	while (dn) {
-		if (of_address_to_resource(dn, 0, &res))
-			continue;
-		if (res.start == base_address)
+		if (!of_address_to_resource(dn, 0, &res) &&
+		    res.start == base_address)
 			return dn;
+
 		dn = of_find_matching_node(dn, matches);
 	}
 
-- 
2.6.0


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

* [PATCH 3.12 30/84] ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (28 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 29/84] of/address: Don't loop forever in of_find_matching_node_by_address() Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 31/84] drivercore: Fix unregistration path of platform devices Jiri Slaby
                   ` (29 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vignesh R, Paul Walmsley, Jiri Slaby

From: Vignesh R <vigneshr@ti.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit b9e23f321940d2db2c9def8ff723b8464fb86343 upstream.

Legacy IPs like PWMSS, present under l4per2_7xx_clkdm, cannot support
smart-idle when its clock domain is in HW_AUTO on DRA7 SoCs. Hence,
program clock domain to SW_WKUP.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Acked-by: Tero Kristo <t-kristo@ti.com>
Reviewed-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/mach-omap2/clockdomains7xx_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/clockdomains7xx_data.c b/arch/arm/mach-omap2/clockdomains7xx_data.c
index 57d5df0c1fbd..7581e036bda6 100644
--- a/arch/arm/mach-omap2/clockdomains7xx_data.c
+++ b/arch/arm/mach-omap2/clockdomains7xx_data.c
@@ -331,7 +331,7 @@ static struct clockdomain l4per2_7xx_clkdm = {
 	.dep_bit	  = DRA7XX_L4PER2_STATDEP_SHIFT,
 	.wkdep_srcs	  = l4per2_wkup_sleep_deps,
 	.sleepdep_srcs	  = l4per2_wkup_sleep_deps,
-	.flags		  = CLKDM_CAN_HWSUP_SWSUP,
+	.flags		  = CLKDM_CAN_SWSUP,
 };
 
 static struct clockdomain mpu0_7xx_clkdm = {
-- 
2.6.0


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

* [PATCH 3.12 31/84] drivercore: Fix unregistration path of platform devices
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (29 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 30/84] ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 32/84] hpfs: update ctime and mtime on directory modification Jiri Slaby
                   ` (28 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Grant Likely, Pantelis Antoniou, Wolfram Sang,
	Rob Herring, Greg Kroah-Hartman, Ricardo Ribalda Delgado,
	Jiri Slaby

From: Grant Likely <grant.likely@linaro.org>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 7f5dcaf1fdf289767a126a0a5cc3ef39b5254b06 upstream.

The unregister path of platform_device is broken. On registration, it
will register all resources with either a parent already set, or
type==IORESOURCE_{IO,MEM}. However, on unregister it will release
everything with type==IORESOURCE_{IO,MEM}, but ignore the others. There
are also cases where resources don't get registered in the first place,
like with devices created by of_platform_populate()*.

Fix the unregister path to be symmetrical with the register path by
checking the parent pointer instead of the type field to decide which
resources to unregister. This is safe because the upshot of the
registration path algorithm is that registered resources have a parent
pointer, and non-registered resources do not.

* It can be argued that of_platform_populate() should be registering
  it's resources, and they argument has some merit. However, there are
  quite a few platforms that end up broken if we try to do that due to
  overlapping resources in the device tree. Until that is fixed, we need
  to solve the immediate problem.

Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: Rob Herring <robh@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
Tested-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/base/platform.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 4f8bef3eb5a8..413441a2ad4a 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -344,9 +344,7 @@ int platform_device_add(struct platform_device *pdev)
 
 	while (--i >= 0) {
 		struct resource *r = &pdev->resource[i];
-		unsigned long type = resource_type(r);
-
-		if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
+		if (r->parent)
 			release_resource(r);
 	}
 
@@ -377,9 +375,7 @@ void platform_device_del(struct platform_device *pdev)
 
 		for (i = 0; i < pdev->num_resources; i++) {
 			struct resource *r = &pdev->resource[i];
-			unsigned long type = resource_type(r);
-
-			if (type == IORESOURCE_MEM || type == IORESOURCE_IO)
+			if (r->parent)
 				release_resource(r);
 		}
 	}
-- 
2.6.0


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

* [PATCH 3.12 32/84] hpfs: update ctime and mtime on directory modification
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (30 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 31/84] drivercore: Fix unregistration path of platform devices Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 33/84] tty/vt: don't set font mappings on vc not supporting this Jiri Slaby
                   ` (27 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Mikulas Patocka, Mikulas Patocka, Linus Torvalds,
	Jiri Slaby

From: Mikulas Patocka <mikulas@twibright.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit f49a26e7718dd30b49e3541e3e25aecf5e7294e2 upstream.

Update ctime and mtime when a directory is modified. (though OS/2 doesn't
update them anyway)

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/hpfs/namei.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 345713d2f8f3..6b42789ae799 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -8,6 +8,17 @@
 #include <linux/sched.h>
 #include "hpfs_fn.h"
 
+static void hpfs_update_directory_times(struct inode *dir)
+{
+	time_t t = get_seconds();
+	if (t == dir->i_mtime.tv_sec &&
+	    t == dir->i_ctime.tv_sec)
+		return;
+	dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t;
+	dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec = 0;
+	hpfs_write_inode_nolock(dir);
+}
+
 static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
 	const unsigned char *name = dentry->d_name.name;
@@ -99,6 +110,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 		result->i_mode = mode | S_IFDIR;
 		hpfs_write_inode_nolock(result);
 	}
+	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	hpfs_unlock(dir->i_sb);
 	return 0;
@@ -187,6 +199,7 @@ static int hpfs_create(struct inode *dir, struct dentry *dentry, umode_t mode, b
 		result->i_mode = mode | S_IFREG;
 		hpfs_write_inode_nolock(result);
 	}
+	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	hpfs_unlock(dir->i_sb);
 	return 0;
@@ -262,6 +275,7 @@ static int hpfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode, de
 	insert_inode_hash(result);
 
 	hpfs_write_inode_nolock(result);
+	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	brelse(bh);
 	hpfs_unlock(dir->i_sb);
@@ -340,6 +354,7 @@ static int hpfs_symlink(struct inode *dir, struct dentry *dentry, const char *sy
 	insert_inode_hash(result);
 
 	hpfs_write_inode_nolock(result);
+	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	hpfs_unlock(dir->i_sb);
 	return 0;
@@ -423,6 +438,8 @@ again:
 out1:
 	hpfs_brelse4(&qbh);
 out:
+	if (!err)
+		hpfs_update_directory_times(dir);
 	hpfs_unlock(dir->i_sb);
 	return err;
 }
@@ -477,6 +494,8 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
 out1:
 	hpfs_brelse4(&qbh);
 out:
+	if (!err)
+		hpfs_update_directory_times(dir);
 	hpfs_unlock(dir->i_sb);
 	return err;
 }
@@ -595,7 +614,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		goto end1;
 	}
 
-	end:
+end:
 	hpfs_i(i)->i_parent_dir = new_dir->i_ino;
 	if (S_ISDIR(i->i_mode)) {
 		inc_nlink(new_dir);
@@ -610,6 +629,10 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
 		brelse(bh);
 	}
 end1:
+	if (!err) {
+		hpfs_update_directory_times(old_dir);
+		hpfs_update_directory_times(new_dir);
+	}
 	hpfs_unlock(i->i_sb);
 	return err;
 }
-- 
2.6.0


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

* [PATCH 3.12 33/84] tty/vt: don't set font mappings on vc not supporting this
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (31 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 32/84] hpfs: update ctime and mtime on directory modification Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 34/84] unshare: Unsharing a thread does not require unsharing a vm Jiri Slaby
                   ` (26 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Imre Deak, Sudip Mukherjee, Jiri Slaby

From: Imre Deak <imre.deak@intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 9e326f78713a4421fe11afc2ddeac07698fac131 upstream.

We can call this function for a dummy console that doesn't support
setting the font mapping, which will result in a null ptr BUG. So check
for this case and return error for consoles w/o font mapping support.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=59321
Signed-off-by: Imre Deak <imre.deak@intel.com>
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/vt/consolemap.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/tty/vt/consolemap.c b/drivers/tty/vt/consolemap.c
index 2978ca596a7f..0e75d2a76511 100644
--- a/drivers/tty/vt/consolemap.c
+++ b/drivers/tty/vt/consolemap.c
@@ -540,6 +540,12 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
 
 	/* Save original vc_unipagdir_loc in case we allocate a new one */
 	p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc;
+
+	if (!p) {
+		err = -EINVAL;
+
+		goto out_unlock;
+	}
 	if (p->readonly) {
 		console_unlock();
 		return -EIO;
@@ -633,6 +639,7 @@ int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list)
 		set_inverse_transl(vc, p, i); /* Update inverse translations */
 	set_inverse_trans_unicode(vc, p);
 
+out_unlock:
 	console_unlock();
 	return err;
 }
-- 
2.6.0


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

* [PATCH 3.12 34/84] unshare: Unsharing a thread does not require unsharing a vm
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (32 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 33/84] tty/vt: don't set font mappings on vc not supporting this Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 35/84] rtlwifi: rtl8192cu: Add new device ID Jiri Slaby
                   ` (25 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Eric W. Biederman, Jiri Slaby

From: "Eric W. Biederman" <ebiederm@xmission.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 12c641ab8270f787dfcce08b5f20ce8b65008096 upstream.

In the logic in the initial commit of unshare made creating a new
thread group for a process, contingent upon creating a new memory
address space for that process.  That is wrong.  Two separate
processes in different thread groups can share a memory address space
and clone allows creation of such proceses.

This is significant because it was observed that mm_users > 1 does not
mean that a process is multi-threaded, as reading /proc/PID/maps
temporarily increments mm_users, which allows other processes to
(accidentally) interfere with unshare() calls.

Correct the check in check_unshare_flags() to test for
!thread_group_empty() for CLONE_THREAD, CLONE_SIGHAND, and CLONE_VM.
For sighand->count > 1 for CLONE_SIGHAND and CLONE_VM.
For !current_is_single_threaded instead of mm_users > 1 for CLONE_VM.

By using the correct checks in unshare this removes the possibility of
an accidental denial of service attack.

Additionally using the correct checks in unshare ensures that only an
explicit unshare(CLONE_VM) can possibly trigger the slow path of
current_is_single_threaded().  As an explict unshare(CLONE_VM) is
pointless it is not expected there are many applications that make
that call.

Fixes: b2e0d98705e60e45bbb3c0032c48824ad7ae0704 userns: Implement unshare of the user namespace
Reported-by: Ricky Zhou <rickyz@chromium.org>
Reported-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/fork.c | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 982a36db1593..60403f7efdad 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1762,13 +1762,21 @@ static int check_unshare_flags(unsigned long unshare_flags)
 				CLONE_NEWUSER|CLONE_NEWPID))
 		return -EINVAL;
 	/*
-	 * Not implemented, but pretend it works if there is nothing to
-	 * unshare. Note that unsharing CLONE_THREAD or CLONE_SIGHAND
-	 * needs to unshare vm.
+	 * Not implemented, but pretend it works if there is nothing
+	 * to unshare.  Note that unsharing the address space or the
+	 * signal handlers also need to unshare the signal queues (aka
+	 * CLONE_THREAD).
 	 */
 	if (unshare_flags & (CLONE_THREAD | CLONE_SIGHAND | CLONE_VM)) {
-		/* FIXME: get_task_mm() increments ->mm_users */
-		if (atomic_read(&current->mm->mm_users) > 1)
+		if (!thread_group_empty(current))
+			return -EINVAL;
+	}
+	if (unshare_flags & (CLONE_SIGHAND | CLONE_VM)) {
+		if (atomic_read(&current->sighand->count) > 1)
+			return -EINVAL;
+	}
+	if (unshare_flags & CLONE_VM) {
+		if (!current_is_single_threaded())
 			return -EINVAL;
 	}
 
@@ -1837,16 +1845,16 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
 	if (unshare_flags & CLONE_NEWUSER)
 		unshare_flags |= CLONE_THREAD | CLONE_FS;
 	/*
-	 * If unsharing a thread from a thread group, must also unshare vm.
-	 */
-	if (unshare_flags & CLONE_THREAD)
-		unshare_flags |= CLONE_VM;
-	/*
 	 * If unsharing vm, must also unshare signal handlers.
 	 */
 	if (unshare_flags & CLONE_VM)
 		unshare_flags |= CLONE_SIGHAND;
 	/*
+	 * If unsharing a signal handlers, must also unshare the signal queues.
+	 */
+	if (unshare_flags & CLONE_SIGHAND)
+		unshare_flags |= CLONE_THREAD;
+	/*
 	 * If unsharing namespace, must also unshare filesystem information.
 	 */
 	if (unshare_flags & CLONE_NEWNS)
-- 
2.6.0


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

* [PATCH 3.12 35/84] rtlwifi: rtl8192cu: Add new device ID
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (33 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 34/84] unshare: Unsharing a thread does not require unsharing a vm Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 36/84] tg3: Fix temperature reporting Jiri Slaby
                   ` (24 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Adrien Schildknecht, Kalle Valo, Jiri Slaby

From: Adrien Schildknecht <adrien+dev@schischi.me>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 1642d09fb9b128e8e538b2a4179962a34f38dff9 upstream.

The v2 of NetGear WNA1000M uses a different idProduct: USB ID 0846:9043

Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
index 7555095e0b74..fa669b52fc91 100644
--- a/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
+++ b/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
@@ -313,6 +313,7 @@ static struct usb_device_id rtl8192c_usb_ids[] = {
 	{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
 	{RTL_USB_DEVICE(0x07b8, 0x8189, rtl92cu_hal_cfg)}, /*Funai - Abocom*/
 	{RTL_USB_DEVICE(0x0846, 0x9041, rtl92cu_hal_cfg)}, /*NetGear WNA1000M*/
+	{RTL_USB_DEVICE(0x0846, 0x9043, rtl92cu_hal_cfg)}, /*NG WNA1000Mv2*/
 	{RTL_USB_DEVICE(0x0b05, 0x17ba, rtl92cu_hal_cfg)}, /*ASUS-Edimax*/
 	{RTL_USB_DEVICE(0x0bda, 0x5088, rtl92cu_hal_cfg)}, /*Thinkware-CC&C*/
 	{RTL_USB_DEVICE(0x0df6, 0x0052, rtl92cu_hal_cfg)}, /*Sitecom - Edimax*/
-- 
2.6.0


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

* [PATCH 3.12 36/84] tg3: Fix temperature reporting
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (34 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 35/84] rtlwifi: rtl8192cu: Add new device ID Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 37/84] mac80211: enable assoc check for mesh interfaces Jiri Slaby
                   ` (23 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jean Delvare, Prashant Sreedharan, Michael Chan,
	David S . Miller, Jiri Slaby

From: Jean Delvare <jdelvare@suse.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit d3d11fe08ccc9bff174fc958722b5661f0932486 upstream.

The temperature registers appear to report values in degrees Celsius
while the hwmon API mandates values to be exposed in millidegrees
Celsius. Do the conversion so that the values reported by "sensors"
are correct.

Fixes: aed93e0bf493 ("tg3: Add hwmon support for temperature")
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Prashant Sreedharan <prashant@broadcom.com>
Cc: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/ethernet/broadcom/tg3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 8ad9ff65913c..fe601e264f94 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -10650,7 +10650,7 @@ static ssize_t tg3_show_temp(struct device *dev,
 	tg3_ape_scratchpad_read(tp, &temperature, attr->index,
 				sizeof(temperature));
 	spin_unlock_bh(&tp->lock);
-	return sprintf(buf, "%u\n", temperature);
+	return sprintf(buf, "%u\n", temperature * 1000);
 }
 
 
-- 
2.6.0


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

* [PATCH 3.12 37/84] mac80211: enable assoc check for mesh interfaces
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (35 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 36/84] tg3: Fix temperature reporting Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 38/84] arm64: kconfig: Move LIST_POISON to a safe value Jiri Slaby
                   ` (22 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bob Copeland, Johannes Berg, Jiri Slaby

From: Bob Copeland <me@bobcopeland.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 3633ebebab2bbe88124388b7620442315c968e8f upstream.

We already set a station to be associated when peering completes, both
in user space and in the kernel.  Thus we should always have an
associated sta before sending data frames to that station.

Failure to check assoc state can cause crashes in the lower-level driver
due to transmitting unicast data frames before driver sta structures
(e.g. ampdu state in ath9k) are initialized.  This occurred when
forwarding in the presence of fixed mesh paths: frames were transmitted
to stations with whom we hadn't yet completed peering.

Reported-by: Alexis Green <agreen@cococorp.com>
Tested-by: Jesse Jones <jjones@cococorp.com>
Signed-off-by: Bob Copeland <me@bobcopeland.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/mac80211/tx.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d36e0977f44a..eac14e99c941 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -296,9 +296,6 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx)
 	if (tx->sdata->vif.type == NL80211_IFTYPE_WDS)
 		return TX_CONTINUE;
 
-	if (tx->sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
-		return TX_CONTINUE;
-
 	if (tx->flags & IEEE80211_TX_PS_BUFFERED)
 		return TX_CONTINUE;
 
-- 
2.6.0


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

* [PATCH 3.12 38/84] arm64: kconfig: Move LIST_POISON to a safe value
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (36 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 37/84] mac80211: enable assoc check for mesh interfaces Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 39/84] arm64: compat: fix vfp save/restore across signal handlers in big-endian Jiri Slaby
                   ` (21 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jeff Vander Stoep, Thierry Strudel, Will Deacon,
	Jiri Slaby

From: Jeff Vander Stoep <jeffv@google.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit bf0c4e04732479f650ff59d1ee82de761c0071f0 upstream.

Move the poison pointer offset to 0xdead000000000000, a
recognized value that is not mappable by user-space exploits.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Thierry Strudel <tstrudel@google.com>
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index fe70eaea0e28..b07f9f356b87 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -56,6 +56,10 @@ config NO_IOPORT
 config STACKTRACE_SUPPORT
 	def_bool y
 
+config ILLEGAL_POINTER_VALUE
+	hex
+	default 0xdead000000000000
+
 config LOCKDEP_SUPPORT
 	def_bool y
 
-- 
2.6.0


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

* [PATCH 3.12 39/84] arm64: compat: fix vfp save/restore across signal handlers in big-endian
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (37 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 38/84] arm64: kconfig: Move LIST_POISON to a safe value Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 40/84] arm64: head.S: initialise mdcr_el2 in el2_setup Jiri Slaby
                   ` (20 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Will Deacon, Jiri Slaby

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

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit bdec97a855ef1e239f130f7a11584721c9a1bf04 upstream.

When saving/restoring the VFP registers from a compat (AArch32)
signal frame, we rely on the compat registers forming a prefix of the
native register file and therefore make use of copy_{to,from}_user to
transfer between the native fpsimd_state and the compat_vfp_sigframe.

Unfortunately, this doesn't work so well in a big-endian environment.
Our fpsimd save/restore code operates directly on 128-bit quantities
(Q registers) whereas the compat_vfp_sigframe represents the registers
as an array of 64-bit (D) registers. The architecture packs the compat D
registers into the Q registers, with the least significant bytes holding
the lower register. Consequently, we need to swap the 64-bit halves when
converting between these two representations on a big-endian machine.

This patch replaces the __copy_{to,from}_user invocations in our
compat VFP signal handling code with explicit __put_user loops that
operate on 64-bit values and swap them accordingly.

Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kernel/signal32.c | 47 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 36 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/kernel/signal32.c b/arch/arm64/kernel/signal32.c
index b9564b8d6bab..1e60acc6a4d7 100644
--- a/arch/arm64/kernel/signal32.c
+++ b/arch/arm64/kernel/signal32.c
@@ -231,14 +231,32 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
 
 /*
  * VFP save/restore code.
+ *
+ * We have to be careful with endianness, since the fpsimd context-switch
+ * code operates on 128-bit (Q) register values whereas the compat ABI
+ * uses an array of 64-bit (D) registers. Consequently, we need to swap
+ * the two halves of each Q register when running on a big-endian CPU.
  */
+union __fpsimd_vreg {
+	__uint128_t	raw;
+	struct {
+#ifdef __AARCH64EB__
+		u64	hi;
+		u64	lo;
+#else
+		u64	lo;
+		u64	hi;
+#endif
+	};
+};
+
 static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame)
 {
 	struct fpsimd_state *fpsimd = &current->thread.fpsimd_state;
 	compat_ulong_t magic = VFP_MAGIC;
 	compat_ulong_t size = VFP_STORAGE_SIZE;
 	compat_ulong_t fpscr, fpexc;
-	int err = 0;
+	int i, err = 0;
 
 	/*
 	 * Save the hardware registers to the fpsimd_state structure.
@@ -254,10 +272,15 @@ static int compat_preserve_vfp_context(struct compat_vfp_sigframe __user *frame)
 	/*
 	 * Now copy the FP registers. Since the registers are packed,
 	 * we can copy the prefix we want (V0-V15) as it is.
-	 * FIXME: Won't work if big endian.
 	 */
-	err |= __copy_to_user(&frame->ufp.fpregs, fpsimd->vregs,
-			      sizeof(frame->ufp.fpregs));
+	for (i = 0; i < ARRAY_SIZE(frame->ufp.fpregs); i += 2) {
+		union __fpsimd_vreg vreg = {
+			.raw = fpsimd->vregs[i >> 1],
+		};
+
+		__put_user_error(vreg.lo, &frame->ufp.fpregs[i], err);
+		__put_user_error(vreg.hi, &frame->ufp.fpregs[i + 1], err);
+	}
 
 	/* Create an AArch32 fpscr from the fpsr and the fpcr. */
 	fpscr = (fpsimd->fpsr & VFP_FPSCR_STAT_MASK) |
@@ -282,7 +305,7 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame)
 	compat_ulong_t magic = VFP_MAGIC;
 	compat_ulong_t size = VFP_STORAGE_SIZE;
 	compat_ulong_t fpscr;
-	int err = 0;
+	int i, err = 0;
 
 	__get_user_error(magic, &frame->magic, err);
 	__get_user_error(size, &frame->size, err);
@@ -292,12 +315,14 @@ static int compat_restore_vfp_context(struct compat_vfp_sigframe __user *frame)
 	if (magic != VFP_MAGIC || size != VFP_STORAGE_SIZE)
 		return -EINVAL;
 
-	/*
-	 * Copy the FP registers into the start of the fpsimd_state.
-	 * FIXME: Won't work if big endian.
-	 */
-	err |= __copy_from_user(fpsimd.vregs, frame->ufp.fpregs,
-				sizeof(frame->ufp.fpregs));
+	/* Copy the FP registers into the start of the fpsimd_state. */
+	for (i = 0; i < ARRAY_SIZE(frame->ufp.fpregs); i += 2) {
+		union __fpsimd_vreg vreg;
+
+		__get_user_error(vreg.lo, &frame->ufp.fpregs[i], err);
+		__get_user_error(vreg.hi, &frame->ufp.fpregs[i + 1], err);
+		fpsimd.vregs[i >> 1] = vreg.raw;
+	}
 
 	/* Extract the fpsr and the fpcr from the fpscr */
 	__get_user_error(fpscr, &frame->ufp.fpscr, err);
-- 
2.6.0


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

* [PATCH 3.12 40/84] arm64: head.S: initialise mdcr_el2 in el2_setup
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (38 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 39/84] arm64: compat: fix vfp save/restore across signal handlers in big-endian Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 41/84] arm64: errata: add module build workaround for erratum #843419 Jiri Slaby
                   ` (19 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Will Deacon, Jiri Slaby

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

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit d10bcd473301888f957ec4b6b12aa3621be78d59 upstream.

When entering the kernel at EL2, we fail to initialise the MDCR_EL2
register which controls debug access and PMU capabilities at EL1.

This patch ensures that the register is initialised so that all traps
are disabled and all the PMU counters are available to the host. When a
guest is scheduled, KVM takes care to configure trapping appropriately.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kernel/head.S | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S
index 7090c126797c..aca41b06dc7a 100644
--- a/arch/arm64/kernel/head.S
+++ b/arch/arm64/kernel/head.S
@@ -192,6 +192,11 @@ ENTRY(el2_setup)
 	msr	hstr_el2, xzr			// Disable CP15 traps to EL2
 #endif
 
+	/* EL2 debug */
+	mrs	x0, pmcr_el0			// Disable debug access traps
+	ubfx	x0, x0, #11, #5			// to EL2 and allow access to
+	msr	mdcr_el2, x0			// all PMU counters from EL1
+
 	/* Stage-2 translation */
 	msr	vttbr_el2, xzr
 
-- 
2.6.0


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

* [PATCH 3.12 41/84] arm64: errata: add module build workaround for erratum #843419
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (39 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 40/84] arm64: head.S: initialise mdcr_el2 in el2_setup Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 42/84] arm64: KVM: Disable virtual timer even if the guest is not using it Jiri Slaby
                   ` (18 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Will Deacon, Jiri Slaby

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

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit df057cc7b4fa59e9b55f07ffdb6c62bf02e99a00 upstream.

Cortex-A53 processors <= r0p4 are affected by erratum #843419 which can
lead to a memory access using an incorrect address in certain sequences
headed by an ADRP instruction.

There is a linker fix to generate veneers for ADRP instructions, but
this doesn't work for kernel modules which are built as unlinked ELF
objects.

This patch adds a new config option for the erratum which, when enabled,
builds kernel modules with the mcmodel=large flag. This uses absolute
addressing for all kernel symbols, thereby removing the use of ADRP as
a PC-relative form of addressing. The ADRP relocs are removed from the
module loader so that we fail to load any potentially affected modules.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/Kconfig         | 16 ++++++++++++++++
 arch/arm64/Makefile        |  4 ++++
 arch/arm64/kernel/module.c |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index b07f9f356b87..c6ab435557b2 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -269,6 +269,22 @@ config SYSVIPC_COMPAT
 	def_bool y
 	depends on COMPAT && SYSVIPC
 
+config ARM64_ERRATUM_843419
+	bool "Cortex-A53: 843419: A load or store might access an incorrect address"
+	depends on MODULES
+	default y
+	help
+	  This option builds kernel modules using the large memory model in
+	  order to avoid the use of the ADRP instruction, which can cause
+	  a subsequent memory access to use an incorrect address on Cortex-A53
+	  parts up to r0p4.
+
+	  Note that the kernel itself must be linked with a version of ld
+	  which fixes potentially affected ADRP instructions through the
+	  use of veneers.
+
+	  If unsure, say Y.
+
 endmenu
 
 source "net/Kconfig"
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index d90cf79f233a..4148c05df99a 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -28,6 +28,10 @@ comma = ,
 
 CHECKFLAGS	+= -D__aarch64__
 
+ifeq ($(CONFIG_ARM64_ERRATUM_843419), y)
+CFLAGS_MODULE	+= -mcmodel=large
+endif
+
 # Default value
 head-y		:= arch/arm64/kernel/head.o
 
diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c
index ca0e3d55da99..9589a92f6332 100644
--- a/arch/arm64/kernel/module.c
+++ b/arch/arm64/kernel/module.c
@@ -390,12 +390,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,
 			ovf = reloc_insn_imm(RELOC_OP_PREL, loc, val, 0, 21,
 					     INSN_IMM_ADR);
 			break;
+#ifndef CONFIG_ARM64_ERRATUM_843419
 		case R_AARCH64_ADR_PREL_PG_HI21_NC:
 			overflow_check = false;
 		case R_AARCH64_ADR_PREL_PG_HI21:
 			ovf = reloc_insn_imm(RELOC_OP_PAGE, loc, val, 12, 21,
 					     INSN_IMM_ADR);
 			break;
+#endif
 		case R_AARCH64_ADD_ABS_LO12_NC:
 		case R_AARCH64_LDST8_ABS_LO12_NC:
 			overflow_check = false;
-- 
2.6.0


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

* [PATCH 3.12 42/84] arm64: KVM: Disable virtual timer even if the guest is not using it
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (40 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 41/84] arm64: errata: add module build workaround for erratum #843419 Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 43/84] Input: evdev - do not report errors form flush() Jiri Slaby
                   ` (17 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Marc Zyngier, Jiri Slaby

From: Marc Zyngier <marc.zyngier@arm.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit c4cbba9fa078f55d9f6d081dbb4aec7cf969e7c7 upstream.

When running a guest with the architected timer disabled (with QEMU and
the kernel_irqchip=off option, for example), it is important to make
sure the timer gets turned off. Otherwise, the guest may try to
enable it anyway, leading to a screaming HW interrupt.

The fix is to unconditionally turn off the virtual timer on guest
exit.

Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kvm/hyp.S | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kvm/hyp.S b/arch/arm64/kvm/hyp.S
index a255167baf6a..44b00eb7b340 100644
--- a/arch/arm64/kvm/hyp.S
+++ b/arch/arm64/kvm/hyp.S
@@ -472,8 +472,6 @@ __kvm_hyp_code_start:
 	mrs	x3, cntv_ctl_el0
 	and	x3, x3, #3
 	str	w3, [x0, #VCPU_TIMER_CNTV_CTL]
-	bic	x3, x3, #1		// Clear Enable
-	msr	cntv_ctl_el0, x3
 
 	isb
 
@@ -481,6 +479,9 @@ __kvm_hyp_code_start:
 	str	x3, [x0, #VCPU_TIMER_CNTV_CVAL]
 
 1:
+	// Disable the virtual timer
+	msr	cntv_ctl_el0, xzr
+
 	// Allow physical timer/counter access for the host
 	mrs	x2, cnthctl_el2
 	orr	x2, x2, #3
-- 
2.6.0


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

* [PATCH 3.12 43/84] Input: evdev - do not report errors form flush()
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (41 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 42/84] arm64: KVM: Disable virtual timer even if the guest is not using it Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 44/84] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops Jiri Slaby
                   ` (16 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Takashi Iwai, Dmitry Torokhov, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit eb38f3a4f6e86f8bb10a3217ebd85ecc5d763aae upstream.

We've got bug reports showing the old systemd-logind (at least
system-210) aborting unexpectedly, and this turned out to be because
of an invalid error code from close() call to evdev devices.  close()
is supposed to return only either EINTR or EBADFD, while the device
returned ENODEV.  logind was overreacting to it and decided to kill
itself when an unexpected error code was received.  What a tragedy.

The bad error code comes from flush fops, and actually evdev_flush()
returns ENODEV when device is disconnected or client's access to it is
revoked. But in these cases the fact that flush did not actually happen is
not an error, but rather normal behavior. For non-disconnected devices
result of flush is also not that interesting as there is no potential of
data loss and even if it fails application has no way of handling the
error. Because of that we are better off always returning success from
evdev_flush().

Also returning EINTR from flush()/close() is discouraged (as it is not
clear how application should handle this error), so let's stop taking
evdev->mutex interruptibly.

Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=939834
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/evdev.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 694af4958a98..5311dbbee47c 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -240,19 +240,14 @@ static int evdev_flush(struct file *file, fl_owner_t id)
 {
 	struct evdev_client *client = file->private_data;
 	struct evdev *evdev = client->evdev;
-	int retval;
 
-	retval = mutex_lock_interruptible(&evdev->mutex);
-	if (retval)
-		return retval;
+	mutex_lock(&evdev->mutex);
 
-	if (!evdev->exist || client->revoked)
-		retval = -ENODEV;
-	else
-		retval = input_flush_device(&evdev->handle, file);
+	if (evdev->exist && !client->revoked)
+		input_flush_device(&evdev->handle, file);
 
 	mutex_unlock(&evdev->mutex);
-	return retval;
+	return 0;
 }
 
 static void evdev_free(struct device *dev)
-- 
2.6.0


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

* [PATCH 3.12 44/84] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (42 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 43/84] Input: evdev - do not report errors form flush() Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 45/84] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437 Jiri Slaby
                   ` (15 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Takashi Iwai, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit bb148bdeb0ab16fc0ae8009799471e4d7180073b upstream.

According to the bug report, FSC Amilo laptops with ALC880 can detect
the headphone jack but currently the driver disables it.  It's partly
intentionally, as non-working jack detect was reported in the past.
Let's enable now.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/hda/patch_realtek.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index f92057919273..62a28865a2e4 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1144,7 +1144,7 @@ static const struct hda_fixup alc880_fixups[] = {
 		/* override all pins as BIOS on old Amilo is broken */
 		.type = HDA_FIXUP_PINS,
 		.v.pins = (const struct hda_pintbl[]) {
-			{ 0x14, 0x0121411f }, /* HP */
+			{ 0x14, 0x0121401f }, /* HP */
 			{ 0x15, 0x99030120 }, /* speaker */
 			{ 0x16, 0x99030130 }, /* bass speaker */
 			{ 0x17, 0x411111f0 }, /* N/A */
@@ -1164,7 +1164,7 @@ static const struct hda_fixup alc880_fixups[] = {
 		/* almost compatible with FUJITSU, but no bass and SPDIF */
 		.type = HDA_FIXUP_PINS,
 		.v.pins = (const struct hda_pintbl[]) {
-			{ 0x14, 0x0121411f }, /* HP */
+			{ 0x14, 0x0121401f }, /* HP */
 			{ 0x15, 0x99030120 }, /* speaker */
 			{ 0x16, 0x411111f0 }, /* N/A */
 			{ 0x17, 0x411111f0 }, /* N/A */
-- 
2.6.0


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

* [PATCH 3.12 45/84] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (43 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 44/84] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 46/84] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash Jiri Slaby
                   ` (14 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Takashi Iwai, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit a161574e200ae63a5042120e0d8c36830e81bde3 upstream.

It turned out that the machine has a bass speaker, so take a correct
fixup entry.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=102501
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/hda/patch_realtek.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 62a28865a2e4..73d342c8403c 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1372,7 +1372,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
 	SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
 	SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
-	SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
+	SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
 	SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
 	SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
 	SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
-- 
2.6.0


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

* [PATCH 3.12 46/84] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (44 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 45/84] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437 Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 47/84] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers Jiri Slaby
                   ` (13 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michael Ellerman, Jiri Slaby

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

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 74b5037baa2011a2799e2c43adde7d171b072f9e upstream.

The powerpc kernel can be built to have either a 4K PAGE_SIZE or a 64K
PAGE_SIZE.

However when built with a 4K PAGE_SIZE there is an additional config
option which can be enabled, PPC_HAS_HASH_64K, which means the kernel
also knows how to hash a 64K page even though the base PAGE_SIZE is 4K.

This is used in one obscure configuration, to support 64K pages for SPU
local store on the Cell processor when the rest of the kernel is using
4K pages.

In this configuration, pte_pagesize_index() is defined to just pass
through its arguments to get_slice_psize(). However pte_pagesize_index()
is called for both user and kernel addresses, whereas get_slice_psize()
only knows how to handle user addresses.

This has been broken forever, however until recently it happened to
work. That was because in get_slice_psize() the large kernel address
would cause the right shift of the slice mask to return zero.

However in commit 7aa0727f3302 ("powerpc/mm: Increase the slice range to
64TB"), the get_slice_psize() code was changed so that instead of a
right shift we do an array lookup based on the address. When passed a
kernel address this means we index way off the end of the slice array
and return random junk.

That is only fatal if we happen to hit something non-zero, but when we
do return a non-zero value we confuse the MMU code and eventually cause
a check stop.

This fix is ugly, but simple. When we're called for a kernel address we
return 4K, which is always correct in this configuration, otherwise we
use the slice mask.

Fixes: 7aa0727f3302 ("powerpc/mm: Increase the slice range to 64TB")
Reported-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/asm/pgtable-ppc64.h | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 832a39d042d4..3848deed9472 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -135,7 +135,19 @@
 #define pte_iterate_hashed_end() } while(0)
 
 #ifdef CONFIG_PPC_HAS_HASH_64K
-#define pte_pagesize_index(mm, addr, pte)	get_slice_psize(mm, addr)
+/*
+ * We expect this to be called only for user addresses or kernel virtual
+ * addresses other than the linear mapping.
+ */
+#define pte_pagesize_index(mm, addr, pte)			\
+	({							\
+		unsigned int psize;				\
+		if (is_kernel_addr(addr))			\
+			psize = MMU_PAGE_4K;			\
+		else						\
+			psize = get_slice_psize(mm, addr);	\
+		psize;						\
+	})
 #else
 #define pte_pagesize_index(mm, addr, pte)	MMU_PAGE_4K
 #endif
-- 
2.6.0


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

* [PATCH 3.12 47/84] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (45 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 46/84] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 48/84] powerpc/mm: Recompute hash value after a failed update Jiri Slaby
                   ` (12 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Thomas Huth, Michael Ellerman, Jiri Slaby

From: Thomas Huth <thuth@redhat.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 1c2cb594441d02815d304cccec9742ff5c707495 upstream.

The EPOW interrupt handler uses rtas_get_sensor(), which in turn
uses rtas_busy_delay() to wait for RTAS becoming ready in case it
is necessary. But rtas_busy_delay() is annotated with might_sleep()
and thus may not be used by interrupts handlers like the EPOW handler!
This leads to the following BUG when CONFIG_DEBUG_ATOMIC_SLEEP is
enabled:

 BUG: sleeping function called from invalid context at arch/powerpc/kernel/rtas.c:496
 in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1
 CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.2.0-rc2-thuth #6
 Call Trace:
 [c00000007ffe7b90] [c000000000807670] dump_stack+0xa0/0xdc (unreliable)
 [c00000007ffe7bc0] [c0000000000e1f14] ___might_sleep+0x134/0x180
 [c00000007ffe7c20] [c00000000002aec0] rtas_busy_delay+0x30/0xd0
 [c00000007ffe7c50] [c00000000002bde4] rtas_get_sensor+0x74/0xe0
 [c00000007ffe7ce0] [c000000000083264] ras_epow_interrupt+0x44/0x450
 [c00000007ffe7d90] [c000000000120260] handle_irq_event_percpu+0xa0/0x300
 [c00000007ffe7e70] [c000000000120524] handle_irq_event+0x64/0xc0
 [c00000007ffe7eb0] [c000000000124dbc] handle_fasteoi_irq+0xec/0x260
 [c00000007ffe7ef0] [c00000000011f4f0] generic_handle_irq+0x50/0x80
 [c00000007ffe7f20] [c000000000010f3c] __do_irq+0x8c/0x200
 [c00000007ffe7f90] [c0000000000236cc] call_do_irq+0x14/0x24
 [c00000007e6f39e0] [c000000000011144] do_IRQ+0x94/0x110
 [c00000007e6f3a30] [c000000000002594] hardware_interrupt_common+0x114/0x180

Fix this issue by introducing a new rtas_get_sensor_fast() function
that does not use rtas_busy_delay() - and thus can only be used for
sensors that do not cause a BUSY condition - known as "fast" sensors.

The EPOW sensor is defined to be "fast" in sPAPR - mpe.

Fixes: 587f83e8dd50 ("powerpc/pseries: Use rtas_get_sensor in RAS code")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/asm/rtas.h      |  1 +
 arch/powerpc/kernel/rtas.c           | 17 +++++++++++++++++
 arch/powerpc/platforms/pseries/ras.c |  3 ++-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 9bd52c65e66f..14de1385dedb 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -255,6 +255,7 @@ extern void rtas_power_off(void);
 extern void rtas_halt(void);
 extern void rtas_os_term(char *str);
 extern int rtas_get_sensor(int sensor, int index, int *state);
+extern int rtas_get_sensor_fast(int sensor, int index, int *state);
 extern int rtas_get_power_level(int powerdomain, int *level);
 extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
 extern bool rtas_indicator_present(int token, int *maxindex);
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 4cf674d7d5ae..c4bc8d6cfd79 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -584,6 +584,23 @@ int rtas_get_sensor(int sensor, int index, int *state)
 }
 EXPORT_SYMBOL(rtas_get_sensor);
 
+int rtas_get_sensor_fast(int sensor, int index, int *state)
+{
+	int token = rtas_token("get-sensor-state");
+	int rc;
+
+	if (token == RTAS_UNKNOWN_SERVICE)
+		return -ENOENT;
+
+	rc = rtas_call(token, 2, 2, state, sensor, index);
+	WARN_ON(rc == RTAS_BUSY || (rc >= RTAS_EXTENDED_DELAY_MIN &&
+				    rc <= RTAS_EXTENDED_DELAY_MAX));
+
+	if (rc < 0)
+		return rtas_error_rc(rc);
+	return rc;
+}
+
 bool rtas_indicator_present(int token, int *maxindex)
 {
 	int proplen, count, i;
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 721c0586b284..50fd3ac7b7bf 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -187,7 +187,8 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)
 	int state;
 	int critical;
 
-	status = rtas_get_sensor(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, &state);
+	status = rtas_get_sensor_fast(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX,
+				      &state);
 
 	if (state > 3)
 		critical = 1;		/* Time Critical */
-- 
2.6.0


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

* [PATCH 3.12 48/84] powerpc/mm: Recompute hash value after a failed update
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (46 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 47/84] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 49/84] Add radeon suspend/resume quirk for HP Compaq dc5750 Jiri Slaby
                   ` (11 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Aneesh Kumar K.V, Michael Ellerman, Jiri Slaby

From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 36b35d5d807b7e57aff7d08e63de8b17731ee211 upstream.

If we had secondary hash flag set, we ended up modifying hash value in
the updatepp code path. Hence with a failed updatepp we will be using
a wrong hash value for the following hash insert. Fix this by
recomputing hash before insert.

Without this patch we can end up with using wrong slot number in linux
pte. That can result in us missing an hash pte update or invalidate
which can cause memory corruption or even machine check.

Fixes: 6d492ecc6489 ("powerpc/THP: Add code to handle HPTE faults for hugepages")
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Reviewed-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/mm/hugepage-hash64.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/mm/hugepage-hash64.c b/arch/powerpc/mm/hugepage-hash64.c
index 7d86c868040d..9836e8032d0b 100644
--- a/arch/powerpc/mm/hugepage-hash64.c
+++ b/arch/powerpc/mm/hugepage-hash64.c
@@ -136,7 +136,6 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
 	BUG_ON(index >= 4096);
 
 	vpn = hpt_vpn(ea, vsid, ssize);
-	hash = hpt_hash(vpn, shift, ssize);
 	hpte_slot_array = get_hpte_slot_array(pmdp);
 	if (psize == MMU_PAGE_4K) {
 		/*
@@ -151,6 +150,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
 	valid = hpte_valid(hpte_slot_array, index);
 	if (valid) {
 		/* update the hpte bits */
+		hash = hpt_hash(vpn, shift, ssize);
 		hidx =  hpte_hash_index(hpte_slot_array, index);
 		if (hidx & _PTEIDX_SECONDARY)
 			hash = ~hash;
@@ -176,6 +176,7 @@ int __hash_page_thp(unsigned long ea, unsigned long access, unsigned long vsid,
 	if (!valid) {
 		unsigned long hpte_group;
 
+		hash = hpt_hash(vpn, shift, ssize);
 		/* insert new entry */
 		pa = pmd_pfn(__pmd(old_pmd)) << PAGE_SHIFT;
 		new_pmd |= _PAGE_HASHPTE;
-- 
2.6.0


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

* [PATCH 3.12 49/84] Add radeon suspend/resume quirk for HP Compaq dc5750.
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (47 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 48/84] powerpc/mm: Recompute hash value after a failed update Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 50/84] x86/mm: Initialize pmd_idx in page_table_range_init_count() Jiri Slaby
                   ` (10 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jeffery Miller, Alex Deucher, Jiri Slaby

From: Jeffery Miller <jmiller@neverware.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 09bfda10e6efd7b65bcc29237bee1765ed779657 upstream.

With the radeon driver loaded the HP Compaq dc5750
Small Form Factor machine fails to resume from suspend.
Adding a quirk similar to other devices avoids
the problem and the system resumes properly.

Signed-off-by: Jeffery Miller <jmiller@neverware.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/radeon_combios.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 8cac69819054..9c64a973190e 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -3403,6 +3403,14 @@ void radeon_combios_asic_init(struct drm_device *dev)
 	    rdev->pdev->subsystem_device == 0x30ae)
 		return;
 
+	/* quirk for rs4xx HP Compaq dc5750 Small Form Factor to make it resume
+	 * - it hangs on resume inside the dynclk 1 table.
+	 */
+	if (rdev->family == CHIP_RS480 &&
+	    rdev->pdev->subsystem_vendor == 0x103c &&
+	    rdev->pdev->subsystem_device == 0x280a)
+		return;
+
 	/* DYN CLK 1 */
 	table = combios_get_table_offset(dev, COMBIOS_DYN_CLK_1_TABLE);
 	if (table)
-- 
2.6.0


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

* [PATCH 3.12 50/84] x86/mm: Initialize pmd_idx in page_table_range_init_count()
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (48 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 49/84] Add radeon suspend/resume quirk for HP Compaq dc5750 Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 51/84] rc-core: fix remove uevent generation Jiri Slaby
                   ` (9 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Minfei Huang, tony.luck, wangnan0, david.vrabel,
	Thomas Gleixner, Jiri Slaby

From: Minfei Huang <mnfhuang@gmail.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 9962eea9e55f797f05f20ba6448929cab2a9f018 upstream.

The variable pmd_idx is not initialized for the first iteration of the
for loop.

Assign the proper value which indexes the start address.

Fixes: 719272c45b82 'x86, mm: only call early_ioremap_page_table_range_init() once'
Signed-off-by: Minfei Huang <mnfhuang@gmail.com>
Cc: tony.luck@intel.com
Cc: wangnan0@huawei.com
Cc: david.vrabel@citrix.com
Reviewed-by: yinghai@kernel.org
Link: http://lkml.kernel.org/r/1436703522-29552-1-git-send-email-mhuang@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/mm/init_32.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 4287f1ffba7e..948e91b731a2 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -137,6 +137,7 @@ page_table_range_init_count(unsigned long start, unsigned long end)
 
 	vaddr = start;
 	pgd_idx = pgd_index(vaddr);
+	pmd_idx = pmd_index(vaddr);
 
 	for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd_idx++) {
 		for (; (pmd_idx < PTRS_PER_PMD) && (vaddr != end);
-- 
2.6.0


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

* [PATCH 3.12 51/84] rc-core: fix remove uevent generation
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (49 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 50/84] x86/mm: Initialize pmd_idx in page_table_range_init_count() Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 52/84] v4l: omap3isp: Fix sub-device power management code Jiri Slaby
                   ` (8 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David Härdeman, Mauro Carvalho Chehab,
	Jiri Slaby

From: David Härdeman <david@hardeman.nu>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit a66b0c41ad277ae62a3ae6ac430a71882f899557 upstream.

The input_dev is already gone when the rc device is being unregistered
so checking for its presence only means that no remove uevent will be
generated.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/media/rc/rc-main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 46da365c9c84..f972de9f02e6 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -978,9 +978,6 @@ static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env)
 {
 	struct rc_dev *dev = to_rc_dev(device);
 
-	if (!dev || !dev->input_dev)
-		return -ENODEV;
-
 	if (dev->rc_map.name)
 		ADD_HOTPLUG_VAR("NAME=%s", dev->rc_map.name);
 	if (dev->driver_name)
-- 
2.6.0


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

* [PATCH 3.12 52/84] v4l: omap3isp: Fix sub-device power management code
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (50 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 51/84] rc-core: fix remove uevent generation Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 53/84] Btrfs: check if previous transaction aborted to avoid fs corruption Jiri Slaby
                   ` (7 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Sakari Ailus, Laurent Pinchart,
	Mauro Carvalho Chehab, Jiri Slaby

From: Sakari Ailus <sakari.ailus@iki.fi>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 9d39f05490115bf145e5ea03c0b7ec9d3d015b01 upstream.

Commit 813f5c0ac5cc ("media: Change media device link_notify behaviour")
modified the media controller link setup notification API and updated the
OMAP3 ISP driver accordingly. As a side effect it introduced a bug by
turning power on after setting the link instead of before. This results in
sub-devices not being powered down in some cases when they should be. Fix
it.

Fixes: 813f5c0ac5cc [media] media: Change media device link_notify behaviour

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/media/platform/omap3isp/isp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index df3a0ec7fd2c..9dd0e0cc65cf 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -814,14 +814,14 @@ static int isp_pipeline_link_notify(struct media_link *link, u32 flags,
 	int ret;
 
 	if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
-	    !(link->flags & MEDIA_LNK_FL_ENABLED)) {
+	    !(flags & MEDIA_LNK_FL_ENABLED)) {
 		/* Powering off entities is assumed to never fail. */
 		isp_pipeline_pm_power(source, -sink_use);
 		isp_pipeline_pm_power(sink, -source_use);
 		return 0;
 	}
 
-	if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH &&
+	if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH &&
 		(flags & MEDIA_LNK_FL_ENABLED)) {
 
 		ret = isp_pipeline_pm_power(source, sink_use);
-- 
2.6.0


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

* [PATCH 3.12 53/84] Btrfs: check if previous transaction aborted to avoid fs corruption
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (51 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 52/84] v4l: omap3isp: Fix sub-device power management code Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 54/84] NFSv4: don't set SETATTR for O_RDONLY|O_EXCL Jiri Slaby
                   ` (6 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Filipe Manana, Chris Mason, Jiri Slaby

From: Filipe Manana <fdmanana@suse.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit 1f9b8c8fbc9a4d029760b16f477b9d15500e3a34 upstream.

While we are committing a transaction, it's possible the previous one is
still finishing its commit and therefore we wait for it to finish first.
However we were not checking if that previous transaction ended up getting
aborted after we waited for it to commit, so we ended up committing the
current transaction which can lead to fs corruption because the new
superblock can point to trees that have had one or more nodes/leafs that
were never durably persisted.
The following sequence diagram exemplifies how this is possible:

          CPU 0                                                        CPU 1

  transaction N starts

  (...)

  btrfs_commit_transaction(N)

    cur_trans->state = TRANS_STATE_COMMIT_START;
    (...)
    cur_trans->state = TRANS_STATE_COMMIT_DOING;
    (...)

    cur_trans->state = TRANS_STATE_UNBLOCKED;
    root->fs_info->running_transaction = NULL;

                                                              btrfs_start_transaction()
                                                                 --> starts transaction N + 1

    btrfs_write_and_wait_transaction(trans, root);
      --> starts writing all new or COWed ebs created
          at transaction N

                                                              creates some new ebs, COWs some
                                                              existing ebs but doesn't COW or
                                                              deletes eb X

                                                              btrfs_commit_transaction(N + 1)
                                                                (...)
                                                                cur_trans->state = TRANS_STATE_COMMIT_START;
                                                                (...)
                                                                wait_for_commit(root, prev_trans);
                                                                  --> prev_trans == transaction N

    btrfs_write_and_wait_transaction() continues
    writing ebs
       --> fails writing eb X, we abort transaction N
           and set bit BTRFS_FS_STATE_ERROR on
           fs_info->fs_state, so no new transactions
           can start after setting that bit

       cleanup_transaction()
         btrfs_cleanup_one_transaction()
           wakes up task at CPU 1

                                                                continues, doesn't abort because
                                                                cur_trans->aborted (transaction N + 1)
                                                                is zero, and no checks for bit
                                                                BTRFS_FS_STATE_ERROR in fs_info->fs_state
                                                                are made

                                                                btrfs_write_and_wait_transaction(trans, root);
                                                                  --> succeeds, no errors during writeback

                                                                write_ctree_super(trans, root, 0);
                                                                  --> succeeds
                                                                  --> we have now a superblock that points us
                                                                      to some root that uses eb X, which was
                                                                      never written to disk

In this scenario future attempts to read eb X from disk results in an
error message like "parent transid verify failed on X wanted Y found Z".

So fix this by aborting the current transaction if after waiting for the
previous transaction we verify that it was aborted.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/btrfs/transaction.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 069c2fd37ce7..9218ea8dbfe5 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1711,8 +1711,11 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
 			spin_unlock(&root->fs_info->trans_lock);
 
 			wait_for_commit(root, prev_trans);
+			ret = prev_trans->aborted;
 
 			btrfs_put_transaction(prev_trans);
+			if (ret)
+				goto cleanup_transaction;
 		} else {
 			spin_unlock(&root->fs_info->trans_lock);
 		}
-- 
2.6.0


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

* [PATCH 3.12 54/84] NFSv4: don't set SETATTR for O_RDONLY|O_EXCL
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (52 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 53/84] Btrfs: check if previous transaction aborted to avoid fs corruption Jiri Slaby
@ 2015-10-02 13:24 ` Jiri Slaby
  2015-10-02 13:25 ` [PATCH 3.12 55/84] NFS: nfs_set_pgio_error sometimes misses errors Jiri Slaby
                   ` (5 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:24 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, NeilBrown, Trond Myklebust, Jiri Slaby

From: NeilBrown <neilb@suse.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit efcbc04e16dfa95fef76309f89710dd1d99a5453 upstream.

It is unusual to combine the open flags O_RDONLY and O_EXCL, but
it appears that libre-office does just that.

[pid  3250] stat("/home/USER/.config", {st_mode=S_IFDIR|0700, st_size=8192, ...}) = 0
[pid  3250] open("/home/USER/.config/libreoffice/4-suse/user/extensions/buildid", O_RDONLY|O_EXCL <unfinished ...>

NFSv4 takes O_EXCL as a sign that a setattr command should be sent,
probably to reset the timestamps.

When it was an O_RDONLY open, the SETATTR command does not
identify any actual attributes to change.
If no delegation was provided to the open, the SETATTR uses the
all-zeros stateid and the request is accepted (at least by the
Linux NFS server - no harm, no foul).

If a read-delegation was provided, this is used in the SETATTR
request, and a Netapp filer will justifiably claim
NFS4ERR_BAD_STATEID, which the Linux client takes as a sign
to retry - indefinitely.

So only treat O_EXCL specially if O_CREAT was also given.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 36a72b59d7c8..794af58b388f 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2267,7 +2267,7 @@ static int _nfs4_do_open(struct inode *dir,
 		goto err_free_label;
 	state = ctx->state;
 
-	if ((opendata->o_arg.open_flags & O_EXCL) &&
+	if ((opendata->o_arg.open_flags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) &&
 	    (opendata->o_arg.createmode != NFS4_CREATE_GUARDED)) {
 		nfs4_exclusive_attrset(opendata, sattr);
 
-- 
2.6.0


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

* [PATCH 3.12 55/84] NFS: nfs_set_pgio_error sometimes misses errors
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (53 preceding siblings ...)
  2015-10-02 13:24 ` [PATCH 3.12 54/84] NFSv4: don't set SETATTR for O_RDONLY|O_EXCL Jiri Slaby
@ 2015-10-02 13:25 ` Jiri Slaby
  2015-10-02 13:25 ` [PATCH 3.12 56/84] parisc: Filter out spurious interrupts in PA-RISC irq handler Jiri Slaby
                   ` (4 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:25 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Trond Myklebust, Jiri Slaby

From: Trond Myklebust <trond.myklebust@primarydata.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit e9ae58aeee8842a50f7e199d602a5ccb2e41a95f upstream.

We should ensure that we always set the pgio_header's error field
if a READ or WRITE RPC call returns an error. The current code depends
on 'hdr->good_bytes' always being initialised to a large value, which
is not always done correctly by callers.
When this happens, applications may end up missing important errors.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/pagelist.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
index 27d7f2742592..11763ce73709 100644
--- a/fs/nfs/pagelist.c
+++ b/fs/nfs/pagelist.c
@@ -60,8 +60,8 @@ EXPORT_SYMBOL_GPL(nfs_pgheader_init);
 void nfs_set_pgio_error(struct nfs_pgio_header *hdr, int error, loff_t pos)
 {
 	spin_lock(&hdr->lock);
-	if (pos < hdr->io_start + hdr->good_bytes) {
-		set_bit(NFS_IOHDR_ERROR, &hdr->flags);
+	if (!test_and_set_bit(NFS_IOHDR_ERROR, &hdr->flags)
+	    || pos < hdr->io_start + hdr->good_bytes) {
 		clear_bit(NFS_IOHDR_EOF, &hdr->flags);
 		hdr->good_bytes = pos - hdr->io_start;
 		hdr->error = error;
-- 
2.6.0


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

* [PATCH 3.12 56/84] parisc: Filter out spurious interrupts in PA-RISC irq handler
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (54 preceding siblings ...)
  2015-10-02 13:25 ` [PATCH 3.12 55/84] NFS: nfs_set_pgio_error sometimes misses errors Jiri Slaby
@ 2015-10-02 13:25 ` Jiri Slaby
  2015-10-02 13:25 ` [PATCH 3.12 57/84] vmscan: fix increasing nr_isolated incurred by putback unevictable pages Jiri Slaby
                   ` (3 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:25 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Helge Deller, Jiri Slaby

From: Helge Deller <deller@gmx.de>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit b1b4e435e4ef7de77f07bf2a42c8380b960c2d44 upstream.

When detecting a serial port on newer PA-RISC machines (with iosapic) we have a
long way to go to find the right IRQ line, registering it, then registering the
serial port and the irq handler for the serial port. During this phase spurious
interrupts for the serial port may happen which then crashes the kernel because
the action handler might not have been set up yet.

So, basically it's a race condition between the serial port hardware and the
CPU which sets up the necessary fields in the irq sructs. The main reason for
this race is, that we unmask the serial port irqs too early without having set
up everything properly before (which isn't easily possible because we need the
IRQ number to register the serial ports).

This patch is a work-around for this problem. It adds checks to the CPU irq
handler to verify if the IRQ action field has been initialized already. If not,
we just skip this interrupt (which isn't critical for a serial port at bootup).
The real fix would probably involve rewriting all PA-RISC specific IRQ code
(for CPU, IOSAPIC, GSC and EISA) to use IRQ domains with proper parenting of
the irq chips and proper irq enabling along this line.

This bug has been in the PA-RISC port since the beginning, but the crashes
happened very rarely with currently used hardware.  But on the latest machine
which I bought (a C8000 workstation), which uses the fastest CPUs (4 x PA8900,
1GHz) and which has the largest possible L1 cache size (64MB each), the kernel
crashed at every boot because of this race. So, without this patch the machine
would currently be unuseable.

For the record, here is the flow logic:
1. serial_init_chip() in 8250_gsc.c calls iosapic_serial_irq().
2. iosapic_serial_irq() calls txn_alloc_irq() to find the irq.
3. iosapic_serial_irq() calls cpu_claim_irq() to register the CPU irq
4. cpu_claim_irq() unmasks the CPU irq (which it shouldn't!)
5. serial_init_chip() then registers the 8250 port.
Problems:
- In step 4 the CPU irq shouldn't have been registered yet, but after step 5
- If serial irq happens between 4 and 5 have finished, the kernel will crash

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/parisc/kernel/irq.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index 2e6443b1e922..c32a37e0e0d2 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -524,8 +524,8 @@ void do_cpu_irq_mask(struct pt_regs *regs)
 	struct pt_regs *old_regs;
 	unsigned long eirr_val;
 	int irq, cpu = smp_processor_id();
-#ifdef CONFIG_SMP
 	struct irq_desc *desc;
+#ifdef CONFIG_SMP
 	cpumask_t dest;
 #endif
 
@@ -538,8 +538,12 @@ void do_cpu_irq_mask(struct pt_regs *regs)
 		goto set_out;
 	irq = eirr_to_irq(eirr_val);
 
-#ifdef CONFIG_SMP
+	/* Filter out spurious interrupts, mostly from serial port at bootup */
 	desc = irq_to_desc(irq);
+	if (unlikely(!desc->action))
+		goto set_out;
+
+#ifdef CONFIG_SMP
 	cpumask_copy(&dest, desc->irq_data.affinity);
 	if (irqd_is_per_cpu(&desc->irq_data) &&
 	    !cpu_isset(smp_processor_id(), dest)) {
-- 
2.6.0


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

* [PATCH 3.12 57/84] vmscan: fix increasing nr_isolated incurred by putback unevictable pages
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (55 preceding siblings ...)
  2015-10-02 13:25 ` [PATCH 3.12 56/84] parisc: Filter out spurious interrupts in PA-RISC irq handler Jiri Slaby
@ 2015-10-02 13:25 ` Jiri Slaby
  2015-10-02 13:25 ` [PATCH 3.12 58/84] fs: if a coredump already exists, unlink and recreate with O_EXCL Jiri Slaby
                   ` (2 subsequent siblings)
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:25 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jaewon Kim, Mel Gorman, Andrew Morton,
	Linus Torvalds, Jiri Slaby

From: Jaewon Kim <jaewon31.kim@samsung.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit c54839a722a02818677bcabe57e957f0ce4f841d upstream.

reclaim_clean_pages_from_list() assumes that shrink_page_list() returns
number of pages removed from the candidate list.  But shrink_page_list()
puts back mlocked pages without passing it to caller and without
counting as nr_reclaimed.  This increases nr_isolated.

To fix this, this patch changes shrink_page_list() to pass unevictable
pages back to caller.  Caller will take care those pages.

Minchan said:

It fixes two issues.

1. With unevictable page, cma_alloc will be successful.

Exactly speaking, cma_alloc of current kernel will fail due to
unevictable pages.

2. fix leaking of NR_ISOLATED counter of vmstat

With it, too_many_isolated works.  Otherwise, it could make hang until
the process get SIGKILL.

Signed-off-by: Jaewon Kim <jaewon31.kim@samsung.com>
Acked-by: Minchan Kim <minchan@kernel.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
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/vmscan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 04c33d5fb079..6dc33d9dc2cf 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1087,7 +1087,7 @@ cull_mlocked:
 		if (PageSwapCache(page))
 			try_to_free_swap(page);
 		unlock_page(page);
-		putback_lru_page(page);
+		list_add(&page->lru, &ret_pages);
 		continue;
 
 activate_locked:
-- 
2.6.0


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

* [PATCH 3.12 58/84] fs: if a coredump already exists, unlink and recreate with O_EXCL
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (56 preceding siblings ...)
  2015-10-02 13:25 ` [PATCH 3.12 57/84] vmscan: fix increasing nr_isolated incurred by putback unevictable pages Jiri Slaby
@ 2015-10-02 13:25 ` Jiri Slaby
  2015-10-02 15:34 ` [PATCH 3.12 00/84] 3.12.49-stable review Shuah Khan
  2015-10-02 16:09 ` Guenter Roeck
  59 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:25 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jann Horn, Kees Cook, Al Viro, Andrew Morton,
	Linus Torvalds, Jiri Slaby

From: Jann Horn <jann@thejh.net>

3.12-stable review patch.  If anyone has any objections, please let me know.

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

commit fbb1816942c04429e85dbf4c1a080accc534299e upstream.

It was possible for an attacking user to trick root (or another user) into
writing his coredumps into an attacker-readable, pre-existing file using
rename() or link(), causing the disclosure of secret data from the victim
process' virtual memory.  Depending on the configuration, it was also
possible to trick root into overwriting system files with coredumps.  Fix
that issue by never writing coredumps into existing files.

Requirements for the attack:
 - The attack only applies if the victim's process has a nonzero
   RLIMIT_CORE and is dumpable.
 - The attacker can trick the victim into coredumping into an
   attacker-writable directory D, either because the core_pattern is
   relative and the victim's cwd is attacker-writable or because an
   absolute core_pattern pointing to a world-writable directory is used.
 - The attacker has one of these:
  A: on a system with protected_hardlinks=0:
     execute access to a folder containing a victim-owned,
     attacker-readable file on the same partition as D, and the
     victim-owned file will be deleted before the main part of the attack
     takes place. (In practice, there are lots of files that fulfill
     this condition, e.g. entries in Debian's /var/lib/dpkg/info/.)
     This does not apply to most Linux systems because most distros set
     protected_hardlinks=1.
  B: on a system with protected_hardlinks=1:
     execute access to a folder containing a victim-owned,
     attacker-readable and attacker-writable file on the same partition
     as D, and the victim-owned file will be deleted before the main part
     of the attack takes place.
     (This seems to be uncommon.)
  C: on any system, independent of protected_hardlinks:
     write access to a non-sticky folder containing a victim-owned,
     attacker-readable file on the same partition as D
     (This seems to be uncommon.)

The basic idea is that the attacker moves the victim-owned file to where
he expects the victim process to dump its core.  The victim process dumps
its core into the existing file, and the attacker reads the coredump from
it.

If the attacker can't move the file because he does not have write access
to the containing directory, he can instead link the file to a directory
he controls, then wait for the original link to the file to be deleted
(because the kernel checks that the link count of the corefile is 1).

A less reliable variant that requires D to be non-sticky works with link()
and does not require deletion of the original link: link() the file into
D, but then unlink() it directly before the kernel performs the link count
check.

On systems with protected_hardlinks=0, this variant allows an attacker to
not only gain information from coredumps, but also clobber existing,
victim-writable files with coredumps.  (This could theoretically lead to a
privilege escalation.)

Signed-off-by: Jann Horn <jann@thejh.net>
Cc: Kees Cook <keescook@chromium.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
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>
---
 fs/coredump.c | 38 ++++++++++++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 88adbdd15193..ff78d9075316 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -499,10 +499,10 @@ void do_coredump(siginfo_t *siginfo)
 	const struct cred *old_cred;
 	struct cred *cred;
 	int retval = 0;
-	int flag = 0;
 	int ispipe;
 	struct files_struct *displaced;
-	bool need_nonrelative = false;
+	/* require nonrelative corefile path and be extra careful */
+	bool need_suid_safe = false;
 	bool core_dumped = false;
 	static atomic_t core_dump_count = ATOMIC_INIT(0);
 	struct coredump_params cprm = {
@@ -536,9 +536,8 @@ void do_coredump(siginfo_t *siginfo)
 	 */
 	if (__get_dumpable(cprm.mm_flags) == SUID_DUMP_ROOT) {
 		/* Setuid core dump mode */
-		flag = O_EXCL;		/* Stop rewrite attacks */
 		cred->fsuid = GLOBAL_ROOT_UID;	/* Dump root private */
-		need_nonrelative = true;
+		need_suid_safe = true;
 	}
 
 	retval = coredump_wait(siginfo->si_signo, &core_state);
@@ -619,7 +618,7 @@ void do_coredump(siginfo_t *siginfo)
 		if (cprm.limit < binfmt->min_coredump)
 			goto fail_unlock;
 
-		if (need_nonrelative && cn.corename[0] != '/') {
+		if (need_suid_safe && cn.corename[0] != '/') {
 			printk(KERN_WARNING "Pid %d(%s) can only dump core "\
 				"to fully qualified path!\n",
 				task_tgid_vnr(current), current->comm);
@@ -627,8 +626,35 @@ void do_coredump(siginfo_t *siginfo)
 			goto fail_unlock;
 		}
 
+		/*
+		 * Unlink the file if it exists unless this is a SUID
+		 * binary - in that case, we're running around with root
+		 * privs and don't want to unlink another user's coredump.
+		 */
+		if (!need_suid_safe) {
+			mm_segment_t old_fs;
+
+			old_fs = get_fs();
+			set_fs(KERNEL_DS);
+			/*
+			 * If it doesn't exist, that's fine. If there's some
+			 * other problem, we'll catch it at the filp_open().
+			 */
+			(void) sys_unlink((const char __user *)cn.corename);
+			set_fs(old_fs);
+		}
+
+		/*
+		 * There is a race between unlinking and creating the
+		 * file, but if that causes an EEXIST here, that's
+		 * fine - another process raced with us while creating
+		 * the corefile, and the other process won. To userspace,
+		 * what matters is that at least one of the two processes
+		 * writes its coredump successfully, not which one.
+		 */
 		cprm.file = filp_open(cn.corename,
-				 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
+				 O_CREAT | 2 | O_NOFOLLOW |
+				 O_LARGEFILE | O_EXCL,
 				 0600);
 		if (IS_ERR(cprm.file))
 			goto fail_unlock;
-- 
2.6.0


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

* [PATCH 3.12 00/84] 3.12.49-stable review
@ 2015-10-02 13:25 Jiri Slaby
  2015-10-02 13:24 ` [PATCH 3.12 01/84] PCI: Add dev_flags bit to access VPD through function 0 Jiri Slaby
                   ` (59 more replies)
  0 siblings, 60 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-02 13:25 UTC (permalink / raw)
  To: stable; +Cc: linux, shuah.kh, linux-kernel, Jiri Slaby

This is the start of the stable review cycle for the 3.12.49 release.
There are 84 patches in this series, all will be posted as a response
to this one.  If anyone has any issues with these being applied, please
let me know.

Responses should be made by Tue Oct  6 15:25:04 CEST 2015.
Anything received after that time might be too late.

The whole patch series can be found in one patch at:
	http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.49-rc1.xz
and the diffstat can be found below.

thanks,
js

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


Adrien Schildknecht (1):
  rtlwifi: rtl8192cu: Add new device ID

Alexey Brodkin (1):
  stmmac: troubleshoot unexpected bits in des0 & des1

Andrey Ryabinin (1):
  crypto: ghash-clmulni: specify context size for ghash async algorithm

Andy Lutomirski (3):
  x86/nmi/64: Improve nested NMI comments
  x86/nmi/64: Reorder nested NMI checks
  x86/nmi/64: Use DF to avoid userspace RSP confusing nested NMI
    detection

Aneesh Kumar K.V (1):
  powerpc/mm: Recompute hash value after a failed update

Bart Van Assche (1):
  libfc: Fix fc_fcp_cleanup_each_cmd()

Bjorn Helgaas (1):
  PCI: Fix TI816X class code quirk

Bob Copeland (1):
  mac80211: enable assoc check for mesh interfaces

Christoph Hellwig (1):
  IB/uverbs: reject invalid or unknown opcodes

Dan Carpenter (1):
  clk: versatile: off by one in clk_sp810_timerclken_of_get()

Daniel Borkmann (2):
  ipv6: fix exthdrs offload registration in out_rt path
  netlink, mmap: transform mmap skb into full skb on taps

David Daney (1):
  of/address: Don't loop forever in of_find_matching_node_by_address().

David Härdeman (1):
  rc-core: fix remove uevent generation

David Vrabel (1):
  xen/gntdev: convert priv->lock to a mutex

Davide Italiano (1):
  ext4: move check under lock scope to close a race.

Don Zickus (1):
  HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error

Eric W. Biederman (3):
  unshare: Unsharing a thread does not require unsharing a vm
  dcache: Handle escaped paths in prepend_path
  vfs: Test for and handle paths that are unreachable from their
    mnt_root

Eugene Shatokhin (1):
  usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared

Filipe Manana (1):
  Btrfs: check if previous transaction aborted to avoid fs corruption

Grant Likely (1):
  drivercore: Fix unregistration path of platform devices

Guenter Roeck (1):
  regmap: regcache-rbtree: Clean new present bits on present bitmap
    resize

Helge Deller (1):
  parisc: Filter out spurious interrupts in PA-RISC irq handler

Hin-Tak Leung (2):
  hfs: fix B-tree corruption after insertion at position 0
  hfs,hfsplus: cache pages correctly between bnode_create and bnode_free

Horia Geant? (1):
  crypto: caam - fix memory corruption in ahash_final_ctx

Ian Abbott (3):
  staging: comedi: usbduxsigma: don't clobber ai_timer in command test
  staging: comedi: usbduxsigma: don't clobber ao_timer in command test
  staging: comedi: adl_pci7x3x: fix digital output on PCI-7230

Imre Deak (1):
  tty/vt: don't set font mappings on vc not supporting this

Jack Morgenstein (1):
  IB/mlx4: Forbid using sysfs to change RoCE pkeys

Jaewon Kim (1):
  vmscan: fix increasing nr_isolated incurred by putback unevictable
    pages

Jann Horn (1):
  fs: if a coredump already exists, unlink and recreate with O_EXCL

Jean Delvare (1):
  tg3: Fix temperature reporting

Jeff Vander Stoep (1):
  arm64: kconfig: Move LIST_POISON to a safe value

Jeffery Miller (1):
  Add radeon suspend/resume quirk for HP Compaq dc5750.

Jesse Gross (1):
  openvswitch: Zero flows on allocation.

Jialing Fu (1):
  mmc: core: fix race condition in mmc_wait_data_done

Jonathon Jongsma (1):
  drm/qxl: validate monitors config modes

Kishon Vijay Abraham I (1):
  usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512
    bytes

Lars-Peter Clausen (2):
  iio: Add inverse unit conversion macros
  iio: adis16480: Fix scale factors

Maciej S. Szmigiero (1):
  serial: 8250: don't bind to SMSC IrCC IR port

Marc Zyngier (2):
  arm64: KVM: Fix host crash when injecting a fault into a 32bit guest
  arm64: KVM: Disable virtual timer even if the guest is not using it

Marcelo Ricardo Leitner (1):
  sctp: fix race on protocol/netns initialization

Mark Rustad (2):
  PCI: Add dev_flags bit to access VPD through function 0
  PCI: Add VPD function 0 quirk for Intel Ethernet devices

Masahiro Yamada (1):
  devres: fix devres_get()

Matthijs Kooijman (1):
  USB: ftdi_sio: Added custom PID for CustomWare products

Max Filippov (2):
  xtensa: fix threadptr reload on return to userspace
  xtensa: fix kernel register spilling

Michael Ellerman (1):
  powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash

Mike Marciniszyn (1):
  IB/qib: Change lkey table allocation to support more MRs

Mikulas Patocka (1):
  hpfs: update ctime and mtime on directory modification

Minfei Huang (1):
  x86/mm: Initialize pmd_idx in page_table_range_init_count()

Neil Brown (1):
  md: flush ->event_work before stopping array.

NeilBrown (2):
  NFSv4: don't set SETATTR for O_RDONLY|O_EXCL
  md/raid10: always set reshape_safe when initializing reshape_position.

Noa Osherovich (1):
  IB/mlx4: Use correct SL on AH query under RoCE

Paul Mackerras (1):
  powerpc/MSI: Fix race condition in tearing down MSI interrupts

Peter Chen (1):
  usb: host: ehci-sys: delete useless bus_to_hcd conversion

Philipp Hachtmann (1):
  USB: symbolserial: Use usb_get_serial_port_data

Richard Laing (1):
  net/ipv6: Correct PIM6 mrt_lock handling

Sakari Ailus (1):
  v4l: omap3isp: Fix sub-device power management code

Stephen Chandler Paul (1):
  DRM - radeon: Don't link train DisplayPort on HPD until we get the
    dpcd

Sudip Mukherjee (1):
  auxdisplay: ks0108: fix refcount

Takashi Iwai (3):
  Input: evdev - do not report errors form flush()
  ALSA: hda - Enable headphone jack detect on old Fujitsu laptops
  ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437

Thomas Huth (1):
  powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers

Trond Myklebust (1):
  NFS: nfs_set_pgio_error sometimes misses errors

Vignesh R (1):
  ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP

Will Deacon (3):
  arm64: compat: fix vfp save/restore across signal handlers in
    big-endian
  arm64: head.S: initialise mdcr_el2 in el2_setup
  arm64: errata: add module build workaround for erratum #843419

Wilson Kok (1):
  fib_rules: fix fib rule dumps across multiple skbs

Xiao Guangrong (1):
  KVM: MMU: fix validation of mmio page fault

Yishai Hadas (1):
  IB/uverbs: Fix race between ib_uverbs_open and remove_one

huaibin Wang (1):
  ip6_gre: release cached dst on tunnel removal

 arch/arm/mach-omap2/clockdomains7xx_data.c        |   2 +-
 arch/arm64/Kconfig                                |  20 +++
 arch/arm64/Makefile                               |   4 +
 arch/arm64/kernel/head.S                          |   5 +
 arch/arm64/kernel/module.c                        |   2 +
 arch/arm64/kernel/signal32.c                      |  47 +++--
 arch/arm64/kvm/hyp.S                              |   5 +-
 arch/arm64/kvm/inject_fault.c                     |  12 +-
 arch/parisc/kernel/irq.c                          |   8 +-
 arch/powerpc/include/asm/pgtable-ppc64.h          |  14 +-
 arch/powerpc/include/asm/rtas.h                   |   1 +
 arch/powerpc/kernel/rtas.c                        |  17 ++
 arch/powerpc/mm/hugepage-hash64.c                 |   3 +-
 arch/powerpc/platforms/powernv/pci.c              |   5 +-
 arch/powerpc/platforms/pseries/ras.c              |   3 +-
 arch/powerpc/sysdev/fsl_msi.c                     |   5 +-
 arch/powerpc/sysdev/mpic_pasemi_msi.c             |   6 +-
 arch/powerpc/sysdev/mpic_u3msi.c                  |   5 +-
 arch/powerpc/sysdev/ppc4xx_msi.c                  |   5 +-
 arch/x86/crypto/ghash-clmulni-intel_glue.c        |   1 +
 arch/x86/kernel/entry_64.S                        | 201 +++++++++++++---------
 arch/x86/kernel/nmi.c                             |   4 +-
 arch/x86/kvm/mmu.c                                |  45 -----
 arch/x86/mm/init_32.c                             |   1 +
 arch/xtensa/include/asm/traps.h                   |  29 ++--
 arch/xtensa/kernel/entry.S                        |   7 +-
 drivers/auxdisplay/ks0108.c                       |   1 +
 drivers/base/devres.c                             |   4 +-
 drivers/base/platform.c                           |   8 +-
 drivers/base/regmap/regcache-rbtree.c             |  19 +-
 drivers/clk/versatile/clk-sp810.c                 |   4 +-
 drivers/crypto/caam/caamhash.c                    |   7 +-
 drivers/gpu/drm/qxl/qxl_display.c                 |  66 ++++---
 drivers/gpu/drm/qxl/qxl_drv.h                     |   2 +
 drivers/gpu/drm/radeon/radeon_combios.c           |   8 +
 drivers/gpu/drm/radeon/radeon_connectors.c        |   5 +
 drivers/hid/usbhid/hid-core.c                     |   2 +-
 drivers/iio/imu/adis16480.c                       |  39 ++++-
 drivers/infiniband/core/uverbs.h                  |   3 +-
 drivers/infiniband/core/uverbs_cmd.c              |  10 +-
 drivers/infiniband/core/uverbs_main.c             |  43 +++--
 drivers/infiniband/hw/mlx4/ah.c                   |   6 +-
 drivers/infiniband/hw/mlx4/sysfs.c                |   5 +-
 drivers/infiniband/hw/qib/qib_keys.c              |   4 +
 drivers/infiniband/hw/qib/qib_verbs.c             |  14 +-
 drivers/infiniband/hw/qib/qib_verbs.h             |   2 +
 drivers/input/evdev.c                             |  13 +-
 drivers/md/md.c                                   |   2 +
 drivers/md/raid10.c                               |   5 +-
 drivers/media/platform/omap3isp/isp.c             |   4 +-
 drivers/media/rc/rc-main.c                        |   3 -
 drivers/mmc/core/core.c                           |   6 +-
 drivers/net/ethernet/broadcom/tg3.c               |   2 +-
 drivers/net/ethernet/stmicro/stmmac/descs.h       |   2 +
 drivers/net/ethernet/stmicro/stmmac/enh_desc.c    |   3 +-
 drivers/net/ethernet/stmicro/stmmac/norm_desc.c   |   3 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |  44 ++---
 drivers/net/usb/usbnet.c                          |   7 +-
 drivers/net/wireless/rtlwifi/rtl8192cu/sw.c       |   1 +
 drivers/of/address.c                              |   6 +-
 drivers/pci/access.c                              |  61 ++++++-
 drivers/pci/quirks.c                              |  18 +-
 drivers/scsi/libfc/fc_fcp.c                       |  19 +-
 drivers/staging/comedi/drivers/adl_pci7x3x.c      |  15 +-
 drivers/staging/comedi/drivers/usbduxsigma.c      |  99 +++++------
 drivers/tty/serial/8250/8250_pnp.c                |   5 +
 drivers/tty/vt/consolemap.c                       |   7 +
 drivers/usb/dwc3/ep0.c                            |  12 +-
 drivers/usb/host/ehci-sysfs.c                     |   8 +-
 drivers/usb/serial/ftdi_sio.c                     |   4 +
 drivers/usb/serial/ftdi_sio_ids.h                 |   8 +
 drivers/usb/serial/symbolserial.c                 |   6 +-
 drivers/xen/gntdev.c                              |  40 ++---
 fs/btrfs/transaction.c                            |   3 +
 fs/coredump.c                                     |  38 +++-
 fs/dcache.c                                       |   7 +
 fs/ext4/extents.c                                 |  17 +-
 fs/hfs/bnode.c                                    |   9 +-
 fs/hfs/brec.c                                     |  20 ++-
 fs/hfsplus/bnode.c                                |   3 -
 fs/hpfs/namei.c                                   |  25 ++-
 fs/namei.c                                        |  31 +++-
 fs/nfs/nfs4proc.c                                 |   2 +-
 fs/nfs/pagelist.c                                 |   4 +-
 include/linux/iio/iio.h                           |  17 ++
 include/linux/pci.h                               |   2 +
 kernel/fork.c                                     |  28 +--
 mm/vmscan.c                                       |   2 +-
 net/core/fib_rules.c                              |  14 +-
 net/ipv6/exthdrs_offload.c                        |   2 +-
 net/ipv6/ip6_gre.c                                |   1 +
 net/ipv6/ip6mr.c                                  |   2 +-
 net/mac80211/tx.c                                 |   3 -
 net/netlink/af_netlink.c                          |  30 +++-
 net/netlink/af_netlink.h                          |   9 +
 net/openvswitch/datapath.c                        |   2 +-
 net/openvswitch/flow.c                            |  21 ++-
 net/openvswitch/flow.h                            |   2 +-
 net/sctp/protocol.c                               |  64 ++++---
 sound/pci/hda/patch_realtek.c                     |   6 +-
 100 files changed, 991 insertions(+), 485 deletions(-)

-- 
2.6.0


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

* Re: [PATCH 3.12 00/84] 3.12.49-stable review
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (57 preceding siblings ...)
  2015-10-02 13:25 ` [PATCH 3.12 58/84] fs: if a coredump already exists, unlink and recreate with O_EXCL Jiri Slaby
@ 2015-10-02 15:34 ` Shuah Khan
  2015-10-06  8:40   ` Jiri Slaby
  2015-10-02 16:09 ` Guenter Roeck
  59 siblings, 1 reply; 62+ messages in thread
From: Shuah Khan @ 2015-10-02 15:34 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: linux, shuah.kh, linux-kernel

On 10/02/2015 07:25 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.49 release.
> There are 84 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Tue Oct  6 15:25:04 CEST 2015.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.49-rc1.xz
> and the diffstat can be found below.
> 

Compiled and booted on my test system. No dmesg regressions.

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978

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

* Re: [PATCH 3.12 00/84] 3.12.49-stable review
  2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
                   ` (58 preceding siblings ...)
  2015-10-02 15:34 ` [PATCH 3.12 00/84] 3.12.49-stable review Shuah Khan
@ 2015-10-02 16:09 ` Guenter Roeck
  59 siblings, 0 replies; 62+ messages in thread
From: Guenter Roeck @ 2015-10-02 16:09 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: shuah.kh, linux-kernel

On 10/02/2015 06:25 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.49 release.
> There are 84 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Tue Oct  6 15:25:04 CEST 2015.
> Anything received after that time might be too late.
>

Build results:
	total: 123 pass: 123 fail: 0
Qemu test results:
	total: 76 pass: 76 fail: 0

Details are available at http://server.roeck-us.net:8010/builders.

Guenter


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

* Re: [PATCH 3.12 00/84] 3.12.49-stable review
  2015-10-02 15:34 ` [PATCH 3.12 00/84] 3.12.49-stable review Shuah Khan
@ 2015-10-06  8:40   ` Jiri Slaby
  0 siblings, 0 replies; 62+ messages in thread
From: Jiri Slaby @ 2015-10-06  8:40 UTC (permalink / raw)
  To: Shuah Khan, stable, linux; +Cc: shuah.kh, linux-kernel

On 10/02/2015, 05:34 PM, Shuah Khan wrote:
> On 10/02/2015 07:25 AM, Jiri Slaby wrote:
>> This is the start of the stable review cycle for the 3.12.49 release.
>> There are 84 patches in this series, all will be posted as a response
>> to this one.  If anyone has any issues with these being applied, please
>> let me know.
>>
>> Responses should be made by Tue Oct  6 15:25:04 CEST 2015.
>> Anything received after that time might be too late.
>>
>> The whole patch series can be found in one patch at:
>> 	http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.49-rc1.xz
>> and the diffstat can be found below.
>>
> 
> Compiled and booted on my test system. No dmesg regressions.

On 10/02/2015, 06:09 PM, Guenter Roeck wrote:
> Build results:
>     total: 123 pass: 123 fail: 0
> Qemu test results:
>     total: 76 pass: 76 fail: 0

Thank you both!

-- 
js
suse labs

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

end of thread, other threads:[~2015-10-06  8:40 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-02 13:25 [PATCH 3.12 00/84] 3.12.49-stable review Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 01/84] PCI: Add dev_flags bit to access VPD through function 0 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 02/84] PCI: Add VPD function 0 quirk for Intel Ethernet devices Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 03/84] staging: comedi: usbduxsigma: don't clobber ai_timer in command test Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 04/84] staging: comedi: usbduxsigma: don't clobber ao_timer " Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 05/84] staging: comedi: adl_pci7x3x: fix digital output on PCI-7230 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 06/84] ext4: move check under lock scope to close a race Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 07/84] libfc: Fix fc_fcp_cleanup_each_cmd() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 08/84] regmap: regcache-rbtree: Clean new present bits on present bitmap resize Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 09/84] crypto: caam - fix memory corruption in ahash_final_ctx Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 10/84] arm64: KVM: Fix host crash when injecting a fault into a 32bit guest Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 11/84] DRM - radeon: Don't link train DisplayPort on HPD until we get the dpcd Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 12/84] drm/qxl: validate monitors config modes Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 13/84] iio: Add inverse unit conversion macros Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 14/84] iio: adis16480: Fix scale factors Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 15/84] clk: versatile: off by one in clk_sp810_timerclken_of_get() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 16/84] PCI: Fix TI816X class code quirk Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 17/84] USB: symbolserial: Use usb_get_serial_port_data Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 18/84] USB: ftdi_sio: Added custom PID for CustomWare products Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 19/84] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 20/84] usb: host: ehci-sys: delete useless bus_to_hcd conversion Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 21/84] serial: 8250: don't bind to SMSC IrCC IR port Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 22/84] crypto: ghash-clmulni: specify context size for ghash async algorithm Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 23/84] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 24/84] KVM: MMU: fix validation of mmio page fault Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 25/84] xtensa: fix threadptr reload on return to userspace Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 26/84] xtensa: fix kernel register spilling Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 27/84] devres: fix devres_get() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 28/84] auxdisplay: ks0108: fix refcount Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 29/84] of/address: Don't loop forever in of_find_matching_node_by_address() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 30/84] ARM: OMAP2+: DRA7: clockdomain: change l4per2_7xx_clkdm to SW_WKUP Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 31/84] drivercore: Fix unregistration path of platform devices Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 32/84] hpfs: update ctime and mtime on directory modification Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 33/84] tty/vt: don't set font mappings on vc not supporting this Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 34/84] unshare: Unsharing a thread does not require unsharing a vm Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 35/84] rtlwifi: rtl8192cu: Add new device ID Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 36/84] tg3: Fix temperature reporting Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 37/84] mac80211: enable assoc check for mesh interfaces Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 38/84] arm64: kconfig: Move LIST_POISON to a safe value Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 39/84] arm64: compat: fix vfp save/restore across signal handlers in big-endian Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 40/84] arm64: head.S: initialise mdcr_el2 in el2_setup Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 41/84] arm64: errata: add module build workaround for erratum #843419 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 42/84] arm64: KVM: Disable virtual timer even if the guest is not using it Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 43/84] Input: evdev - do not report errors form flush() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 44/84] ALSA: hda - Enable headphone jack detect on old Fujitsu laptops Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 45/84] ALSA: hda - Use ALC880_FIXUP_FUJITSU for FSC Amilo M1437 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 46/84] powerpc/mm: Fix pte_pagesize_index() crash on 4K w/64K hash Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 47/84] powerpc/rtas: Introduce rtas_get_sensor_fast() for IRQ handlers Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 48/84] powerpc/mm: Recompute hash value after a failed update Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 49/84] Add radeon suspend/resume quirk for HP Compaq dc5750 Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 50/84] x86/mm: Initialize pmd_idx in page_table_range_init_count() Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 51/84] rc-core: fix remove uevent generation Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 52/84] v4l: omap3isp: Fix sub-device power management code Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 53/84] Btrfs: check if previous transaction aborted to avoid fs corruption Jiri Slaby
2015-10-02 13:24 ` [PATCH 3.12 54/84] NFSv4: don't set SETATTR for O_RDONLY|O_EXCL Jiri Slaby
2015-10-02 13:25 ` [PATCH 3.12 55/84] NFS: nfs_set_pgio_error sometimes misses errors Jiri Slaby
2015-10-02 13:25 ` [PATCH 3.12 56/84] parisc: Filter out spurious interrupts in PA-RISC irq handler Jiri Slaby
2015-10-02 13:25 ` [PATCH 3.12 57/84] vmscan: fix increasing nr_isolated incurred by putback unevictable pages Jiri Slaby
2015-10-02 13:25 ` [PATCH 3.12 58/84] fs: if a coredump already exists, unlink and recreate with O_EXCL Jiri Slaby
2015-10-02 15:34 ` [PATCH 3.12 00/84] 3.12.49-stable review Shuah Khan
2015-10-06  8:40   ` Jiri Slaby
2015-10-02 16:09 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).