All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.12 01/64] ALSA: rme96: Fix unexpected volume reset after rate changes
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 02/64] ALSA: hda - Add inverted dmic for Packard Bell DOTS Jiri Slaby
                   ` (66 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 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 a74a821624c0c75388a193337babd17a8c02c740 upstream.

rme96 driver needs to reset DAC depending on the sample rate, and this
results in resetting to the max volume suddenly.  It's because of the
missing call of snd_rme96_apply_dac_volume().

However, calling this function right after the DAC reset still may not
work, and we need some delay before this call.  Since the DAC reset
and the procedure after that are performed in the spinlock, we delay
the DAC volume restore at the end after the spinlock.

Reported-and-tested-by: Sylvain LABOISNE <maeda1@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/rme96.c | 41 ++++++++++++++++++++++++++---------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index bb9ebc5543d7..2da24272e6a5 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -744,10 +744,11 @@ snd_rme96_playback_setrate(struct rme96 *rme96,
 	{
 		/* change to/from double-speed: reset the DAC (if available) */
 		snd_rme96_reset_dac(rme96);
+		return 1; /* need to restore volume */
 	} else {
 		writel(rme96->wcreg, rme96->iobase + RME96_IO_CONTROL_REGISTER);
+		return 0;
 	}
-	return 0;
 }
 
 static int
@@ -985,6 +986,7 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream,
 	struct rme96 *rme96 = snd_pcm_substream_chip(substream);
 	struct snd_pcm_runtime *runtime = substream->runtime;
 	int err, rate, dummy;
+	bool apply_dac_volume = false;
 
 	runtime->dma_area = (void __force *)(rme96->iobase +
 					     RME96_IO_PLAY_BUFFER);
@@ -998,24 +1000,26 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream,
 	{
                 /* slave clock */
                 if ((int)params_rate(params) != rate) {
-			spin_unlock_irq(&rme96->lock);
-			return -EIO;                    
-                }
-	} else if ((err = snd_rme96_playback_setrate(rme96, params_rate(params))) < 0) {
-		spin_unlock_irq(&rme96->lock);
-		return err;
-	}
-	if ((err = snd_rme96_playback_setformat(rme96, params_format(params))) < 0) {
-		spin_unlock_irq(&rme96->lock);
-		return err;
+			err = -EIO;
+			goto error;
+		}
+	} else {
+		err = snd_rme96_playback_setrate(rme96, params_rate(params));
+		if (err < 0)
+			goto error;
+		apply_dac_volume = err > 0; /* need to restore volume later? */
 	}
+
+	err = snd_rme96_playback_setformat(rme96, params_format(params));
+	if (err < 0)
+		goto error;
 	snd_rme96_setframelog(rme96, params_channels(params), 1);
 	if (rme96->capture_periodsize != 0) {
 		if (params_period_size(params) << rme96->playback_frlog !=
 		    rme96->capture_periodsize)
 		{
-			spin_unlock_irq(&rme96->lock);
-			return -EBUSY;
+			err = -EBUSY;
+			goto error;
 		}
 	}
 	rme96->playback_periodsize =
@@ -1026,9 +1030,16 @@ snd_rme96_playback_hw_params(struct snd_pcm_substream *substream,
 		rme96->wcreg &= ~(RME96_WCR_PRO | RME96_WCR_DOLBY | RME96_WCR_EMP);
 		writel(rme96->wcreg |= rme96->wcreg_spdif_stream, rme96->iobase + RME96_IO_CONTROL_REGISTER);
 	}
+
+	err = 0;
+ error:
 	spin_unlock_irq(&rme96->lock);
-		
-	return 0;
+	if (apply_dac_volume) {
+		usleep_range(3000, 10000);
+		snd_rme96_apply_dac_volume(rme96);
+	}
+
+	return err;
 }
 
 static int
-- 
2.7.1

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

* [PATCH 3.12 02/64] ALSA: hda - Add inverted dmic for Packard Bell DOTS
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 01/64] ALSA: rme96: Fix unexpected volume reset after rate changes Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 03/64] ALSA: hda - Set SKL+ hda controller power at freeze() and thaw() Jiri Slaby
                   ` (65 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David Henningsson, Takashi Iwai, Jiri Slaby

From: David Henningsson <david.henningsson@canonical.com>

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

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

commit 02f6ff90400d055f08b0ba0b5f0707630b6faed7 upstream.

On the internal mic of the Packard Bell DOTS, one channel
has an inverted signal. Add a quirk to fix this up.

BugLink: https://bugs.launchpad.net/bugs/1523232
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/hda/patch_realtek.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 1ec93efc8253..6d9a42a16a16 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4956,6 +4956,7 @@ static const struct hda_fixup alc662_fixups[] = {
 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
 	SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
+	SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
 	SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
 	SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
-- 
2.7.1

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

* [PATCH 3.12 03/64] ALSA: hda - Set SKL+ hda controller power at freeze() and thaw()
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 01/64] ALSA: rme96: Fix unexpected volume reset after rate changes Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 02/64] ALSA: hda - Add inverted dmic for Packard Bell DOTS Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 04/64] ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2) Jiri Slaby
                   ` (64 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Xiong Zhang, Takashi Iwai, Jiri Slaby

From: Xiong Zhang <xiong.y.zhang@intel.com>

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

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

commit 3e6db33aaf1d42a30339f831ec4850570d6cc7a3 upstream.

It takes three minutes to enter into hibernation on some OEM SKL
machines and we see many codec spurious response after thaw() opertion.
This is because HDA is still in D0 state after freeze() call and
pci_pm_freeze/pci_pm_freeze_noirq() don't set D3 hot in pci_bus driver.
It seems bios still access HDA when system enter into freeze state,
HDA will receive codec response interrupt immediately after thaw() call.
Because of this unexpected interrupt, HDA enter into a abnormal
state and slow down the system enter into hibernation.

In this patch, we put HDA into D3 hot state in azx_freeze_noirq() and
put HDA into D0 state in azx_thaw_noirq().

V2: Only apply this fix to SKL+
    Fix compile error when CONFIG_PM_SLEEP isn't defined

[Yet another fix for CONFIG_PM_SLEEP ifdef and the additional comment
 by tiwai]

Signed-off-by: Xiong Zhang <xiong.y.zhang@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/hda/hda_intel.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index baf12f1a2820..6a5e36dc23e5 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1180,6 +1180,36 @@ static unsigned int azx_get_response(struct hda_bus *bus,
 		return azx_rirb_get_response(bus, addr);
 }
 
+#ifdef CONFIG_PM_SLEEP
+/* put codec down to D3 at hibernation for Intel SKL+;
+ * otherwise BIOS may still access the codec and screw up the driver
+ */
+#define IS_SKL(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0xa170)
+#define IS_SKL_LP(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x9d70)
+#define IS_BXT(pci) ((pci)->vendor == 0x8086 && (pci)->device == 0x5a98)
+#define IS_SKL_PLUS(pci) (IS_SKL(pci) || IS_SKL_LP(pci) || IS_BXT(pci))
+
+static int azx_freeze_noirq(struct device *dev)
+{
+	struct pci_dev *pci = to_pci_dev(dev);
+
+	if (IS_SKL_PLUS(pci))
+		pci_set_power_state(pci, PCI_D3hot);
+
+	return 0;
+}
+
+static int azx_thaw_noirq(struct device *dev)
+{
+	struct pci_dev *pci = to_pci_dev(dev);
+
+	if (IS_SKL_PLUS(pci))
+		pci_set_power_state(pci, PCI_D0);
+
+	return 0;
+}
+#endif /* CONFIG_PM_SLEEP */
+
 #ifdef CONFIG_PM
 static void azx_power_notify(struct hda_bus *bus, bool power_up);
 #endif
@@ -3139,6 +3169,10 @@ static int azx_runtime_idle(struct device *dev)
 #ifdef CONFIG_PM
 static const struct dev_pm_ops azx_pm = {
 	SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
+#ifdef CONFIG_PM_SLEEP
+	.freeze_noirq = azx_freeze_noirq,
+	.thaw_noirq = azx_thaw_noirq,
+#endif
 	SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle)
 };
 
-- 
2.7.1

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

* [PATCH 3.12 04/64] ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2)
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (2 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 03/64] ALSA: hda - Set SKL+ hda controller power at freeze() and thaw() Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 05/64] ALSA: seq: Fix missing NULL check at remove_events ioctl Jiri Slaby
                   ` (63 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mario Kleiner, Takashi Iwai, Jiri Slaby

From: Mario Kleiner <mario.kleiner.de@gmail.com>

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

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

commit 9f660a1c43890c2cdd1f423fd73654e7ca08fe56 upstream.

Without this patch, internal speaker and line-out work,
but front headphone output jack stays silent on the
Mac Pro 4,1.

This code path also gets executed on the MacPro 5,1 due
to identical codec SSID, but i don't know if it has any
positive or adverse effects there or not.

(v2) Implement feedback from Takashi Iwai: Reuse
     alc889_fixup_mbp_vref and just add a new nid
     0x19 for the MacPro 4,1.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/hda/patch_realtek.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6d9a42a16a16..1dc0702ff818 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1775,6 +1775,7 @@ enum {
 	ALC889_FIXUP_MBA11_VREF,
 	ALC889_FIXUP_MBA21_VREF,
 	ALC889_FIXUP_MP11_VREF,
+	ALC889_FIXUP_MP41_VREF,
 	ALC882_FIXUP_INV_DMIC,
 	ALC882_FIXUP_NO_PRIMARY_HP,
 	ALC887_FIXUP_ASUS_BASS,
@@ -1861,7 +1862,7 @@ static void alc889_fixup_mbp_vref(struct hda_codec *codec,
 				  const struct hda_fixup *fix, int action)
 {
 	struct alc_spec *spec = codec->spec;
-	static hda_nid_t nids[2] = { 0x14, 0x15 };
+	static hda_nid_t nids[3] = { 0x14, 0x15, 0x19 };
 	int i;
 
 	if (action != HDA_FIXUP_ACT_INIT)
@@ -2137,6 +2138,12 @@ static const struct hda_fixup alc882_fixups[] = {
 		.chained = true,
 		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
 	},
+	[ALC889_FIXUP_MP41_VREF] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc889_fixup_mbp_vref,
+		.chained = true,
+		.chain_id = ALC885_FIXUP_MACPRO_GPIO,
+	},
 	[ALC882_FIXUP_INV_DMIC] = {
 		.type = HDA_FIXUP_FUNC,
 		.v.func = alc_fixup_inv_dmic_0x12,
@@ -2209,7 +2216,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
-	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
+	SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
 	SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
-- 
2.7.1

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

* [PATCH 3.12 05/64] ALSA: seq: Fix missing NULL check at remove_events ioctl
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (3 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 04/64] ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2) Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 06/64] ALSA: seq: Fix race at timer setup and close Jiri Slaby
                   ` (62 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 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 030e2c78d3a91dd0d27fef37e91950dde333eba1 upstream.

snd_seq_ioctl_remove_events() calls snd_seq_fifo_clear()
unconditionally even if there is no FIFO assigned, and this leads to
an Oops due to NULL dereference.  The fix is just to add a proper NULL
check.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/seq/seq_clientmgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 4dc6bae80e15..ecfbf5f39d38 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1950,7 +1950,7 @@ static int snd_seq_ioctl_remove_events(struct snd_seq_client *client,
 		 * No restrictions so for a user client we can clear
 		 * the whole fifo
 		 */
-		if (client->type == USER_CLIENT)
+		if (client->type == USER_CLIENT && client->data.user.fifo)
 			snd_seq_fifo_clear(client->data.user.fifo);
 	}
 
-- 
2.7.1

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

* [PATCH 3.12 06/64] ALSA: seq: Fix race at timer setup and close
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (4 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 05/64] ALSA: seq: Fix missing NULL check at remove_events ioctl Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 07/64] ALSA: timer: Harden slave timer list handling Jiri Slaby
                   ` (61 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 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 3567eb6af614dac436c4b16a8d426f9faed639b3 upstream.

ALSA sequencer code has an open race between the timer setup ioctl and
the close of the client.  This was triggered by syzkaller fuzzer, and
a use-after-free was caught there as a result.

This patch papers over it by adding a proper queue->timer_mutex lock
around the timer-related calls in the relevant code path.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/seq/seq_queue.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index f9077361c119..4c9aa462de9b 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -144,8 +144,10 @@ static struct snd_seq_queue *queue_new(int owner, int locked)
 static void queue_delete(struct snd_seq_queue *q)
 {
 	/* stop and release the timer */
+	mutex_lock(&q->timer_mutex);
 	snd_seq_timer_stop(q->timer);
 	snd_seq_timer_close(q);
+	mutex_unlock(&q->timer_mutex);
 	/* wait until access free */
 	snd_use_lock_sync(&q->use_lock);
 	/* release resources... */
-- 
2.7.1

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

* [PATCH 3.12 07/64] ALSA: timer: Harden slave timer list handling
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (5 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 06/64] ALSA: seq: Fix race at timer setup and close Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 08/64] ALSA: timer: Fix race among timer ioctls Jiri Slaby
                   ` (60 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 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 b5a663aa426f4884c71cd8580adae73f33570f0d upstream.

A slave timer instance might be still accessible in a racy way while
operating the master instance as it lacks of locking.  Since the
master operation is mostly protected with timer->lock, we should cope
with it while changing the slave instance, too.  Also, some linked
lists (active_list and ack_list) of slave instances aren't unlinked
immediately at stopping or closing, and this may lead to unexpected
accesses.

This patch tries to address these issues.  It adds spin lock of
timer->lock (either from master or slave, which is equivalent) in a
few places.  For avoiding a deadlock, we ensure that the global
slave_active_lock is always locked at first before each timer lock.

Also, ack and active_list of slave instances are properly unlinked at
snd_timer_stop() and snd_timer_close().

Last but not least, remove the superfluous call of _snd_timer_stop()
at removing slave links.  This is a noop, and calling it may confuse
readers wrt locking.  Further cleanup will follow in a later patch.

Actually we've got reports of use-after-free by syzkaller fuzzer, and
this hopefully fixes these issues.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/timer.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/sound/core/timer.c b/sound/core/timer.c
index 6ddcf06f52f9..38a137d6b04f 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -215,11 +215,13 @@ static void snd_timer_check_master(struct snd_timer_instance *master)
 		    slave->slave_id == master->slave_id) {
 			list_move_tail(&slave->open_list, &master->slave_list_head);
 			spin_lock_irq(&slave_active_lock);
+			spin_lock(&master->timer->lock);
 			slave->master = master;
 			slave->timer = master->timer;
 			if (slave->flags & SNDRV_TIMER_IFLG_RUNNING)
 				list_add_tail(&slave->active_list,
 					      &master->slave_active_head);
+			spin_unlock(&master->timer->lock);
 			spin_unlock_irq(&slave_active_lock);
 		}
 	}
@@ -345,15 +347,18 @@ int snd_timer_close(struct snd_timer_instance *timeri)
 		    timer->hw.close)
 			timer->hw.close(timer);
 		/* remove slave links */
+		spin_lock_irq(&slave_active_lock);
+		spin_lock(&timer->lock);
 		list_for_each_entry_safe(slave, tmp, &timeri->slave_list_head,
 					 open_list) {
-			spin_lock_irq(&slave_active_lock);
-			_snd_timer_stop(slave, 1, SNDRV_TIMER_EVENT_RESOLUTION);
 			list_move_tail(&slave->open_list, &snd_timer_slave_list);
 			slave->master = NULL;
 			slave->timer = NULL;
-			spin_unlock_irq(&slave_active_lock);
+			list_del_init(&slave->ack_list);
+			list_del_init(&slave->active_list);
 		}
+		spin_unlock(&timer->lock);
+		spin_unlock_irq(&slave_active_lock);
 		mutex_unlock(&register_mutex);
 	}
  out:
@@ -440,9 +445,12 @@ static int snd_timer_start_slave(struct snd_timer_instance *timeri)
 
 	spin_lock_irqsave(&slave_active_lock, flags);
 	timeri->flags |= SNDRV_TIMER_IFLG_RUNNING;
-	if (timeri->master)
+	if (timeri->master && timeri->timer) {
+		spin_lock(&timeri->timer->lock);
 		list_add_tail(&timeri->active_list,
 			      &timeri->master->slave_active_head);
+		spin_unlock(&timeri->timer->lock);
+	}
 	spin_unlock_irqrestore(&slave_active_lock, flags);
 	return 1; /* delayed start */
 }
@@ -488,6 +496,8 @@ static int _snd_timer_stop(struct snd_timer_instance * timeri,
 		if (!keep_flag) {
 			spin_lock_irqsave(&slave_active_lock, flags);
 			timeri->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
+			list_del_init(&timeri->ack_list);
+			list_del_init(&timeri->active_list);
 			spin_unlock_irqrestore(&slave_active_lock, flags);
 		}
 		goto __end;
-- 
2.7.1

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

* [PATCH 3.12 08/64] ALSA: timer: Fix race among timer ioctls
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (6 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 07/64] ALSA: timer: Harden slave timer list handling Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 09/64] ALSA: timer: Fix double unlink of active_list Jiri Slaby
                   ` (59 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 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 af368027a49a751d6ff4ee9e3f9961f35bb4fede upstream.

ALSA timer ioctls have an open race and this may lead to a
use-after-free of timer instance object.  A simplistic fix is to make
each ioctl exclusive.  We have already tread_sem for controlling the
tread, and extend this as a global mutex to be applied to each ioctl.

The downside is, of course, the worse concurrency.  But these ioctls
aren't to be parallel accessible, in anyway, so it should be fine to
serialize there.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/timer.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/sound/core/timer.c b/sound/core/timer.c
index 38a137d6b04f..1d5461719e31 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -73,7 +73,7 @@ struct snd_timer_user {
 	struct timespec tstamp;		/* trigger tstamp */
 	wait_queue_head_t qchange_sleep;
 	struct fasync_struct *fasync;
-	struct mutex tread_sem;
+	struct mutex ioctl_lock;
 };
 
 /* list of timers */
@@ -1266,7 +1266,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
 		return -ENOMEM;
 	spin_lock_init(&tu->qlock);
 	init_waitqueue_head(&tu->qchange_sleep);
-	mutex_init(&tu->tread_sem);
+	mutex_init(&tu->ioctl_lock);
 	tu->ticks = 1;
 	tu->queue_size = 128;
 	tu->queue = kmalloc(tu->queue_size * sizeof(struct snd_timer_read),
@@ -1286,8 +1286,10 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)
 	if (file->private_data) {
 		tu = file->private_data;
 		file->private_data = NULL;
+		mutex_lock(&tu->ioctl_lock);
 		if (tu->timeri)
 			snd_timer_close(tu->timeri);
+		mutex_unlock(&tu->ioctl_lock);
 		kfree(tu->queue);
 		kfree(tu->tqueue);
 		kfree(tu);
@@ -1525,7 +1527,6 @@ static int snd_timer_user_tselect(struct file *file,
 	int err = 0;
 
 	tu = file->private_data;
-	mutex_lock(&tu->tread_sem);
 	if (tu->timeri) {
 		snd_timer_close(tu->timeri);
 		tu->timeri = NULL;
@@ -1569,7 +1570,6 @@ static int snd_timer_user_tselect(struct file *file,
 	}
 
       __err:
-      	mutex_unlock(&tu->tread_sem);
 	return err;
 }
 
@@ -1782,7 +1782,7 @@ enum {
 	SNDRV_TIMER_IOCTL_PAUSE_OLD = _IO('T', 0x23),
 };
 
-static long snd_timer_user_ioctl(struct file *file, unsigned int cmd,
+static long __snd_timer_user_ioctl(struct file *file, unsigned int cmd,
 				 unsigned long arg)
 {
 	struct snd_timer_user *tu;
@@ -1799,17 +1799,11 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd,
 	{
 		int xarg;
 
-		mutex_lock(&tu->tread_sem);
-		if (tu->timeri)	{	/* too late */
-			mutex_unlock(&tu->tread_sem);
+		if (tu->timeri)	/* too late */
 			return -EBUSY;
-		}
-		if (get_user(xarg, p)) {
-			mutex_unlock(&tu->tread_sem);
+		if (get_user(xarg, p))
 			return -EFAULT;
-		}
 		tu->tread = xarg ? 1 : 0;
-		mutex_unlock(&tu->tread_sem);
 		return 0;
 	}
 	case SNDRV_TIMER_IOCTL_GINFO:
@@ -1842,6 +1836,18 @@ static long snd_timer_user_ioctl(struct file *file, unsigned int cmd,
 	return -ENOTTY;
 }
 
+static long snd_timer_user_ioctl(struct file *file, unsigned int cmd,
+				 unsigned long arg)
+{
+	struct snd_timer_user *tu = file->private_data;
+	long ret;
+
+	mutex_lock(&tu->ioctl_lock);
+	ret = __snd_timer_user_ioctl(file, cmd, arg);
+	mutex_unlock(&tu->ioctl_lock);
+	return ret;
+}
+
 static int snd_timer_user_fasync(int fd, struct file * file, int on)
 {
 	struct snd_timer_user *tu;
-- 
2.7.1

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

* [PATCH 3.12 09/64] ALSA: timer: Fix double unlink of active_list
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (7 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 08/64] ALSA: timer: Fix race among timer ioctls Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 10/64] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode Jiri Slaby
                   ` (58 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 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 ee8413b01045c74340aa13ad5bdf905de32be736 upstream.

ALSA timer instance object has a couple of linked lists and they are
unlinked unconditionally at snd_timer_stop().  Meanwhile
snd_timer_interrupt() unlinks it, but it calls list_del() which leaves
the element list itself unchanged.  This ends up with unlinking twice,
and it was caught by syzkaller fuzzer.

The fix is to use list_del_init() variant properly there, too.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/core/timer.c b/sound/core/timer.c
index 1d5461719e31..4e436fe53afa 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -703,7 +703,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
 		} else {
 			ti->flags &= ~SNDRV_TIMER_IFLG_RUNNING;
 			if (--timer->running)
-				list_del(&ti->active_list);
+				list_del_init(&ti->active_list);
 		}
 		if ((timer->hw.flags & SNDRV_TIMER_HW_TASKLET) ||
 		    (ti->flags & SNDRV_TIMER_IFLG_FAST))
-- 
2.7.1

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

* [PATCH 3.12 10/64] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (8 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 09/64] ALSA: timer: Fix double unlink of active_list Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 11/64] ALSA: pcm: Fix snd_pcm_hw_params struct copy " Jiri Slaby
                   ` (57 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nicolas Boichat, Takashi Iwai, Jiri Slaby

From: Nicolas Boichat <drinkcat@chromium.org>

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

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

commit 9586495dc3011a80602329094e746dbce16cb1f1 upstream.

This reverts one hunk of
commit ef44a1ec6eee ("ALSA: sound/core: use memdup_user()"), which
replaced a number of kmalloc followed by memcpy with memdup calls.

In this case, we are copying from a struct snd_seq_port_info32 to a
struct snd_seq_port_info, but the latter is 4 bytes longer than the
32-bit version, so we need to separate kmalloc and copy calls.

Fixes: ef44a1ec6eee ('ALSA: sound/core: use memdup_user()')
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/seq/seq_compat.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/core/seq/seq_compat.c b/sound/core/seq/seq_compat.c
index 81f7c109dc46..65175902a68a 100644
--- a/sound/core/seq/seq_compat.c
+++ b/sound/core/seq/seq_compat.c
@@ -49,11 +49,12 @@ static int snd_seq_call_port_info_ioctl(struct snd_seq_client *client, unsigned
 	struct snd_seq_port_info *data;
 	mm_segment_t fs;
 
-	data = memdup_user(data32, sizeof(*data32));
-	if (IS_ERR(data))
-		return PTR_ERR(data);
+	data = kmalloc(sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
 
-	if (get_user(data->flags, &data32->flags) ||
+	if (copy_from_user(data, data32, sizeof(*data32)) ||
+	    get_user(data->flags, &data32->flags) ||
 	    get_user(data->time_queue, &data32->time_queue))
 		goto error;
 	data->kernel = NULL;
-- 
2.7.1

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

* [PATCH 3.12 11/64] ALSA: pcm: Fix snd_pcm_hw_params struct copy in compat mode
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (9 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 10/64] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 12/64] ALSA: hrtimer: Fix stall by hrtimer_cancel() Jiri Slaby
                   ` (56 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nicolas Boichat, Takashi Iwai, Jiri Slaby

From: Nicolas Boichat <drinkcat@chromium.org>

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

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

commit 43c54b8c7cfe22f868a751ba8a59abf1724160b1 upstream.

This reverts one hunk of
commit ef44a1ec6eee ("ALSA: sound/core: use memdup_user()"), which
replaced a number of kmalloc followed by memcpy with memdup calls.

In this case, we are copying from a struct snd_pcm_hw_params32 to
a struct snd_pcm_hw_params, but the latter is 4 bytes longer than
the 32-bit version, so we need to separate kmalloc and copy calls.

This actually leads to an out-of-bounds memory access later on
in sound/soc/soc-pcm.c:soc_pcm_hw_params() (detected using KASan).

Fixes: ef44a1ec6eee ('ALSA: sound/core: use memdup_user()')
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/pcm_compat.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index c4ac3c1e19af..1bb1a43c7d03 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -236,10 +236,15 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
 	if (! (runtime = substream->runtime))
 		return -ENOTTY;
 
-	/* only fifo_size is different, so just copy all */
-	data = memdup_user(data32, sizeof(*data32));
-	if (IS_ERR(data))
-		return PTR_ERR(data);
+	data = kmalloc(sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	/* only fifo_size (RO from userspace) is different, so just copy all */
+	if (copy_from_user(data, data32, sizeof(*data32))) {
+		err = -EFAULT;
+		goto error;
+	}
 
 	if (refine)
 		err = snd_pcm_hw_refine(substream, data);
-- 
2.7.1

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

* [PATCH 3.12 12/64] ALSA: hrtimer: Fix stall by hrtimer_cancel()
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (10 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 11/64] ALSA: pcm: Fix snd_pcm_hw_params struct copy " Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 13/64] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0 Jiri Slaby
                   ` (55 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 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 2ba1fe7a06d3624f9a7586d672b55f08f7c670f3 upstream.

hrtimer_cancel() waits for the completion from the callback, thus it
must not be called inside the callback itself.  This was already a
problem in the past with ALSA hrtimer driver, and the early commit
[fcfdebe70759: ALSA: hrtimer - Fix lock-up] tried to address it.

However, the previous fix is still insufficient: it may still cause a
lockup when the ALSA timer instance reprograms itself in its callback.
Then it invokes the start function even in snd_timer_interrupt() that
is called in hrtimer callback itself, results in a CPU stall.  This is
no hypothetical problem but actually triggered by syzkaller fuzzer.

This patch tries to fix the issue again.  Now we call
hrtimer_try_to_cancel() at both start and stop functions so that it
won't fall into a deadlock, yet giving some chance to cancel the queue
if the functions have been called outside the callback.  The proper
hrtimer_cancel() is called in anyway at closing, so this should be
enough.

Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/hrtimer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
index b8b31c433d64..14d483d6b3b0 100644
--- a/sound/core/hrtimer.c
+++ b/sound/core/hrtimer.c
@@ -90,7 +90,7 @@ static int snd_hrtimer_start(struct snd_timer *t)
 	struct snd_hrtimer *stime = t->private_data;
 
 	atomic_set(&stime->running, 0);
-	hrtimer_cancel(&stime->hrt);
+	hrtimer_try_to_cancel(&stime->hrt);
 	hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution),
 		      HRTIMER_MODE_REL);
 	atomic_set(&stime->running, 1);
@@ -101,6 +101,7 @@ static int snd_hrtimer_stop(struct snd_timer *t)
 {
 	struct snd_hrtimer *stime = t->private_data;
 	atomic_set(&stime->running, 0);
+	hrtimer_try_to_cancel(&stime->hrt);
 	return 0;
 }
 
-- 
2.7.1

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

* [PATCH 3.12 13/64] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (11 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 12/64] ALSA: hrtimer: Fix stall by hrtimer_cancel() Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 14/64] ASoC: wm8962: correct addresses for HPF_C_0/1 Jiri Slaby
                   ` (54 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 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 c0bcdbdff3ff73a54161fca3cb8b6cdbd0bb8762 upstream.

When a TLV ioctl with numid zero is handled, the driver may spew a
kernel warning with a stack trace at each call.  The check was
intended obviously only for a kernel driver, but not for a user
interaction.  Let's fix it.

This was spotted by syzkaller fuzzer.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/control.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/core/control.c b/sound/core/control.c
index f2082a35b890..3fcead61f0ef 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1325,6 +1325,8 @@ static int snd_ctl_tlv_ioctl(struct snd_ctl_file *file,
 		return -EFAULT;
 	if (tlv.length < sizeof(unsigned int) * 2)
 		return -EINVAL;
+	if (!tlv.numid)
+		return -EINVAL;
 	down_read(&card->controls_rwsem);
 	kctl = snd_ctl_find_numid(card, tlv.numid);
 	if (kctl == NULL) {
-- 
2.7.1

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

* [PATCH 3.12 14/64] ASoC: wm8962: correct addresses for HPF_C_0/1
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (12 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 13/64] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0 Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 15/64] ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz Jiri Slaby
                   ` (53 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Sachin Pandhare, Mark Brown, Jiri Slaby

From: Sachin Pandhare <sachinpandhare@gmail.com>

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

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

commit e9f96bc53c1b959859599cb30ce6fd4fbb4448c2 upstream.

>From datasheet:
R17408 (4400h) HPF_C_1
R17409 (4401h) HPF_C_0
17048 -> 17408 (0x4400)
17049 -> 17409 (0x4401)

Signed-off-by: Sachin Pandhare <sachinpandhare@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/codecs/wm8962.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index ea16dc456352..c2cd83d8ed97 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -364,8 +364,8 @@ static struct reg_default wm8962_reg[] = {
 	{ 16924, 0x0059 },   /* R16924 - HDBASS_PG_1 */
 	{ 16925, 0x999A },   /* R16925 - HDBASS_PG_0 */
 
-	{ 17048, 0x0083 },   /* R17408 - HPF_C_1 */
-	{ 17049, 0x98AD },   /* R17409 - HPF_C_0 */
+	{ 17408, 0x0083 },   /* R17408 - HPF_C_1 */
+	{ 17409, 0x98AD },   /* R17409 - HPF_C_0 */
 
 	{ 17920, 0x007F },   /* R17920 - ADCL_RETUNE_C1_1 */
 	{ 17921, 0xFFFF },   /* R17921 - ADCL_RETUNE_C1_0 */
-- 
2.7.1

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

* [PATCH 3.12 15/64] ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (13 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 14/64] ASoC: wm8962: correct addresses for HPF_C_0/1 Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 16/64] ASoC: compress: Fix compress device direction check Jiri Slaby
                   ` (52 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nikesh Oswal, Charles Keepax, Mark Brown, Jiri Slaby

From: Nikesh Oswal <Nikesh.Oswal@cirrus.com>

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

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

commit e73694d871867cae8471d2350ce89acb38bc2b63 upstream.

For a sample rate of 12kHz the bclk was taken from the 44.1kHz table as
we test for a multiple of 8kHz. This patch fixes this issue by testing
for multiples of 4kHz instead.

Signed-off-by: Nikesh Oswal <Nikesh.Oswal@cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/codecs/arizona.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index f38ed4d225ca..26a5925b5c51 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1120,7 +1120,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
 	int chan_limit = arizona->pdata.max_channels_clocked[dai->id - 1];
 	int bclk, lrclk, wl, frame, bclk_target;
 
-	if (params_rate(params) % 8000)
+	if (params_rate(params) % 4000)
 		rates = &arizona_44k1_bclk_rates[0];
 	else
 		rates = &arizona_48k_bclk_rates[0];
-- 
2.7.1

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

* [PATCH 3.12 16/64] ASoC: compress: Fix compress device direction check
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (14 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 15/64] ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 17/64] usb: xhci: fix config fail of FS hub behind a HS hub with MTT Jiri Slaby
                   ` (51 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vinod Koul, Mark Brown, Jiri Slaby

From: Vinod Koul <vinod.koul@intel.com>

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

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

commit a1068045883ed4a18363a4ebad0c3d55e473b716 upstream.

The detection of direction for compress was only taking into account codec
capabilities and not CPU ones. Fix this by checking the CPU side capabilities
as well

Tested-by: Ashish Panwar <ashish.panwar@intel.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/soc/soc-compress.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 53c9ecdd119f..2868a17ff9a8 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -385,17 +385,34 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
 	struct snd_compr *compr;
 	char new_name[64];
 	int ret = 0, direction = 0;
+	int playback = 0, capture = 0;
 
 	/* check client and interface hw capabilities */
 	snprintf(new_name, sizeof(new_name), "%s %s-%d",
 			rtd->dai_link->stream_name, codec_dai->name, num);
 
 	if (codec_dai->driver->playback.channels_min)
+		playback = 1;
+	if (codec_dai->driver->capture.channels_min)
+		capture = 1;
+
+	capture = capture && cpu_dai->driver->capture.channels_min;
+	playback = playback && cpu_dai->driver->playback.channels_min;
+
+	/*
+	 * Compress devices are unidirectional so only one of the directions
+	 * should be set, check for that (xor)
+	 */
+	if (playback + capture != 1) {
+		dev_err(rtd->card->dev, "Invalid direction for compress P %d, C %d\n",
+				playback, capture);
+		return -EINVAL;
+	}
+
+	if(playback)
 		direction = SND_COMPRESS_PLAYBACK;
-	else if (codec_dai->driver->capture.channels_min)
-		direction = SND_COMPRESS_CAPTURE;
 	else
-		return -EINVAL;
+		direction = SND_COMPRESS_CAPTURE;
 
 	compr = kzalloc(sizeof(*compr), GFP_KERNEL);
 	if (compr == NULL) {
-- 
2.7.1

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

* [PATCH 3.12 17/64] usb: xhci: fix config fail of FS hub behind a HS hub with MTT
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (15 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 16/64] ASoC: compress: Fix compress device direction check Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 18/64] USB: ipaq.c: fix a timeout loop Jiri Slaby
                   ` (50 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Chunfeng Yun, Mathias Nyman, Jiri Slaby

From: Chunfeng Yun <chunfeng.yun@mediatek.com>

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

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

commit 096b110a3dd3c868e4610937c80d2e3f3357c1a9 upstream.

if a full speed hub connects to a high speed hub which
supports MTT, the MTT field of its slot context will be set
to 1 when xHCI driver setups an xHCI virtual device in
xhci_setup_addressable_virt_dev(); once usb core fetch its
hub descriptor, and need to update the xHC's internal data
structures for the device, the HUB field of its slot context
will be set to 1 too, meanwhile MTT is also set before,
this will cause configure endpoint command fail, so in the
case, we should clear MTT to 0 for full speed hub according
to section 6.2.2

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 3d98a3a82c79..47b25542a99c 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4696,8 +4696,16 @@ int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev,
 	ctrl_ctx->add_flags |= cpu_to_le32(SLOT_FLAG);
 	slot_ctx = xhci_get_slot_ctx(xhci, config_cmd->in_ctx);
 	slot_ctx->dev_info |= cpu_to_le32(DEV_HUB);
+	/*
+	 * refer to section 6.2.2: MTT should be 0 for full speed hub,
+	 * but it may be already set to 1 when setup an xHCI virtual
+	 * device, so clear it anyway.
+	 */
 	if (tt->multi)
 		slot_ctx->dev_info |= cpu_to_le32(DEV_MTT);
+	else if (hdev->speed == USB_SPEED_FULL)
+		slot_ctx->dev_info &= cpu_to_le32(~DEV_MTT);
+
 	if (xhci->hci_version > 0x95) {
 		xhci_dbg(xhci, "xHCI version %x needs hub "
 				"TT think time and number of ports\n",
-- 
2.7.1

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

* [PATCH 3.12 18/64] USB: ipaq.c: fix a timeout loop
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (16 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 17/64] usb: xhci: fix config fail of FS hub behind a HS hub with MTT Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 19/64] USB: cp210x: add ID for ELV Marble Sound Board 1 Jiri Slaby
                   ` (49 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dan Carpenter, Jiri Slaby

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

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

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

commit abdc9a3b4bac97add99e1d77dc6d28623afe682b upstream.

The code expects the loop to end with "retries" set to zero but, because
it is a post-op, it will end set to -1.  I have fixed this by moving the
decrement inside the loop.

Fixes: 014aa2a3c32e ('USB: ipaq: minor ipaq_open() cleanup.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/ipaq.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c
index 76c9a847da5d..e03900e8c667 100644
--- a/drivers/usb/serial/ipaq.c
+++ b/drivers/usb/serial/ipaq.c
@@ -532,7 +532,8 @@ static int ipaq_open(struct tty_struct *tty,
 	 * through. Since this has a reasonably high failure rate, we retry
 	 * several times.
 	 */
-	while (retries--) {
+	while (retries) {
+		retries--;
 		result = usb_control_msg(serial->dev,
 				usb_sndctrlpipe(serial->dev, 0), 0x22, 0x21,
 				0x1, 0, NULL, 0, 100);
-- 
2.7.1

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

* [PATCH 3.12 19/64] USB: cp210x: add ID for ELV Marble Sound Board 1
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (17 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 18/64] USB: ipaq.c: fix a timeout loop Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 20/64] xhci: refuse loading if nousb is used Jiri Slaby
                   ` (48 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Oliver Freyermuth, Johan Hovold, Jiri Slaby

From: Oliver Freyermuth <o.freyermuth@googlemail.com>

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

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

commit f7d7f59ab124748156ea551edf789994f05da342 upstream.

Add the USB device ID for ELV Marble Sound Board 1.

Signed-off-by: Oliver Freyermuth <o.freyermuth@googlemail.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/cp210x.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 3597be0a5ae4..9a3c0f76db8c 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -160,6 +160,7 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
 	{ USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
 	{ USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
+	{ USB_DEVICE(0x18EF, 0xE025) }, /* ELV Marble Sound Board 1 */
 	{ USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
 	{ USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */
 	{ USB_DEVICE(0x1BA4, 0x0002) },	/* Silicon Labs 358x factory default */
-- 
2.7.1

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

* [PATCH 3.12 20/64] xhci: refuse loading if nousb is used
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (18 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 19/64] USB: cp210x: add ID for ELV Marble Sound Board 1 Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-16  3:06   ` Ben Hutchings
  2016-02-11 13:58 ` [PATCH 3.12 21/64] ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h Jiri Slaby
                   ` (47 subsequent siblings)
  67 siblings, 1 reply; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Oliver Neukum, Jiri Slaby

From: Oliver Neukum <oneukum@suse.com>

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

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

commit 1eaf35e4dd592c59041bc1ed3248c46326da1f5f upstream.

The module should fail to load.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 47b25542a99c..6888e9a956d4 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4891,6 +4891,10 @@ static int __init xhci_hcd_init(void)
 	BUILD_BUG_ON(sizeof(struct xhci_intr_reg) != 8*32/8);
 	/* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */
 	BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
+
+	if (usb_disabled())
+		return -ENODEV;
+
 	return 0;
 unreg_pci:
 	xhci_unregister_pci();
-- 
2.7.1

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

* [PATCH 3.12 21/64] ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (19 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 20/64] xhci: refuse loading if nousb is used Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 22/64] ARM: 8160/1: drop warning about return_address not using unwind tables Jiri Slaby
                   ` (46 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Behan Webster, Russell King, Jiri Slaby

From: Behan Webster <behanw@converseincode.com>

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

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

commit aeea3592a13bf12861943e44fc48f1f270941f8d upstream.

With compilers which follow the C99 standard (like modern versions of gcc and
clang), "extern inline" does the wrong thing (emits code for an externally
linkable version of the inline function). In this case using static inline
and removing the NULL version of return_address in return_address.c does
the right thing.

Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/include/asm/ftrace.h    | 2 +-
 arch/arm/kernel/return_address.c | 5 -----
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/arm/include/asm/ftrace.h b/arch/arm/include/asm/ftrace.h
index f89515adac60..2bb8cac28b9e 100644
--- a/arch/arm/include/asm/ftrace.h
+++ b/arch/arm/include/asm/ftrace.h
@@ -45,7 +45,7 @@ void *return_address(unsigned int);
 
 #else
 
-extern inline void *return_address(unsigned int level)
+static inline void *return_address(unsigned int level)
 {
 	return NULL;
 }
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index fafedd86885d..f6aa84d5b93c 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -63,11 +63,6 @@ void *return_address(unsigned int level)
 #warning "TODO: return_address should use unwind tables"
 #endif
 
-void *return_address(unsigned int level)
-{
-	return NULL;
-}
-
 #endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
 
 EXPORT_SYMBOL_GPL(return_address);
-- 
2.7.1

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

* [PATCH 3.12 22/64] ARM: 8160/1: drop warning about return_address not using unwind tables
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (20 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 21/64] ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 23/64] drm/radeon: cypress_dpm: Fix unused variable warning when CONFIG_ACPI=n Jiri Slaby
                   ` (45 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Uwe Kleine-König, Russell King, Jiri Slaby

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

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

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

commit e16343c47e4276f5ebc77ca16feb5e50ca1918f9 upstream.

The warning was introduced in 2009 (commit 4bf1fa5a34aa ([ARM] 5613/1:
implement CALLER_ADDRESSx)). The only "problem" here is that
CALLER_ADDRESSx for x > 1 returns NULL which doesn't do much harm.

The drawback of implementing a fix (i.e. use unwind tables to implement CALLER_ADDRESSx) is that much of the unwinder code would need to be marked as not
traceable.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/kernel/return_address.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index f6aa84d5b93c..98ea4b7eb406 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -59,10 +59,6 @@ void *return_address(unsigned int level)
 
 #else /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */
 
-#if defined(CONFIG_ARM_UNWIND)
-#warning "TODO: return_address should use unwind tables"
-#endif
-
 #endif /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) / else */
 
 EXPORT_SYMBOL_GPL(return_address);
-- 
2.7.1

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

* [PATCH 3.12 23/64] drm/radeon: cypress_dpm: Fix unused variable warning when CONFIG_ACPI=n
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (21 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 22/64] ARM: 8160/1: drop warning about return_address not using unwind tables Jiri Slaby
@ 2016-02-11 13:58 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 24/64] drm: radeon: ni_dpm: " Jiri Slaby
                   ` (44 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:58 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alex Deucher, Jiri Slaby

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

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

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

commit 936b32643cb03dcb34ef5dab81970229b1cc2a33 upstream.

With CONFIG_ACPI=n the following build warning is seen:

drivers/gpu/drm/radeon/cypress_dpm.c:302:31: warning: unused variable 'eg_pi' [-Wunused-variable]

Protect eg_pi with CONFIG_ACPI.

Based on patch from: Fabio Estevam <fabio.estevam@freescale.com>
but doesn't mix allocation and code.

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

diff --git a/drivers/gpu/drm/radeon/cypress_dpm.c b/drivers/gpu/drm/radeon/cypress_dpm.c
index 7143783fb237..b5a00771f27a 100644
--- a/drivers/gpu/drm/radeon/cypress_dpm.c
+++ b/drivers/gpu/drm/radeon/cypress_dpm.c
@@ -299,7 +299,9 @@ void cypress_program_response_times(struct radeon_device *rdev)
 static int cypress_pcie_performance_request(struct radeon_device *rdev,
 					    u8 perf_req, bool advertise)
 {
+#if defined(CONFIG_ACPI)
 	struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
+#endif
 	u32 tmp;
 
 	udelay(10);
-- 
2.7.1

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

* [PATCH 3.12 24/64] drm: radeon: ni_dpm: Fix unused variable warning when CONFIG_ACPI=n
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (22 preceding siblings ...)
  2016-02-11 13:58 ` [PATCH 3.12 23/64] drm/radeon: cypress_dpm: Fix unused variable warning when CONFIG_ACPI=n Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 25/64] lkdtm: adjust recursion size to avoid warnings Jiri Slaby
                   ` (43 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Fabio Estevam, Alex Deucher, Jiri Slaby

From: Fabio Estevam <fabio.estevam@freescale.com>

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

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

commit 71473dbd66d4a61be4cd531ef96b4877f6ee3941 upstream.

With CONFIG_ACPI=n the following build warning is seen:

drivers/gpu/drm/radeon/ni_dpm.c:3448:31: warning: unused variable 'eg_pi' [-Wunused-variable]

Move the definition of eg_pi inside the CONFIG_ACPI 'if' block.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/radeon/ni_dpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dpm.c
index 85f36e702595..89bdc12adebb 100644
--- a/drivers/gpu/drm/radeon/ni_dpm.c
+++ b/drivers/gpu/drm/radeon/ni_dpm.c
@@ -3445,9 +3445,9 @@ static int ni_enable_smc_cac(struct radeon_device *rdev,
 static int ni_pcie_performance_request(struct radeon_device *rdev,
 				       u8 perf_req, bool advertise)
 {
+#if defined(CONFIG_ACPI)
 	struct evergreen_power_info *eg_pi = evergreen_get_pi(rdev);
 
-#if defined(CONFIG_ACPI)
 	if ((perf_req == PCIE_PERF_REQ_PECI_GEN1) ||
             (perf_req == PCIE_PERF_REQ_PECI_GEN2)) {
 		if (eg_pi->pcie_performance_request_registered == false)
-- 
2.7.1

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

* [PATCH 3.12 25/64] lkdtm: adjust recursion size to avoid warnings
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (23 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 24/64] drm: radeon: ni_dpm: " Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 26/64] RDMA/cxgb4: Fix gcc warning on 32-bit arch Jiri Slaby
                   ` (42 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Kees Cook, Greg Kroah-Hartman, Jiri Slaby

From: Kees Cook <keescook@chromium.org>

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

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

commit 7d196ac303652588c60350f0a581d71e2e7b1a50 upstream.

When CONFIG_FRAME_WARN is set low (e.g. some ARM builds), the hard-coded
stack buffer size used for kernel stack over run testing triggers build
warnings. Instead, avoid the warning by recalcuating the buffer size and
recursion count needed to trigger the test. Also uses the recursion counter
indirectly to avoid changing the parameter during the test.

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/misc/lkdtm.c | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/misc/lkdtm.c b/drivers/misc/lkdtm.c
index 9cbd0370ca44..482344242f94 100644
--- a/drivers/misc/lkdtm.c
+++ b/drivers/misc/lkdtm.c
@@ -49,8 +49,19 @@
 #include <linux/ide.h>
 #endif
 
+/*
+ * Make sure our attempts to over run the kernel stack doesn't trigger
+ * a compiler warning when CONFIG_FRAME_WARN is set. Then make sure we
+ * recurse past the end of THREAD_SIZE by default.
+ */
+#if defined(CONFIG_FRAME_WARN) && (CONFIG_FRAME_WARN > 0)
+#define REC_STACK_SIZE (CONFIG_FRAME_WARN / 2)
+#else
+#define REC_STACK_SIZE (THREAD_SIZE / 8)
+#endif
+#define REC_NUM_DEFAULT ((THREAD_SIZE / REC_STACK_SIZE) * 2)
+
 #define DEFAULT_COUNT 10
-#define REC_NUM_DEFAULT 10
 #define EXEC_SIZE 64
 
 enum cname {
@@ -140,8 +151,7 @@ static DEFINE_SPINLOCK(lock_me_up);
 static u8 data_area[EXEC_SIZE];
 
 module_param(recur_count, int, 0644);
-MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test, "\
-				 "default is 10");
+MODULE_PARM_DESC(recur_count, " Recursion level for the stack overflow test");
 module_param(cpoint_name, charp, 0444);
 MODULE_PARM_DESC(cpoint_name, " Crash Point, where kernel is to be crashed");
 module_param(cpoint_type, charp, 0444);
@@ -280,16 +290,16 @@ static int lkdtm_parse_commandline(void)
 	return -EINVAL;
 }
 
-static int recursive_loop(int a)
+static int recursive_loop(int remaining)
 {
-	char buf[1024];
+	char buf[REC_STACK_SIZE];
 
-	memset(buf,0xFF,1024);
-	recur_count--;
-	if (!recur_count)
+	/* Make sure compiler does not optimize this away. */
+	memset(buf, (remaining & 0xff) | 0x1, REC_STACK_SIZE);
+	if (!remaining)
 		return 0;
 	else
-        	return recursive_loop(a);
+		return recursive_loop(remaining - 1);
 }
 
 static void do_nothing(void)
@@ -333,7 +343,7 @@ static void lkdtm_do_action(enum ctype which)
 			;
 		break;
 	case CT_OVERFLOW:
-		(void) recursive_loop(0);
+		(void) recursive_loop(recur_count);
 		break;
 	case CT_CORRUPT_STACK:
 		corrupt_stack();
-- 
2.7.1

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

* [PATCH 3.12 26/64] RDMA/cxgb4: Fix gcc warning on 32-bit arch
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (24 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 25/64] lkdtm: adjust recursion size to avoid warnings Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 27/64] mISDN: avoid arch specific __builtin_return_address call Jiri Slaby
                   ` (41 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Paul Bolle, Roland Dreier, Jiri Slaby

From: Paul Bolle <pebolle@tiscali.nl>

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

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

commit 298589b1cb626adf4beba6dd8e3cd4b64e8799be upstream.

Building mem.o for 32 bits x86 triggers a GCC warning:

    drivers/infiniband/hw/cxgb4/mem.c: In function '_c4iw_write_mem_dma_aligned':
    drivers/infiniband/hw/cxgb4/mem.c:79:25: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]

Silence that warning by casting "&wr_wait" to unsigned long before
casting it to __be64.  That's what _c4iw_write_mem_inline() already does.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Acked-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/hw/cxgb4/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index 4cb8eb24497c..a80503b3795c 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -76,7 +76,7 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr,
 	INIT_ULPTX_WR(req, wr_len, 0, 0);
 	req->wr.wr_hi = cpu_to_be32(FW_WR_OP(FW_ULPTX_WR) |
 			(wait ? FW_WR_COMPL(1) : 0));
-	req->wr.wr_lo = wait ? (__force __be64)&wr_wait : 0;
+	req->wr.wr_lo = wait ? (__force __be64)(unsigned long) &wr_wait : 0L;
 	req->wr.wr_mid = cpu_to_be32(FW_WR_LEN16(DIV_ROUND_UP(wr_len, 16)));
 	req->cmd = cpu_to_be32(ULPTX_CMD(ULP_TX_MEM_WRITE));
 	req->cmd |= cpu_to_be32(V_T5_ULP_MEMIO_ORDER(1));
-- 
2.7.1

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

* [PATCH 3.12 27/64] mISDN: avoid arch specific __builtin_return_address call
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (25 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 26/64] RDMA/cxgb4: Fix gcc warning on 32-bit arch Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 28/64] veth: don’t modify ip_summed; doing so treats packets with bad checksums as good Jiri Slaby
                   ` (40 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Arnd Bergmann, David S . Miller, Jiri Slaby

From: Arnd Bergmann <arnd@arndb.de>

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

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

commit 3e7a8716e20b759eec0ad88145255bb33174f0c8 upstream.

Not all architectures are able to call __builtin_return_address().
On ARM, the mISDN code produces this warning:

hardware/mISDN/w6692.c: In function 'w6692_dctrl':
hardware/mISDN/w6692.c:1181:75: warning: unsupported argument to '__builtin_return_address'
  pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__,
                                                                           ^
hardware/mISDN/mISDNipac.c: In function 'open_dchannel':
hardware/mISDN/mISDNipac.c:759:75: warning: unsupported argument to '__builtin_return_address'
  pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__,
                                                                           ^

In a lot of cases, this is relatively easy to work around by
passing the value of __builtin_return_address(0) from the
callers into the functions that want it. One exception is
the indirect 'open' function call in struct isac_hw. While it
would be possible to fix this as well, this patch only addresses
the other callers properly and lets this one return the direct
parent function, which should be good enough.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/isdn/hardware/mISDN/mISDNipac.c | 12 +++++++++---
 drivers/isdn/hardware/mISDN/w6692.c     |  6 +++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c b/drivers/isdn/hardware/mISDN/mISDNipac.c
index ccd7d851be26..a77eea594b69 100644
--- a/drivers/isdn/hardware/mISDN/mISDNipac.c
+++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
@@ -754,10 +754,10 @@ dbusy_timer_handler(struct isac_hw *isac)
 }
 
 static int
-open_dchannel(struct isac_hw *isac, struct channel_req *rq)
+open_dchannel_caller(struct isac_hw *isac, struct channel_req *rq, void *caller)
 {
 	pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__,
-		 isac->dch.dev.id, __builtin_return_address(1));
+		 isac->dch.dev.id, caller);
 	if (rq->protocol != ISDN_P_TE_S0)
 		return -EINVAL;
 	if (rq->adr.channel == 1)
@@ -771,6 +771,12 @@ open_dchannel(struct isac_hw *isac, struct channel_req *rq)
 	return 0;
 }
 
+static int
+open_dchannel(struct isac_hw *isac, struct channel_req *rq)
+{
+	return open_dchannel_caller(isac, rq, __builtin_return_address(0));
+}
+
 static const char *ISACVer[] =
 {"2086/2186 V1.1", "2085 B1", "2085 B2",
  "2085 V2.3"};
@@ -1548,7 +1554,7 @@ ipac_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
 	case OPEN_CHANNEL:
 		rq = arg;
 		if (rq->protocol == ISDN_P_TE_S0)
-			err = open_dchannel(isac, rq);
+			err = open_dchannel_caller(isac, rq, __builtin_return_address(0));
 		else
 			err = open_bchannel(ipac, rq);
 		if (err)
diff --git a/drivers/isdn/hardware/mISDN/w6692.c b/drivers/isdn/hardware/mISDN/w6692.c
index de69f6828c76..741675525b53 100644
--- a/drivers/isdn/hardware/mISDN/w6692.c
+++ b/drivers/isdn/hardware/mISDN/w6692.c
@@ -1176,10 +1176,10 @@ w6692_l1callback(struct dchannel *dch, u32 cmd)
 }
 
 static int
-open_dchannel(struct w6692_hw *card, struct channel_req *rq)
+open_dchannel(struct w6692_hw *card, struct channel_req *rq, void *caller)
 {
 	pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__,
-		 card->dch.dev.id, __builtin_return_address(1));
+		 card->dch.dev.id, caller);
 	if (rq->protocol != ISDN_P_TE_S0)
 		return -EINVAL;
 	if (rq->adr.channel == 1)
@@ -1207,7 +1207,7 @@ w6692_dctrl(struct mISDNchannel *ch, u32 cmd, void *arg)
 	case OPEN_CHANNEL:
 		rq = arg;
 		if (rq->protocol == ISDN_P_TE_S0)
-			err = open_dchannel(card, rq);
+			err = open_dchannel(card, rq, __builtin_return_address(0));
 		else
 			err = open_bchannel(card, rq);
 		if (err)
-- 
2.7.1

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

* [PATCH 3.12 28/64] veth: don’t modify ip_summed; doing so treats packets with bad checksums as good.
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (26 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 27/64] mISDN: avoid arch specific __builtin_return_address call Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 29/64] ipv6/addrlabel: fix ip6addrlbl_get() Jiri Slaby
                   ` (39 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Vijay Pandurangan, Evan Jones, Nicolas Dichtel,
	Phil Sutter, Toshiaki Makita, netdev, David S . Miller,
	Jiri Slaby

From: Vijay Pandurangan <vijayp@vijayp.ca>

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

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

[ Upstream commit ce8c839b74e3017996fad4e1b7ba2e2625ede82f ]

Packets that arrive from real hardware devices have ip_summed ==
CHECKSUM_UNNECESSARY if the hardware verified the checksums, or
CHECKSUM_NONE if the packet is bad or it was unable to verify it. The
current version of veth will replace CHECKSUM_NONE with
CHECKSUM_UNNECESSARY, which causes corrupt packets routed from hardware to
a veth device to be delivered to the application. This caused applications
at Twitter to receive corrupt data when network hardware was corrupting
packets.

We believe this was added as an optimization to skip computing and
verifying checksums for communication between containers. However, locally
generated packets have ip_summed == CHECKSUM_PARTIAL, so the code as
written does nothing for them. As far as we can tell, after removing this
code, these packets are transmitted from one stack to another unmodified
(tcpdump shows invalid checksums on both sides, as expected), and they are
delivered correctly to applications. We didn’t test every possible network
configuration, but we tried a few common ones such as bridging containers,
using NAT between the host and a container, and routing from hardware
devices to containers. We have effectively deployed this in production at
Twitter (by disabling RX checksum offloading on veth devices).

This code dates back to the first version of the driver, commit
<e314dbdc1c0dc6a548ecf> ("[NET]: Virtual ethernet device driver"), so I
suspect this bug occurred mostly because the driver API has evolved
significantly since then. Commit <0b7967503dc97864f283a> ("net/veth: Fix
packet checksumming") (in December 2010) fixed this for packets that get
created locally and sent to hardware devices, by not changing
CHECKSUM_PARTIAL. However, the same issue still occurs for packets coming
in from hardware devices.

Co-authored-by: Evan Jones <ej@evanjones.ca>
Signed-off-by: Evan Jones <ej@evanjones.ca>
Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Cc: Phil Sutter <phil@nwl.cc>
Cc: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Vijay Pandurangan <vijayp@vijayp.ca>
Acked-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/veth.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 61c4044f644e..917abeae77ad 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -116,12 +116,6 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 		kfree_skb(skb);
 		goto drop;
 	}
-	/* don't change ip_summed == CHECKSUM_PARTIAL, as that
-	 * will cause bad checksum on forwarded packets
-	 */
-	if (skb->ip_summed == CHECKSUM_NONE &&
-	    rcv->features & NETIF_F_RXCSUM)
-		skb->ip_summed = CHECKSUM_UNNECESSARY;
 
 	if (likely(dev_forward_skb(rcv, skb) == NET_RX_SUCCESS)) {
 		struct pcpu_vstats *stats = this_cpu_ptr(dev->vstats);
-- 
2.7.1

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

* [PATCH 3.12 29/64] ipv6/addrlabel: fix ip6addrlbl_get()
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (27 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 28/64] veth: don’t modify ip_summed; doing so treats packets with bad checksums as good Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 30/64] sctp: sctp should release assoc when sctp_make_abort_user return NULL in sctp_close Jiri Slaby
                   ` (38 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Andrey Ryabinin, David S . Miller, Jiri Slaby

From: Andrey Ryabinin <aryabinin@virtuozzo.com>

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

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

[ Upstream commit e459dfeeb64008b2d23bdf600f03b3605dbb8152 ]

ip6addrlbl_get() has never worked. If ip6addrlbl_hold() succeeded,
ip6addrlbl_get() will exit with '-ESRCH'. If ip6addrlbl_hold() failed,
ip6addrlbl_get() will use about to be free ip6addrlbl_entry pointer.

Fix this by inverting ip6addrlbl_hold() check.

Fixes: 2a8cc6c89039 ("[IPV6] ADDRCONF: Support RFC3484 configurable address selection policy table.")
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Reviewed-by: Cong Wang <cwang@twopensource.com>
Acked-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv6/addrlabel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv6/addrlabel.c b/net/ipv6/addrlabel.c
index b30ad3741b46..d5c918975c8c 100644
--- a/net/ipv6/addrlabel.c
+++ b/net/ipv6/addrlabel.c
@@ -558,7 +558,7 @@ static int ip6addrlbl_get(struct sk_buff *in_skb, struct nlmsghdr* nlh)
 
 	rcu_read_lock();
 	p = __ipv6_addr_label(net, addr, ipv6_addr_type(addr), ifal->ifal_index);
-	if (p && ip6addrlbl_hold(p))
+	if (p && !ip6addrlbl_hold(p))
 		p = NULL;
 	lseq = ip6addrlbl_table.seq;
 	rcu_read_unlock();
-- 
2.7.1

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

* [PATCH 3.12 30/64] sctp: sctp should release assoc when sctp_make_abort_user return NULL in sctp_close
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (28 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 29/64] ipv6/addrlabel: fix ip6addrlbl_get() Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 31/64] connector: bump skb->users before callback invocation Jiri Slaby
                   ` (37 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Xin Long, David S . Miller, Jiri Slaby

From: Xin Long <lucien.xin@gmail.com>

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

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

[ Upstream commit 068d8bd338e855286aea54e70d1c101569284b21 ]

In sctp_close, sctp_make_abort_user may return NULL because of memory
allocation failure. If this happens, it will bypass any state change
and never free the assoc. The assoc has no chance to be freed and it
will be kept in memory with the state it had even after the socket is
closed by sctp_close().

So if sctp_make_abort_user fails to allocate memory, we should abort
the asoc via sctp_primitive_ABORT as well. Just like the annotation in
sctp_sf_cookie_wait_prm_abort and sctp_sf_do_9_1_prm_abort said,
"Even if we can't send the ABORT due to low memory delete the TCB.
This is a departure from our typical NOMEM handling".

But then the chunk is NULL (low memory) and the SCTP_CMD_REPLY cmd would
dereference the chunk pointer, and system crash. So we should add
SCTP_CMD_REPLY cmd only when the chunk is not NULL, just like other
places where it adds SCTP_CMD_REPLY cmd.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/sctp/sm_statefuns.c | 6 ++++--
 net/sctp/socket.c       | 3 +--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index bf12098bbe1c..63a116c31a8b 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -4835,7 +4835,8 @@ sctp_disposition_t sctp_sf_do_9_1_prm_abort(
 
 	retval = SCTP_DISPOSITION_CONSUME;
 
-	sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
+	if (abort)
+		sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
 
 	/* Even if we can't send the ABORT due to low memory delete the
 	 * TCB.  This is a departure from our typical NOMEM handling.
@@ -4972,7 +4973,8 @@ sctp_disposition_t sctp_sf_cookie_wait_prm_abort(
 			SCTP_TO(SCTP_EVENT_TIMEOUT_T1_INIT));
 	retval = SCTP_DISPOSITION_CONSUME;
 
-	sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
+	if (abort)
+		sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(abort));
 
 	sctp_add_cmd_sf(commands, SCTP_CMD_NEW_STATE,
 			SCTP_STATE(SCTP_STATE_CLOSED));
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index e2b1da09dc79..9c47fbc5de0c 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1518,8 +1518,7 @@ static void sctp_close(struct sock *sk, long timeout)
 			struct sctp_chunk *chunk;
 
 			chunk = sctp_make_abort_user(asoc, NULL, 0);
-			if (chunk)
-				sctp_primitive_ABORT(net, asoc, chunk);
+			sctp_primitive_ABORT(net, asoc, chunk);
 		} else
 			sctp_primitive_SHUTDOWN(net, asoc, NULL);
 	}
-- 
2.7.1

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

* [PATCH 3.12 31/64] connector: bump skb->users before callback invocation
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (29 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 30/64] sctp: sctp should release assoc when sctp_make_abort_user return NULL in sctp_close Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets Jiri Slaby
                   ` (36 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Florian Westphal, David S . Miller, Jiri Slaby

From: Florian Westphal <fw@strlen.de>

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

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

[ Upstream commit 55285bf09427c5abf43ee1d54e892f352092b1f1 ]

Dmitry reports memleak with syskaller program.
Problem is that connector bumps skb usecount but might not invoke callback.

So move skb_get to where we invoke the callback.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/connector/connector.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index fb1bad083aa9..12e737e0a5af 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -160,26 +160,21 @@ static int cn_call_callback(struct sk_buff *skb)
  *
  * It checks skb, netlink header and msg sizes, and calls callback helper.
  */
-static void cn_rx_skb(struct sk_buff *__skb)
+static void cn_rx_skb(struct sk_buff *skb)
 {
 	struct nlmsghdr *nlh;
-	struct sk_buff *skb;
 	int len, err;
 
-	skb = skb_get(__skb);
-
 	if (skb->len >= NLMSG_HDRLEN) {
 		nlh = nlmsg_hdr(skb);
 		len = nlmsg_len(nlh);
 
 		if (len < (int)sizeof(struct cn_msg) ||
 		    skb->len < nlh->nlmsg_len ||
-		    len > CONNECTOR_MAX_MSG_SIZE) {
-			kfree_skb(skb);
+		    len > CONNECTOR_MAX_MSG_SIZE)
 			return;
-		}
 
-		err = cn_call_callback(skb);
+		err = cn_call_callback(skb_get(skb));
 		if (err < 0)
 			kfree_skb(skb);
 	}
-- 
2.7.1

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

* [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (30 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 31/64] connector: bump skb->users before callback invocation Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 17:32   ` Willy Tarreau
  2016-02-11 13:59 ` [PATCH 3.12 33/64] bridge: Only call /sbin/bridge-stp for the initial network namespace Jiri Slaby
                   ` (35 subsequent siblings)
  67 siblings, 1 reply; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, willy tarreau, David S . Miller, Jiri Slaby

From: willy tarreau <w@1wt.eu>

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

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

[ Upstream commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 ]

It is possible for a process to allocate and accumulate far more FDs than
the process' limit by sending them over a unix socket then closing them
to keep the process' fd count low.

This change addresses this problem by keeping track of the number of FDs
in flight per user and preventing non-privileged processes from having
more FDs in flight than their configured FD limit.

Reported-by: socketpair@gmail.com
Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Mitigates: CVE-2013-4312 (Linux 2.0+)
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/sched.h |  1 +
 net/unix/af_unix.c    | 24 ++++++++++++++++++++----
 net/unix/garbage.c    | 16 ++++++++++++----
 3 files changed, 33 insertions(+), 8 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index a4d7d19fc338..3ecea51ea060 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -664,6 +664,7 @@ struct user_struct {
 	unsigned long mq_bytes;	/* How many bytes can be allocated to mqueue? */
 #endif
 	unsigned long locked_shm; /* How many pages of mlocked shm ? */
+	unsigned long unix_inflight;	/* How many files in flight in unix sockets */
 
 #ifdef CONFIG_KEYS
 	struct key *uid_keyring;	/* UID specific keyring */
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 31b88dcb0f01..e6b021327c3a 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1484,6 +1484,21 @@ static void unix_destruct_scm(struct sk_buff *skb)
 	sock_wfree(skb);
 }
 
+/*
+ * The "user->unix_inflight" variable is protected by the garbage
+ * collection lock, and we just read it locklessly here. If you go
+ * over the limit, there might be a tiny race in actually noticing
+ * it across threads. Tough.
+ */
+static inline bool too_many_unix_fds(struct task_struct *p)
+{
+	struct user_struct *user = current_user();
+
+	if (unlikely(user->unix_inflight > task_rlimit(p, RLIMIT_NOFILE)))
+		return !capable(CAP_SYS_RESOURCE) && !capable(CAP_SYS_ADMIN);
+	return false;
+}
+
 #define MAX_RECURSION_LEVEL 4
 
 static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
@@ -1492,6 +1507,9 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
 	unsigned char max_level = 0;
 	int unix_sock_count = 0;
 
+	if (too_many_unix_fds(current))
+		return -ETOOMANYREFS;
+
 	for (i = scm->fp->count - 1; i >= 0; i--) {
 		struct sock *sk = unix_get_socket(scm->fp->fp[i]);
 
@@ -1513,10 +1531,8 @@ static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
 	if (!UNIXCB(skb).fp)
 		return -ENOMEM;
 
-	if (unix_sock_count) {
-		for (i = scm->fp->count - 1; i >= 0; i--)
-			unix_inflight(scm->fp->fp[i]);
-	}
+	for (i = scm->fp->count - 1; i >= 0; i--)
+		unix_inflight(scm->fp->fp[i]);
 	return max_level;
 }
 
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 9bc73f87f64a..06730fe6ad9d 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -125,9 +125,12 @@ struct sock *unix_get_socket(struct file *filp)
 void unix_inflight(struct file *fp)
 {
 	struct sock *s = unix_get_socket(fp);
+
+	spin_lock(&unix_gc_lock);
+
 	if (s) {
 		struct unix_sock *u = unix_sk(s);
-		spin_lock(&unix_gc_lock);
+
 		if (atomic_long_inc_return(&u->inflight) == 1) {
 			BUG_ON(!list_empty(&u->link));
 			list_add_tail(&u->link, &gc_inflight_list);
@@ -135,22 +138,27 @@ void unix_inflight(struct file *fp)
 			BUG_ON(list_empty(&u->link));
 		}
 		unix_tot_inflight++;
-		spin_unlock(&unix_gc_lock);
 	}
+	fp->f_cred->user->unix_inflight++;
+	spin_unlock(&unix_gc_lock);
 }
 
 void unix_notinflight(struct file *fp)
 {
 	struct sock *s = unix_get_socket(fp);
+
+	spin_lock(&unix_gc_lock);
+
 	if (s) {
 		struct unix_sock *u = unix_sk(s);
-		spin_lock(&unix_gc_lock);
+
 		BUG_ON(list_empty(&u->link));
 		if (atomic_long_dec_and_test(&u->inflight))
 			list_del_init(&u->link);
 		unix_tot_inflight--;
-		spin_unlock(&unix_gc_lock);
 	}
+	fp->f_cred->user->unix_inflight--;
+	spin_unlock(&unix_gc_lock);
 }
 
 static void scan_inflight(struct sock *x, void (*func)(struct unix_sock *),
-- 
2.7.1

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

* [PATCH 3.12 33/64] bridge: Only call /sbin/bridge-stp for the initial network namespace
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (31 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 34/64] net: sctp: prevent writes to cookie_hmac_alg from accessing invalid memory Jiri Slaby
                   ` (34 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Hannes Frederic Sowa, Eric W . Biederman,
	David S . Miller, Jiri Slaby

From: Hannes Frederic Sowa <hannes@stressinduktion.org>

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

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

[ Upstream commit ff62198553e43cdffa9d539f6165d3e83f8a42bc ]

[I stole this patch from Eric Biederman. He wrote:]

> There is no defined mechanism to pass network namespace information
> into /sbin/bridge-stp therefore don't even try to invoke it except
> for bridge devices in the initial network namespace.
>
> It is possible for unprivileged users to cause /sbin/bridge-stp to be
> invoked for any network device name which if /sbin/bridge-stp does not
> guard against unreasonable arguments or being invoked twice on the
> same network device could cause problems.

[Hannes: changed patch using netns_eq]

Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/bridge/br_stp_if.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/bridge/br_stp_if.c b/net/bridge/br_stp_if.c
index 886f6d6dc48a..3995a66c3e4e 100644
--- a/net/bridge/br_stp_if.c
+++ b/net/bridge/br_stp_if.c
@@ -128,7 +128,10 @@ static void br_stp_start(struct net_bridge *br)
 	char *argv[] = { BR_STP_PROG, br->dev->name, "start", NULL };
 	char *envp[] = { NULL };
 
-	r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC);
+	if (net_eq(dev_net(br->dev), &init_net))
+		r = call_usermodehelper(BR_STP_PROG, argv, envp, UMH_WAIT_PROC);
+	else
+		r = -ENOENT;
 
 	spin_lock_bh(&br->lock);
 
-- 
2.7.1

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

* [PATCH 3.12 34/64] net: sctp: prevent writes to cookie_hmac_alg from accessing invalid memory
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (32 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 33/64] bridge: Only call /sbin/bridge-stp for the initial network namespace Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 35/64] ipv6: tcp: add rcu locking in tcp_v6_send_synack() Jiri Slaby
                   ` (33 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Sasha Levin, David S . Miller, Jiri Slaby

From: Sasha Levin <sasha.levin@oracle.com>

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

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

[ Upstream commit 320f1a4a175e7cd5d3f006f92b4d4d3e2cbb7bb5 ]

proc_dostring() needs an initialized destination string, while the one
provided in proc_sctp_do_hmac_alg() contains stack garbage.

Thus, writing to cookie_hmac_alg would strlen() that garbage and end up
accessing invalid memory.

Fixes: 3c68198e7 ("sctp: Make hmac algorithm selection for cookie generation dynamic")
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/sctp/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sctp/sysctl.c b/net/sctp/sysctl.c
index 968355f0de60..596aa3c5321c 100644
--- a/net/sctp/sysctl.c
+++ b/net/sctp/sysctl.c
@@ -306,7 +306,7 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl,
 	struct ctl_table tbl;
 	bool changed = false;
 	char *none = "none";
-	char tmp[8];
+	char tmp[8] = {0};
 	int ret;
 
 	memset(&tbl, 0, sizeof(struct ctl_table));
-- 
2.7.1

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

* [PATCH 3.12 35/64] ipv6: tcp: add rcu locking in tcp_v6_send_synack()
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (33 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 34/64] net: sctp: prevent writes to cookie_hmac_alg from accessing invalid memory Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 36/64] tcp_yeah: don't set ssthresh below 2 Jiri Slaby
                   ` (32 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Eric Dumazet, David S . Miller, Jiri Slaby

From: Eric Dumazet <edumazet@google.com>

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

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

[ Upstream commit 3e4006f0b86a5ae5eb0e8215f9a9e1db24506977 ]

When first SYNACK is sent, we already hold rcu_read_lock(), but this
is not true if a SYNACK is retransmitted, as a timer (soft) interrupt
does not hold rcu_read_lock()

Fixes: 45f6fad84cc30 ("ipv6: add complete rcu protection around np->opt")
Reported-by: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv6/tcp_ipv6.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 90004c6e3bff..7138ee87e07c 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -484,8 +484,10 @@ static int tcp_v6_send_synack(struct sock *sk, struct dst_entry *dst,
 
 		fl6->daddr = treq->rmt_addr;
 		skb_set_queue_mapping(skb, queue_mapping);
+		rcu_read_lock();
 		err = ip6_xmit(sk, skb, fl6, rcu_dereference(np->opt),
 			       np->tclass);
+		rcu_read_unlock();
 		err = net_xmit_eval(err);
 	}
 
-- 
2.7.1

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

* [PATCH 3.12 36/64] tcp_yeah: don't set ssthresh below 2
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (34 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 35/64] ipv6: tcp: add rcu locking in tcp_v6_send_synack() Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 37/64] phonet: properly unshare skbs in phonet_rcv() Jiri Slaby
                   ` (31 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Neal Cardwell, Yuchung Cheng, Eric Dumazet,
	David S . Miller, Jiri Slaby

From: Neal Cardwell <ncardwell@google.com>

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

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

[ Upstream commit 83d15e70c4d8909d722c0d64747d8fb42e38a48f ]

For tcp_yeah, use an ssthresh floor of 2, the same floor used by Reno
and CUBIC, per RFC 5681 (equation 4).

tcp_yeah_ssthresh() was sometimes returning a 0 or negative ssthresh
value if the intended reduction is as big or bigger than the current
cwnd. Congestion control modules should never return a zero or
negative ssthresh. A zero ssthresh generally results in a zero cwnd,
causing the connection to stall. A negative ssthresh value will be
interpreted as a u32 and will set a target cwnd for PRR near 4
billion.

Oleksandr Natalenko reported that a system using tcp_yeah with ECN
could see a warning about a prior_cwnd of 0 in
tcp_cwnd_reduction(). Testing verified that this was due to
tcp_yeah_ssthresh() misbehaving in this way.

Reported-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/tcp_yeah.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c
index 05c3b6f0e8e1..bf8321d6f2ef 100644
--- a/net/ipv4/tcp_yeah.c
+++ b/net/ipv4/tcp_yeah.c
@@ -222,7 +222,7 @@ static u32 tcp_yeah_ssthresh(struct sock *sk) {
 	yeah->fast_count = 0;
 	yeah->reno_count = max(yeah->reno_count>>1, 2U);
 
-	return tp->snd_cwnd - reduction;
+	return max_t(int, tp->snd_cwnd - reduction, 2);
 }
 
 static struct tcp_congestion_ops tcp_yeah __read_mostly = {
-- 
2.7.1

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

* [PATCH 3.12 37/64] phonet: properly unshare skbs in phonet_rcv()
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (35 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 36/64] tcp_yeah: don't set ssthresh below 2 Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 38/64] ipv6: update skb->csum when CE mark is propagated Jiri Slaby
                   ` (30 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Eric Dumazet, Remi Denis-Courmont,
	David S . Miller, Jiri Slaby

From: Eric Dumazet <edumazet@google.com>

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

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

[ Upstream commit 7aaed57c5c2890634cfadf725173c7c68ea4cb4f ]

Ivaylo Dimitrov reported a regression caused by commit 7866a621043f
("dev: add per net_device packet type chains").

skb->dev becomes NULL and we crash in __netif_receive_skb_core().

Before above commit, different kind of bugs or corruptions could happen
without major crash.

But the root cause is that phonet_rcv() can queue skb without checking
if skb is shared or not.

Many thanks to Ivaylo Dimitrov for his help, diagnosis and tests.

Reported-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Remi Denis-Courmont <courmisch@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/phonet/af_phonet.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c
index 5a940dbd74a3..f0229223bf91 100644
--- a/net/phonet/af_phonet.c
+++ b/net/phonet/af_phonet.c
@@ -377,6 +377,10 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
 	struct sockaddr_pn sa;
 	u16 len;
 
+	skb = skb_share_check(skb, GFP_ATOMIC);
+	if (!skb)
+		return NET_RX_DROP;
+
 	/* check we have at least a full Phonet header */
 	if (!pskb_pull(skb, sizeof(struct phonethdr)))
 		goto out;
-- 
2.7.1

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

* [PATCH 3.12 38/64] ipv6: update skb->csum when CE mark is propagated
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (36 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 37/64] phonet: properly unshare skbs in phonet_rcv() Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 39/64] team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid Jiri Slaby
                   ` (29 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Eric Dumazet, David S . Miller, Jiri Slaby

From: Eric Dumazet <edumazet@google.com>

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

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

[ Upstream commit 34ae6a1aa0540f0f781dd265366036355fdc8930 ]

When a tunnel decapsulates the outer header, it has to comply
with RFC 6080 and eventually propagate CE mark into inner header.

It turns out IP6_ECN_set_ce() does not correctly update skb->csum
for CHECKSUM_COMPLETE packets, triggering infamous "hw csum failure"
messages and stack traces.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/net/inet_ecn.h       | 19 ++++++++++++++++---
 net/ipv6/xfrm6_mode_tunnel.c |  2 +-
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
index 3bd22795c3e2..194723c2e7bb 100644
--- a/include/net/inet_ecn.h
+++ b/include/net/inet_ecn.h
@@ -111,11 +111,24 @@ static inline void ipv4_copy_dscp(unsigned int dscp, struct iphdr *inner)
 
 struct ipv6hdr;
 
-static inline int IP6_ECN_set_ce(struct ipv6hdr *iph)
+/* Note:
+ * IP_ECN_set_ce() has to tweak IPV4 checksum when setting CE,
+ * meaning both changes have no effect on skb->csum if/when CHECKSUM_COMPLETE
+ * In IPv6 case, no checksum compensates the change in IPv6 header,
+ * so we have to update skb->csum.
+ */
+static inline int IP6_ECN_set_ce(struct sk_buff *skb, struct ipv6hdr *iph)
 {
+	__be32 from, to;
+
 	if (INET_ECN_is_not_ect(ipv6_get_dsfield(iph)))
 		return 0;
-	*(__be32*)iph |= htonl(INET_ECN_CE << 20);
+
+	from = *(__be32 *)iph;
+	to = from | htonl(INET_ECN_CE << 20);
+	*(__be32 *)iph = to;
+	if (skb->ip_summed == CHECKSUM_COMPLETE)
+		skb->csum = csum_add(csum_sub(skb->csum, from), to);
 	return 1;
 }
 
@@ -142,7 +155,7 @@ static inline int INET_ECN_set_ce(struct sk_buff *skb)
 	case cpu_to_be16(ETH_P_IPV6):
 		if (skb_network_header(skb) + sizeof(struct ipv6hdr) <=
 		    skb_tail_pointer(skb))
-			return IP6_ECN_set_ce(ipv6_hdr(skb));
+			return IP6_ECN_set_ce(skb, ipv6_hdr(skb));
 		break;
 	}
 
diff --git a/net/ipv6/xfrm6_mode_tunnel.c b/net/ipv6/xfrm6_mode_tunnel.c
index 4770d515c2c8..d43c9babc2b0 100644
--- a/net/ipv6/xfrm6_mode_tunnel.c
+++ b/net/ipv6/xfrm6_mode_tunnel.c
@@ -24,7 +24,7 @@ static inline void ipip6_ecn_decapsulate(struct sk_buff *skb)
 	struct ipv6hdr *inner_iph = ipipv6_hdr(skb);
 
 	if (INET_ECN_is_ce(ipv6_get_dsfield(outer_iph)))
-		IP6_ECN_set_ce(inner_iph);
+		IP6_ECN_set_ce(skb, inner_iph);
 }
 
 /* Add encapsulation header.
-- 
2.7.1

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

* [PATCH 3.12 39/64] team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (37 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 38/64] ipv6: update skb->csum when CE mark is propagated Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 40/64] xfrm: dst_entries_init() per-net dst_ops Jiri Slaby
                   ` (28 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ido Schimmel, David S . Miller, Jiri Slaby

From: Ido Schimmel <idosch@mellanox.com>

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

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

[ Upstream commit 60a6531bfe49555581ccd65f66a350cc5693fcde ]

We can't be within an RCU read-side critical section when deleting
VLANs, as underlying drivers might sleep during the hardware operation.
Therefore, replace the RCU critical section with a mutex. This is
consistent with team_vlan_rx_add_vid.

Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/team/team.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 020581ddfdd3..3059b8c3825f 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1831,10 +1831,10 @@ static int team_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid)
 	struct team *team = netdev_priv(dev);
 	struct team_port *port;
 
-	rcu_read_lock();
-	list_for_each_entry_rcu(port, &team->port_list, list)
+	mutex_lock(&team->lock);
+	list_for_each_entry(port, &team->port_list, list)
 		vlan_vid_del(port->dev, proto, vid);
-	rcu_read_unlock();
+	mutex_unlock(&team->lock);
 
 	return 0;
 }
-- 
2.7.1

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

* [PATCH 3.12 40/64] xfrm: dst_entries_init() per-net dst_ops
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (38 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 39/64] team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 41/64] powerpc/tm: Block signal return setting invalid MSR state Jiri Slaby
                   ` (27 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Dan Streetman, Dan Streetman, Steffen Klassert, Jiri Slaby

From: Dan Streetman <dan.streetman@canonical.com>

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

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

[ Upstream commit a8a572a6b5f2a79280d6e302cb3c1cb1fbaeb3e8 ]

Remove the dst_entries_init/destroy calls for xfrm4 and xfrm6 dst_ops
templates; their dst_entries counters will never be used.  Move the
xfrm dst_ops initialization from the common xfrm/xfrm_policy.c to
xfrm4/xfrm4_policy.c and xfrm6/xfrm6_policy.c, and call dst_entries_init
and dst_entries_destroy for each net namespace.

The ipv4 and ipv6 xfrms each create dst_ops template, and perform
dst_entries_init on the templates.  The template values are copied to each
net namespace's xfrm.xfrm*_dst_ops.  The problem there is the dst_ops
pcpuc_entries field is a percpu counter and cannot be used correctly by
simply copying it to another object.

The result of this is a very subtle bug; changes to the dst entries
counter from one net namespace may sometimes get applied to a different
net namespace dst entries counter.  This is because of how the percpu
counter works; it has a main count field as well as a pointer to the
percpu variables.  Each net namespace maintains its own main count
variable, but all point to one set of percpu variables.  When any net
namespace happens to change one of the percpu variables to outside its
small batch range, its count is moved to the net namespace's main count
variable.  So with multiple net namespaces operating concurrently, the
dst_ops entries counter can stray from the actual value that it should
be; if counts are consistently moved from one net namespace to another
(which my testing showed is likely), then one net namespace winds up
with a negative dst_ops count while another winds up with a continually
increasing count, eventually reaching its gc_thresh limit, which causes
all new traffic on the net namespace to fail with -ENOBUFS.

Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
Signed-off-by: Dan Streetman <ddstreet@ieee.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/xfrm4_policy.c | 46 +++++++++++++++++++++++++++++++++---------
 net/ipv6/xfrm6_policy.c | 53 +++++++++++++++++++++++++++++++++++--------------
 net/xfrm/xfrm_policy.c  | 38 -----------------------------------
 3 files changed, 75 insertions(+), 62 deletions(-)

diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index adf998322bd2..bb201660bd8a 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -230,7 +230,7 @@ static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
 	xfrm_dst_ifdown(dst, dev);
 }
 
-static struct dst_ops xfrm4_dst_ops = {
+static struct dst_ops xfrm4_dst_ops_template = {
 	.family =		AF_INET,
 	.protocol =		cpu_to_be16(ETH_P_IP),
 	.gc =			xfrm4_garbage_collect,
@@ -245,7 +245,7 @@ static struct dst_ops xfrm4_dst_ops = {
 
 static struct xfrm_policy_afinfo xfrm4_policy_afinfo = {
 	.family = 		AF_INET,
-	.dst_ops =		&xfrm4_dst_ops,
+	.dst_ops =		&xfrm4_dst_ops_template,
 	.dst_lookup =		xfrm4_dst_lookup,
 	.get_saddr =		xfrm4_get_saddr,
 	.decode_session =	_decode_session4,
@@ -267,7 +267,7 @@ static struct ctl_table xfrm4_policy_table[] = {
 	{ }
 };
 
-static int __net_init xfrm4_net_init(struct net *net)
+static int __net_init xfrm4_net_sysctl_init(struct net *net)
 {
 	struct ctl_table *table;
 	struct ctl_table_header *hdr;
@@ -295,7 +295,7 @@ err_alloc:
 	return -ENOMEM;
 }
 
-static void __net_exit xfrm4_net_exit(struct net *net)
+static void __net_exit xfrm4_net_sysctl_exit(struct net *net)
 {
 	struct ctl_table *table;
 
@@ -307,12 +307,44 @@ static void __net_exit xfrm4_net_exit(struct net *net)
 	if (!net_eq(net, &init_net))
 		kfree(table);
 }
+#else /* CONFIG_SYSCTL */
+static int inline xfrm4_net_sysctl_init(struct net *net)
+{
+	return 0;
+}
+
+static void inline xfrm4_net_sysctl_exit(struct net *net)
+{
+}
+#endif
+
+static int __net_init xfrm4_net_init(struct net *net)
+{
+	int ret;
+
+	memcpy(&net->xfrm.xfrm4_dst_ops, &xfrm4_dst_ops_template,
+	       sizeof(xfrm4_dst_ops_template));
+	ret = dst_entries_init(&net->xfrm.xfrm4_dst_ops);
+	if (ret)
+		return ret;
+
+	ret = xfrm4_net_sysctl_init(net);
+	if (ret)
+		dst_entries_destroy(&net->xfrm.xfrm4_dst_ops);
+
+	return ret;
+}
+
+static void __net_exit xfrm4_net_exit(struct net *net)
+{
+	xfrm4_net_sysctl_exit(net);
+	dst_entries_destroy(&net->xfrm.xfrm4_dst_ops);
+}
 
 static struct pernet_operations __net_initdata xfrm4_net_ops = {
 	.init	= xfrm4_net_init,
 	.exit	= xfrm4_net_exit,
 };
-#endif
 
 static void __init xfrm4_policy_init(void)
 {
@@ -321,12 +353,8 @@ static void __init xfrm4_policy_init(void)
 
 void __init xfrm4_init(void)
 {
-	dst_entries_init(&xfrm4_dst_ops);
-
 	xfrm4_state_init();
 	xfrm4_policy_init();
-#ifdef CONFIG_SYSCTL
 	register_pernet_subsys(&xfrm4_net_ops);
-#endif
 }
 
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index 550b195bb2fc..b2ea43167633 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -279,7 +279,7 @@ static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
 	xfrm_dst_ifdown(dst, dev);
 }
 
-static struct dst_ops xfrm6_dst_ops = {
+static struct dst_ops xfrm6_dst_ops_template = {
 	.family =		AF_INET6,
 	.protocol =		cpu_to_be16(ETH_P_IPV6),
 	.gc =			xfrm6_garbage_collect,
@@ -294,7 +294,7 @@ static struct dst_ops xfrm6_dst_ops = {
 
 static struct xfrm_policy_afinfo xfrm6_policy_afinfo = {
 	.family =		AF_INET6,
-	.dst_ops =		&xfrm6_dst_ops,
+	.dst_ops =		&xfrm6_dst_ops_template,
 	.dst_lookup =		xfrm6_dst_lookup,
 	.get_saddr = 		xfrm6_get_saddr,
 	.decode_session =	_decode_session6,
@@ -327,7 +327,7 @@ static struct ctl_table xfrm6_policy_table[] = {
 	{ }
 };
 
-static int __net_init xfrm6_net_init(struct net *net)
+static int __net_init xfrm6_net_sysctl_init(struct net *net)
 {
 	struct ctl_table *table;
 	struct ctl_table_header *hdr;
@@ -355,7 +355,7 @@ err_alloc:
 	return -ENOMEM;
 }
 
-static void __net_exit xfrm6_net_exit(struct net *net)
+static void __net_exit xfrm6_net_sysctl_exit(struct net *net)
 {
 	struct ctl_table *table;
 
@@ -367,31 +367,57 @@ static void __net_exit xfrm6_net_exit(struct net *net)
 	if (!net_eq(net, &init_net))
 		kfree(table);
 }
+#else /* CONFIG_SYSCTL */
+static int inline xfrm6_net_sysctl_init(struct net *net)
+{
+	return 0;
+}
+
+static void inline xfrm6_net_sysctl_exit(struct net *net)
+{
+}
+#endif
+
+static int __net_init xfrm6_net_init(struct net *net)
+{
+	int ret;
+
+	memcpy(&net->xfrm.xfrm6_dst_ops, &xfrm6_dst_ops_template,
+	       sizeof(xfrm6_dst_ops_template));
+	ret = dst_entries_init(&net->xfrm.xfrm6_dst_ops);
+	if (ret)
+		return ret;
+
+	ret = xfrm6_net_sysctl_init(net);
+	if (ret)
+		dst_entries_destroy(&net->xfrm.xfrm6_dst_ops);
+
+	return ret;
+}
+
+static void __net_exit xfrm6_net_exit(struct net *net)
+{
+	xfrm6_net_sysctl_exit(net);
+	dst_entries_destroy(&net->xfrm.xfrm6_dst_ops);
+}
 
 static struct pernet_operations xfrm6_net_ops = {
 	.init	= xfrm6_net_init,
 	.exit	= xfrm6_net_exit,
 };
-#endif
 
 int __init xfrm6_init(void)
 {
 	int ret;
 
-	dst_entries_init(&xfrm6_dst_ops);
-
 	ret = xfrm6_policy_init();
-	if (ret) {
-		dst_entries_destroy(&xfrm6_dst_ops);
+	if (ret)
 		goto out;
-	}
 	ret = xfrm6_state_init();
 	if (ret)
 		goto out_policy;
 
-#ifdef CONFIG_SYSCTL
 	register_pernet_subsys(&xfrm6_net_ops);
-#endif
 out:
 	return ret;
 out_policy:
@@ -401,10 +427,7 @@ out_policy:
 
 void xfrm6_fini(void)
 {
-#ifdef CONFIG_SYSCTL
 	unregister_pernet_subsys(&xfrm6_net_ops);
-#endif
 	xfrm6_policy_fini();
 	xfrm6_state_fini();
-	dst_entries_destroy(&xfrm6_dst_ops);
 }
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 57674ddc683d..5606e994f56e 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2724,7 +2724,6 @@ static struct neighbour *xfrm_neigh_lookup(const struct dst_entry *dst,
 
 int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
 {
-	struct net *net;
 	int err = 0;
 	if (unlikely(afinfo == NULL))
 		return -EINVAL;
@@ -2755,26 +2754,6 @@ int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
 	}
 	spin_unlock(&xfrm_policy_afinfo_lock);
 
-	rtnl_lock();
-	for_each_net(net) {
-		struct dst_ops *xfrm_dst_ops;
-
-		switch (afinfo->family) {
-		case AF_INET:
-			xfrm_dst_ops = &net->xfrm.xfrm4_dst_ops;
-			break;
-#if IS_ENABLED(CONFIG_IPV6)
-		case AF_INET6:
-			xfrm_dst_ops = &net->xfrm.xfrm6_dst_ops;
-			break;
-#endif
-		default:
-			BUG();
-		}
-		*xfrm_dst_ops = *afinfo->dst_ops;
-	}
-	rtnl_unlock();
-
 	return err;
 }
 EXPORT_SYMBOL(xfrm_policy_register_afinfo);
@@ -2810,22 +2789,6 @@ int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo)
 }
 EXPORT_SYMBOL(xfrm_policy_unregister_afinfo);
 
-static void __net_init xfrm_dst_ops_init(struct net *net)
-{
-	struct xfrm_policy_afinfo *afinfo;
-
-	rcu_read_lock();
-	afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET]);
-	if (afinfo)
-		net->xfrm.xfrm4_dst_ops = *afinfo->dst_ops;
-#if IS_ENABLED(CONFIG_IPV6)
-	afinfo = rcu_dereference(xfrm_policy_afinfo[AF_INET6]);
-	if (afinfo)
-		net->xfrm.xfrm6_dst_ops = *afinfo->dst_ops;
-#endif
-	rcu_read_unlock();
-}
-
 static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void *ptr)
 {
 	struct net_device *dev = netdev_notifier_info_to_dev(ptr);
@@ -2971,7 +2934,6 @@ static int __net_init xfrm_net_init(struct net *net)
 	rv = xfrm_policy_init(net);
 	if (rv < 0)
 		goto out_policy;
-	xfrm_dst_ops_init(net);
 	rv = xfrm_sysctl_init(net);
 	if (rv < 0)
 		goto out_sysctl;
-- 
2.7.1

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

* [PATCH 3.12 41/64] powerpc/tm: Block signal return setting invalid MSR state
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (39 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 40/64] xfrm: dst_entries_init() per-net dst_ops Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 42/64] powerpc: Make value-returning atomics fully ordered Jiri Slaby
                   ` (26 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Michael Neuling, Michael Ellerman, Jiri Slaby

From: Michael Neuling <mikey@neuling.org>

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

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

commit d2b9d2a5ad5ef04ff978c9923d19730cb05efd55 upstream.

Currently we allow both the MSR T and S bits to be set by userspace on
a signal return.  Unfortunately this is a reserved configuration and
will cause a TM Bad Thing exception if attempted (via rfid).

This patch checks for this case in both the 32 and 64 bit signals
code.  If both T and S are set, we mark the context as invalid.

Found using a syscall fuzzer.

Fixes: 2b0a576d15e0 ("powerpc: Add new transactional memory state to the signal context")
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/asm/reg.h  |  1 +
 arch/powerpc/kernel/signal_32.c | 14 +++++++++-----
 arch/powerpc/kernel/signal_64.c |  4 ++++
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 390e09872b77..3ce6b7b5ca19 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -108,6 +108,7 @@
 #define MSR_TS_T	__MASK(MSR_TS_T_LG)	/*  Transaction Transactional */
 #define MSR_TS_MASK	(MSR_TS_T | MSR_TS_S)   /* Transaction State bits */
 #define MSR_TM_ACTIVE(x) (((x) & MSR_TS_MASK) != 0) /* Transaction active? */
+#define MSR_TM_RESV(x) (((x) & MSR_TS_MASK) == MSR_TS_MASK) /* Reserved */
 #define MSR_TM_TRANSACTIONAL(x)	(((x) & MSR_TS_MASK) == MSR_TS_T)
 #define MSR_TM_SUSPENDED(x)	(((x) & MSR_TS_MASK) == MSR_TS_S)
 
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 7fce77b89f6d..3678e5097c59 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -867,6 +867,15 @@ static long restore_tm_user_regs(struct pt_regs *regs,
 		return 1;
 #endif /* CONFIG_SPE */
 
+	/* Get the top half of the MSR from the user context */
+	if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
+		return 1;
+	msr_hi <<= 32;
+	/* If TM bits are set to the reserved value, it's an invalid context */
+	if (MSR_TM_RESV(msr_hi))
+		return 1;
+	/* Pull in the MSR TM bits from the user context */
+	regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr_hi & MSR_TS_MASK);
 	/* Now, recheckpoint.  This loads up all of the checkpointed (older)
 	 * registers, including FP and V[S]Rs.  After recheckpointing, the
 	 * transactional versions should be loaded.
@@ -876,11 +885,6 @@ static long restore_tm_user_regs(struct pt_regs *regs,
 	current->thread.tm_texasr |= TEXASR_FS;
 	/* This loads the checkpointed FP/VEC state, if used */
 	tm_recheckpoint(&current->thread, msr);
-	/* Get the top half of the MSR */
-	if (__get_user(msr_hi, &tm_sr->mc_gregs[PT_MSR]))
-		return 1;
-	/* Pull in MSR TM from user context */
-	regs->msr = (regs->msr & ~MSR_TS_MASK) | ((msr_hi<<32) & MSR_TS_MASK);
 
 	/* This loads the speculative FP/VEC state, if used */
 	if (msr & MSR_FP) {
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 4456779dba1c..1c43da49fb1c 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -420,6 +420,10 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
 
 	/* get MSR separately, transfer the LE bit if doing signal return */
 	err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
+	/* Don't allow reserved mode. */
+	if (MSR_TM_RESV(msr))
+		return -EINVAL;
+
 	/* pull in MSR TM from user context */
 	regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
 
-- 
2.7.1

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

* [PATCH 3.12 42/64] powerpc: Make value-returning atomics fully ordered
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (40 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 41/64] powerpc/tm: Block signal return setting invalid MSR state Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 43/64] powerpc: Make {cmp}xchg* and their atomic_ versions " Jiri Slaby
                   ` (25 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Boqun Feng, Michael Ellerman, Jiri Slaby

From: Boqun Feng <boqun.feng@gmail.com>

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

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

commit 49e9cf3f0c04bf76ffa59242254110309554861d upstream.

According to memory-barriers.txt:

> Any atomic operation that modifies some state in memory and returns
> information about the state (old or new) implies an SMP-conditional
> general memory barrier (smp_mb()) on each side of the actual
> operation ...

Which mean these operations should be fully ordered. However on PPC,
PPC_ATOMIC_ENTRY_BARRIER is the barrier before the actual operation,
which is currently "lwsync" if SMP=y. The leading "lwsync" can not
guarantee fully ordered atomics, according to Paul Mckenney:

https://lkml.org/lkml/2015/10/14/970

To fix this, we define PPC_ATOMIC_ENTRY_BARRIER as "sync" to guarantee
the fully-ordered semantics.

This also makes futex atomics fully ordered, which can avoid possible
memory ordering problems if userspace code relies on futex system call
for fully ordered semantics.

Fixes: b97021f85517 ("powerpc: Fix atomic_xxx_return barrier semantics")
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/asm/synch.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/synch.h b/arch/powerpc/include/asm/synch.h
index e682a7143edb..c50868681f9e 100644
--- a/arch/powerpc/include/asm/synch.h
+++ b/arch/powerpc/include/asm/synch.h
@@ -44,7 +44,7 @@ static inline void isync(void)
 	MAKE_LWSYNC_SECTION_ENTRY(97, __lwsync_fixup);
 #define PPC_ACQUIRE_BARRIER	 "\n" stringify_in_c(__PPC_ACQUIRE_BARRIER)
 #define PPC_RELEASE_BARRIER	 stringify_in_c(LWSYNC) "\n"
-#define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(LWSYNC) "\n"
+#define PPC_ATOMIC_ENTRY_BARRIER "\n" stringify_in_c(sync) "\n"
 #define PPC_ATOMIC_EXIT_BARRIER	 "\n" stringify_in_c(sync) "\n"
 #else
 #define PPC_ACQUIRE_BARRIER
-- 
2.7.1

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

* [PATCH 3.12 43/64] powerpc: Make {cmp}xchg* and their atomic_ versions fully ordered
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (41 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 42/64] powerpc: Make value-returning atomics fully ordered Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 44/64] scripts/recordmcount.pl: support data in text section on powerpc Jiri Slaby
                   ` (24 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Boqun Feng, Michael Ellerman, Jiri Slaby

From: Boqun Feng <boqun.feng@gmail.com>

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

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

commit 81d7a3294de7e9828310bbf986a67246b13fa01e upstream.

According to memory-barriers.txt, xchg*, cmpxchg* and their atomic_
versions all need to be fully ordered, however they are now just
RELEASE+ACQUIRE, which are not fully ordered.

So also replace PPC_RELEASE_BARRIER and PPC_ACQUIRE_BARRIER with
PPC_ATOMIC_ENTRY_BARRIER and PPC_ATOMIC_EXIT_BARRIER in
__{cmp,}xchg_{u32,u64} respectively to guarantee fully ordered semantics
of atomic{,64}_{cmp,}xchg() and {cmp,}xchg(), as a complement of commit
b97021f85517 ("powerpc: Fix atomic_xxx_return barrier semantics")

This patch depends on patch "powerpc: Make value-returning atomics fully
ordered" for PPC_ATOMIC_ENTRY_BARRIER definition.

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/include/asm/cmpxchg.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/include/asm/cmpxchg.h b/arch/powerpc/include/asm/cmpxchg.h
index e245aab7f191..95b515113186 100644
--- a/arch/powerpc/include/asm/cmpxchg.h
+++ b/arch/powerpc/include/asm/cmpxchg.h
@@ -18,12 +18,12 @@ __xchg_u32(volatile void *p, unsigned long val)
 	unsigned long prev;
 
 	__asm__ __volatile__(
-	PPC_RELEASE_BARRIER
+	PPC_ATOMIC_ENTRY_BARRIER
 "1:	lwarx	%0,0,%2 \n"
 	PPC405_ERR77(0,%2)
 "	stwcx.	%3,0,%2 \n\
 	bne-	1b"
-	PPC_ACQUIRE_BARRIER
+	PPC_ATOMIC_EXIT_BARRIER
 	: "=&r" (prev), "+m" (*(volatile unsigned int *)p)
 	: "r" (p), "r" (val)
 	: "cc", "memory");
@@ -61,12 +61,12 @@ __xchg_u64(volatile void *p, unsigned long val)
 	unsigned long prev;
 
 	__asm__ __volatile__(
-	PPC_RELEASE_BARRIER
+	PPC_ATOMIC_ENTRY_BARRIER
 "1:	ldarx	%0,0,%2 \n"
 	PPC405_ERR77(0,%2)
 "	stdcx.	%3,0,%2 \n\
 	bne-	1b"
-	PPC_ACQUIRE_BARRIER
+	PPC_ATOMIC_EXIT_BARRIER
 	: "=&r" (prev), "+m" (*(volatile unsigned long *)p)
 	: "r" (p), "r" (val)
 	: "cc", "memory");
@@ -152,14 +152,14 @@ __cmpxchg_u32(volatile unsigned int *p, unsigned long old, unsigned long new)
 	unsigned int prev;
 
 	__asm__ __volatile__ (
-	PPC_RELEASE_BARRIER
+	PPC_ATOMIC_ENTRY_BARRIER
 "1:	lwarx	%0,0,%2		# __cmpxchg_u32\n\
 	cmpw	0,%0,%3\n\
 	bne-	2f\n"
 	PPC405_ERR77(0,%2)
 "	stwcx.	%4,0,%2\n\
 	bne-	1b"
-	PPC_ACQUIRE_BARRIER
+	PPC_ATOMIC_EXIT_BARRIER
 	"\n\
 2:"
 	: "=&r" (prev), "+m" (*p)
@@ -198,13 +198,13 @@ __cmpxchg_u64(volatile unsigned long *p, unsigned long old, unsigned long new)
 	unsigned long prev;
 
 	__asm__ __volatile__ (
-	PPC_RELEASE_BARRIER
+	PPC_ATOMIC_ENTRY_BARRIER
 "1:	ldarx	%0,0,%2		# __cmpxchg_u64\n\
 	cmpd	0,%0,%3\n\
 	bne-	2f\n\
 	stdcx.	%4,0,%2\n\
 	bne-	1b"
-	PPC_ACQUIRE_BARRIER
+	PPC_ATOMIC_EXIT_BARRIER
 	"\n\
 2:"
 	: "=&r" (prev), "+m" (*p)
-- 
2.7.1

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

* [PATCH 3.12 44/64] scripts/recordmcount.pl: support data in text section on powerpc
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (42 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 43/64] powerpc: Make {cmp}xchg* and their atomic_ versions " Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 45/64] arm64: KVM: Fix AArch32 to AArch64 register mapping Jiri Slaby
                   ` (23 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ulrich Weigand, Michael Ellerman, Jiri Slaby

From: Ulrich Weigand <ulrich.weigand@de.ibm.com>

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

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

commit 2e50c4bef77511b42cc226865d6bc568fa7f8769 upstream.

If a text section starts out with a data blob before the first
function start label, disassembly parsing doing in recordmcount.pl
gets confused on powerpc, leading to creation of corrupted module
objects.

This was not a problem so far since the compiler would never create
such text sections.  However, this has changed with a recent change
in GCC 6 to support distances of > 2GB between a function and its
assoicated TOC in the ELFv2 ABI, exposing this problem.

There is already code in recordmcount.pl to handle such data blobs
on the sparc64 platform.  This patch uses the same method to handle
those on powerpc as well.

Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 scripts/recordmcount.pl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index a27134fc3f76..efe7567d6225 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -265,7 +265,8 @@ if ($arch eq "x86_64") {
 
 } elsif ($arch eq "powerpc") {
     $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)";
-    $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:";
+    # See comment in the sparc64 section for why we use '\w'.
+    $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?\\w*?)>:";
     $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$";
 
     if ($bits == 64) {
-- 
2.7.1

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

* [PATCH 3.12 45/64] arm64: KVM: Fix AArch32 to AArch64 register mapping
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (43 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 44/64] scripts/recordmcount.pl: support data in text section on powerpc Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 46/64] arm64: fix building without CONFIG_UID16 Jiri Slaby
                   ` (22 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Marc Zyngier, Christoffer Dall, Jiri Slaby

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

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

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

commit c0f0963464c24e034b858441205455bf2a5d93ad upstream.

When running a 32bit guest under a 64bit hypervisor, the ARMv8
architecture defines a mapping of the 32bit registers in the 64bit
space. This includes banked registers that are being demultiplexed
over the 64bit ones.

On exceptions caused by an operation involving a 32bit register, the
HW exposes the register number in the ESR_EL2 register. It was so
far understood that SW had to distinguish between AArch32 and AArch64
accesses (based on the current AArch32 mode and register number).

It turns out that I misinterpreted the ARM ARM, and the clue is in
D1.20.1: "For some exceptions, the exception syndrome given in the
ESR_ELx identifies one or more register numbers from the issued
instruction that generated the exception. Where the exception is
taken from an Exception level using AArch32 these register numbers
give the AArch64 view of the register."

Which means that the HW is already giving us the translated version,
and that we shouldn't try to interpret it at all (for example, doing
an MMIO operation from the IRQ mode using the LR register leads to
very unexpected behaviours).

The fix is thus not to perform a call to vcpu_reg32() at all from
vcpu_reg(), and use whatever register number is supplied directly.
The only case we need to find out about the mapping is when we
actively generate a register access, which only occurs when injecting
a fault in a guest.

Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/include/asm/kvm_emulate.h | 8 +++++---
 arch/arm64/kvm/inject_fault.c        | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index 2b01e2bdb7ef..a79bcce9b66d 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -86,11 +86,13 @@ static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu)
 	*vcpu_cpsr(vcpu) |= COMPAT_PSR_T_BIT;
 }
 
+/*
+ * vcpu_reg should always be passed a register number coming from a
+ * read of ESR_EL2. Otherwise, it may give the wrong result on AArch32
+ * with banked registers.
+ */
 static inline unsigned long *vcpu_reg(const struct kvm_vcpu *vcpu, u8 reg_num)
 {
-	if (vcpu_mode_is_32bit(vcpu))
-		return vcpu_reg32(vcpu, reg_num);
-
 	return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.regs[reg_num];
 }
 
diff --git a/arch/arm64/kvm/inject_fault.c b/arch/arm64/kvm/inject_fault.c
index 86825f8883de..f527a37ac979 100644
--- a/arch/arm64/kvm/inject_fault.c
+++ b/arch/arm64/kvm/inject_fault.c
@@ -48,7 +48,7 @@ static void prepare_fault32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset)
 
 	/* Note: These now point to the banked copies */
 	*vcpu_spsr(vcpu) = new_spsr_value;
-	*vcpu_reg(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
+	*vcpu_reg32(vcpu, 14) = *vcpu_pc(vcpu) + return_offset;
 
 	/* Branch to exception vector */
 	if (sctlr & (1 << 13))
-- 
2.7.1

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

* [PATCH 3.12 46/64] arm64: fix building without CONFIG_UID16
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (44 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 45/64] arm64: KVM: Fix AArch32 to AArch64 register mapping Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 47/64] arm64: Clear out any singlestep state on a ptrace detach operation Jiri Slaby
                   ` (21 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Arnd Bergmann, Catalin Marinas, Jiri Slaby

From: Arnd Bergmann <arnd@arndb.de>

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

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

commit fbc416ff86183e2203cdf975e2881d7c164b0271 upstream.

As reported by Michal Simek, building an ARM64 kernel with CONFIG_UID16
disabled currently fails because the system call table still needs to
reference the individual function entry points that are provided by
kernel/sys_ni.c in this case, and the declarations are hidden inside
of #ifdef CONFIG_UID16:

arch/arm64/include/asm/unistd32.h:57:8: error: 'sys_lchown16' undeclared here (not in a function)
 __SYSCALL(__NR_lchown, sys_lchown16)

I believe this problem only exists on ARM64, because older architectures
tend to not need declarations when their system call table is built
in assembly code, while newer architectures tend to not need UID16
support. ARM64 only uses these system calls for compatibility with
32-bit ARM binaries.

This changes the CONFIG_UID16 check into CONFIG_HAVE_UID16, which is
set unconditionally on ARM64 with CONFIG_COMPAT, so we see the
declarations whenever we need them, but otherwise the behavior is
unchanged.

Fixes: af1839eb4bd4 ("Kconfig: clean up the long arch list for the UID16 config option")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/syscalls.h | 2 +-
 include/linux/types.h    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 7fac04e7ff6e..f662a3719a1b 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -499,7 +499,7 @@ asmlinkage long sys_chown(const char __user *filename,
 asmlinkage long sys_lchown(const char __user *filename,
 				uid_t user, gid_t group);
 asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group);
-#ifdef CONFIG_UID16
+#ifdef CONFIG_HAVE_UID16
 asmlinkage long sys_chown16(const char __user *filename,
 				old_uid_t user, old_gid_t group);
 asmlinkage long sys_lchown16(const char __user *filename,
diff --git a/include/linux/types.h b/include/linux/types.h
index 4d118ba11349..83db8e5974dc 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -35,7 +35,7 @@ typedef __kernel_gid16_t        gid16_t;
 
 typedef unsigned long		uintptr_t;
 
-#ifdef CONFIG_UID16
+#ifdef CONFIG_HAVE_UID16
 /* This is defined by include/asm-{arch}/posix_types.h */
 typedef __kernel_old_uid_t	old_uid_t;
 typedef __kernel_old_gid_t	old_gid_t;
-- 
2.7.1

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

* [PATCH 3.12 47/64] arm64: Clear out any singlestep state on a ptrace detach operation
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (45 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 46/64] arm64: fix building without CONFIG_UID16 Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 48/64] arm64: mm: ensure that the zero page is visible to the page table walker Jiri Slaby
                   ` (20 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, John Blackwood, Will Deacon, Jiri Slaby

From: John Blackwood <john.blackwood@ccur.com>

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

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

commit 5db4fd8c52810bd9740c1240ebf89223b171aa70 upstream.

Make sure to clear out any ptrace singlestep state when a ptrace(2)
PTRACE_DETACH call is made on arm64 systems.

Otherwise, the previously ptraced task will die off with a SIGTRAP
signal if the debugger just previously singlestepped the ptraced task.

Signed-off-by: John Blackwood <john.blackwood@ccur.com>
[will: added comment to justify why this is in the arch code]
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kernel/ptrace.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c
index ee79a1a6e965..9b9d651446ba 100644
--- a/arch/arm64/kernel/ptrace.c
+++ b/arch/arm64/kernel/ptrace.c
@@ -51,6 +51,12 @@
  */
 void ptrace_disable(struct task_struct *child)
 {
+	/*
+	 * This would be better off in core code, but PTRACE_DETACH has
+	 * grown its fair share of arch-specific worts and changing it
+	 * is likely to cause regressions on obscure architectures.
+	 */
+	user_disable_single_step(child);
 }
 
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
-- 
2.7.1

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

* [PATCH 3.12 48/64] arm64: mm: ensure that the zero page is visible to the page table walker
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (46 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 47/64] arm64: Clear out any singlestep state on a ptrace detach operation Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 49/64] parisc iommu: fix panic due to trying to allocate too large region Jiri Slaby
                   ` (19 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Will Deacon, Greg Kroah-Hartman

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

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

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

commit 32d6397805d00573ce1fa55f408ce2bca15b0ad3 upstream.

In paging_init, we allocate the zero page, memset it to zero and then
point TTBR0 to it in order to avoid speculative fetches through the
identity mapping.

In order to guarantee that the freshly zeroed page is indeed visible to
the page table walker, we need to execute a dsb instruction prior to
writing the TTBR.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm64/mm/mmu.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index f8dc7e8fce6f..84ddb372fbc6 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -374,6 +374,9 @@ void __init paging_init(void)
 
 	empty_zero_page = virt_to_page(zero_page);
 
+	/* Ensure the zero page is visible to the page table walker */
+	dsb();
+
 	/*
 	 * TTBR0 is only used for the identity mapping at this stage. Make it
 	 * point to zero page to avoid speculatively fetching new entries.
-- 
2.7.1

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

* [PATCH 3.12 49/64] parisc iommu: fix panic due to trying to allocate too large region
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (47 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 48/64] arm64: mm: ensure that the zero page is visible to the page table walker Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 50/64] HID: core: Avoid uninitialized buffer access Jiri Slaby
                   ` (18 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mikulas Patocka, Helge Deller, Jiri Slaby

From: Mikulas Patocka <mpatocka@redhat.com>

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

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

commit e46e31a3696ae2d66f32c207df3969613726e636 upstream.

When using the Promise TX2+ SATA controller on PA-RISC, the system often
crashes with kernel panic, for example just writing data with the dd
utility will make it crash.

Kernel panic - not syncing: drivers/parisc/sba_iommu.c: I/O MMU @ 000000000000a000 is out of mapping resources

CPU: 0 PID: 18442 Comm: mkspadfs Not tainted 4.4.0-rc2 #2
Backtrace:
 [<000000004021497c>] show_stack+0x14/0x20
 [<0000000040410bf0>] dump_stack+0x88/0x100
 [<000000004023978c>] panic+0x124/0x360
 [<0000000040452c18>] sba_alloc_range+0x698/0x6a0
 [<0000000040453150>] sba_map_sg+0x260/0x5b8
 [<000000000c18dbb4>] ata_qc_issue+0x264/0x4a8 [libata]
 [<000000000c19535c>] ata_scsi_translate+0xe4/0x220 [libata]
 [<000000000c19a93c>] ata_scsi_queuecmd+0xbc/0x320 [libata]
 [<0000000040499bbc>] scsi_dispatch_cmd+0xfc/0x130
 [<000000004049da34>] scsi_request_fn+0x6e4/0x970
 [<00000000403e95a8>] __blk_run_queue+0x40/0x60
 [<00000000403e9d8c>] blk_run_queue+0x3c/0x68
 [<000000004049a534>] scsi_run_queue+0x2a4/0x360
 [<000000004049be68>] scsi_end_request+0x1a8/0x238
 [<000000004049de84>] scsi_io_completion+0xfc/0x688
 [<0000000040493c74>] scsi_finish_command+0x17c/0x1d0

The cause of the crash is not exhaustion of the IOMMU space, there is
plenty of free pages. The function sba_alloc_range is called with size
0x11000, thus the pages_needed variable is 0x11. The function
sba_search_bitmap is called with bits_wanted 0x11 and boundary size is
0x10 (because dma_get_seg_boundary(dev) returns 0xffff).

The function sba_search_bitmap attempts to allocate 17 pages that must not
cross 16-page boundary - it can't satisfy this requirement
(iommu_is_span_boundary always returns true) and fails even if there are
many free entries in the IOMMU space.

How did it happen that we try to allocate 17 pages that don't cross
16-page boundary? The cause is in the function iommu_coalesce_chunks. This
function tries to coalesce adjacent entries in the scatterlist. The
function does several checks if it may coalesce one entry with the next,
one of those checks is this:

	if (startsg->length + dma_len > max_seg_size)
		break;

When it finishes coalescing adjacent entries, it allocates the mapping:

sg_dma_len(contig_sg) = dma_len;
dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
sg_dma_address(contig_sg) =
	PIDE_FLAG
	| (iommu_alloc_range(ioc, dev, dma_len) << IOVP_SHIFT)
	| dma_offset;

It is possible that (startsg->length + dma_len > max_seg_size) is false
(we are just near the 0x10000 max_seg_size boundary), so the funcion
decides to coalesce this entry with the next entry. When the coalescing
succeeds, the function performs
	dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
And now, because of non-zero dma_offset, dma_len is greater than 0x10000.
iommu_alloc_range (a pointer to sba_alloc_range) is called and it attempts
to allocate 17 pages for a device that must not cross 16-page boundary.

To fix the bug, we must make sure that dma_len after addition of
dma_offset and alignment doesn't cross the segment boundary. I.e. change
	if (startsg->length + dma_len > max_seg_size)
		break;
to
	if (ALIGN(dma_len + dma_offset + startsg->length, IOVP_SIZE) > max_seg_size)
		break;

This patch makes this change (it precalculates max_seg_boundary at the
beginning of the function iommu_coalesce_chunks). I also added a check
that the mapping length doesn't exceed dma_get_seg_boundary(dev) (it is
not needed for Promise TX2+ SATA, but it may be needed for other devices
that have dma_get_seg_boundary lower than dma_get_max_seg_size).

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/parisc/iommu-helpers.h | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/parisc/iommu-helpers.h b/drivers/parisc/iommu-helpers.h
index 8c33491b21fe..c6aa38883466 100644
--- a/drivers/parisc/iommu-helpers.h
+++ b/drivers/parisc/iommu-helpers.h
@@ -104,7 +104,11 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
 	struct scatterlist *contig_sg;	   /* contig chunk head */
 	unsigned long dma_offset, dma_len; /* start/len of DMA stream */
 	unsigned int n_mappings = 0;
-	unsigned int max_seg_size = dma_get_max_seg_size(dev);
+	unsigned int max_seg_size = min(dma_get_max_seg_size(dev),
+					(unsigned)DMA_CHUNK_SIZE);
+	unsigned int max_seg_boundary = dma_get_seg_boundary(dev) + 1;
+	if (max_seg_boundary)	/* check if the addition above didn't overflow */
+		max_seg_size = min(max_seg_size, max_seg_boundary);
 
 	while (nents > 0) {
 
@@ -139,14 +143,11 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
 
 			/*
 			** First make sure current dma stream won't
-			** exceed DMA_CHUNK_SIZE if we coalesce the
+			** exceed max_seg_size if we coalesce the
 			** next entry.
 			*/   
-			if(unlikely(ALIGN(dma_len + dma_offset + startsg->length,
-					    IOVP_SIZE) > DMA_CHUNK_SIZE))
-				break;
-
-			if (startsg->length + dma_len > max_seg_size)
+			if (unlikely(ALIGN(dma_len + dma_offset + startsg->length, IOVP_SIZE) >
+				     max_seg_size))
 				break;
 
 			/*
-- 
2.7.1

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

* [PATCH 3.12 00/64] 3.12.54-stable review
@ 2016-02-11 13:59 Jiri Slaby
  2016-02-11 13:58 ` [PATCH 3.12 01/64] ALSA: rme96: Fix unexpected volume reset after rate changes Jiri Slaby
                   ` (67 more replies)
  0 siblings, 68 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 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.54 release.
There are 64 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 Mon Feb 15 14:54:53 CET 2016.
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.54-rc1.xz
and the diffstat can be found below.

thanks,
js

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


Alex Deucher (1):
  drm/radeon: cypress_dpm: Fix unused variable warning when
    CONFIG_ACPI=n

Andrew Morton (1):
  openrisc: fix CONFIG_UID16 setting

Andrey Ryabinin (1):
  ipv6/addrlabel: fix ip6addrlbl_get()

Arnd Bergmann (2):
  mISDN: avoid arch specific __builtin_return_address call
  arm64: fix building without CONFIG_UID16

Behan Webster (1):
  ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h

Boqun Feng (2):
  powerpc: Make value-returning atomics fully ordered
  powerpc: Make {cmp}xchg* and their atomic_ versions fully ordered

Chunfeng Yun (1):
  usb: xhci: fix config fail of FS hub behind a HS hub with MTT

Dan Carpenter (1):
  USB: ipaq.c: fix a timeout loop

Dan Streetman (1):
  xfrm: dst_entries_init() per-net dst_ops

David Henningsson (1):
  ALSA: hda - Add inverted dmic for Packard Bell DOTS

Eric Dumazet (3):
  ipv6: tcp: add rcu locking in tcp_v6_send_synack()
  phonet: properly unshare skbs in phonet_rcv()
  ipv6: update skb->csum when CE mark is propagated

Fabio Estevam (1):
  drm: radeon: ni_dpm: Fix unused variable warning when CONFIG_ACPI=n

Florian Westphal (1):
  connector: bump skb->users before callback invocation

Greg Kroah-Hartman (1):
  xhci: fix placement of call to usb_disabled()

Guenter Roeck (1):
  mn10300: Select CONFIG_HAVE_UID16 to fix build failure

Hannes Frederic Sowa (1):
  bridge: Only call /sbin/bridge-stp for the initial network namespace

Herbert Xu (1):
  crypto: algif_hash - Only export and import on sockets with data

Ido Schimmel (1):
  team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid

Ioan-Adrian Ratiu (1):
  HID: usbhid: fix recursive deadlock

Jiri Slaby (1):
  x86: vvar, fix excessive gcc-6 DECLARE_VVAR warnings

Joe Perches (1):
  compiler-gcc: integrate the various compiler-gcc[345].h files

John Blackwood (1):
  arm64: Clear out any singlestep state on a ptrace detach operation

Kees Cook (1):
  lkdtm: adjust recursion size to avoid warnings

Linus Torvalds (1):
  vmstat: explicitly schedule per-cpu work on the CPU we need it to run
    on

Marc Zyngier (1):
  arm64: KVM: Fix AArch32 to AArch64 register mapping

Mario Kleiner (1):
  ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2)

Michael Neuling (1):
  powerpc/tm: Block signal return setting invalid MSR state

Mike Snitzer (1):
  dm btree: fix leak of bufio-backed block in btree_split_sibling error
    path

Mikulas Patocka (1):
  parisc iommu: fix panic due to trying to allocate too large region

Neal Cardwell (1):
  tcp_yeah: don't set ssthresh below 2

Nicolas Boichat (2):
  ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode
  ALSA: pcm: Fix snd_pcm_hw_params struct copy in compat mode

Nikesh Oswal (1):
  ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz

Oliver Freyermuth (1):
  USB: cp210x: add ID for ELV Marble Sound Board 1

Oliver Neukum (1):
  xhci: refuse loading if nousb is used

Paul Bolle (1):
  RDMA/cxgb4: Fix gcc warning on 32-bit arch

Richard Purdie (1):
  HID: core: Avoid uninitialized buffer access

Sachin Pandhare (1):
  ASoC: wm8962: correct addresses for HPF_C_0/1

Sasha Levin (1):
  net: sctp: prevent writes to cookie_hmac_alg from accessing invalid
    memory

Seth Jennings (1):
  drivers/base/memory.c: prohibit offlining of memory blocks with
    missing sections

Steven Noonan (1):
  compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles

Takashi Iwai (8):
  ALSA: rme96: Fix unexpected volume reset after rate changes
  ALSA: seq: Fix missing NULL check at remove_events ioctl
  ALSA: seq: Fix race at timer setup and close
  ALSA: timer: Harden slave timer list handling
  ALSA: timer: Fix race among timer ioctls
  ALSA: timer: Fix double unlink of active_list
  ALSA: hrtimer: Fix stall by hrtimer_cancel()
  ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0

Tejun Heo (1):
  Revert "workqueue: make sure delayed work run in local cpu"

Ulrich Weigand (1):
  scripts/recordmcount.pl: support data in text section on powerpc

Uwe Kleine-König (1):
  ARM: 8160/1: drop warning about return_address not using unwind tables

Vijay Pandurangan (1):
  veth: don’t modify ip_summed; doing so treats packets with bad
    checksums as good.

Vinod Koul (1):
  ASoC: compress: Fix compress device direction check

Will Deacon (1):
  arm64: mm: ensure that the zero page is visible to the page table
    walker

Xin Long (1):
  sctp: sctp should release assoc when sctp_make_abort_user return NULL
    in sctp_close

Xiong Zhang (1):
  ALSA: hda - Set SKL+ hda controller power at freeze() and thaw()

Yang Shi (1):
  arm64: restore bogomips information in /proc/cpuinfo

libin (1):
  recordmcount: Fix endianness handling bug for nop_mcount

willy tarreau (1):
  unix: properly account for FDs passed over unix sockets

 arch/arm/include/asm/ftrace.h           |   2 +-
 arch/arm/kernel/return_address.c        |   9 ---
 arch/arm64/include/asm/kvm_emulate.h    |   8 ++-
 arch/arm64/kernel/ptrace.c              |   6 ++
 arch/arm64/kernel/setup.c               |   4 ++
 arch/arm64/kvm/inject_fault.c           |   2 +-
 arch/arm64/mm/mmu.c                     |   3 +
 arch/mn10300/Kconfig                    |   4 +-
 arch/openrisc/Kconfig                   |   4 +-
 arch/powerpc/include/asm/cmpxchg.h      |  16 ++---
 arch/powerpc/include/asm/reg.h          |   1 +
 arch/powerpc/include/asm/synch.h        |   2 +-
 arch/powerpc/kernel/signal_32.c         |  14 ++--
 arch/powerpc/kernel/signal_64.c         |   4 ++
 arch/x86/include/asm/vvar.h             |   2 +-
 crypto/algif_hash.c                     |  12 +++-
 drivers/base/memory.c                   |   4 ++
 drivers/connector/connector.c           |  11 +--
 drivers/gpu/drm/radeon/cypress_dpm.c    |   2 +
 drivers/gpu/drm/radeon/ni_dpm.c         |   2 +-
 drivers/hid/hid-core.c                  |   2 +-
 drivers/hid/usbhid/hid-core.c           |   4 +-
 drivers/infiniband/hw/cxgb4/mem.c       |   2 +-
 drivers/isdn/hardware/mISDN/mISDNipac.c |  12 +++-
 drivers/isdn/hardware/mISDN/w6692.c     |   6 +-
 drivers/md/persistent-data/dm-btree.c   |   4 +-
 drivers/misc/lkdtm.c                    |  30 ++++++---
 drivers/net/team/team.c                 |   6 +-
 drivers/net/veth.c                      |   6 --
 drivers/parisc/iommu-helpers.h          |  15 +++--
 drivers/usb/host/xhci.c                 |  12 ++++
 drivers/usb/serial/cp210x.c             |   1 +
 drivers/usb/serial/ipaq.c               |   3 +-
 include/linux/compiler-gcc.h            | 114 ++++++++++++++++++++++++++++++--
 include/linux/compiler-gcc3.h           |  23 -------
 include/linux/compiler-gcc4.h           |  88 ------------------------
 include/linux/compiler-gcc5.h           |  66 ------------------
 include/linux/sched.h                   |   1 +
 include/linux/syscalls.h                |   2 +-
 include/linux/types.h                   |   2 +-
 include/net/inet_ecn.h                  |  19 +++++-
 kernel/workqueue.c                      |   8 +--
 mm/vmstat.c                             |   3 +-
 net/bridge/br_stp_if.c                  |   5 +-
 net/ipv4/tcp_yeah.c                     |   2 +-
 net/ipv4/xfrm4_policy.c                 |  46 ++++++++++---
 net/ipv6/addrlabel.c                    |   2 +-
 net/ipv6/tcp_ipv6.c                     |   2 +
 net/ipv6/xfrm6_mode_tunnel.c            |   2 +-
 net/ipv6/xfrm6_policy.c                 |  53 ++++++++++-----
 net/phonet/af_phonet.c                  |   4 ++
 net/sctp/sm_statefuns.c                 |   6 +-
 net/sctp/socket.c                       |   3 +-
 net/sctp/sysctl.c                       |   2 +-
 net/unix/af_unix.c                      |  24 +++++--
 net/unix/garbage.c                      |  16 +++--
 net/xfrm/xfrm_policy.c                  |  38 -----------
 scripts/recordmcount.h                  |   2 +-
 scripts/recordmcount.pl                 |   3 +-
 sound/core/control.c                    |   2 +
 sound/core/hrtimer.c                    |   3 +-
 sound/core/pcm_compat.c                 |  13 ++--
 sound/core/seq/seq_clientmgr.c          |   2 +-
 sound/core/seq/seq_compat.c             |   9 +--
 sound/core/seq/seq_queue.c              |   2 +
 sound/core/timer.c                      |  52 ++++++++++-----
 sound/pci/hda/hda_intel.c               |  34 ++++++++++
 sound/pci/hda/patch_realtek.c           |  12 +++-
 sound/pci/rme96.c                       |  41 +++++++-----
 sound/soc/codecs/arizona.c              |   2 +-
 sound/soc/codecs/wm8962.c               |   4 +-
 sound/soc/soc-compress.c                |  23 ++++++-
 72 files changed, 543 insertions(+), 407 deletions(-)
 delete mode 100644 include/linux/compiler-gcc3.h
 delete mode 100644 include/linux/compiler-gcc4.h
 delete mode 100644 include/linux/compiler-gcc5.h

-- 
2.7.1

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

* [PATCH 3.12 50/64] HID: core: Avoid uninitialized buffer access
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (48 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 49/64] parisc iommu: fix panic due to trying to allocate too large region Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 51/64] mn10300: Select CONFIG_HAVE_UID16 to fix build failure Jiri Slaby
                   ` (17 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Richard Purdie, Jiri Kosina, linux-input,
	Darren Hart, Jiri Kosina, Jiri Slaby

From: Richard Purdie <richard.purdie@linuxfoundation.org>

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

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

commit 79b568b9d0c7c5d81932f4486d50b38efdd6da6d upstream.

hid_connect adds various strings to the buffer but they're all
conditional. You can find circumstances where nothing would be written
to it but the kernel will still print the supposedly empty buffer with
printk. This leads to corruption on the console/in the logs.

Ensure buf is initialized to an empty string.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
[dvhart: Initialize string to "" rather than assign buf[0] = NULL;]
Cc: Jiri Kosina <jikos@kernel.org>
Cc: linux-input@vger.kernel.org
Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 85b0da8c33f4..7ca1b4a97a14 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1514,7 +1514,7 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
 		"Multi-Axis Controller"
 	};
 	const char *type, *bus;
-	char buf[64];
+	char buf[64] = "";
 	unsigned int i;
 	int len;
 	int ret;
-- 
2.7.1

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

* [PATCH 3.12 51/64] mn10300: Select CONFIG_HAVE_UID16 to fix build failure
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (49 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 50/64] HID: core: Avoid uninitialized buffer access Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 52/64] arm64: restore bogomips information in /proc/cpuinfo Jiri Slaby
                   ` (16 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Guenter Roeck, Arnd Bergmann, Jiri Slaby

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

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

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

commit c86576ea114a9a881cf7328dc7181052070ca311 upstream.

mn10300 builds fail with

fs/stat.c: In function 'cp_old_stat':
fs/stat.c:163:2: error: 'old_uid_t' undeclared

ipc/util.c: In function 'ipc64_perm_to_ipc_perm':
ipc/util.c:540:2: error: 'old_uid_t' undeclared

Select CONFIG_HAVE_UID16 and remove local definition of CONFIG_UID16
to fix the problem.

Fixes: fbc416ff8618 ("arm64: fix building without CONFIG_UID16")
Cc: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mn10300/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 6aaa1607001a..c61bf144b8f2 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -1,6 +1,7 @@
 config MN10300
 	def_bool y
 	select HAVE_OPROFILE
+	select HAVE_UID16
 	select GENERIC_IRQ_SHOW
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select HAVE_ARCH_TRACEHOOK
@@ -37,9 +38,6 @@ config HIGHMEM
 config NUMA
 	def_bool n
 
-config UID16
-	def_bool y
-
 config RWSEM_GENERIC_SPINLOCK
 	def_bool y
 
-- 
2.7.1

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

* [PATCH 3.12 52/64] arm64: restore bogomips information in /proc/cpuinfo
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (50 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 51/64] mn10300: Select CONFIG_HAVE_UID16 to fix build failure Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 53/64] compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles Jiri Slaby
                   ` (15 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Yang Shi, Catalin Marinas, Jiri Slaby

From: Yang Shi <yang.shi@linaro.org>

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

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

commit 92e788b749862ebe9920360513a718e5dd4da7a9 upstream.

As previously reported, some userspace applications depend on bogomips
showed by /proc/cpuinfo. Although there is much less legacy impact on
aarch64 than arm, it does break libvirt.

This patch reverts commit 326b16db9f69 ("arm64: delay: don't bother
reporting bogomips in /proc/cpuinfo"), but with some tweak due to
context change and without the pr_info().

Fixes: 326b16db9f69 ("arm64: delay: don't bother reporting bogomips in /proc/cpuinfo")
Signed-off-by: Yang Shi <yang.shi@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm64/kernel/setup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index 24bf1563c3bd..59411c933393 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -365,6 +365,10 @@ static int c_show(struct seq_file *m, void *v)
 		seq_printf(m, "processor\t: %d\n", i);
 #endif
 
+		seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
+			   loops_per_jiffy / (500000UL/HZ),
+			   loops_per_jiffy / (5000UL/HZ) % 100);
+
 		/*
 		 * Dump out the common processor features in a single line.
 		 * Userspace should read the hwcaps with getauxval(AT_HWCAP)
-- 
2.7.1

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

* [PATCH 3.12 53/64] compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (51 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 52/64] arm64: restore bogomips information in /proc/cpuinfo Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 54/64] compiler-gcc: integrate the various compiler-gcc[345].h files Jiri Slaby
                   ` (14 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Steven Noonan, Ingo Molnar, Jakub Jelinek,
	Richard Henderson, Linus Torvalds, Steven Rostedt, Jiri Slaby

From: Steven Noonan <steven@uplinklabs.net>

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

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

commit 5631b8fba640a4ab2f8a954f63a603fa34eda96b upstream.

The bug referenced by the comment in this commit was not
completely fixed in GCC 4.8.2, as I mentioned in a thread back
in February:

   https://lkml.org/lkml/2014/2/12/797

The conclusion at that time was to make the quirk unconditional
until the bug could be found and fixed in GCC. Unfortunately,
when I submitted the patch (commit a9f18034) I left a comment
in that claimed the bug was fixed in GCC 4.8.2+.

This comment is inaccurate, and should be removed.

Signed-off-by: Steven Noonan <steven@uplinklabs.net>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1414274982-14040-1-git-send-email-steven@uplinklabs.net
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/compiler-gcc4.h | 1 -
 include/linux/compiler-gcc5.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
index 2507fd2a1eb4..d1a558239b1a 100644
--- a/include/linux/compiler-gcc4.h
+++ b/include/linux/compiler-gcc4.h
@@ -71,7 +71,6 @@
  *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
  *
  * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
- * Fixed in GCC 4.8.2 and later versions.
  *
  * (asm goto is automatically volatile - the naming reflects this.)
  */
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
index cdd1cc202d51..c8c565952548 100644
--- a/include/linux/compiler-gcc5.h
+++ b/include/linux/compiler-gcc5.h
@@ -53,7 +53,6 @@
  *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
  *
  * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
- * Fixed in GCC 4.8.2 and later versions.
  *
  * (asm goto is automatically volatile - the naming reflects this.)
  */
-- 
2.7.1

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

* [PATCH 3.12 54/64] compiler-gcc: integrate the various compiler-gcc[345].h files
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (52 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 53/64] compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 55/64] x86: vvar, fix excessive gcc-6 DECLARE_VVAR warnings Jiri Slaby
                   ` (13 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Joe Perches, Andi Kleen, Michal Marek,
	Segher Boessenkool, Sasha Levin, Anton Blanchard, Alan Modra,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Joe Perches <joe@perches.com>

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

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

commit cb984d101b30eb7478d32df56a0023e4603cba7f upstream.

As gcc major version numbers are going to advance rather rapidly in the
future, there's no real value in separate files for each compiler
version.

Deduplicate some of the macros #defined in each file too.

Neaten comments using normal kernel commenting style.

Signed-off-by: Joe Perches <joe@perches.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Michal Marek <mmarek@suse.cz>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Sasha Levin <levinsasha928@gmail.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: Alan Modra <amodra@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/compiler-gcc.h  | 114 ++++++++++++++++++++++++++++++++++++++++--
 include/linux/compiler-gcc3.h |  23 ---------
 include/linux/compiler-gcc4.h |  87 --------------------------------
 include/linux/compiler-gcc5.h |  65 ------------------------
 4 files changed, 110 insertions(+), 179 deletions(-)
 delete mode 100644 include/linux/compiler-gcc3.h
 delete mode 100644 include/linux/compiler-gcc4.h
 delete mode 100644 include/linux/compiler-gcc5.h

diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
index 02ae99e8e6d3..65856c3599b4 100644
--- a/include/linux/compiler-gcc.h
+++ b/include/linux/compiler-gcc.h
@@ -100,10 +100,116 @@
 #define __maybe_unused			__attribute__((unused))
 #define __always_unused			__attribute__((unused))
 
-#define __gcc_header(x) #x
-#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h)
-#define gcc_header(x) _gcc_header(x)
-#include gcc_header(__GNUC__)
+/* gcc version specific checks */
+
+#if GCC_VERSION < 30200
+# error Sorry, your compiler is too old - please upgrade it.
+#endif
+
+#if GCC_VERSION < 30300
+# define __used			__attribute__((__unused__))
+#else
+# define __used			__attribute__((__used__))
+#endif
+
+#ifdef CONFIG_GCOV_KERNEL
+# if GCC_VERSION < 30400
+#   error "GCOV profiling support for gcc versions below 3.4 not included"
+# endif /* __GNUC_MINOR__ */
+#endif /* CONFIG_GCOV_KERNEL */
+
+#if GCC_VERSION >= 30400
+#define __must_check		__attribute__((warn_unused_result))
+#endif
+
+#if GCC_VERSION >= 40000
+
+/* GCC 4.1.[01] miscompiles __weak */
+#ifdef __KERNEL__
+# if GCC_VERSION >= 40100 &&  GCC_VERSION <= 40101
+#  error Your version of gcc miscompiles the __weak directive
+# endif
+#endif
+
+#define __used			__attribute__((__used__))
+#define __compiler_offsetof(a, b)					\
+	__builtin_offsetof(a, b)
+
+#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
+# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
+#endif
+
+#if GCC_VERSION >= 40300
+/* Mark functions as cold. gcc will assume any path leading to a call
+ * to them will be unlikely.  This means a lot of manual unlikely()s
+ * are unnecessary now for any paths leading to the usual suspects
+ * like BUG(), printk(), panic() etc. [but let's keep them for now for
+ * older compilers]
+ *
+ * Early snapshots of gcc 4.3 don't support this and we can't detect this
+ * in the preprocessor, but we can live with this because they're unreleased.
+ * Maketime probing would be overkill here.
+ *
+ * gcc also has a __attribute__((__hot__)) to move hot functions into
+ * a special section, but I don't see any sense in this right now in
+ * the kernel context
+ */
+#define __cold			__attribute__((__cold__))
+
+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
+
+#ifndef __CHECKER__
+# define __compiletime_warning(message) __attribute__((warning(message)))
+# define __compiletime_error(message) __attribute__((error(message)))
+#endif /* __CHECKER__ */
+#endif /* GCC_VERSION >= 40300 */
+
+#if GCC_VERSION >= 40500
+/*
+ * Mark a position in code as unreachable.  This can be used to
+ * suppress control flow warnings after asm blocks that transfer
+ * control elsewhere.
+ *
+ * Early snapshots of gcc 4.5 don't support this and we can't detect
+ * this in the preprocessor, but we can live with this because they're
+ * unreleased.  Really, we need to have autoconf for the kernel.
+ */
+#define unreachable() __builtin_unreachable()
+
+/* Mark a function definition as prohibited from being cloned. */
+#define __noclone	__attribute__((__noclone__))
+
+#endif /* GCC_VERSION >= 40500 */
+
+#if GCC_VERSION >= 40600
+/*
+ * Tell the optimizer that something else uses this function or variable.
+ */
+#define __visible	__attribute__((externally_visible))
+#endif
+
+/*
+ * GCC 'asm goto' miscompiles certain code sequences:
+ *
+ *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
+ *
+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
+ *
+ * (asm goto is automatically volatile - the naming reflects this.)
+ */
+#define asm_volatile_goto(x...)	do { asm goto(x); asm (""); } while (0)
+
+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
+#if GCC_VERSION >= 40400
+#define __HAVE_BUILTIN_BSWAP32__
+#define __HAVE_BUILTIN_BSWAP64__
+#endif
+#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
+#define __HAVE_BUILTIN_BSWAP16__
+#endif
+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
+
+#endif	/* gcc version >= 40000 specific checks */
 
 #if !defined(__noclone)
 #define __noclone	/* not needed */
diff --git a/include/linux/compiler-gcc3.h b/include/linux/compiler-gcc3.h
deleted file mode 100644
index 7d89febe4d79..000000000000
--- a/include/linux/compiler-gcc3.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __LINUX_COMPILER_H
-#error "Please don't include <linux/compiler-gcc3.h> directly, include <linux/compiler.h> instead."
-#endif
-
-#if GCC_VERSION < 30200
-# error Sorry, your compiler is too old - please upgrade it.
-#endif
-
-#if GCC_VERSION >= 30300
-# define __used			__attribute__((__used__))
-#else
-# define __used			__attribute__((__unused__))
-#endif
-
-#if GCC_VERSION >= 30400
-#define __must_check		__attribute__((warn_unused_result))
-#endif
-
-#ifdef CONFIG_GCOV_KERNEL
-# if GCC_VERSION < 30400
-#   error "GCOV profiling support for gcc versions below 3.4 not included"
-# endif /* __GNUC_MINOR__ */
-#endif /* CONFIG_GCOV_KERNEL */
diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h
deleted file mode 100644
index d1a558239b1a..000000000000
--- a/include/linux/compiler-gcc4.h
+++ /dev/null
@@ -1,87 +0,0 @@
-#ifndef __LINUX_COMPILER_H
-#error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead."
-#endif
-
-/* GCC 4.1.[01] miscompiles __weak */
-#ifdef __KERNEL__
-# if GCC_VERSION >= 40100 &&  GCC_VERSION <= 40101
-#  error Your version of gcc miscompiles the __weak directive
-# endif
-#endif
-
-#define __used			__attribute__((__used__))
-#define __must_check 		__attribute__((warn_unused_result))
-#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
-
-#if GCC_VERSION >= 40100 && GCC_VERSION < 40600
-# define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
-#endif
-
-#if GCC_VERSION >= 40300
-/* Mark functions as cold. gcc will assume any path leading to a call
-   to them will be unlikely.  This means a lot of manual unlikely()s
-   are unnecessary now for any paths leading to the usual suspects
-   like BUG(), printk(), panic() etc. [but let's keep them for now for
-   older compilers]
-
-   Early snapshots of gcc 4.3 don't support this and we can't detect this
-   in the preprocessor, but we can live with this because they're unreleased.
-   Maketime probing would be overkill here.
-
-   gcc also has a __attribute__((__hot__)) to move hot functions into
-   a special section, but I don't see any sense in this right now in
-   the kernel context */
-#define __cold			__attribute__((__cold__))
-
-#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
-
-#ifndef __CHECKER__
-# define __compiletime_warning(message) __attribute__((warning(message)))
-# define __compiletime_error(message) __attribute__((error(message)))
-#endif /* __CHECKER__ */
-#endif /* GCC_VERSION >= 40300 */
-
-#if GCC_VERSION >= 40500
-/*
- * Mark a position in code as unreachable.  This can be used to
- * suppress control flow warnings after asm blocks that transfer
- * control elsewhere.
- *
- * Early snapshots of gcc 4.5 don't support this and we can't detect
- * this in the preprocessor, but we can live with this because they're
- * unreleased.  Really, we need to have autoconf for the kernel.
- */
-#define unreachable() __builtin_unreachable()
-
-/* Mark a function definition as prohibited from being cloned. */
-#define __noclone	__attribute__((__noclone__))
-
-#endif /* GCC_VERSION >= 40500 */
-
-#if GCC_VERSION >= 40600
-/*
- * Tell the optimizer that something else uses this function or variable.
- */
-#define __visible __attribute__((externally_visible))
-#endif
-
-/*
- * GCC 'asm goto' miscompiles certain code sequences:
- *
- *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
- *
- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
- *
- * (asm goto is automatically volatile - the naming reflects this.)
- */
-#define asm_volatile_goto(x...)	do { asm goto(x); asm (""); } while (0)
-
-#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
-#if GCC_VERSION >= 40400
-#define __HAVE_BUILTIN_BSWAP32__
-#define __HAVE_BUILTIN_BSWAP64__
-#endif
-#if GCC_VERSION >= 40800 || (defined(__powerpc__) && GCC_VERSION >= 40600)
-#define __HAVE_BUILTIN_BSWAP16__
-#endif
-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h
deleted file mode 100644
index c8c565952548..000000000000
--- a/include/linux/compiler-gcc5.h
+++ /dev/null
@@ -1,65 +0,0 @@
-#ifndef __LINUX_COMPILER_H
-#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
-#endif
-
-#define __used				__attribute__((__used__))
-#define __must_check			__attribute__((warn_unused_result))
-#define __compiler_offsetof(a, b)	__builtin_offsetof(a, b)
-
-/* Mark functions as cold. gcc will assume any path leading to a call
-   to them will be unlikely.  This means a lot of manual unlikely()s
-   are unnecessary now for any paths leading to the usual suspects
-   like BUG(), printk(), panic() etc. [but let's keep them for now for
-   older compilers]
-
-   Early snapshots of gcc 4.3 don't support this and we can't detect this
-   in the preprocessor, but we can live with this because they're unreleased.
-   Maketime probing would be overkill here.
-
-   gcc also has a __attribute__((__hot__)) to move hot functions into
-   a special section, but I don't see any sense in this right now in
-   the kernel context */
-#define __cold			__attribute__((__cold__))
-
-#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
-
-#ifndef __CHECKER__
-# define __compiletime_warning(message) __attribute__((warning(message)))
-# define __compiletime_error(message) __attribute__((error(message)))
-#endif /* __CHECKER__ */
-
-/*
- * Mark a position in code as unreachable.  This can be used to
- * suppress control flow warnings after asm blocks that transfer
- * control elsewhere.
- *
- * Early snapshots of gcc 4.5 don't support this and we can't detect
- * this in the preprocessor, but we can live with this because they're
- * unreleased.  Really, we need to have autoconf for the kernel.
- */
-#define unreachable() __builtin_unreachable()
-
-/* Mark a function definition as prohibited from being cloned. */
-#define __noclone	__attribute__((__noclone__))
-
-/*
- * Tell the optimizer that something else uses this function or variable.
- */
-#define __visible __attribute__((externally_visible))
-
-/*
- * GCC 'asm goto' miscompiles certain code sequences:
- *
- *   http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
- *
- * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
- *
- * (asm goto is automatically volatile - the naming reflects this.)
- */
-#define asm_volatile_goto(x...)	do { asm goto(x); asm (""); } while (0)
-
-#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
-#define __HAVE_BUILTIN_BSWAP32__
-#define __HAVE_BUILTIN_BSWAP64__
-#define __HAVE_BUILTIN_BSWAP16__
-#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
-- 
2.7.1

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

* [PATCH 3.12 55/64] x86: vvar, fix excessive gcc-6 DECLARE_VVAR warnings
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (53 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 54/64] compiler-gcc: integrate the various compiler-gcc[345].h files Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-12 16:42   ` Andy Lutomirski
  2016-02-11 13:59 ` [PATCH 3.12 56/64] openrisc: fix CONFIG_UID16 setting Jiri Slaby
                   ` (12 subsequent siblings)
  67 siblings, 1 reply; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jiri Slaby, Andy Lutomirski

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

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

On 3.12, with gcc-6, I see a lot of:
arch/x86/include/asm/vvar.h:33:28: warning: ‘vvaraddr_jiffies’ defined but not used [-Wunused-const-variable]
  static type const * const vvaraddr_ ## name =   \
                            ^
arch/x86/include/asm/vvar.h:46:1: note: in expansion of macro ‘DECLARE_VVAR’
 DECLARE_VVAR(0, volatile unsigned long, jiffies)
 ^~~~~~~~~~~~

In upstream, this is fixed by ef721987ae (x86, vdso: Introduce VVAR
marco for vdso32) and f40c330091 (x86, vdso: Move the vvar and hpet
mappings next to the 64-bit vDSO). But this is not applicable to
stable.

So mark the vvar declaration as __maybe_unused and be done with it.
This will generate it to the code only if it is used. I.e. the same as
with gcc < 6.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Andy Lutomirski <luto@amacapital.net>
---
 arch/x86/include/asm/vvar.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/vvar.h b/arch/x86/include/asm/vvar.h
index d76ac40da206..9fb01a91c013 100644
--- a/arch/x86/include/asm/vvar.h
+++ b/arch/x86/include/asm/vvar.h
@@ -30,7 +30,7 @@
 #else
 
 #define DECLARE_VVAR(offset, type, name)				\
-	static type const * const vvaraddr_ ## name =			\
+	static type const * const vvaraddr_ ## name __maybe_unused =	\
 		(void *)(VVAR_ADDRESS + (offset));
 
 #define DEFINE_VVAR(type, name)						\
-- 
2.7.1

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

* [PATCH 3.12 56/64] openrisc: fix CONFIG_UID16 setting
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (54 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 55/64] x86: vvar, fix excessive gcc-6 DECLARE_VVAR warnings Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 57/64] vmstat: explicitly schedule per-cpu work on the CPU we need it to run on Jiri Slaby
                   ` (11 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Andrew Morton, Iulia Manda, Josh Triplett,
	Linus Torvalds, Guenter Roeck, Jiri Slaby

From: Andrew Morton <akpm@linux-foundation.org>

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

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

commit 04ea1e91f85615318ea91ce8ab50cb6a01ee4005 upstream.

openrisc-allnoconfig:

  kernel/uid16.c: In function 'SYSC_setgroups16':
  kernel/uid16.c:184:2: error: implicit declaration of function 'groups_alloc'
  kernel/uid16.c:184:13: warning: assignment makes pointer from integer without a cast

openrisc shouldn't be setting CONFIG_UID16 when CONFIG_MULTIUSER=n.

Fixes: 2813893f8b197a1 ("kernel: conditionally support non-root users, groups and capabilities")
Reported-by: Fengguang Wu <fengguang.wu@gmail.com>
Cc: Iulia Manda <iulia.manda21@gmail.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/openrisc/Kconfig | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9488209a5253..191cd8e8b5da 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -16,6 +16,7 @@ config OPENRISC
 	select GENERIC_IRQ_SHOW
 	select GENERIC_IOMAP
 	select GENERIC_CPU_DEVICES
+	select HAVE_UID16
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_STRNCPY_FROM_USER
@@ -29,9 +30,6 @@ config MMU
 config HAVE_DMA_ATTRS
 	def_bool y
 
-config UID16
-	def_bool y
-
 config RWSEM_GENERIC_SPINLOCK
 	def_bool y
 
-- 
2.7.1

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

* [PATCH 3.12 57/64] vmstat: explicitly schedule per-cpu work on the CPU we need it to run on
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (55 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 56/64] openrisc: fix CONFIG_UID16 setting Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 58/64] Revert "workqueue: make sure delayed work run in local cpu" Jiri Slaby
                   ` (10 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Linus Torvalds, Christoph Lameter, Tejun Heo,
	Mike Galbraith, Michal Hocko, Jiri Slaby

From: Linus Torvalds <torvalds@linux-foundation.org>

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

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

commit 176bed1de5bf977938cad26551969eca8f0883b1 upstream.

The vmstat code uses "schedule_delayed_work_on()" to do the initial
startup of the delayed work on the right CPU, but then once it was
started it would use the non-cpu-specific "schedule_delayed_work()" to
re-schedule it on that CPU.

That just happened to schedule it on the same CPU historically (well, in
almost all situations), but the code _requires_ this work to be per-cpu,
and should say so explicitly rather than depend on the non-cpu-specific
scheduling to schedule on the current CPU.

The timer code is being changed to not be as single-minded in always
running things on the calling CPU.

See also commit 874bbfe600a6 ("workqueue: make sure delayed work run in
local cpu") that for now maintains the local CPU guarantees just in case
there are other broken users that depended on the accidental behavior.

js: 3.12 backport

Cc: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Mike Galbraith <mgalbraith@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/vmstat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index f7ca04482299..1dbd89d2fb9c 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1221,7 +1221,8 @@ int sysctl_stat_interval __read_mostly = HZ;
 static void vmstat_update(struct work_struct *w)
 {
 	refresh_cpu_vm_stats();
-	schedule_delayed_work(&__get_cpu_var(vmstat_work),
+	schedule_delayed_work_on(smp_processor_id(),
+		&__get_cpu_var(vmstat_work),
 		round_jiffies_relative(sysctl_stat_interval));
 }
 
-- 
2.7.1

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

* [PATCH 3.12 58/64] Revert "workqueue: make sure delayed work run in local cpu"
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (56 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 57/64] vmstat: explicitly schedule per-cpu work on the CPU we need it to run on Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 59/64] xhci: fix placement of call to usb_disabled() Jiri Slaby
                   ` (9 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Tejun Heo, Mike Galbraith,
	Henrique de Moraes Holschuh, Daniel Bilik, Jan Kara, Shaohua Li,
	Sasha Levin, Ben Hutchings, Thomas Gleixner, Jiri Slaby,
	Michal Hocko

From: Tejun Heo <tj@kernel.org>

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

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

commit 041bd12e272c53a35c54c13875839bcb98c999ce upstream.

This reverts commit 874bbfe600a660cba9c776b3957b1ce393151b76.

Workqueue used to implicity guarantee that work items queued without
explicit CPU specified are put on the local CPU.  Recent changes in
timer broke the guarantee and led to vmstat breakage which was fixed
by 176bed1de5bf ("vmstat: explicitly schedule per-cpu work on the CPU
we need it to run on").

vmstat is the most likely to expose the issue and it's quite possible
that there are other similar problems which are a lot more difficult
to trigger.  As a preventive measure, 874bbfe600a6 ("workqueue: make
sure delayed work run in local cpu") was applied to restore the local
CPU guarnatee.  Unfortunately, the change exposed a bug in timer code
which got fixed by 22b886dd1018 ("timers: Use proper base migration in
add_timer_on()").  Due to code restructuring, the commit couldn't be
backported beyond certain point and stable kernels which only had
874bbfe600a6 started crashing.

The local CPU guarantee was accidental more than anything else and we
want to get rid of it anyway.  As, with the vmstat case fixed,
874bbfe600a6 is causing more problems than it's fixing, it has been
decided to take the chance and officially break the guarantee by
reverting the commit.  A debug feature will be added to force foreign
CPU assignment to expose cases relying on the guarantee and fixes for
the individual cases will be backported to stable as necessary.

Signed-off-by: Tejun Heo <tj@kernel.org>
Fixes: 874bbfe600a6 ("workqueue: make sure delayed work run in local cpu")
Link: http://lkml.kernel.org/g/20160120211926.GJ10810@quack.suse.cz
Cc: Mike Galbraith <umgwanakikbuti@gmail.com>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Cc: Daniel Bilik <daniel.bilik@neosystem.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Shaohua Li <shli@fb.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Daniel Bilik <daniel.bilik@neosystem.cz>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/workqueue.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index bba4e426ccbc..bb5f920268d7 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1468,13 +1468,13 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
 	timer_stats_timer_set_start_info(&dwork->timer);
 
 	dwork->wq = wq;
-	/* timer isn't guaranteed to run in this cpu, record earlier */
-	if (cpu == WORK_CPU_UNBOUND)
-		cpu = raw_smp_processor_id();
 	dwork->cpu = cpu;
 	timer->expires = jiffies + delay;
 
-	add_timer_on(timer, cpu);
+	if (unlikely(cpu != WORK_CPU_UNBOUND))
+		add_timer_on(timer, cpu);
+	else
+		add_timer(timer);
 }
 
 /**
-- 
2.7.1

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

* [PATCH 3.12 59/64] xhci: fix placement of call to usb_disabled()
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (57 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 58/64] Revert "workqueue: make sure delayed work run in local cpu" Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 60/64] recordmcount: Fix endianness handling bug for nop_mcount Jiri Slaby
                   ` (8 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Greg Kroah-Hartman, Jiri Slaby

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

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

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

In the backport of 1eaf35e4dd592c59041bc1ed3248c46326da1f5f, the call to
usb_disabled() was too late, after we had already done some allocation.
Move that call to the top of the function instead, making the logic
match what is intended and is in the original patch.

Reported-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/host/xhci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6888e9a956d4..dfcf0a3527b8 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4864,6 +4864,9 @@ static int __init xhci_hcd_init(void)
 {
 	int retval;
 
+	if (usb_disabled())
+		return -ENODEV;
+
 	retval = xhci_register_pci();
 	if (retval < 0) {
 		pr_debug("Problem registering PCI driver.\n");
@@ -4892,9 +4895,6 @@ static int __init xhci_hcd_init(void)
 	/* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */
 	BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
 
-	if (usb_disabled())
-		return -ENODEV;
-
 	return 0;
 unreg_pci:
 	xhci_unregister_pci();
-- 
2.7.1

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

* [PATCH 3.12 60/64] recordmcount: Fix endianness handling bug for nop_mcount
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (58 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 59/64] xhci: fix placement of call to usb_disabled() Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 61/64] crypto: algif_hash - Only export and import on sockets with data Jiri Slaby
                   ` (7 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, libin, Steven Rostedt, Jiri Slaby

From: libin <huawei.libin@huawei.com>

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

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

commit c84da8b9ad3761eef43811181c7e896e9834b26b upstream.

In nop_mcount, shdr->sh_offset and welp->r_offset should handle
endianness properly, otherwise it will trigger Segmentation fault
if the recordmcount main and file.o have different endianness.

Link: http://lkml.kernel.org/r/563806C7.7070606@huawei.com

Signed-off-by: Li Bin <huawei.libin@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 scripts/recordmcount.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/recordmcount.h b/scripts/recordmcount.h
index 49b582a225b0..b9897e2be404 100644
--- a/scripts/recordmcount.h
+++ b/scripts/recordmcount.h
@@ -377,7 +377,7 @@ static void nop_mcount(Elf_Shdr const *const relhdr,
 
 		if (mcountsym == Elf_r_sym(relp) && !is_fake_mcount(relp)) {
 			if (make_nop)
-				ret = make_nop((void *)ehdr, shdr->sh_offset + relp->r_offset);
+				ret = make_nop((void *)ehdr, _w(shdr->sh_offset) + _w(relp->r_offset));
 			if (warn_on_notrace_sect && !once) {
 				printf("Section %s has mcount callers being ignored\n",
 				       txtname);
-- 
2.7.1

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

* [PATCH 3.12 61/64] crypto: algif_hash - Only export and import on sockets with data
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (59 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 60/64] recordmcount: Fix endianness handling bug for nop_mcount Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 62/64] dm btree: fix leak of bufio-backed block in btree_split_sibling error path Jiri Slaby
                   ` (6 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Herbert Xu, Jiri Slaby

From: Herbert Xu <herbert@gondor.apana.org.au>

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

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

commit 4afa5f9617927453ac04b24b584f6c718dfb4f45 upstream.

The hash_accept call fails to work on sockets that have not received
any data.  For some algorithm implementations it may cause crashes.

This patch fixes this by ensuring that we only export and import on
sockets that have received data.

Reported-by: Harsh Jain <harshjain.prof@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Tested-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 crypto/algif_hash.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index 850246206b12..a68b56a368a8 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -192,9 +192,14 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
 	struct sock *sk2;
 	struct alg_sock *ask2;
 	struct hash_ctx *ctx2;
+	bool more;
 	int err;
 
-	err = crypto_ahash_export(req, state);
+	lock_sock(sk);
+	more = ctx->more;
+	err = more ? crypto_ahash_export(req, state) : 0;
+	release_sock(sk);
+
 	if (err)
 		return err;
 
@@ -205,7 +210,10 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
 	sk2 = newsock->sk;
 	ask2 = alg_sk(sk2);
 	ctx2 = ask2->private;
-	ctx2->more = 1;
+	ctx2->more = more;
+
+	if (!more)
+		return err;
 
 	err = crypto_ahash_import(&ctx2->req, state);
 	if (err) {
-- 
2.7.1

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

* [PATCH 3.12 62/64] dm btree: fix leak of bufio-backed block in btree_split_sibling error path
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (60 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 61/64] crypto: algif_hash - Only export and import on sockets with data Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 63/64] drivers/base/memory.c: prohibit offlining of memory blocks with missing sections Jiri Slaby
                   ` (5 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Mike Snitzer, Jiri Slaby

From: Mike Snitzer <snitzer@redhat.com>

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

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

commit 30ce6e1cc5a0f781d60227e9096c86e188d2c2bd upstream.

The block allocated at the start of btree_split_sibling() is never
released if later insert_at() fails.

Fix this by releasing the previously allocated bufio block using
unlock_block().

Reported-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/persistent-data/dm-btree.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/md/persistent-data/dm-btree.c b/drivers/md/persistent-data/dm-btree.c
index fc3d733aab1c..28662bd600e0 100644
--- a/drivers/md/persistent-data/dm-btree.c
+++ b/drivers/md/persistent-data/dm-btree.c
@@ -471,8 +471,10 @@ static int btree_split_sibling(struct shadow_spine *s, dm_block_t root,
 
 	r = insert_at(sizeof(__le64), pn, parent_index + 1,
 		      le64_to_cpu(rn->keys[0]), &location);
-	if (r)
+	if (r) {
+		unlock_block(s->info, right);
 		return r;
+	}
 
 	if (key < le64_to_cpu(rn->keys[0])) {
 		unlock_block(s->info, right);
-- 
2.7.1

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

* [PATCH 3.12 63/64] drivers/base/memory.c: prohibit offlining of memory blocks with missing sections
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (61 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 62/64] dm btree: fix leak of bufio-backed block in btree_split_sibling error path Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 13:59 ` [PATCH 3.12 64/64] HID: usbhid: fix recursive deadlock Jiri Slaby
                   ` (4 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Seth Jennings, Daniel J Blueman, Yinghai Lu,
	Greg KH, Russ Anderson, Andrew Morton, Linus Torvalds,
	Jiri Slaby

From: Seth Jennings <sjennings@variantweb.net>

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

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

commit 26bbe7ef6d5cdc7ec08cba6d433fca4060f258f3 upstream.

Commit bdee237c0343 ("x86: mm: Use 2GB memory block size on large-memory
x86-64 systems") and 982792c782ef ("x86, mm: probe memory block size for
generic x86 64bit") introduced large block sizes for x86.  This made it
possible to have multiple sections per memory block where previously,
there was a only every one section per block.

Since blocks consist of contiguous ranges of section, there can be holes
in the blocks where sections are not present.  If one attempts to
offline such a block, a crash occurs since the code is not designed to
deal with this.

This patch is a quick fix to gaurd against the crash by not allowing
blocks with non-present sections to be offlined.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=107781

Signed-off-by: Seth Jennings <sjennings@variantweb.net>
Reported-by: Andrew Banman <abanman@sgi.com>
Cc: Daniel J Blueman <daniel@numascale.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Greg KH <greg@kroah.com>
Cc: Russ Anderson <rja@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/base/memory.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index bece691cb5d9..3e2a3059b1f8 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -311,6 +311,10 @@ static int memory_subsys_offline(struct device *dev)
 	if (mem->state == MEM_OFFLINE)
 		return 0;
 
+	/* Can't offline block with non-present sections */
+	if (mem->section_count != sections_per_block)
+		return -EINVAL;
+
 	return memory_block_change_state(mem, MEM_OFFLINE, MEM_ONLINE);
 }
 
-- 
2.7.1

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

* [PATCH 3.12 64/64] HID: usbhid: fix recursive deadlock
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (62 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 63/64] drivers/base/memory.c: prohibit offlining of memory blocks with missing sections Jiri Slaby
@ 2016-02-11 13:59 ` Jiri Slaby
  2016-02-11 14:09 ` [PATCH 3.12 00/64] 3.12.54-stable review Nikolay Borisov
                   ` (3 subsequent siblings)
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 13:59 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Ioan-Adrian Ratiu, Jiri Kosina, Jason Gerecke, Jiri Slaby

From: Ioan-Adrian Ratiu <adi@adirat.com>

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

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

commit e470127e9606b1fa151c4184243e61296d1e0c0f upstream.

The critical section protected by usbhid->lock in hid_ctrl() is too
big and because of this it causes a recursive deadlock. "Too big" means
the case statement and the call to hid_input_report() do not need to be
protected by the spinlock (no URB operations are done inside them).

The deadlock happens because in certain rare cases drivers try to grab
the lock while handling the ctrl irq which grabs the lock before them
as described above. For example newer wacom tablets like 056a:033c try
to reschedule proximity reads from wacom_intuos_schedule_prox_event()
calling hid_hw_request() -> usbhid_request() -> usbhid_submit_report()
which tries to grab the usbhid lock already held by hid_ctrl().

There are two ways to get out of this deadlock:
    1. Make the drivers work "around" the ctrl critical region, in the
    wacom case for ex. by delaying the scheduling of the proximity read
    request itself to a workqueue.
    2. Shrink the critical region so the usbhid lock protects only the
    instructions which modify usbhid state, calling hid_input_report()
    with the spinlock unlocked, allowing the device driver to grab the
    lock first, finish and then grab the lock afterwards in hid_ctrl().

This patch implements the 2nd solution.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/usbhid/hid-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index f44be51e261d..183a3e9b1ccc 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -492,8 +492,6 @@ static void hid_ctrl(struct urb *urb)
 	struct usbhid_device *usbhid = hid->driver_data;
 	int unplug = 0, status = urb->status;
 
-	spin_lock(&usbhid->lock);
-
 	switch (status) {
 	case 0:			/* success */
 		if (usbhid->ctrl[usbhid->ctrltail].dir == USB_DIR_IN)
@@ -513,6 +511,8 @@ static void hid_ctrl(struct urb *urb)
 		hid_warn(urb->dev, "ctrl urb status %d received\n", status);
 	}
 
+	spin_lock(&usbhid->lock);
+
 	if (unplug) {
 		usbhid->ctrltail = usbhid->ctrlhead;
 	} else {
-- 
2.7.1

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

* Re: [PATCH 3.12 00/64] 3.12.54-stable review
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (63 preceding siblings ...)
  2016-02-11 13:59 ` [PATCH 3.12 64/64] HID: usbhid: fix recursive deadlock Jiri Slaby
@ 2016-02-11 14:09 ` Nikolay Borisov
  2016-02-11 14:10   ` Jiri Slaby
  2016-02-11 14:17 ` [PATCH 3.12 65/65] dm thin: fix race condition when destroying thin pool workqueue Jiri Slaby
                   ` (2 subsequent siblings)
  67 siblings, 1 reply; 80+ messages in thread
From: Nikolay Borisov @ 2016-02-11 14:09 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: linux, shuah.kh, linux-kernel

Hi Jiri,

I think this commit should also be included:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=18d03e8c25f173f4107a40d0b8c24defb6ed69f3

On 02/11/2016 03:59 PM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.54 release.
> There are 64 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 Mon Feb 15 14:54:53 CET 2016.
> 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.54-rc1.xz
> and the diffstat can be found below.
> 
> thanks,
> js
> 
> ===============
> 
> 
> Alex Deucher (1):
>   drm/radeon: cypress_dpm: Fix unused variable warning when
>     CONFIG_ACPI=n
> 
> Andrew Morton (1):
>   openrisc: fix CONFIG_UID16 setting
> 
> Andrey Ryabinin (1):
>   ipv6/addrlabel: fix ip6addrlbl_get()
> 
> Arnd Bergmann (2):
>   mISDN: avoid arch specific __builtin_return_address call
>   arm64: fix building without CONFIG_UID16
> 
> Behan Webster (1):
>   ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h
> 
> Boqun Feng (2):
>   powerpc: Make value-returning atomics fully ordered
>   powerpc: Make {cmp}xchg* and their atomic_ versions fully ordered
> 
> Chunfeng Yun (1):
>   usb: xhci: fix config fail of FS hub behind a HS hub with MTT
> 
> Dan Carpenter (1):
>   USB: ipaq.c: fix a timeout loop
> 
> Dan Streetman (1):
>   xfrm: dst_entries_init() per-net dst_ops
> 
> David Henningsson (1):
>   ALSA: hda - Add inverted dmic for Packard Bell DOTS
> 
> Eric Dumazet (3):
>   ipv6: tcp: add rcu locking in tcp_v6_send_synack()
>   phonet: properly unshare skbs in phonet_rcv()
>   ipv6: update skb->csum when CE mark is propagated
> 
> Fabio Estevam (1):
>   drm: radeon: ni_dpm: Fix unused variable warning when CONFIG_ACPI=n
> 
> Florian Westphal (1):
>   connector: bump skb->users before callback invocation
> 
> Greg Kroah-Hartman (1):
>   xhci: fix placement of call to usb_disabled()
> 
> Guenter Roeck (1):
>   mn10300: Select CONFIG_HAVE_UID16 to fix build failure
> 
> Hannes Frederic Sowa (1):
>   bridge: Only call /sbin/bridge-stp for the initial network namespace
> 
> Herbert Xu (1):
>   crypto: algif_hash - Only export and import on sockets with data
> 
> Ido Schimmel (1):
>   team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid
> 
> Ioan-Adrian Ratiu (1):
>   HID: usbhid: fix recursive deadlock
> 
> Jiri Slaby (1):
>   x86: vvar, fix excessive gcc-6 DECLARE_VVAR warnings
> 
> Joe Perches (1):
>   compiler-gcc: integrate the various compiler-gcc[345].h files
> 
> John Blackwood (1):
>   arm64: Clear out any singlestep state on a ptrace detach operation
> 
> Kees Cook (1):
>   lkdtm: adjust recursion size to avoid warnings
> 
> Linus Torvalds (1):
>   vmstat: explicitly schedule per-cpu work on the CPU we need it to run
>     on
> 
> Marc Zyngier (1):
>   arm64: KVM: Fix AArch32 to AArch64 register mapping
> 
> Mario Kleiner (1):
>   ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2)
> 
> Michael Neuling (1):
>   powerpc/tm: Block signal return setting invalid MSR state
> 
> Mike Snitzer (1):
>   dm btree: fix leak of bufio-backed block in btree_split_sibling error
>     path
> 
> Mikulas Patocka (1):
>   parisc iommu: fix panic due to trying to allocate too large region
> 
> Neal Cardwell (1):
>   tcp_yeah: don't set ssthresh below 2
> 
> Nicolas Boichat (2):
>   ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode
>   ALSA: pcm: Fix snd_pcm_hw_params struct copy in compat mode
> 
> Nikesh Oswal (1):
>   ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz
> 
> Oliver Freyermuth (1):
>   USB: cp210x: add ID for ELV Marble Sound Board 1
> 
> Oliver Neukum (1):
>   xhci: refuse loading if nousb is used
> 
> Paul Bolle (1):
>   RDMA/cxgb4: Fix gcc warning on 32-bit arch
> 
> Richard Purdie (1):
>   HID: core: Avoid uninitialized buffer access
> 
> Sachin Pandhare (1):
>   ASoC: wm8962: correct addresses for HPF_C_0/1
> 
> Sasha Levin (1):
>   net: sctp: prevent writes to cookie_hmac_alg from accessing invalid
>     memory
> 
> Seth Jennings (1):
>   drivers/base/memory.c: prohibit offlining of memory blocks with
>     missing sections
> 
> Steven Noonan (1):
>   compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles
> 
> Takashi Iwai (8):
>   ALSA: rme96: Fix unexpected volume reset after rate changes
>   ALSA: seq: Fix missing NULL check at remove_events ioctl
>   ALSA: seq: Fix race at timer setup and close
>   ALSA: timer: Harden slave timer list handling
>   ALSA: timer: Fix race among timer ioctls
>   ALSA: timer: Fix double unlink of active_list
>   ALSA: hrtimer: Fix stall by hrtimer_cancel()
>   ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0
> 
> Tejun Heo (1):
>   Revert "workqueue: make sure delayed work run in local cpu"
> 
> Ulrich Weigand (1):
>   scripts/recordmcount.pl: support data in text section on powerpc
> 
> Uwe Kleine-König (1):
>   ARM: 8160/1: drop warning about return_address not using unwind tables
> 
> Vijay Pandurangan (1):
>   veth: don’t modify ip_summed; doing so treats packets with bad
>     checksums as good.
> 
> Vinod Koul (1):
>   ASoC: compress: Fix compress device direction check
> 
> Will Deacon (1):
>   arm64: mm: ensure that the zero page is visible to the page table
>     walker
> 
> Xin Long (1):
>   sctp: sctp should release assoc when sctp_make_abort_user return NULL
>     in sctp_close
> 
> Xiong Zhang (1):
>   ALSA: hda - Set SKL+ hda controller power at freeze() and thaw()
> 
> Yang Shi (1):
>   arm64: restore bogomips information in /proc/cpuinfo
> 
> libin (1):
>   recordmcount: Fix endianness handling bug for nop_mcount
> 
> willy tarreau (1):
>   unix: properly account for FDs passed over unix sockets
> 
>  arch/arm/include/asm/ftrace.h           |   2 +-
>  arch/arm/kernel/return_address.c        |   9 ---
>  arch/arm64/include/asm/kvm_emulate.h    |   8 ++-
>  arch/arm64/kernel/ptrace.c              |   6 ++
>  arch/arm64/kernel/setup.c               |   4 ++
>  arch/arm64/kvm/inject_fault.c           |   2 +-
>  arch/arm64/mm/mmu.c                     |   3 +
>  arch/mn10300/Kconfig                    |   4 +-
>  arch/openrisc/Kconfig                   |   4 +-
>  arch/powerpc/include/asm/cmpxchg.h      |  16 ++---
>  arch/powerpc/include/asm/reg.h          |   1 +
>  arch/powerpc/include/asm/synch.h        |   2 +-
>  arch/powerpc/kernel/signal_32.c         |  14 ++--
>  arch/powerpc/kernel/signal_64.c         |   4 ++
>  arch/x86/include/asm/vvar.h             |   2 +-
>  crypto/algif_hash.c                     |  12 +++-
>  drivers/base/memory.c                   |   4 ++
>  drivers/connector/connector.c           |  11 +--
>  drivers/gpu/drm/radeon/cypress_dpm.c    |   2 +
>  drivers/gpu/drm/radeon/ni_dpm.c         |   2 +-
>  drivers/hid/hid-core.c                  |   2 +-
>  drivers/hid/usbhid/hid-core.c           |   4 +-
>  drivers/infiniband/hw/cxgb4/mem.c       |   2 +-
>  drivers/isdn/hardware/mISDN/mISDNipac.c |  12 +++-
>  drivers/isdn/hardware/mISDN/w6692.c     |   6 +-
>  drivers/md/persistent-data/dm-btree.c   |   4 +-
>  drivers/misc/lkdtm.c                    |  30 ++++++---
>  drivers/net/team/team.c                 |   6 +-
>  drivers/net/veth.c                      |   6 --
>  drivers/parisc/iommu-helpers.h          |  15 +++--
>  drivers/usb/host/xhci.c                 |  12 ++++
>  drivers/usb/serial/cp210x.c             |   1 +
>  drivers/usb/serial/ipaq.c               |   3 +-
>  include/linux/compiler-gcc.h            | 114 ++++++++++++++++++++++++++++++--
>  include/linux/compiler-gcc3.h           |  23 -------
>  include/linux/compiler-gcc4.h           |  88 ------------------------
>  include/linux/compiler-gcc5.h           |  66 ------------------
>  include/linux/sched.h                   |   1 +
>  include/linux/syscalls.h                |   2 +-
>  include/linux/types.h                   |   2 +-
>  include/net/inet_ecn.h                  |  19 +++++-
>  kernel/workqueue.c                      |   8 +--
>  mm/vmstat.c                             |   3 +-
>  net/bridge/br_stp_if.c                  |   5 +-
>  net/ipv4/tcp_yeah.c                     |   2 +-
>  net/ipv4/xfrm4_policy.c                 |  46 ++++++++++---
>  net/ipv6/addrlabel.c                    |   2 +-
>  net/ipv6/tcp_ipv6.c                     |   2 +
>  net/ipv6/xfrm6_mode_tunnel.c            |   2 +-
>  net/ipv6/xfrm6_policy.c                 |  53 ++++++++++-----
>  net/phonet/af_phonet.c                  |   4 ++
>  net/sctp/sm_statefuns.c                 |   6 +-
>  net/sctp/socket.c                       |   3 +-
>  net/sctp/sysctl.c                       |   2 +-
>  net/unix/af_unix.c                      |  24 +++++--
>  net/unix/garbage.c                      |  16 +++--
>  net/xfrm/xfrm_policy.c                  |  38 -----------
>  scripts/recordmcount.h                  |   2 +-
>  scripts/recordmcount.pl                 |   3 +-
>  sound/core/control.c                    |   2 +
>  sound/core/hrtimer.c                    |   3 +-
>  sound/core/pcm_compat.c                 |  13 ++--
>  sound/core/seq/seq_clientmgr.c          |   2 +-
>  sound/core/seq/seq_compat.c             |   9 +--
>  sound/core/seq/seq_queue.c              |   2 +
>  sound/core/timer.c                      |  52 ++++++++++-----
>  sound/pci/hda/hda_intel.c               |  34 ++++++++++
>  sound/pci/hda/patch_realtek.c           |  12 +++-
>  sound/pci/rme96.c                       |  41 +++++++-----
>  sound/soc/codecs/arizona.c              |   2 +-
>  sound/soc/codecs/wm8962.c               |   4 +-
>  sound/soc/soc-compress.c                |  23 ++++++-
>  72 files changed, 543 insertions(+), 407 deletions(-)
>  delete mode 100644 include/linux/compiler-gcc3.h
>  delete mode 100644 include/linux/compiler-gcc4.h
>  delete mode 100644 include/linux/compiler-gcc5.h
> 

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

* Re: [PATCH 3.12 00/64] 3.12.54-stable review
  2016-02-11 14:09 ` [PATCH 3.12 00/64] 3.12.54-stable review Nikolay Borisov
@ 2016-02-11 14:10   ` Jiri Slaby
  2016-02-11 14:12     ` Jiri Slaby
  0 siblings, 1 reply; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 14:10 UTC (permalink / raw)
  To: Nikolay Borisov, stable; +Cc: linux, shuah.kh, linux-kernel

On 02/11/2016, 03:09 PM, Nikolay Borisov wrote:
> Hi Jiri,
> 
> I think this commit should also be included:
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=18d03e8c25f173f4107a40d0b8c24defb6ed69f3

Hi,

given it is marked as:
    Fixes: 905e51b39a555 ("dm thin: commit outstanding data every second")
    Fixes: 85ad643b7e7e5 ("dm thin: add timeout to stop
out-of-data-space mode holding IO forever")


and neither is in 3.12, why do you think so?

thanks,
-- 
js
suse labs

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

* Re: [PATCH 3.12 00/64] 3.12.54-stable review
  2016-02-11 14:10   ` Jiri Slaby
@ 2016-02-11 14:12     ` Jiri Slaby
  0 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 14:12 UTC (permalink / raw)
  To: Nikolay Borisov, stable; +Cc: linux, shuah.kh, linux-kernel

On 02/11/2016, 03:10 PM, Jiri Slaby wrote:
> On 02/11/2016, 03:09 PM, Nikolay Borisov wrote:
>> Hi Jiri,
>>
>> I think this commit should also be included:
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=18d03e8c25f173f4107a40d0b8c24defb6ed69f3
> 
> Hi,
> 
> given it is marked as:
>     Fixes: 905e51b39a555 ("dm thin: commit outstanding data every second")
>     Fixes: 85ad643b7e7e5 ("dm thin: add timeout to stop
> out-of-data-space mode holding IO forever")
> 
> 
> and neither is in 3.12, why do you think so?

Actually, it is. I will queue it up. Thanks.

-- 
js
suse labs

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

* [PATCH 3.12 65/65] dm thin: fix race condition when destroying thin pool workqueue
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (64 preceding siblings ...)
  2016-02-11 14:09 ` [PATCH 3.12 00/64] 3.12.54-stable review Nikolay Borisov
@ 2016-02-11 14:17 ` Jiri Slaby
  2016-02-11 18:17 ` [PATCH 3.12 00/64] 3.12.54-stable review Guenter Roeck
  2016-02-11 19:26 ` Shuah Khan
  67 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-11 14:17 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nikolay Borisov, Mike Snitzer, Jiri Slaby

From: Nikolay Borisov <kernel@kyup.com>

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

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

commit 18d03e8c25f173f4107a40d0b8c24defb6ed69f3 upstream.

When a thin pool is being destroyed delayed work items are
cancelled using cancel_delayed_work(), which doesn't guarantee that on
return the delayed item isn't running.  This can cause the work item to
requeue itself on an already destroyed workqueue.  Fix this by using
cancel_delayed_work_sync() which guarantees that on return the work item
is not running anymore.

Fixes: 905e51b39a555 ("dm thin: commit outstanding data every second")
Fixes: 85ad643b7e7e5 ("dm thin: add timeout to stop out-of-data-space mode holding IO forever")
Signed-off-by: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Cc: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/dm-thin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c
index 5ff934102f30..d14d1c1fff8b 100644
--- a/drivers/md/dm-thin.c
+++ b/drivers/md/dm-thin.c
@@ -2331,7 +2331,7 @@ static void pool_postsuspend(struct dm_target *ti)
 	struct pool_c *pt = ti->private;
 	struct pool *pool = pt->pool;
 
-	cancel_delayed_work(&pool->waker);
+	cancel_delayed_work_sync(&pool->waker);
 	flush_workqueue(pool->wq);
 	(void) commit(pool);
 }
-- 
2.7.1

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

* Re: [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets
  2016-02-11 13:59 ` [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets Jiri Slaby
@ 2016-02-11 17:32   ` Willy Tarreau
  2016-02-12  7:57     ` Jiri Slaby
  0 siblings, 1 reply; 80+ messages in thread
From: Willy Tarreau @ 2016-02-11 17:32 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: stable, linux-kernel, David S . Miller, Hannes Frederic Sowa

Hi Jiri,

On Thu, Feb 11, 2016 at 02:59:08PM +0100, Jiri Slaby wrote:
> From: willy tarreau <w@1wt.eu>
> 
> 3.12-stable review patch.  If anyone has any objections, please let me know.
> 
> ===============
> 
> [ Upstream commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 ]
> 
> It is possible for a process to allocate and accumulate far more FDs than
> the process' limit by sending them over a unix socket then closing them
> to keep the process' fd count low.
> 
> This change addresses this problem by keeping track of the number of FDs
> in flight per user and preventing non-privileged processes from having
> more FDs in flight than their configured FD limit.
> 
> Reported-by: socketpair@gmail.com
> Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Mitigates: CVE-2013-4312 (Linux 2.0+)
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> Signed-off-by: Willy Tarreau <w@1wt.eu>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>

A possible issue was reported regarding this patch, and Hannes
implemented a fix that's not yet in mainline. I guess it's
preferable to postpone this patch for now.

Thanks,
Willy

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

* Re: [PATCH 3.12 00/64] 3.12.54-stable review
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (65 preceding siblings ...)
  2016-02-11 14:17 ` [PATCH 3.12 65/65] dm thin: fix race condition when destroying thin pool workqueue Jiri Slaby
@ 2016-02-11 18:17 ` Guenter Roeck
  2016-02-11 19:26 ` Shuah Khan
  67 siblings, 0 replies; 80+ messages in thread
From: Guenter Roeck @ 2016-02-11 18:17 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: stable, shuah.kh, linux-kernel

On Thu, Feb 11, 2016 at 02:59:26PM +0100, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.54 release.
> There are 64 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 Mon Feb 15 14:54:53 CET 2016.
> Anything received after that time might be too late.
> 
Build results:
	total: 124 pass: 124 fail: 0
Qemu test results:
	total: 79 pass: 79 fail: 0

Details are available at http://kerneltests.org/builders.

Guenter

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

* Re: [PATCH 3.12 00/64] 3.12.54-stable review
  2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
                   ` (66 preceding siblings ...)
  2016-02-11 18:17 ` [PATCH 3.12 00/64] 3.12.54-stable review Guenter Roeck
@ 2016-02-11 19:26 ` Shuah Khan
  2016-02-15 15:20   ` Jiri Slaby
  67 siblings, 1 reply; 80+ messages in thread
From: Shuah Khan @ 2016-02-11 19:26 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: linux, shuah.kh, linux-kernel, Shuah Khan

On 02/11/2016 06:59 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.54 release.
> There are 64 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 Mon Feb 15 14:54:53 CET 2016.
> 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.54-rc1.xz
> and the diffstat can be found below.
> 

Compiled and booted on my test system. I did see
one additional error message:

mei_me 0000:00:16.0: version message write failed

Anything to be concerned about?

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] 80+ messages in thread

* Re: [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets
  2016-02-11 17:32   ` Willy Tarreau
@ 2016-02-12  7:57     ` Jiri Slaby
  2016-02-12  8:45       ` Philipp Hahn
  0 siblings, 1 reply; 80+ messages in thread
From: Jiri Slaby @ 2016-02-12  7:57 UTC (permalink / raw)
  To: Willy Tarreau
  Cc: stable, linux-kernel, David S . Miller, Hannes Frederic Sowa

On 02/11/2016, 06:32 PM, Willy Tarreau wrote:
> Hi Jiri,
> 
> On Thu, Feb 11, 2016 at 02:59:08PM +0100, Jiri Slaby wrote:
>> From: willy tarreau <w@1wt.eu>
>>
>> 3.12-stable review patch.  If anyone has any objections, please let me know.
>>
>> ===============
>>
>> [ Upstream commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 ]
>>
>> It is possible for a process to allocate and accumulate far more FDs than
>> the process' limit by sending them over a unix socket then closing them
>> to keep the process' fd count low.
>>
>> This change addresses this problem by keeping track of the number of FDs
>> in flight per user and preventing non-privileged processes from having
>> more FDs in flight than their configured FD limit.
>>
>> Reported-by: socketpair@gmail.com
>> Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>> Mitigates: CVE-2013-4312 (Linux 2.0+)
>> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
>> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
>> Signed-off-by: Willy Tarreau <w@1wt.eu>
>> Signed-off-by: David S. Miller <davem@davemloft.net>
>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> 
> A possible issue was reported regarding this patch, and Hannes
> implemented a fix that's not yet in mainline. I guess it's
> preferable to postpone this patch for now.

Hi,

yes definitely. Thanks for noting.

For reference:
http://article.gmane.org/gmane.linux.kernel/2142236

thanks,
-- 
js
suse labs

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

* Re: [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets
  2016-02-12  7:57     ` Jiri Slaby
@ 2016-02-12  8:45       ` Philipp Hahn
  2016-02-12  9:03         ` Willy Tarreau
  0 siblings, 1 reply; 80+ messages in thread
From: Philipp Hahn @ 2016-02-12  8:45 UTC (permalink / raw)
  To: Jiri Slaby, Willy Tarreau
  Cc: stable, linux-kernel, David S . Miller, Hannes Frederic Sowa

Am 12.02.2016 um 08:57 schrieb Jiri Slaby:
> On 02/11/2016, 06:32 PM, Willy Tarreau wrote:
>> On Thu, Feb 11, 2016 at 02:59:08PM +0100, Jiri Slaby wrote:
>>> From: willy tarreau <w@1wt.eu>
>>>
>>> 3.12-stable review patch.  If anyone has any objections, please let me know.
>>>
>>> ===============
>>>
>>> [ Upstream commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 ]
>>>
>>> It is possible for a process to allocate and accumulate far more FDs than
>>> the process' limit by sending them over a unix socket then closing them
>>> to keep the process' fd count low.
>>>
>>> This change addresses this problem by keeping track of the number of FDs
>>> in flight per user and preventing non-privileged processes from having
>>> more FDs in flight than their configured FD limit.
>>>
>>> Reported-by: socketpair@gmail.com
>>> Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
>>> Mitigates: CVE-2013-4312 (Linux 2.0+)
>>> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
>>> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
>>> Signed-off-by: Willy Tarreau <w@1wt.eu>
>>> Signed-off-by: David S. Miller <davem@davemloft.net>
>>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
>>
>> A possible issue was reported regarding this patch, and Hannes
>> implemented a fix that's not yet in mainline. I guess it's
>> preferable to postpone this patch for now.
> 
> yes definitely. Thanks for noting.

Yes and no: the above mentioned patch looks innocent now after more
bisecting, but there is <https://patchwork.ozlabs.org/patch/577653/> as
a folow-up to the FD-accounting.

> For reference:
> http://article.gmane.org/gmane.linux.kernel/2142236

Better read the full thread:
<http://thread.gmane.org/gmane.linux.kernel/2142236>; the suspected bad
patch is
 unix: avoid use-after-free in ep_remove_wait_queue

Philipp

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

* Re: [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets
  2016-02-12  8:45       ` Philipp Hahn
@ 2016-02-12  9:03         ` Willy Tarreau
  0 siblings, 0 replies; 80+ messages in thread
From: Willy Tarreau @ 2016-02-12  9:03 UTC (permalink / raw)
  To: Philipp Hahn
  Cc: Jiri Slaby, stable, linux-kernel, David S . Miller, Hannes Frederic Sowa

On Fri, Feb 12, 2016 at 09:45:22AM +0100, Philipp Hahn wrote:
> Am 12.02.2016 um 08:57 schrieb Jiri Slaby:
> > On 02/11/2016, 06:32 PM, Willy Tarreau wrote:
> >> On Thu, Feb 11, 2016 at 02:59:08PM +0100, Jiri Slaby wrote:
> >>> From: willy tarreau <w@1wt.eu>
> >>>
> >>> 3.12-stable review patch.  If anyone has any objections, please let me know.
> >>>
> >>> ===============
> >>>
> >>> [ Upstream commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 ]
> >>>
> >>> It is possible for a process to allocate and accumulate far more FDs than
> >>> the process' limit by sending them over a unix socket then closing them
> >>> to keep the process' fd count low.
> >>>
> >>> This change addresses this problem by keeping track of the number of FDs
> >>> in flight per user and preventing non-privileged processes from having
> >>> more FDs in flight than their configured FD limit.
> >>>
> >>> Reported-by: socketpair@gmail.com
> >>> Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> >>> Mitigates: CVE-2013-4312 (Linux 2.0+)
> >>> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> >>> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> >>> Signed-off-by: Willy Tarreau <w@1wt.eu>
> >>> Signed-off-by: David S. Miller <davem@davemloft.net>
> >>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> >>
> >> A possible issue was reported regarding this patch, and Hannes
> >> implemented a fix that's not yet in mainline. I guess it's
> >> preferable to postpone this patch for now.
> > 
> > yes definitely. Thanks for noting.
> 
> Yes and no: the above mentioned patch looks innocent now after more
> bisecting, but there is <https://patchwork.ozlabs.org/patch/577653/> as
> a folow-up to the FD-accounting.

It was not the only issue reported, as I remember there is a possibility
that for processes having to pass FDs from one socket to another (eg:
dbus), the wrong user could be credited. I don't remember the exact
detail but since the fix is pending and the current patch fixes an
issue which is as old as kernel 2.0 or so, there's no need to rush it
into stable kernels.

Willy

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

* Re: [PATCH 3.12 55/64] x86: vvar, fix excessive gcc-6 DECLARE_VVAR warnings
  2016-02-11 13:59 ` [PATCH 3.12 55/64] x86: vvar, fix excessive gcc-6 DECLARE_VVAR warnings Jiri Slaby
@ 2016-02-12 16:42   ` Andy Lutomirski
  0 siblings, 0 replies; 80+ messages in thread
From: Andy Lutomirski @ 2016-02-12 16:42 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: stable, linux-kernel

On Thu, Feb 11, 2016 at 5:59 AM, Jiri Slaby <jslaby@suse.cz> wrote:
> 3.12-stable review patch.  If anyone has any objections, please let me know.
>
> ===============
>
> On 3.12, with gcc-6, I see a lot of:
> arch/x86/include/asm/vvar.h:33:28: warning: ‘vvaraddr_jiffies’ defined but not used [-Wunused-const-variable]
>   static type const * const vvaraddr_ ## name =   \
>                             ^
> arch/x86/include/asm/vvar.h:46:1: note: in expansion of macro ‘DECLARE_VVAR’
>  DECLARE_VVAR(0, volatile unsigned long, jiffies)
>  ^~~~~~~~~~~~
>
> In upstream, this is fixed by ef721987ae (x86, vdso: Introduce VVAR
> marco for vdso32) and f40c330091 (x86, vdso: Move the vvar and hpet
> mappings next to the 64-bit vDSO). But this is not applicable to
> stable.
>
> So mark the vvar declaration as __maybe_unused and be done with it.
> This will generate it to the code only if it is used. I.e. the same as
> with gcc < 6.

LGTM.

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

* Re: [PATCH 3.12 00/64] 3.12.54-stable review
  2016-02-11 19:26 ` Shuah Khan
@ 2016-02-15 15:20   ` Jiri Slaby
  2016-02-15 16:10     ` Winkler, Tomas
  0 siblings, 1 reply; 80+ messages in thread
From: Jiri Slaby @ 2016-02-15 15:20 UTC (permalink / raw)
  To: Shuah Khan, stable; +Cc: linux, shuah.kh, linux-kernel, tomas.winkler

On 02/11/2016, 08:26 PM, Shuah Khan wrote:
> On 02/11/2016 06:59 AM, Jiri Slaby wrote:
>> This is the start of the stable review cycle for the 3.12.54 release.
>> There are 64 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 Mon Feb 15 14:54:53 CET 2016.
>> 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.54-rc1.xz
>> and the diffstat can be found below.
>>
> 
> Compiled and booted on my test system. I did see
> one additional error message:
> 
> mei_me 0000:00:16.0: version message write failed
> 
> Anything to be concerned about?

I hope not, given there are no relevant changes in mei in this release.
Ccing MEI maintainer if this rings a bell?

thanks,
-- 
js
suse labs

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

* RE: [PATCH 3.12 00/64] 3.12.54-stable review
  2016-02-15 15:20   ` Jiri Slaby
@ 2016-02-15 16:10     ` Winkler, Tomas
  0 siblings, 0 replies; 80+ messages in thread
From: Winkler, Tomas @ 2016-02-15 16:10 UTC (permalink / raw)
  To: Jiri Slaby, Shuah Khan, stable; +Cc: linux, shuah.kh, linux-kernel



> -----Original Message-----
> From: Jiri Slaby [mailto:jslaby@suse.cz]
> Sent: Monday, February 15, 2016 17:20
> To: Shuah Khan <shuahkh@osg.samsung.com>; stable@vger.kernel.org
> Cc: linux@roeck-us.net; shuah.kh@samsung.com; linux-kernel@vger.kernel.org;
> Winkler, Tomas <tomas.winkler@intel.com>
> Subject: Re: [PATCH 3.12 00/64] 3.12.54-stable review
> 
> On 02/11/2016, 08:26 PM, Shuah Khan wrote:
> > On 02/11/2016 06:59 AM, Jiri Slaby wrote:
> >> This is the start of the stable review cycle for the 3.12.54 release.
> >> There are 64 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 Mon Feb 15 14:54:53 CET 2016.
> >> 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.54-rc1.xz
> >> and the diffstat can be found below.
> >>
> >
> > Compiled and booted on my test system. I did see
> > one additional error message:
> >
> > mei_me 0000:00:16.0: version message write failed
> >
> > Anything to be concerned about?
> 
> I hope not, given there are no relevant changes in mei in this release.
> Ccing MEI maintainer if this rings a bell?


On what platform is this happening? Do you have a more content in the log?
Thanks
Tomas 

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

* Re: [PATCH 3.12 20/64] xhci: refuse loading if nousb is used
  2016-02-11 13:58 ` [PATCH 3.12 20/64] xhci: refuse loading if nousb is used Jiri Slaby
@ 2016-02-16  3:06   ` Ben Hutchings
  2016-02-16  8:49     ` Jiri Slaby
  0 siblings, 1 reply; 80+ messages in thread
From: Ben Hutchings @ 2016-02-16  3:06 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: linux-kernel, Oliver Neukum

[-- Attachment #1: Type: text/plain, Size: 1322 bytes --]

On Thu, 2016-02-11 at 14:58 +0100, Jiri Slaby wrote:
> From: Oliver Neukum <oneukum@suse.com>
> 
> 3.12-stable review patch.  If anyone has any objections, please let me know.
> 
> ===============
> 
> commit 1eaf35e4dd592c59041bc1ed3248c46326da1f5f upstream.
> 
> The module should fail to load.
> 
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  drivers/usb/host/xhci.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 47b25542a99c..6888e9a956d4 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -4891,6 +4891,10 @@ static int __init xhci_hcd_init(void)
>  	BUILD_BUG_ON(sizeof(struct xhci_intr_reg) != 8*32/8);
>  	/* xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */
>  	BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
> +
> +	if (usb_disabled())
> +		return -ENODEV;
> +
>  	return 0;
>  unreg_pci:
>  	xhci_unregister_pci();

This check needs to go at the top of the function, before the call to
xhci_register_pci().

Ben.

-- 
Ben Hutchings
Life is what happens to you while you're busy making other plans.
                                                               - John Lennon

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* Re: [PATCH 3.12 20/64] xhci: refuse loading if nousb is used
  2016-02-16  3:06   ` Ben Hutchings
@ 2016-02-16  8:49     ` Jiri Slaby
  0 siblings, 0 replies; 80+ messages in thread
From: Jiri Slaby @ 2016-02-16  8:49 UTC (permalink / raw)
  To: Ben Hutchings, stable; +Cc: linux-kernel, Oliver Neukum

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 02/16/2016, 04:06 AM, Ben Hutchings wrote:
> On Thu, 2016-02-11 at 14:58 +0100, Jiri Slaby wrote:
>> From: Oliver Neukum <oneukum@suse.com>
>> 
>> 3.12-stable review patch.  If anyone has any objections, please
>> let me know.
>> 
>> ===============
>> 
>> commit 1eaf35e4dd592c59041bc1ed3248c46326da1f5f upstream.
>> 
>> The module should fail to load.
>> 
>> Signed-off-by: Oliver Neukum <oneukum@suse.com> Signed-off-by:
>> Jiri Slaby <jslaby@suse.cz> --- drivers/usb/host/xhci.c | 4 ++++ 
>> 1 file changed, 4 insertions(+)
>> 
>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c 
>> index 47b25542a99c..6888e9a956d4 100644 ---
>> a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@
>> -4891,6 +4891,10 @@ static int __init xhci_hcd_init(void) 
>> BUILD_BUG_ON(sizeof(struct xhci_intr_reg) != 8*32/8); /*
>> xhci_run_regs has eight fields and embeds 128 xhci_intr_regs */ 
>> BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); + +
>> if (usb_disabled()) +		return -ENODEV; + return 0; unreg_pci: 
>> xhci_unregister_pci();
> 
> This check needs to go at the top of the function, before the call
> to xhci_register_pci().

Oh yes, this is done later in 3.12.54 in:

commit b48d054283a2c2d60a100bf7772bf308042c57ac
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Jan 31 11:11:58 2016 -0800

    xhci: fix placement of call to usb_disabled()

thanks,
- -- 
js
suse labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWwuKNAAoJEL0lsQQGtHBJijIP/iZ6yp7A99iQi2ZqPvsHe+xC
Cqip1AXpPaA727acGmlhC+B55jFzWQyEGFYOq7/Q3pZ8uxp9iVDfa6RsyfPqCbrF
ItadjVKhjTc4RW005sjqUJCh/7fg776tr7mcf+2vgrF/TexSi/OrOOOcgsBVp3vj
iZFnr2mKPC4nLhDx6iOIqYCSEGUASgdwQW3NuhnfOaVRM7lRBLl6Isbg24CN+Kra
V9/x1xxNl00eBpMEU6G9bav847KWdOLik6qW0emuy3Bjzc34bVRH74m20ZVcJSEI
5bG9BFGNbikQdasRoWr/H8OSnh1YwZ38daazPsIdDqyut4VKkQ5wfvxP+/c/KUsG
rYvfVTVaJWXb9gdODDleVIWRaZ1Va/0q5uzDrQi4KGV62dw9Pb0JJnDcuvWKmtx/
N0Fjjl7L1RoqNGklGPtqrYA2B8h/dqPlU0nOxwMBaafjeds+KK1k5ZWLlJUH3K4a
CAFeabEjVCaysrHZ768OXGAH/BGreAUTsYL4l5VapQZwy/EggV5oeFlJjkIRZDJG
kGQpGe63Bl/8+fFtx8UtW4d0LbtvgfSCIOZBCmyd/HIODODv53Exehm7vU409Dyd
9XsVJUhO/ANCHu/NSc+c9bL4f3u5Exd2uLoq2jeMricOZzat3ysVHFrTXqB1tO0f
D14IaCz004DOckjJzJQa
=Wtvm
-----END PGP SIGNATURE-----

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

end of thread, other threads:[~2016-02-16  8:49 UTC | newest]

Thread overview: 80+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-11 13:59 [PATCH 3.12 00/64] 3.12.54-stable review Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 01/64] ALSA: rme96: Fix unexpected volume reset after rate changes Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 02/64] ALSA: hda - Add inverted dmic for Packard Bell DOTS Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 03/64] ALSA: hda - Set SKL+ hda controller power at freeze() and thaw() Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 04/64] ALSA: hda/realtek - Fix silent headphone output on MacPro 4,1 (v2) Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 05/64] ALSA: seq: Fix missing NULL check at remove_events ioctl Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 06/64] ALSA: seq: Fix race at timer setup and close Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 07/64] ALSA: timer: Harden slave timer list handling Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 08/64] ALSA: timer: Fix race among timer ioctls Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 09/64] ALSA: timer: Fix double unlink of active_list Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 10/64] ALSA: seq: Fix snd_seq_call_port_info_ioctl in compat mode Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 11/64] ALSA: pcm: Fix snd_pcm_hw_params struct copy " Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 12/64] ALSA: hrtimer: Fix stall by hrtimer_cancel() Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 13/64] ALSA: control: Avoid kernel warnings from tlv ioctl with numid 0 Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 14/64] ASoC: wm8962: correct addresses for HPF_C_0/1 Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 15/64] ASoC: arizona: Fix bclk for sample rates that are multiple of 4kHz Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 16/64] ASoC: compress: Fix compress device direction check Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 17/64] usb: xhci: fix config fail of FS hub behind a HS hub with MTT Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 18/64] USB: ipaq.c: fix a timeout loop Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 19/64] USB: cp210x: add ID for ELV Marble Sound Board 1 Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 20/64] xhci: refuse loading if nousb is used Jiri Slaby
2016-02-16  3:06   ` Ben Hutchings
2016-02-16  8:49     ` Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 21/64] ARM: 8158/1: LLVMLinux: use static inline in ARM ftrace.h Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 22/64] ARM: 8160/1: drop warning about return_address not using unwind tables Jiri Slaby
2016-02-11 13:58 ` [PATCH 3.12 23/64] drm/radeon: cypress_dpm: Fix unused variable warning when CONFIG_ACPI=n Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 24/64] drm: radeon: ni_dpm: " Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 25/64] lkdtm: adjust recursion size to avoid warnings Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 26/64] RDMA/cxgb4: Fix gcc warning on 32-bit arch Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 27/64] mISDN: avoid arch specific __builtin_return_address call Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 28/64] veth: don’t modify ip_summed; doing so treats packets with bad checksums as good Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 29/64] ipv6/addrlabel: fix ip6addrlbl_get() Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 30/64] sctp: sctp should release assoc when sctp_make_abort_user return NULL in sctp_close Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 31/64] connector: bump skb->users before callback invocation Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 32/64] unix: properly account for FDs passed over unix sockets Jiri Slaby
2016-02-11 17:32   ` Willy Tarreau
2016-02-12  7:57     ` Jiri Slaby
2016-02-12  8:45       ` Philipp Hahn
2016-02-12  9:03         ` Willy Tarreau
2016-02-11 13:59 ` [PATCH 3.12 33/64] bridge: Only call /sbin/bridge-stp for the initial network namespace Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 34/64] net: sctp: prevent writes to cookie_hmac_alg from accessing invalid memory Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 35/64] ipv6: tcp: add rcu locking in tcp_v6_send_synack() Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 36/64] tcp_yeah: don't set ssthresh below 2 Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 37/64] phonet: properly unshare skbs in phonet_rcv() Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 38/64] ipv6: update skb->csum when CE mark is propagated Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 39/64] team: Replace rcu_read_lock with a mutex in team_vlan_rx_kill_vid Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 40/64] xfrm: dst_entries_init() per-net dst_ops Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 41/64] powerpc/tm: Block signal return setting invalid MSR state Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 42/64] powerpc: Make value-returning atomics fully ordered Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 43/64] powerpc: Make {cmp}xchg* and their atomic_ versions " Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 44/64] scripts/recordmcount.pl: support data in text section on powerpc Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 45/64] arm64: KVM: Fix AArch32 to AArch64 register mapping Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 46/64] arm64: fix building without CONFIG_UID16 Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 47/64] arm64: Clear out any singlestep state on a ptrace detach operation Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 48/64] arm64: mm: ensure that the zero page is visible to the page table walker Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 49/64] parisc iommu: fix panic due to trying to allocate too large region Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 50/64] HID: core: Avoid uninitialized buffer access Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 51/64] mn10300: Select CONFIG_HAVE_UID16 to fix build failure Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 52/64] arm64: restore bogomips information in /proc/cpuinfo Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 53/64] compiler/gcc4+: Remove inaccurate comment about 'asm goto' miscompiles Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 54/64] compiler-gcc: integrate the various compiler-gcc[345].h files Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 55/64] x86: vvar, fix excessive gcc-6 DECLARE_VVAR warnings Jiri Slaby
2016-02-12 16:42   ` Andy Lutomirski
2016-02-11 13:59 ` [PATCH 3.12 56/64] openrisc: fix CONFIG_UID16 setting Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 57/64] vmstat: explicitly schedule per-cpu work on the CPU we need it to run on Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 58/64] Revert "workqueue: make sure delayed work run in local cpu" Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 59/64] xhci: fix placement of call to usb_disabled() Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 60/64] recordmcount: Fix endianness handling bug for nop_mcount Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 61/64] crypto: algif_hash - Only export and import on sockets with data Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 62/64] dm btree: fix leak of bufio-backed block in btree_split_sibling error path Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 63/64] drivers/base/memory.c: prohibit offlining of memory blocks with missing sections Jiri Slaby
2016-02-11 13:59 ` [PATCH 3.12 64/64] HID: usbhid: fix recursive deadlock Jiri Slaby
2016-02-11 14:09 ` [PATCH 3.12 00/64] 3.12.54-stable review Nikolay Borisov
2016-02-11 14:10   ` Jiri Slaby
2016-02-11 14:12     ` Jiri Slaby
2016-02-11 14:17 ` [PATCH 3.12 65/65] dm thin: fix race condition when destroying thin pool workqueue Jiri Slaby
2016-02-11 18:17 ` [PATCH 3.12 00/64] 3.12.54-stable review Guenter Roeck
2016-02-11 19:26 ` Shuah Khan
2016-02-15 15:20   ` Jiri Slaby
2016-02-15 16:10     ` Winkler, Tomas

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