All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3.12 01/39] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 02/39] tools: Add a "make all" rule Jiri Slaby
                   ` (39 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Ingo Molnar, Matt Fleming, Luis Henriques, Jiri Slaby

From: Ingo Molnar <mingo@kernel.org>

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

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

commit 23a0d4e8fa6d3a1d7fb819f79bcc0a3739c30ba9 upstream.

Tapasweni Pathak reported that we do a kmalloc() in efi_call_phys_prolog()
on x86-64 while having interrupts disabled, which is a big no-no, as
kmalloc() can sleep.

Solve this by removing the irq disabling from the prolog/epilog calls
around EFI calls: it's unnecessary, as in this stage we are single
threaded in the boot thread, and we don't ever execute this from
interrupt contexts.

Reported-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
[ luis: backported to 3.10: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/platform/efi/efi.c    |  7 +++++++
 arch/x86/platform/efi/efi_32.c | 11 +++--------
 arch/x86/platform/efi/efi_64.c |  3 ---
 3 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index f19284d87dfe..9167de031e47 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -250,12 +250,19 @@ static efi_status_t __init phys_efi_set_virtual_address_map(
 	efi_memory_desc_t *virtual_map)
 {
 	efi_status_t status;
+	unsigned long flags;
 
 	efi_call_phys_prelog();
+
+	/* Disable interrupts around EFI calls: */
+	local_irq_save(flags);
 	status = efi_call_phys4(efi_phys.set_virtual_address_map,
 				memory_map_size, descriptor_size,
 				descriptor_version, virtual_map);
+	local_irq_restore(flags);
+
 	efi_call_phys_epilog();
+
 	return status;
 }
 
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 40e446941dd7..bebbee05e331 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -33,19 +33,16 @@
 
 /*
  * To make EFI call EFI runtime service in physical addressing mode we need
- * prelog/epilog before/after the invocation to disable interrupt, to
- * claim EFI runtime service handler exclusively and to duplicate a memory in
- * low memory space say 0 - 3G.
+ * prolog/epilog before/after the invocation to claim the EFI runtime service
+ * handler exclusively and to duplicate a memory mapping in low memory space,
+ * say 0 - 3G.
  */
 
-static unsigned long efi_rt_eflags;
 
 void efi_call_phys_prelog(void)
 {
 	struct desc_ptr gdt_descr;
 
-	local_irq_save(efi_rt_eflags);
-
 	load_cr3(initial_page_table);
 	__flush_tlb_all();
 
@@ -64,6 +61,4 @@ void efi_call_phys_epilog(void)
 
 	load_cr3(swapper_pg_dir);
 	__flush_tlb_all();
-
-	local_irq_restore(efi_rt_eflags);
 }
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 39a0e7f1f0a3..2f6c1a9734c8 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -40,7 +40,6 @@
 #include <asm/fixmap.h>
 
 static pgd_t *save_pgd __initdata;
-static unsigned long efi_flags __initdata;
 
 static void __init early_code_mapping_set_exec(int executable)
 {
@@ -66,7 +65,6 @@ void __init efi_call_phys_prelog(void)
 	int n_pgds;
 
 	early_code_mapping_set_exec(1);
-	local_irq_save(efi_flags);
 
 	n_pgds = DIV_ROUND_UP((max_pfn << PAGE_SHIFT), PGDIR_SIZE);
 	save_pgd = kmalloc(n_pgds * sizeof(pgd_t), GFP_KERNEL);
@@ -90,7 +88,6 @@ void __init efi_call_phys_epilog(void)
 		set_pgd(pgd_offset_k(pgd * PGDIR_SIZE), save_pgd[pgd]);
 	kfree(save_pgd);
 	__flush_tlb_all();
-	local_irq_restore(efi_flags);
 	early_code_mapping_set_exec(0);
 }
 
-- 
2.7.0

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

* [PATCH 3.12 02/39] tools: Add a "make all" rule
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 01/39] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 03/39] ALSA: hda - Fix noise problems on Thinkpad T440s Jiri Slaby
                   ` (38 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Kamal Mostafa, Jiri Olsa, Jonathan Cameron,
	Pali Rohar, Roberta Dobrescu, Arnaldo Carvalho de Melo,
	Jiri Slaby

From: Kamal Mostafa <kamal@canonical.com>

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

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

commit f6ba98c5dc78708cb7fd29950c4a50c4c7e88f95 upstream.

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Pali Rohar <pali.rohar@gmail.com>
Cc: Roberta Dobrescu <roberta.dobrescu@gmail.com>
Link: http://lkml.kernel.org/r/1447280736-2161-2-git-send-email-kamal@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
[ kamal: backport to 3.12-stable: build all tools for this version ]
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 tools/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/Makefile b/tools/Makefile
index 41067f304215..b82a15b92b1c 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -22,6 +22,10 @@ help:
 	@echo '  from the kernel command line to build and install one of'
 	@echo '  the tools above'
 	@echo ''
+	@echo '  $$ make tools/all'
+	@echo ''
+	@echo '  builds all tools.'
+	@echo ''
 	@echo '  $$ make tools/install'
 	@echo ''
 	@echo '  installs all tools.'
@@ -50,6 +54,10 @@ selftests: FORCE
 turbostat x86_energy_perf_policy: FORCE
 	$(call descend,power/x86/$@)
 
+all: cgroup cpupower firewire lguest \
+		perf selftests turbostat usb \
+		virtio vm net x86_energy_perf_policy
+
 cpupower_install:
 	$(call descend,power/$(@:_install=),install)
 
-- 
2.7.0

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

* [PATCH 3.12 03/39] ALSA: hda - Fix noise problems on Thinkpad T440s
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 01/39] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 02/39] tools: Add a "make all" rule Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 04/39] dlm: make posix locks interruptible Jiri Slaby
                   ` (37 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 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 9a811230481243f384b8036c6a558bfdbd961f78 upstream.

Lenovo Thinkpad T440s suffers from constant background noises, and it
seems to be a generic hardware issue on this model:
  https://forums.lenovo.com/t5/ThinkPad-T400-T500-and-newer-T/T440s-speaker-noise/td-p/1339883

As the noise comes from the analog loopback path, disabling the path
is the easy workaround.

Also, the machine gives significant cracking noises at PM suspend.  A
workaround found by trial-and-error is to disable the shutup callback
currently used for ALC269-variant.

This patch addresses these noise issues by introducing a new fixup
chain.  Although the same workaround might be applicable to other
Thinkpad models, it's applied only to T440s (17aa:220c) in this patch,
so far, just to be safe (you chicken!).  As a compromise, a new model
option string "tp440" is provided now, though, so that owners of other
Thinkpad models can test it more easily.

Bugzilla: https://bugzilla.opensuse.org/show_bug.cgi?id=958504
Reported-and-tested-by: Tim Hardeck <thardeck@suse.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/hda/patch_realtek.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 73d342c8403c..1ec93efc8253 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3637,6 +3637,18 @@ static void alc283_fixup_chromebook(struct hda_codec *codec,
 	}
 }
 
+/* additional fixup for Thinkpad T440s noise problem */
+static void alc_fixup_tpt440(struct hda_codec *codec,
+			     const struct hda_fixup *fix, int action)
+{
+	struct alc_spec *spec = codec->spec;
+
+	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
+		spec->shutup = alc_no_shutup; /* reduce click noise */
+		spec->gen.mixer_nid = 0; /* reduce background noise */
+	}
+}
+
 /* mute tablet speaker pin (0x14) via dock plugging in addition */
 static void asus_tx300_automute(struct hda_codec *codec)
 {
@@ -3746,6 +3758,7 @@ enum {
 	ALC283_FIXUP_INT_MIC,
 	ALC290_FIXUP_MONO_SPEAKERS,
 	ALC292_FIXUP_TPT440_DOCK,
+	ALC292_FIXUP_TPT440,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -4090,6 +4103,12 @@ static const struct hda_fixup alc269_fixups[] = {
 		.chained = true,
 		.chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
 	},
+	[ALC292_FIXUP_TPT440] = {
+		.type = HDA_FIXUP_FUNC,
+		.v.func = alc_fixup_tpt440,
+		.chained = true,
+		.chain_id = ALC292_FIXUP_TPT440_DOCK,
+	},
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -4185,7 +4204,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
 	SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
-	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440_DOCK),
+	SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
 	SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
 	SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
 	SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
@@ -4263,6 +4282,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
 	{.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
 	{.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
 	{.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
+	{.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
 	{}
 };
 
-- 
2.7.0

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

* [PATCH 3.12 04/39] dlm: make posix locks interruptible
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (2 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 03/39] ALSA: hda - Fix noise problems on Thinkpad T440s Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 05/39] PCI: Drop "setting latency timer" messages Jiri Slaby
                   ` (36 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Eric Ren, David Teigland, Jiri Slaby

From: Eric Ren <zren@suse.com>

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

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

commit a6b1533e9a57d76cd3d9b7649d29ac604b1874b8 upstream.

Replace wait_event_killable with wait_event_interruptible
so that a program waiting for a posix lock can be
interrupted by a signal.  With the killable version,
a program was not interruptible by a signal if it
had a signal handler set for it, overriding the default
action of terminating the process.

Signed-off-by: Eric Ren <zren@suse.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/dlm/plock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index f704458ea5f5..a6d999418de4 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -145,7 +145,7 @@ int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file,
 	send_op(op);
 
 	if (xop->callback == NULL) {
-		rv = wait_event_killable(recv_wq, (op->done != 0));
+		rv = wait_event_interruptible(recv_wq, (op->done != 0));
 		if (rv == -ERESTARTSYS) {
 			log_debug(ls, "dlm_posix_lock: wait killed %llx",
 				  (unsigned long long)number);
-- 
2.7.0

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

* [PATCH 3.12 05/39] PCI: Drop "setting latency timer" messages
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (3 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 04/39] dlm: make posix locks interruptible Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 06/39] ipv4: Don't increase PMTU with Datagram Too Big message Jiri Slaby
                   ` (35 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Bjorn Helgaas, Jiri Slaby

From: Bjorn Helgaas <bhelgaas@google.com>

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

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

commit a006482b67a96c16dfefc558e36863c51e1829bf upstream.

This message isn't useful any more, so drop it.

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=60636
Reported-by: Oleksil Shevchuk <alxchk@gmail.com>
Reference: http://lkml.kernel.org/r/CALCETrWkr53ZjqdN3t7rTTfr=+ZKZXJoYsuBcwPf0kN_33GfAw@mail.gmail.com
Reported-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 2d163544fa51..1e480a898d28 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2871,7 +2871,7 @@ void __weak pcibios_set_master(struct pci_dev *dev)
 		lat = pcibios_max_latency;
 	else
 		return;
-	dev_printk(KERN_DEBUG, &dev->dev, "setting latency timer to %d\n", lat);
+
 	pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
 }
 
-- 
2.7.0

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

* [PATCH 3.12 06/39] ipv4: Don't increase PMTU with Datagram Too Big message.
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (4 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 05/39] PCI: Drop "setting latency timer" messages Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 07/39] route: Use ipv4_mtu instead of raw rt_pmtu Jiri Slaby
                   ` (34 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Li Wei, David S . Miller, Jiri Slaby

From: Li Wei <lw@cn.fujitsu.com>

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

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

commit 3cdaa5be9e81a914e633a6be7b7d2ef75b528562 upstream.

RFC 1191 said, "a host MUST not increase its estimate of the Path
MTU in response to the contents of a Datagram Too Big message."

Signed-off-by: Li Wei <lw@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/route.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index bd5f3461d1ce..fe0c761a8fce 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -988,6 +988,9 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
 	if (dst->dev->mtu < mtu)
 		return;
 
+	if (rt->rt_pmtu && rt->rt_pmtu < mtu)
+		return;
+
 	if (mtu < ip_rt_min_pmtu)
 		mtu = ip_rt_min_pmtu;
 
-- 
2.7.0

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

* [PATCH 3.12 07/39] route: Use ipv4_mtu instead of raw rt_pmtu
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (5 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 06/39] ipv4: Don't increase PMTU with Datagram Too Big message Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 08/39] SUNRPC: Fix oops when trace sunrpc_task events in nfs client Jiri Slaby
                   ` (33 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Herbert Xu, David S . Miller, 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 cb6ccf09d6b94bec4def1ac5cf4678d12b216474 upstream.

The commit 3cdaa5be9e81a914e633a6be7b7d2ef75b528562 ("ipv4: Don't
increase PMTU with Datagram Too Big message") broke PMTU in cases
where the rt_pmtu value has expired but is smaller than the new
PMTU value.

This obsolete rt_pmtu then prevents the new PMTU value from being
installed.

Fixes: 3cdaa5be9e81 ("ipv4: Don't increase PMTU with Datagram Too Big message")
Reported-by: Gerd v. Egidy <gerd.von.egidy@intra2net.com>
Signed-off-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>
---
 net/ipv4/route.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index fe0c761a8fce..54874e4767de 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -985,10 +985,7 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
 	if (dst_metric_locked(dst, RTAX_MTU))
 		return;
 
-	if (dst->dev->mtu < mtu)
-		return;
-
-	if (rt->rt_pmtu && rt->rt_pmtu < mtu)
+	if (ipv4_mtu(dst) < mtu)
 		return;
 
 	if (mtu < ip_rt_min_pmtu)
-- 
2.7.0

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

* [PATCH 3.12 08/39] SUNRPC: Fix oops when trace sunrpc_task events in nfs client
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (6 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 07/39] route: Use ipv4_mtu instead of raw rt_pmtu Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 09/39] ring-buffer: Always run per-cpu ring buffer resize with schedule_work_on() Jiri Slaby
                   ` (32 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ditang Chen, Trond Myklebust, Jiri Slaby

From: Ditang Chen <chendt.fnst@cn.fujitsu.com>

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

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

commit 2ca310fc4160ed0420da65534a21ae77b24326a8 upstream.

When tracking sunrpc_task events in nfs client, the clnt pointer may be NULL.

[  139.269266] BUG: unable to handle kernel NULL pointer dereference at 0000000000000004
[  139.269915] IP: [<ffffffffa026f216>] ftrace_raw_event_rpc_task_running+0x86/0xf0 [sunrpc]
[  139.269915] PGD 1d293067 PUD 1d294067 PMD 0
[  139.269915] Oops: 0000 [#1] SMP
[  139.269915] Modules linked in: nfsv4 dns_resolver nfs lockd sunrpc fscache sg ppdev e1000
serio_raw pcspkr parport_pc parport i2c_piix4 i2c_core microcode xfs libcrc32c sd_mod sr_mod
cdrom ata_generic crc_t10dif crct10dif_common pata_acpi ahci libahci ata_piix libata dm_mirror
dm_region_hash dm_log dm_mod
[  139.269915] CPU: 0 PID: 59 Comm: kworker/0:2 Not tainted 3.10.0-84.el7.x86_64 #1
[  139.269915] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[  139.269915] Workqueue: rpciod rpc_async_schedule [sunrpc]
[  139.269915] task: ffff88001b598000 ti: ffff88001b632000 task.ti: ffff88001b632000
[  139.269915] RIP: 0010:[<ffffffffa026f216>]  [<ffffffffa026f216>] ftrace_raw_event_rpc_task_running+0x86/0xf0 [sunrpc]
[  139.269915] RSP: 0018:ffff88001b633d70  EFLAGS: 00010206
[  139.269915] RAX: ffff88001dfc5338 RBX: ffff88001cc37a00 RCX: ffff88001dfc5334
[  139.269915] RDX: ffff88001dfc5338 RSI: 0000000000000000 RDI: ffff88001dfc533c
[  139.269915] RBP: ffff88001b633db0 R08: 000000000000002c R09: 000000000000000a
[  139.269915] R10: 0000000000062180 R11: 00000020759fb9dc R12: ffffffffa0292c20
[  139.269915] R13: ffff88001dfc5334 R14: 0000000000000000 R15: 0000000000000000
[  139.269915] FS:  0000000000000000(0000) GS:ffff88001fc00000(0000) knlGS:0000000000000000
[  139.269915] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[  139.269915] CR2: 0000000000000004 CR3: 000000001d290000 CR4: 00000000000006f0
[  139.269915] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  139.269915] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  139.269915] Stack:
[  139.269915]  000000001b633d98 0000000000000246 ffff88001df1dc00 ffff88001cc37a00
[  139.269915]  ffff88001bc35e60 0000000000000000 ffff88001ffa0a48 ffff88001bc35ee0
[  139.269915]  ffff88001b633e08 ffffffffa02704b5 0000000000010000 ffff88001cc37a70
[  139.269915] Call Trace:
[  139.269915]  [<ffffffffa02704b5>] __rpc_execute+0x1d5/0x400 [sunrpc]
[  139.269915]  [<ffffffffa0270706>] rpc_async_schedule+0x26/0x30 [sunrpc]
[  139.269915]  [<ffffffff8107867b>] process_one_work+0x17b/0x460
[  139.269915]  [<ffffffff8107942b>] worker_thread+0x11b/0x400
[  139.269915]  [<ffffffff81079310>] ? rescuer_thread+0x3e0/0x3e0
[  139.269915]  [<ffffffff8107fc80>] kthread+0xc0/0xd0
[  139.269915]  [<ffffffff8107fbc0>] ? kthread_create_on_node+0x110/0x110
[  139.269915]  [<ffffffff815d122c>] ret_from_fork+0x7c/0xb0
[  139.269915]  [<ffffffff8107fbc0>] ? kthread_create_on_node+0x110/0x110
[  139.269915] Code: 4c 8b 45 c8 48 8d 7d d0 89 4d c4 41 89 c9 b9 28 00 00 00 e8 9d b4 e9
e0 48 85 c0 49 89 c5 74 a2 48 89 c7 e8 9d 3f e9 e0 48 89 c2 <41> 8b 46 04 48 8b 7d d0 4c
89 e9 4c 89 e6 89 42 0c 0f b7 83 d4
[  139.269915] RIP  [<ffffffffa026f216>] ftrace_raw_event_rpc_task_running+0x86/0xf0 [sunrpc]
[  139.269915]  RSP <ffff88001b633d70>
[  139.269915] CR2: 0000000000000004
[  140.946406] ---[ end trace ba486328b98d7622 ]---

Signed-off-by: Ditang Chen <chendt.fnst@cn.fujitsu.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/trace/events/sunrpc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h
index d51d16c7afd8..3646fa31ade9 100644
--- a/include/trace/events/sunrpc.h
+++ b/include/trace/events/sunrpc.h
@@ -83,7 +83,7 @@ DECLARE_EVENT_CLASS(rpc_task_running,
 		),
 
 	TP_fast_assign(
-		__entry->client_id = clnt->cl_clid;
+		__entry->client_id = clnt ? clnt->cl_clid : -1;
 		__entry->task_id = task->tk_pid;
 		__entry->action = action;
 		__entry->runstate = task->tk_runstate;
@@ -91,7 +91,7 @@ DECLARE_EVENT_CLASS(rpc_task_running,
 		__entry->flags = task->tk_flags;
 		),
 
-	TP_printk("task:%u@%u flags=%4.4x state=%4.4lx status=%d action=%pf",
+	TP_printk("task:%u@%d flags=%4.4x state=%4.4lx status=%d action=%pf",
 		__entry->task_id, __entry->client_id,
 		__entry->flags,
 		__entry->runstate,
-- 
2.7.0

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

* [PATCH 3.12 09/39] ring-buffer: Always run per-cpu ring buffer resize with schedule_work_on()
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (7 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 08/39] SUNRPC: Fix oops when trace sunrpc_task events in nfs client Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 10/39] drm/i915: Fix SRC_COPY width on 830/845g Jiri Slaby
                   ` (31 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Corey Minyard, Steven Rostedt, Jiri Slaby

From: Corey Minyard <cminyard@mvista.com>

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

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

commit 021c5b34452d52e51664f09b98cd50c5495e74b6 upstream.

The code for resizing the trace ring buffers has to run the per-cpu
resize on the CPU itself.  The code was using preempt_off() and
running the code for the current CPU directly, otherwise calling
schedule_work_on().

At least on RT this could result in the following:

|BUG: sleeping function called from invalid context at kernel/rtmutex.c:673
|in_atomic(): 1, irqs_disabled(): 0, pid: 607, name: bash
|3 locks held by bash/607:
|CPU: 0 PID: 607 Comm: bash Not tainted 3.12.15-rt25+ #124
|(rt_spin_lock+0x28/0x68)
|(free_hot_cold_page+0x84/0x3b8)
|(free_buffer_page+0x14/0x20)
|(rb_update_pages+0x280/0x338)
|(ring_buffer_resize+0x32c/0x3dc)
|(free_snapshot+0x18/0x38)
|(tracing_set_tracer+0x27c/0x2ac)

probably via
|cd /sys/kernel/debug/tracing/
|echo 1 > events/enable ; sleep 2
|echo 1024 > buffer_size_kb

If we just always use schedule_work_on(), there's no need for the
preempt_off().  So do that.

Link: http://lkml.kernel.org/p/1405537633-31518-1-git-send-email-cminyard@mvista.com

Reported-by: Stanislav Meduna <stano@meduna.org>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/trace/ring_buffer.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 469af802d14e..d6b35d3a232c 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1700,22 +1700,14 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
 			if (!cpu_buffer->nr_pages_to_update)
 				continue;
 
-			/* The update must run on the CPU that is being updated. */
-			preempt_disable();
-			if (cpu == smp_processor_id() || !cpu_online(cpu)) {
+			/* Can't run something on an offline CPU. */
+			if (!cpu_online(cpu)) {
 				rb_update_pages(cpu_buffer);
 				cpu_buffer->nr_pages_to_update = 0;
 			} else {
-				/*
-				 * Can not disable preemption for schedule_work_on()
-				 * on PREEMPT_RT.
-				 */
-				preempt_enable();
 				schedule_work_on(cpu,
 						&cpu_buffer->update_pages_work);
-				preempt_disable();
 			}
-			preempt_enable();
 		}
 
 		/* wait for all the updates to complete */
@@ -1753,22 +1745,14 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
 
 		get_online_cpus();
 
-		preempt_disable();
-		/* The update must run on the CPU that is being updated. */
-		if (cpu_id == smp_processor_id() || !cpu_online(cpu_id))
+		/* Can't run something on an offline CPU. */
+		if (!cpu_online(cpu_id))
 			rb_update_pages(cpu_buffer);
 		else {
-			/*
-			 * Can not disable preemption for schedule_work_on()
-			 * on PREEMPT_RT.
-			 */
-			preempt_enable();
 			schedule_work_on(cpu_id,
 					 &cpu_buffer->update_pages_work);
 			wait_for_completion(&cpu_buffer->update_done);
-			preempt_disable();
 		}
-		preempt_enable();
 
 		cpu_buffer->nr_pages_to_update = 0;
 		put_online_cpus();
-- 
2.7.0

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

* [PATCH 3.12 10/39] drm/i915: Fix SRC_COPY width on 830/845g
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (8 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 09/39] ring-buffer: Always run per-cpu ring buffer resize with schedule_work_on() Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 11/39] lpfc: Fix null ndlp dereference in target_reset_handler Jiri Slaby
                   ` (30 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Chris Wilson, Thomas Richter, Jani Nikula, Jiri Slaby

From: Chris Wilson <chris@chris-wilson.co.uk>

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

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

commit 611a7a4fd8b5fb6b25ab1f8bdcde61800a7feacf upstream.

One small change I forgot to make in

commit c4d69da167fa967749aeb70bc0e94a457e5d00c1
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Mon Sep 8 14:25:41 2014 +0100

    drm/i915: Evict CS TLBs between batches

was to update the copy width for the compact BLT copy instruction.

Reported-by: Thomas Richter <thor@math.tu-berlin.de>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Thomas Richter <thor@math.tu-berlin.de>
Cc: Jani Nikula <jani.nikula@intel.com>
Tested-by: Thomas Richter <thor@math.tu-berlin.de>
Acked-by: Daniel Vetter <daniel@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/i915/intel_ringbuffer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
index 4e51ce2bbb85..83780190cdd7 100644
--- a/drivers/gpu/drm/i915/intel_ringbuffer.c
+++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
@@ -1125,7 +1125,7 @@ i830_dispatch_execbuffer(struct intel_ring_buffer *ring,
 		 */
 		intel_ring_emit(ring, SRC_COPY_BLT_CMD | BLT_WRITE_RGBA);
 		intel_ring_emit(ring, BLT_DEPTH_32 | BLT_ROP_SRC_COPY | 4096);
-		intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 1024);
+		intel_ring_emit(ring, DIV_ROUND_UP(len, 4096) << 16 | 4096);
 		intel_ring_emit(ring, cs_offset);
 		intel_ring_emit(ring, 4096);
 		intel_ring_emit(ring, offset);
-- 
2.7.0

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

* [PATCH 3.12 11/39] lpfc: Fix null ndlp dereference in target_reset_handler
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (9 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 10/39] drm/i915: Fix SRC_COPY width on 830/845g Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 12/39] block: Always check queue limits for cloned requests Jiri Slaby
                   ` (29 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, James Smart, Dick Kennedy, James Bottomley, Jiri Slaby

From: James Smart <james.smart@emulex.com>

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

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

commit 63e480fd2f598e9ad37f89e79c36834e7dd60ba0 upstream.

Signed-off-by: Dick Kennedy <dick.kennedy@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Acked-by: Johannes Thumshirn <jthumshirn@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/lpfc/lpfc_scsi.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
index ed7759980c47..1d01ed6f8dd2 100644
--- a/drivers/scsi/lpfc/lpfc_scsi.c
+++ b/drivers/scsi/lpfc/lpfc_scsi.c
@@ -5264,7 +5264,15 @@ lpfc_target_reset_handler(struct scsi_cmnd *cmnd)
 	if (status == FAILED) {
 		lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
 			"0722 Target Reset rport failure: rdata x%p\n", rdata);
-		return FAILED;
+		if (pnode) {
+			spin_lock_irq(shost->host_lock);
+			pnode->nlp_flag &= ~NLP_NPR_ADISC;
+			pnode->nlp_fcp_info &= ~NLP_FCP_2_DEVICE;
+			spin_unlock_irq(shost->host_lock);
+		}
+		lpfc_reset_flush_io_context(vport, tgt_id, lun_id,
+					    LPFC_CTX_TGT);
+		return FAST_IO_FAIL;
 	}
 
 	scsi_event.event_type = FC_REG_SCSI_EVENT;
-- 
2.7.0

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

* [PATCH 3.12 12/39] block: Always check queue limits for cloned requests
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (10 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 11/39] lpfc: Fix null ndlp dereference in target_reset_handler Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 13/39] Input: aiptek - fix crash on detecting device without endpoints Jiri Slaby
                   ` (28 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Hannes Reinecke, Mike Snitzer, Ewan Milne,
	Jeff Moyer, Jens Axboe, Jiri Slaby

From: Hannes Reinecke <hare@suse.de>

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

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

commit bf4e6b4e757488dee1b6a581f49c7ac34cd217f8 upstream.

When a cloned request is retried on other queues it always needs
to be checked against the queue limits of that queue.
Otherwise the calculations for nr_phys_segments might be wrong,
leading to a crash in scsi_init_sgtable().

To clarify this the patch renames blk_rq_check_limits()
to blk_cloned_rq_check_limits() and removes the symbol
export, as the new function should only be used for
cloned requests and never exported.

Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Ewan Milne <emilne@redhat.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Fixes: e2a60da74 ("block: Clean up special command handling logic")
Acked-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 block/blk-core.c       | 21 +++++++--------------
 include/linux/blkdev.h |  1 -
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index bf214ae98937..de352508333f 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -1893,7 +1893,8 @@ void submit_bio(int rw, struct bio *bio)
 EXPORT_SYMBOL(submit_bio);
 
 /**
- * blk_rq_check_limits - Helper function to check a request for the queue limit
+ * blk_cloned_rq_check_limits - Helper function to check a cloned request
+ *                              for new the queue limits
  * @q:  the queue
  * @rq: the request being checked
  *
@@ -1904,20 +1905,13 @@ EXPORT_SYMBOL(submit_bio);
  *    after it is inserted to @q, it should be checked against @q before
  *    the insertion using this generic function.
  *
- *    This function should also be useful for request stacking drivers
- *    in some cases below, so export this function.
  *    Request stacking drivers like request-based dm may change the queue
- *    limits while requests are in the queue (e.g. dm's table swapping).
- *    Such request stacking drivers should check those requests agaist
- *    the new queue limits again when they dispatch those requests,
- *    although such checkings are also done against the old queue limits
- *    when submitting requests.
+ *    limits when retrying requests on other queues. Those requests need
+ *    to be checked against the new queue limits again during dispatch.
  */
-int blk_rq_check_limits(struct request_queue *q, struct request *rq)
+static int blk_cloned_rq_check_limits(struct request_queue *q,
+				      struct request *rq)
 {
-	if (!rq_mergeable(rq))
-		return 0;
-
 	if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, rq->cmd_flags)) {
 		printk(KERN_ERR "%s: over max size limit.\n", __func__);
 		return -EIO;
@@ -1937,7 +1931,6 @@ int blk_rq_check_limits(struct request_queue *q, struct request *rq)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(blk_rq_check_limits);
 
 /**
  * blk_insert_cloned_request - Helper for stacking drivers to submit a request
@@ -1949,7 +1942,7 @@ int blk_insert_cloned_request(struct request_queue *q, struct request *rq)
 	unsigned long flags;
 	int where = ELEVATOR_INSERT_BACK;
 
-	if (blk_rq_check_limits(q, rq))
+	if (blk_cloned_rq_check_limits(q, rq))
 		return -EIO;
 
 	if (rq->rq_disk &&
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index b1056783c105..e66eba43d702 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -740,7 +740,6 @@ extern struct request *blk_make_request(struct request_queue *, struct bio *,
 extern void blk_requeue_request(struct request_queue *, struct request *);
 extern void blk_add_request_payload(struct request *rq, struct page *page,
 		unsigned int len);
-extern int blk_rq_check_limits(struct request_queue *q, struct request *rq);
 extern int blk_lld_busy(struct request_queue *q);
 extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
 			     struct bio_set *bs, gfp_t gfp_mask,
-- 
2.7.0

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

* [PATCH 3.12 13/39] Input: aiptek - fix crash on detecting device without endpoints
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (11 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 12/39] block: Always check queue limits for cloned requests Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 14/39] qla2xxx: Fix hardware lock/unlock issue causing kernel panic Jiri Slaby
                   ` (27 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vladis Dronov, Dmitry Torokhov, Jiri Slaby

From: Vladis Dronov <vdronov@redhat.com>

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

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

commit 8e20cf2bce122ce9262d6034ee5d5b76fbb92f96 upstream.

The aiptek driver crashes in aiptek_probe() when a specially crafted USB
device without endpoints is detected. This fix adds a check that the device
has proper configuration expected by the driver. Also an error return value
is changed to more matching one in one of the error paths.

Reported-by: Ralf Spenneberg <ralf@spenneberg.net>
Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/tablet/aiptek.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index ee83c3904ee8..fcf9aa1eb167 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1820,6 +1820,14 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_MAX, 0, 0);
 	input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_MAX - 1, 0, 0);
 
+	/* Verify that a device really has an endpoint */
+	if (intf->altsetting[0].desc.bNumEndpoints < 1) {
+		dev_err(&intf->dev,
+			"interface has %d endpoints, but must have minimum 1\n",
+			intf->altsetting[0].desc.bNumEndpoints);
+		err = -EINVAL;
+		goto fail3;
+	}
 	endpoint = &intf->altsetting[0].endpoint[0].desc;
 
 	/* Go set up our URB, which is called when the tablet receives
@@ -1862,6 +1870,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	if (i == ARRAY_SIZE(speeds)) {
 		dev_info(&intf->dev,
 			 "Aiptek tried all speeds, no sane response\n");
+		err = -EINVAL;
 		goto fail3;
 	}
 
-- 
2.7.0

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

* [PATCH 3.12 14/39] qla2xxx: Fix hardware lock/unlock issue causing kernel panic.
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (12 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 13/39] Input: aiptek - fix crash on detecting device without endpoints Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 15/39] module: remove MODULE_GENERIC_TABLE Jiri Slaby
                   ` (26 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Saurav Kashyap, Himanshu Madhani,
	Nicholas Bellinger, Michal Marek, Jiri Slaby

From: Saurav Kashyap <saurav.kashyap@qlogic.com>

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

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

commit ba9f6f64a0ff6b7ecaed72144c179061f8eca378 upstream.

This patch fixes a kernel panic for qla2xxx Target core
Module driver introduced by a fix in the qla2xxx initiator code.

Commit ef86cb2 ("qla2xxx: Mark port lost when we receive an RSCN for it.")
introduced the regression for qla2xxx Target driver.

Stack trace will have following signature

 --- <NMI exception stack> ---
[ffff88081faa3cc8] _raw_spin_lock_irqsave at ffffffff815b1f03
[ffff88081faa3cd0] qlt_fc_port_deleted at ffffffffa096ccd0 [qla2xxx]
[ffff88081faa3d20] qla2x00_schedule_rport_del at ffffffffa0913831[qla2xxx]
[ffff88081faa3d50] qla2x00_mark_device_lost at ffffffffa09159c5[qla2xxx]
[ffff88081faa3db0] qla2x00_async_event at ffffffffa0938d59 [qla2xxx]
[ffff88081faa3e30] qla24xx_msix_default at ffffffffa093a326 [qla2xxx]
[ffff88081faa3e90] handle_irq_event_percpu at ffffffff810a7b8d
[ffff88081faa3ee0] handle_irq_event at ffffffff810a7d32
[ffff88081faa3f10] handle_edge_irq at ffffffff810ab6b9
[ffff88081faa3f30] handle_irq at ffffffff8100619c
[ffff88081faa3f70] do_IRQ at ffffffff815b4b1c
 --- <IRQ stack> ---

Signed-off-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Himanshu Madhani <himanshu.madhani@qlogic.com>
Reviewed-by: Nicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Michal Marek <mmarek@suse.cz>
Fixes: ef86cb205 ("qla2xxx: Mark port lost when we receive an RSCN for it.")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/qla2xxx/qla_init.c   | 4 ++++
 drivers/scsi/qla2xxx/qla_target.c | 5 -----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 03f715e7591e..df67a0649410 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2725,6 +2725,7 @@ qla2x00_rport_del(void *data)
 	struct fc_rport *rport;
 	scsi_qla_host_t *vha = fcport->vha;
 	unsigned long flags;
+	unsigned long vha_flags;
 
 	spin_lock_irqsave(fcport->vha->host->host_lock, flags);
 	rport = fcport->drport ? fcport->drport: fcport->rport;
@@ -2736,7 +2737,9 @@ qla2x00_rport_del(void *data)
 		 * Release the target mode FC NEXUS in qla_target.c code
 		 * if target mod is enabled.
 		 */
+		spin_lock_irqsave(&vha->hw->hardware_lock, vha_flags);
 		qlt_fc_port_deleted(vha, fcport);
+		spin_unlock_irqrestore(&vha->hw->hardware_lock, vha_flags);
 	}
 }
 
@@ -3106,6 +3109,7 @@ qla2x00_reg_remote_port(scsi_qla_host_t *vha, fc_port_t *fcport)
 	 * Create target mode FC NEXUS in qla_target.c if target mode is
 	 * enabled..
 	 */
+
 	qlt_fc_port_added(vha, fcport);
 
 	spin_lock_irqsave(fcport->vha->host->host_lock, flags);
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 30788321ac2b..16a4cf8654a8 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -741,7 +741,6 @@ void qlt_fc_port_deleted(struct scsi_qla_host *vha, fc_port_t *fcport)
 	struct qla_hw_data *ha = vha->hw;
 	struct qla_tgt *tgt = ha->tgt.qla_tgt;
 	struct qla_tgt_sess *sess;
-	unsigned long flags;
 
 	if (!vha->hw->tgt.tgt_ops)
 		return;
@@ -749,14 +748,11 @@ void qlt_fc_port_deleted(struct scsi_qla_host *vha, fc_port_t *fcport)
 	if (!tgt || (fcport->port_type != FCT_INITIATOR))
 		return;
 
-	spin_lock_irqsave(&ha->hardware_lock, flags);
 	if (tgt->tgt_stop) {
-		spin_unlock_irqrestore(&ha->hardware_lock, flags);
 		return;
 	}
 	sess = qlt_find_sess_by_port_name(tgt, fcport->port_name);
 	if (!sess) {
-		spin_unlock_irqrestore(&ha->hardware_lock, flags);
 		return;
 	}
 
@@ -764,7 +760,6 @@ void qlt_fc_port_deleted(struct scsi_qla_host *vha, fc_port_t *fcport)
 
 	sess->local = 1;
 	qlt_schedule_sess_for_deletion(sess, false);
-	spin_unlock_irqrestore(&ha->hardware_lock, flags);
 }
 
 static inline int test_tgt_sess_count(struct qla_tgt *tgt)
-- 
2.7.0

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

* [PATCH 3.12 00/39] 3.12.53-stable review
@ 2016-01-25 11:49 Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 01/39] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls Jiri Slaby
                   ` (40 more replies)
  0 siblings, 41 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: William Dauchy, linux, shuah.kh, linux-kernel, Jiri Slaby

This is the start of the stable review cycle for the 3.12.53 release.
There are 39 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 Wed Jan 27 12:44:04 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.53-rc1.xz
and the diffstat can be found below.

thanks,
js

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


Adrien Vergé (1):
  USB: quirks: Fix another ELAN touchscreen

Alexandra Yates (1):
  ALSA: hda - Add Intel Lewisburg device IDs Audio

Ben Hutchings (2):
  isdn_ppp: Add checks for allocation failure in isdn_ppp_open()
  ppp, slip: Validate VJ compression slot parameters completely

Bjorn Helgaas (1):
  PCI: Drop "setting latency timer" messages

Boris Ostrovsky (1):
  xen/gntdev: Grant maps should not be subject to NUMA balancing

Chris Wilson (1):
  drm/i915: Fix SRC_COPY width on 830/845g

Corey Minyard (1):
  ring-buffer: Always run per-cpu ring buffer resize with
    schedule_work_on()

David Howells (1):
  KEYS: Fix race between read and revoke

Ditang Chen (1):
  SUNRPC: Fix oops when trace sunrpc_task events in nfs client

Dmitry V. Levin (1):
  x86/signal: Fix restart_syscall number for x32 tasks

Eric Dumazet (1):
  udp: properly support MSG_PEEK with truncated buffers

Eric Ren (1):
  dlm: make posix locks interruptible

Finn Thain (1):
  m68k/mac: Make SCC reset work more reliably

Geert Uytterhoeven (1):
  m68k/mm: Check for mm != NULL in do_page_fault() debug code

H.J. Lu (1):
  x86/boot: Double BOOT_HEAP_SIZE to 64KB

Hannes Reinecke (1):
  block: Always check queue limits for cloned requests

Herbert Xu (1):
  route: Use ipv4_mtu instead of raw rt_pmtu

Ingo Molnar (1):
  efi: Disable interrupts around EFI calls, not in the epilog/prolog
    calls

James Smart (1):
  lpfc: Fix null ndlp dereference in target_reset_handler

Jan Stancek (1):
  ipmi: move timer init to before irq is setup

Kamal Mostafa (1):
  tools: Add a "make all" rule

Karl Heiss (1):
  sctp: Prevent soft lockup when sctp_accept() is called during a
    timeout event

Kirill A. Shutemov (2):
  m32r: fix potential NULL-pointer dereference
  m68k: handle pgtable_page_ctor() fail

Li Wei (1):
  ipv4: Don't increase PMTU with Datagram Too Big message.

Mario Kleiner (1):
  x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[]

Ouyang Zhaowei (Charles) (1):
  x86/xen: don't reset vcpu_info on a cancelled suspend

Paul Mackerras (1):
  KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR

Rusty Russell (1):
  module: remove MODULE_GENERIC_TABLE

Salva Peiró (1):
  staging/dgnc: fix info leak in ioctl

Saurav Kashyap (1):
  qla2xxx: Fix hardware lock/unlock issue causing kernel panic.

Scott Jiang (1):
  pm: use GFP_ATOMIC when pm core call this function

Takashi Iwai (2):
  ALSA: hda - Fix noise problems on Thinkpad T440s
  ALSA: hda - Apply pin fixup for HP ProBook 6550b

Vineet Gupta (2):
  MAINTAINERS: Add public mailing list for ARC
  ARC: Fix silly typo in MAINTAINERS file     commit
    30b9dbee895ff0d5cbf155bd1ef3f0f5992bca6f upstream.    
    Signed-off-by: Jiri Slaby <jslaby@suse.cz>

Vladis Dronov (1):
  Input: aiptek - fix crash on detecting device without endpoints

Yevgeny Pats (1):
  KEYS: Fix keyring ref leak in join_session_keyring()

 MAINTAINERS                              |  1 +
 arch/blackfin/mach-common/pm.c           |  2 +-
 arch/m32r/include/asm/pgalloc.h          |  2 ++
 arch/m68k/include/asm/mcf_pgalloc.h      |  4 +++
 arch/m68k/include/asm/motorola_pgalloc.h |  8 ++++--
 arch/m68k/include/asm/sun3_pgalloc.h     |  5 +++-
 arch/m68k/kernel/head.S                  |  4 ++-
 arch/m68k/mm/fault.c                     |  3 +--
 arch/powerpc/kvm/book3s_hv.c             |  6 +++++
 arch/x86/include/asm/boot.h              |  2 +-
 arch/x86/kernel/reboot.c                 |  8 ++++++
 arch/x86/kernel/signal.c                 | 17 +++++++------
 arch/x86/platform/efi/efi.c              |  7 ++++++
 arch/x86/platform/efi/efi_32.c           | 11 +++------
 arch/x86/platform/efi/efi_64.c           |  3 ---
 arch/x86/xen/suspend.c                   |  3 ++-
 block/blk-core.c                         | 21 ++++++----------
 drivers/char/ipmi/ipmi_si_intf.c         |  8 +++---
 drivers/gpu/drm/i915/intel_ringbuffer.c  |  2 +-
 drivers/input/tablet/aiptek.c            |  9 +++++++
 drivers/isdn/i4l/isdn_ppp.c              | 12 ++++++---
 drivers/net/ppp/ppp_generic.c            |  6 ++---
 drivers/net/slip/slhc.c                  | 12 ++++++---
 drivers/net/slip/slip.c                  |  2 +-
 drivers/pci/pci.c                        |  2 +-
 drivers/scsi/lpfc/lpfc_scsi.c            | 10 +++++++-
 drivers/scsi/qla2xxx/qla_init.c          |  4 +++
 drivers/scsi/qla2xxx/qla_target.c        |  5 ----
 drivers/staging/dgnc/dgnc_mgmt.c         |  1 +
 drivers/usb/core/quirks.c                |  3 +++
 drivers/xen/gntdev.c                     |  2 +-
 fs/dlm/plock.c                           |  2 +-
 include/linux/blkdev.h                   |  1 -
 include/linux/isapnp.h                   |  4 ---
 include/linux/module.h                   | 19 ++++++---------
 include/trace/events/sunrpc.h            |  4 +--
 kernel/trace/ring_buffer.c               | 24 +++---------------
 net/ipv4/route.c                         |  2 +-
 net/ipv4/udp.c                           |  6 +++--
 net/ipv6/udp.c                           |  6 +++--
 net/sctp/sm_sideeffect.c                 | 42 +++++++++++++++++---------------
 security/keys/keyctl.c                   | 18 +++++++-------
 security/keys/process_keys.c             |  1 +
 sound/pci/hda/hda_intel.c                |  5 ++++
 sound/pci/hda/patch_realtek.c            | 22 ++++++++++++++++-
 sound/pci/hda/patch_sigmatel.c           |  1 +
 tools/Makefile                           |  8 ++++++
 47 files changed, 210 insertions(+), 140 deletions(-)

-- 
2.7.0

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

* [PATCH 3.12 15/39] module: remove MODULE_GENERIC_TABLE
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (13 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 14/39] qla2xxx: Fix hardware lock/unlock issue causing kernel panic Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 16/39] staging/dgnc: fix info leak in ioctl Jiri Slaby
                   ` (25 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Rusty Russell, Bryan Kadzban, Jiri Slaby

From: Rusty Russell <rusty@rustcorp.com.au>

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

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

commit cff26a51da5d206d3baf871e75778da44710219d upstream.

MODULE_DEVICE_TABLE() calles MODULE_GENERIC_TABLE(); make it do the
work directly.  This also removes a wart introduced in the last patch,
where the alias is defined to be an unknown struct type "struct
type##__##name##_device_id" instead of "struct type##_device_id" (it's
an extern so GCC doesn't care, but it's wrong).

The other user of MODULE_GENERIC_TABLE (ISAPNP_CARD_TABLE) is unused,
so delete it.

Bryan: gcc v3.3.2 cares

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Cc: Bryan Kadzban <bryan@kadzban.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/isapnp.h |  4 ----
 include/linux/module.h | 19 ++++++++-----------
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/include/linux/isapnp.h b/include/linux/isapnp.h
index e2d28b026a8c..3c77bf9b1efd 100644
--- a/include/linux/isapnp.h
+++ b/include/linux/isapnp.h
@@ -56,10 +56,6 @@
 #define ISAPNP_DEVICE_ID(_va, _vb, _vc, _function) \
 		{ .vendor = ISAPNP_VENDOR(_va, _vb, _vc), .function = ISAPNP_FUNCTION(_function) }
 
-/* export used IDs outside module */
-#define ISAPNP_CARD_TABLE(name) \
-		MODULE_GENERIC_TABLE(isapnp_card, name)
-
 struct isapnp_card_id {
 	unsigned long driver_data;	/* data private to the driver */
 	unsigned short card_vendor, card_device;
diff --git a/include/linux/module.h b/include/linux/module.h
index 54aef1b38463..73c8c06c25bf 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -83,15 +83,6 @@ void sort_extable(struct exception_table_entry *start,
 void sort_main_extable(void);
 void trim_init_extable(struct module *m);
 
-#ifdef MODULE
-#define MODULE_GENERIC_TABLE(gtype,name)			\
-extern const struct gtype##_id __mod_##gtype##_table		\
-  __attribute__ ((unused, alias(__stringify(name))))
-
-#else  /* !MODULE */
-#define MODULE_GENERIC_TABLE(gtype,name)
-#endif
-
 /* Generic info of form tag = "info" */
 #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
 
@@ -142,8 +133,14 @@ extern const struct gtype##_id __mod_##gtype##_table		\
 /* What your module does. */
 #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
 
-#define MODULE_DEVICE_TABLE(type,name)		\
-  MODULE_GENERIC_TABLE(type##__##name##_device, name)
+#ifdef MODULE
+/* Creates an alias so file2alias.c can find device table. */
+#define MODULE_DEVICE_TABLE(type, name)					\
+  extern const struct type##_device_id __mod_##type##__##name##_device_table \
+  __attribute__ ((unused, alias(__stringify(name))))
+#else  /* !MODULE */
+#define MODULE_DEVICE_TABLE(type, name)
+#endif
 
 /* Version of form [<epoch>:]<version>[-<extra-version>].
    Or for CVS/RCS ID version, everything but the number is stripped.
-- 
2.7.0

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

* [PATCH 3.12 16/39] staging/dgnc: fix info leak in ioctl
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (14 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 15/39] module: remove MODULE_GENERIC_TABLE Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 17/39] pm: use GFP_ATOMIC when pm core call this function Jiri Slaby
                   ` (24 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Salva Peiró,
	Greg Kroah-Hartman, Yuki Machida, Jiri Slaby

From: Salva Peiró <speirofr@gmail.com>

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

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

commit 4b6184336ebb5c8dc1eae7f7ab46ee608a748b05 upstream.

The dgnc_mgmt_ioctl() code fails to initialize the 16 _reserved bytes of
struct digi_dinfo after the ->dinfo_nboards member. Add an explicit
memset(0) before filling the structure to avoid the info leak.

Signed-off-by: Salva Peiró <speirofr@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Yuki Machida <machida.yuki@jp.fujitsu.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/staging/dgnc/dgnc_mgmt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index c4629d7c80b2..d885bbb7de60 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -145,6 +145,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
 		DGNC_LOCK(dgnc_global_lock, lock_flags);
 
+		memset(&ddi, 0, sizeof(ddi));
 		ddi.dinfo_nboards = dgnc_NumBoards;
 		sprintf(ddi.dinfo_version, "%s", DG_PART);
 
-- 
2.7.0

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

* [PATCH 3.12 17/39] pm: use GFP_ATOMIC when pm core call this function
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (15 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 16/39] staging/dgnc: fix info leak in ioctl Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:49 ` [PATCH 3.12 18/39] m32r: fix potential NULL-pointer dereference Jiri Slaby
                   ` (23 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Scott Jiang, Oliver Neukum, Jiri Slaby

From: Scott Jiang <scott.jiang.linux@gmail.com>

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

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

commit aefefe92116b776203f95f3249ae61b94f73f170 upstream.

We shouldn't sleep in atomic sections.

Signed-off-by: Scott Jiang <scott.jiang.linux@gmail.com>
Cc: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/blackfin/mach-common/pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/blackfin/mach-common/pm.c b/arch/blackfin/mach-common/pm.c
index 87bfe549ad3f..92273fa6804a 100644
--- a/arch/blackfin/mach-common/pm.c
+++ b/arch/blackfin/mach-common/pm.c
@@ -144,7 +144,7 @@ int bfin_pm_suspend_mem_enter(void)
 
 	unsigned char *memptr = kmalloc(L1_CODE_LENGTH + L1_DATA_A_LENGTH
 					 + L1_DATA_B_LENGTH + L1_SCRATCH_LENGTH,
-					  GFP_KERNEL);
+					  GFP_ATOMIC);
 
 	if (memptr == NULL) {
 		panic("bf53x_suspend_l1_mem malloc failed");
-- 
2.7.0

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

* [PATCH 3.12 18/39] m32r: fix potential NULL-pointer dereference
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (16 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 17/39] pm: use GFP_ATOMIC when pm core call this function Jiri Slaby
@ 2016-01-25 11:49 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 19/39] m68k: handle pgtable_page_ctor() fail Jiri Slaby
                   ` (22 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:49 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Kirill A. Shutemov, Hirokazu Takata, Andrew Morton,
	Linus Torvalds, Oliver Neukum, Jiri Slaby

From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>

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

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

commit fecf3743b824ce4eb275ed4a1d6aee9494f6a966 upstream.

Add missing check for memory allocation fail.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/m32r/include/asm/pgalloc.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/m32r/include/asm/pgalloc.h b/arch/m32r/include/asm/pgalloc.h
index 0fc736198979..ac4208bcc5ad 100644
--- a/arch/m32r/include/asm/pgalloc.h
+++ b/arch/m32r/include/asm/pgalloc.h
@@ -43,6 +43,8 @@ static __inline__ pgtable_t pte_alloc_one(struct mm_struct *mm,
 {
 	struct page *pte = alloc_page(GFP_KERNEL|__GFP_ZERO);
 
+	if (!pte)
+		return NULL;
 	pgtable_page_ctor(pte);
 	return pte;
 }
-- 
2.7.0

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

* [PATCH 3.12 19/39] m68k: handle pgtable_page_ctor() fail
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (17 preceding siblings ...)
  2016-01-25 11:49 ` [PATCH 3.12 18/39] m32r: fix potential NULL-pointer dereference Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 20/39] m68k/mm: Check for mm != NULL in do_page_fault() debug code Jiri Slaby
                   ` (21 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Kirill A. Shutemov, Geert Uytterhoeven,
	Andrew Morton, Linus Torvalds, Oliver Neukum, Jiri Slaby

From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>

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

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

commit f84c914b986ed2ec4ffaa5672b423b1f6b65519d upstream.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/m68k/include/asm/mcf_pgalloc.h      | 4 ++++
 arch/m68k/include/asm/motorola_pgalloc.h | 8 ++++++--
 arch/m68k/include/asm/sun3_pgalloc.h     | 5 ++++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/m68k/include/asm/mcf_pgalloc.h b/arch/m68k/include/asm/mcf_pgalloc.h
index 313f3dd23cdc..f9924fbcfe42 100644
--- a/arch/m68k/include/asm/mcf_pgalloc.h
+++ b/arch/m68k/include/asm/mcf_pgalloc.h
@@ -56,6 +56,10 @@ static inline struct page *pte_alloc_one(struct mm_struct *mm,
 
 	if (!page)
 		return NULL;
+	if (!pgtable_page_ctor(page)) {
+		__free_page(page);
+		return NULL;
+	}
 
 	pte = kmap(page);
 	if (pte) {
diff --git a/arch/m68k/include/asm/motorola_pgalloc.h b/arch/m68k/include/asm/motorola_pgalloc.h
index 2f02f264e694..24bcba496c75 100644
--- a/arch/m68k/include/asm/motorola_pgalloc.h
+++ b/arch/m68k/include/asm/motorola_pgalloc.h
@@ -29,18 +29,22 @@ static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
 
 static inline pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
 {
-	struct page *page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
+	struct page *page;
 	pte_t *pte;
 
+	page = alloc_pages(GFP_KERNEL|__GFP_REPEAT|__GFP_ZERO, 0);
 	if(!page)
 		return NULL;
+	if (!pgtable_page_ctor(page)) {
+		__free_page(page);
+		return NULL;
+	}
 
 	pte = kmap(page);
 	__flush_page_to_ram(pte);
 	flush_tlb_kernel_page(pte);
 	nocache_page(pte);
 	kunmap(page);
-	pgtable_page_ctor(page);
 	return page;
 }
 
diff --git a/arch/m68k/include/asm/sun3_pgalloc.h b/arch/m68k/include/asm/sun3_pgalloc.h
index 48d80d5a666f..f868506e3350 100644
--- a/arch/m68k/include/asm/sun3_pgalloc.h
+++ b/arch/m68k/include/asm/sun3_pgalloc.h
@@ -59,7 +59,10 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
 		return NULL;
 
 	clear_highpage(page);
-	pgtable_page_ctor(page);
+	if (!pgtable_page_ctor(page)) {
+		__free_page(page);
+		return NULL;
+	}
 	return page;
 
 }
-- 
2.7.0

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

* [PATCH 3.12 20/39] m68k/mm: Check for mm != NULL in do_page_fault() debug code
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (18 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 19/39] m68k: handle pgtable_page_ctor() fail Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 21/39] m68k/mac: Make SCC reset work more reliably Jiri Slaby
                   ` (20 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Geert Uytterhoeven, Oliver Neukum, Jiri Slaby

From: Geert Uytterhoeven <geert@linux-m68k.org>

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

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

commit 4e25c0e92f8eaf69bc51d1d523bcb7268e7dd162 upstream.

When DEBUG is enabled, do_page_fault() may dereference a NULL pointer,
causing recursive bus errors.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/m68k/mm/fault.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/m68k/mm/fault.c b/arch/m68k/mm/fault.c
index f0eef0491f77..97136b5e47e0 100644
--- a/arch/m68k/mm/fault.c
+++ b/arch/m68k/mm/fault.c
@@ -77,8 +77,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
 
 #ifdef DEBUG
 	printk ("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
-		regs->sr, regs->pc, address, error_code,
-		current->mm->pgd);
+		regs->sr, regs->pc, address, error_code, mm ? mm->pgd : NULL);
 #endif
 
 	/*
-- 
2.7.0

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

* [PATCH 3.12 21/39] m68k/mac: Make SCC reset work more reliably
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (19 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 20/39] m68k/mm: Check for mm != NULL in do_page_fault() debug code Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 22/39] sctp: Prevent soft lockup when sctp_accept() is called during a timeout event Jiri Slaby
                   ` (19 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Finn Thain, Geert Uytterhoeven, Oliver Neukum, Jiri Slaby

From: Finn Thain <fthain@telegraphics.com.au>

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

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

commit 56931d73697c99ecf7aba6ae86c94d3a2d15d596 upstream.

For SCC initialization we cannot assume that the control register is in
the correct state to accept a register pointer. So first read from the
control register in order to "sync" up.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/m68k/kernel/head.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index ac85f16534af..4180f8b20374 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -2909,7 +2909,9 @@ func_start	serial_init,%d0/%d1/%a0/%a1
 
 #if defined(MAC_USE_SCC_A) || defined(MAC_USE_SCC_B)
 	movel	%pc@(L(mac_sccbase)),%a0
-	/* Reset SCC device */
+	/* Reset SCC register pointer */
+	moveb	%a0@(mac_scc_cha_a_ctrl_offset),%d0
+	/* Reset SCC device: write register pointer then register value */
 	moveb	#9,%a0@(mac_scc_cha_a_ctrl_offset)
 	moveb	#0xc0,%a0@(mac_scc_cha_a_ctrl_offset)
 	/* Wait for 5 PCLK cycles, which is about 68 CPU cycles */
-- 
2.7.0

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

* [PATCH 3.12 22/39] sctp: Prevent soft lockup when sctp_accept() is called during a timeout event
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (20 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 21/39] m68k/mac: Make SCC reset work more reliably Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 23/39] USB: quirks: Fix another ELAN touchscreen Jiri Slaby
                   ` (18 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Karl Heiss, David S . Miller, Ben Hutchings, Jiri Slaby

From: Karl Heiss <kheiss@gmail.com>

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

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

commit 635682a14427d241bab7bbdeebb48a7d7b91638e upstream.

A case can occur when sctp_accept() is called by the user during
a heartbeat timeout event after the 4-way handshake.  Since
sctp_assoc_migrate() changes both assoc->base.sk and assoc->ep, the
bh_sock_lock in sctp_generate_heartbeat_event() will be taken with
the listening socket but released with the new association socket.
The result is a deadlock on any future attempts to take the listening
socket lock.

Note that this race can occur with other SCTP timeouts that take
the bh_lock_sock() in the event sctp_accept() is called.

 BUG: soft lockup - CPU#9 stuck for 67s! [swapper:0]
 ...
 RIP: 0010:[<ffffffff8152d48e>]  [<ffffffff8152d48e>] _spin_lock+0x1e/0x30
 RSP: 0018:ffff880028323b20  EFLAGS: 00000206
 RAX: 0000000000000002 RBX: ffff880028323b20 RCX: 0000000000000000
 RDX: 0000000000000000 RSI: ffff880028323be0 RDI: ffff8804632c4b48
 RBP: ffffffff8100bb93 R08: 0000000000000000 R09: 0000000000000000
 R10: ffff880610662280 R11: 0000000000000100 R12: ffff880028323aa0
 R13: ffff8804383c3880 R14: ffff880028323a90 R15: ffffffff81534225
 FS:  0000000000000000(0000) GS:ffff880028320000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
 CR2: 00000000006df528 CR3: 0000000001a85000 CR4: 00000000000006e0
 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
 Process swapper (pid: 0, threadinfo ffff880616b70000, task ffff880616b6cab0)
 Stack:
 ffff880028323c40 ffffffffa01c2582 ffff880614cfb020 0000000000000000
 <d> 0100000000000000 00000014383a6c44 ffff8804383c3880 ffff880614e93c00
 <d> ffff880614e93c00 0000000000000000 ffff8804632c4b00 ffff8804383c38b8
 Call Trace:
 <IRQ>
 [<ffffffffa01c2582>] ? sctp_rcv+0x492/0xa10 [sctp]
 [<ffffffff8148c559>] ? nf_iterate+0x69/0xb0
 [<ffffffff814974a0>] ? ip_local_deliver_finish+0x0/0x2d0
 [<ffffffff8148c716>] ? nf_hook_slow+0x76/0x120
 [<ffffffff814974a0>] ? ip_local_deliver_finish+0x0/0x2d0
 [<ffffffff8149757d>] ? ip_local_deliver_finish+0xdd/0x2d0
 [<ffffffff81497808>] ? ip_local_deliver+0x98/0xa0
 [<ffffffff81496ccd>] ? ip_rcv_finish+0x12d/0x440
 [<ffffffff81497255>] ? ip_rcv+0x275/0x350
 [<ffffffff8145cfeb>] ? __netif_receive_skb+0x4ab/0x750
 ...

With lockdep debugging:

 =====================================
 [ BUG: bad unlock balance detected! ]
 -------------------------------------
 CslRx/12087 is trying to release lock (slock-AF_INET) at:
 [<ffffffffa01bcae0>] sctp_generate_timeout_event+0x40/0xe0 [sctp]
 but there are no more locks to release!

 other info that might help us debug this:
 2 locks held by CslRx/12087:
 #0:  (&asoc->timers[i]){+.-...}, at: [<ffffffff8108ce1f>] run_timer_softirq+0x16f/0x3e0
 #1:  (slock-AF_INET){+.-...}, at: [<ffffffffa01bcac3>] sctp_generate_timeout_event+0x23/0xe0 [sctp]

Ensure the socket taken is also the same one that is released by
saving a copy of the socket before entering the timeout event
critical section.

Signed-off-by: Karl Heiss <kheiss@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/sctp/sm_sideeffect.c | 42 +++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c
index 1a6eef39ab2f..ae66c9fe7c55 100644
--- a/net/sctp/sm_sideeffect.c
+++ b/net/sctp/sm_sideeffect.c
@@ -245,12 +245,13 @@ void sctp_generate_t3_rtx_event(unsigned long peer)
 	int error;
 	struct sctp_transport *transport = (struct sctp_transport *) peer;
 	struct sctp_association *asoc = transport->asoc;
-	struct net *net = sock_net(asoc->base.sk);
+	struct sock *sk = asoc->base.sk;
+	struct net *net = sock_net(sk);
 
 	/* Check whether a task is in the sock.  */
 
-	sctp_bh_lock_sock(asoc->base.sk);
-	if (sock_owned_by_user(asoc->base.sk)) {
+	sctp_bh_lock_sock(sk);
+	if (sock_owned_by_user(sk)) {
 		pr_debug("%s: sock is busy\n", __func__);
 
 		/* Try again later.  */
@@ -273,10 +274,10 @@ void sctp_generate_t3_rtx_event(unsigned long peer)
 			   transport, GFP_ATOMIC);
 
 	if (error)
-		asoc->base.sk->sk_err = -error;
+		sk->sk_err = -error;
 
 out_unlock:
-	sctp_bh_unlock_sock(asoc->base.sk);
+	sctp_bh_unlock_sock(sk);
 	sctp_transport_put(transport);
 }
 
@@ -286,11 +287,12 @@ out_unlock:
 static void sctp_generate_timeout_event(struct sctp_association *asoc,
 					sctp_event_timeout_t timeout_type)
 {
-	struct net *net = sock_net(asoc->base.sk);
+	struct sock *sk = asoc->base.sk;
+	struct net *net = sock_net(sk);
 	int error = 0;
 
-	sctp_bh_lock_sock(asoc->base.sk);
-	if (sock_owned_by_user(asoc->base.sk)) {
+	sctp_bh_lock_sock(sk);
+	if (sock_owned_by_user(sk)) {
 		pr_debug("%s: sock is busy: timer %d\n", __func__,
 			 timeout_type);
 
@@ -313,10 +315,10 @@ static void sctp_generate_timeout_event(struct sctp_association *asoc,
 			   (void *)timeout_type, GFP_ATOMIC);
 
 	if (error)
-		asoc->base.sk->sk_err = -error;
+		sk->sk_err = -error;
 
 out_unlock:
-	sctp_bh_unlock_sock(asoc->base.sk);
+	sctp_bh_unlock_sock(sk);
 	sctp_association_put(asoc);
 }
 
@@ -366,10 +368,11 @@ void sctp_generate_heartbeat_event(unsigned long data)
 	int error = 0;
 	struct sctp_transport *transport = (struct sctp_transport *) data;
 	struct sctp_association *asoc = transport->asoc;
-	struct net *net = sock_net(asoc->base.sk);
+	struct sock *sk = asoc->base.sk;
+	struct net *net = sock_net(sk);
 
-	sctp_bh_lock_sock(asoc->base.sk);
-	if (sock_owned_by_user(asoc->base.sk)) {
+	sctp_bh_lock_sock(sk);
+	if (sock_owned_by_user(sk)) {
 		pr_debug("%s: sock is busy\n", __func__);
 
 		/* Try again later.  */
@@ -390,10 +393,10 @@ void sctp_generate_heartbeat_event(unsigned long data)
 			   transport, GFP_ATOMIC);
 
 	 if (error)
-		 asoc->base.sk->sk_err = -error;
+		 sk->sk_err = -error;
 
 out_unlock:
-	sctp_bh_unlock_sock(asoc->base.sk);
+	sctp_bh_unlock_sock(sk);
 	sctp_transport_put(transport);
 }
 
@@ -404,10 +407,11 @@ void sctp_generate_proto_unreach_event(unsigned long data)
 {
 	struct sctp_transport *transport = (struct sctp_transport *) data;
 	struct sctp_association *asoc = transport->asoc;
-	struct net *net = sock_net(asoc->base.sk);
+	struct sock *sk = asoc->base.sk;
+	struct net *net = sock_net(sk);
 	
-	sctp_bh_lock_sock(asoc->base.sk);
-	if (sock_owned_by_user(asoc->base.sk)) {
+	sctp_bh_lock_sock(sk);
+	if (sock_owned_by_user(sk)) {
 		pr_debug("%s: sock is busy\n", __func__);
 
 		/* Try again later.  */
@@ -428,7 +432,7 @@ void sctp_generate_proto_unreach_event(unsigned long data)
 		   asoc->state, asoc->ep, asoc, transport, GFP_ATOMIC);
 
 out_unlock:
-	sctp_bh_unlock_sock(asoc->base.sk);
+	sctp_bh_unlock_sock(sk);
 	sctp_association_put(asoc);
 }
 
-- 
2.7.0

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

* [PATCH 3.12 23/39] USB: quirks: Fix another ELAN touchscreen
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (21 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 22/39] sctp: Prevent soft lockup when sctp_accept() is called during a timeout event Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 24/39] KEYS: Fix race between read and revoke Jiri Slaby
                   ` (17 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Adrien Vergé,
	Greg Kroah-Hartman, Oliver Neukum, Jiri Slaby

From: Adrien Vergé <adrienverge@gmail.com>

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

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

commit df36c5bede207f734e4750beb2b14fb892050280 upstream.

Like other buggy models that had their fixes [1], the touchscreen with
id 04f3:21b8 from ELAN Microelectronics needs the device-qualifier
quirk. Otherwise, it fails to respond, blocks the boot for a random
amount of time and pollutes dmesg with:

[ 2887.373196] usb 1-5: new full-speed USB device number 41 using xhci_hcd
[ 2889.502000] usb 1-5: unable to read config index 0 descriptor/start: -71
[ 2889.502005] usb 1-5: can't read configurations, error -71
[ 2889.654571] usb 1-5: new full-speed USB device number 42 using xhci_hcd
[ 2891.783438] usb 1-5: unable to read config index 0 descriptor/start: -71
[ 2891.783443] usb 1-5: can't read configurations, error -71

[1]: See commits c68929f, 876af5d, d749947, a32c99e and dc703ec.

Tested-by: Adrien Vergé <adrienverge@gmail.com>
Signed-off-by: Adrien Vergé <adrienverge@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Oliver Neukum <ONeukum@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/quirks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index a6956cd27334..9596d4f3e71a 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -125,6 +125,9 @@ static const struct usb_device_id usb_quirk_list[] = {
 	{ USB_DEVICE(0x04f3, 0x016f), .driver_info =
 			USB_QUIRK_DEVICE_QUALIFIER },
 
+	{ USB_DEVICE(0x04f3, 0x21b8), .driver_info =
+			USB_QUIRK_DEVICE_QUALIFIER },
+
 	/* Roland SC-8820 */
 	{ USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME },
 
-- 
2.7.0

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

* [PATCH 3.12 24/39] KEYS: Fix race between read and revoke
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (22 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 23/39] USB: quirks: Fix another ELAN touchscreen Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 25/39] KEYS: Fix keyring ref leak in join_session_keyring() Jiri Slaby
                   ` (16 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, David Howells, James Morris, Jiri Slaby

From: David Howells <dhowells@redhat.com>

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

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

commit b4a1b4f5047e4f54e194681125c74c0aa64d637d upstream.

This fixes CVE-2015-7550.

There's a race between keyctl_read() and keyctl_revoke().  If the revoke
happens between keyctl_read() checking the validity of a key and the key's
semaphore being taken, then the key type read method will see a revoked key.

This causes a problem for the user-defined key type because it assumes in
its read method that there will always be a payload in a non-revoked key
and doesn't check for a NULL pointer.

Fix this by making keyctl_read() check the validity of a key after taking
semaphore instead of before.

I think the bug was introduced with the original keyrings code.

This was discovered by a multithreaded test program generated by syzkaller
(http://github.com/google/syzkaller).  Here's a cleaned up version:

	#include <sys/types.h>
	#include <keyutils.h>
	#include <pthread.h>
	void *thr0(void *arg)
	{
		key_serial_t key = (unsigned long)arg;
		keyctl_revoke(key);
		return 0;
	}
	void *thr1(void *arg)
	{
		key_serial_t key = (unsigned long)arg;
		char buffer[16];
		keyctl_read(key, buffer, 16);
		return 0;
	}
	int main()
	{
		key_serial_t key = add_key("user", "%", "foo", 3, KEY_SPEC_USER_KEYRING);
		pthread_t th[5];
		pthread_create(&th[0], 0, thr0, (void *)(unsigned long)key);
		pthread_create(&th[1], 0, thr1, (void *)(unsigned long)key);
		pthread_create(&th[2], 0, thr0, (void *)(unsigned long)key);
		pthread_create(&th[3], 0, thr1, (void *)(unsigned long)key);
		pthread_join(th[0], 0);
		pthread_join(th[1], 0);
		pthread_join(th[2], 0);
		pthread_join(th[3], 0);
		return 0;
	}

Build as:

	cc -o keyctl-race keyctl-race.c -lkeyutils -lpthread

Run as:

	while keyctl-race; do :; done

as it may need several iterations to crash the kernel.  The crash can be
summarised as:

	BUG: unable to handle kernel NULL pointer dereference at 0000000000000010
	IP: [<ffffffff81279b08>] user_read+0x56/0xa3
	...
	Call Trace:
	 [<ffffffff81276aa9>] keyctl_read_key+0xb6/0xd7
	 [<ffffffff81277815>] SyS_keyctl+0x83/0xe0
	 [<ffffffff815dbb97>] entry_SYSCALL_64_fastpath+0x12/0x6f

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 security/keys/keyctl.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 33cfd27b4de2..3242195bfa95 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -744,16 +744,16 @@ long keyctl_read_key(key_serial_t keyid, char __user *buffer, size_t buflen)
 
 	/* the key is probably readable - now try to read it */
 can_read_key:
-	ret = key_validate(key);
-	if (ret == 0) {
-		ret = -EOPNOTSUPP;
-		if (key->type->read) {
-			/* read the data with the semaphore held (since we
-			 * might sleep) */
-			down_read(&key->sem);
+	ret = -EOPNOTSUPP;
+	if (key->type->read) {
+		/* Read the data with the semaphore held (since we might sleep)
+		 * to protect against the key being updated or revoked.
+		 */
+		down_read(&key->sem);
+		ret = key_validate(key);
+		if (ret == 0)
 			ret = key->type->read(key, buffer, buflen);
-			up_read(&key->sem);
-		}
+		up_read(&key->sem);
 	}
 
 error2:
-- 
2.7.0

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

* [PATCH 3.12 25/39] KEYS: Fix keyring ref leak in join_session_keyring()
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (23 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 24/39] KEYS: Fix race between read and revoke Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 26/39] udp: properly support MSG_PEEK with truncated buffers Jiri Slaby
                   ` (15 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Yevgeny Pats, David Howells, James Morris, Jiri Slaby

From: Yevgeny Pats <yevgeny@perception-point.io>

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

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

commit 23567fd052a9abb6d67fe8e7a9ccdd9800a540f2 upstream.

This fixes CVE-2016-0728.

If a thread is asked to join as a session keyring the keyring that's already
set as its session, we leak a keyring reference.

This can be tested with the following program:

	#include <stddef.h>
	#include <stdio.h>
	#include <sys/types.h>
	#include <keyutils.h>

	int main(int argc, const char *argv[])
	{
		int i = 0;
		key_serial_t serial;

		serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING,
				"leaked-keyring");
		if (serial < 0) {
			perror("keyctl");
			return -1;
		}

		if (keyctl(KEYCTL_SETPERM, serial,
			   KEY_POS_ALL | KEY_USR_ALL) < 0) {
			perror("keyctl");
			return -1;
		}

		for (i = 0; i < 100; i++) {
			serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING,
					"leaked-keyring");
			if (serial < 0) {
				perror("keyctl");
				return -1;
			}
		}

		return 0;
	}

If, after the program has run, there something like the following line in
/proc/keys:

3f3d898f I--Q---   100 perm 3f3f0000     0     0 keyring   leaked-keyring: empty

with a usage count of 100 * the number of times the program has been run,
then the kernel is malfunctioning.  If leaked-keyring has zero usages or
has been garbage collected, then the problem is fixed.

Reported-by: Yevgeny Pats <yevgeny@perception-point.io>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Don Zickus <dzickus@redhat.com>
Acked-by: Prarit Bhargava <prarit@redhat.com>
Acked-by: Jarod Wilson <jarod@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 security/keys/process_keys.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index 42defae1e161..cd871dc8b7c0 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -792,6 +792,7 @@ long join_session_keyring(const char *name)
 		ret = PTR_ERR(keyring);
 		goto error2;
 	} else if (keyring == new->session_keyring) {
+		key_put(keyring);
 		ret = 0;
 		goto error2;
 	}
-- 
2.7.0

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

* [PATCH 3.12 26/39] udp: properly support MSG_PEEK with truncated buffers
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (24 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 25/39] KEYS: Fix keyring ref leak in join_session_keyring() Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 27/39] x86/signal: Fix restart_syscall number for x32 tasks Jiri Slaby
                   ` (14 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 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.

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

commit 197c949e7798fbf28cfadc69d9ca0c2abbf93191 upstream.

Backport of this upstream commit into stable kernels :
89c22d8c3b27 ("net: Fix skb csum races when peeking")
exposed a bug in udp stack vs MSG_PEEK support, when user provides
a buffer smaller than skb payload.

In this case,
skb_copy_and_csum_datagram_iovec(skb, sizeof(struct udphdr),
                                 msg->msg_iov);
returns -EFAULT.

This bug does not happen in upstream kernels since Al Viro did a great
job to replace this into :
skb_copy_and_csum_datagram_msg(skb, sizeof(struct udphdr), msg);
This variant is safe vs short buffers.

For the time being, instead reverting Herbert Xu patch and add back
skb->ip_summed invalid changes, simply store the result of
udp_lib_checksum_complete() so that we avoid computing the checksum a
second time, and avoid the problematic
skb_copy_and_csum_datagram_iovec() call.

This patch can be applied on recent kernels as it avoids a double
checksumming, then backported to stable kernels as a bug fix.

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>
---
 net/ipv4/udp.c | 6 ++++--
 net/ipv6/udp.c | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 4908eaa1cdec..f8e304667108 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1210,6 +1210,7 @@ int udp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 	int peeked, off = 0;
 	int err;
 	int is_udplite = IS_UDPLITE(sk);
+	bool checksum_valid = false;
 	bool slow;
 
 	if (flags & MSG_ERRQUEUE)
@@ -1235,11 +1236,12 @@ try_again:
 	 */
 
 	if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {
-		if (udp_lib_checksum_complete(skb))
+		checksum_valid = !udp_lib_checksum_complete(skb);
+		if (!checksum_valid)
 			goto csum_copy_err;
 	}
 
-	if (skb_csum_unnecessary(skb))
+	if (checksum_valid || skb_csum_unnecessary(skb))
 		err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
 					      msg->msg_iov, copied);
 	else {
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index a6c5ef5225ef..94ca4172b38e 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -371,6 +371,7 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
 	int peeked, off = 0;
 	int err;
 	int is_udplite = IS_UDPLITE(sk);
+	bool checksum_valid = false;
 	int is_udp4;
 	bool slow;
 
@@ -402,11 +403,12 @@ try_again:
 	 */
 
 	if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {
-		if (udp_lib_checksum_complete(skb))
+		checksum_valid = !udp_lib_checksum_complete(skb);
+		if (!checksum_valid)
 			goto csum_copy_err;
 	}
 
-	if (skb_csum_unnecessary(skb))
+	if (checksum_valid || skb_csum_unnecessary(skb))
 		err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
 					      msg->msg_iov, copied);
 	else {
-- 
2.7.0

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

* [PATCH 3.12 27/39] x86/signal: Fix restart_syscall number for x32 tasks
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (25 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 26/39] udp: properly support MSG_PEEK with truncated buffers Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 28/39] xen/gntdev: Grant maps should not be subject to NUMA balancing Jiri Slaby
                   ` (13 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Dmitry V. Levin, Elvira Khabirova, Thomas Gleixner,
	Jiri Slaby

From: "Dmitry V. Levin" <ldv@altlinux.org>

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

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

commit 22eab1108781eff09961ae7001704f7bd8fb1dce upstream.

When restarting a syscall with regs->ax == -ERESTART_RESTARTBLOCK,
regs->ax is assigned to a restart_syscall number.  For x32 tasks, this
syscall number must have __X32_SYSCALL_BIT set, otherwise it will be
an x86_64 syscall number instead of a valid x32 syscall number. This
issue has been there since the introduction of x32.

Reported-by: strace/tests/restart_syscall.test
Reported-and-tested-by: Elvira Khabirova <lineprinter0@gmail.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Cc: Elvira Khabirova <lineprinter0@gmail.com>
Link: http://lkml.kernel.org/r/20151130215436.GA25996@altlinux.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kernel/signal.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index b88fc86309bc..5d3e60156683 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -682,12 +682,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
 	signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP));
 }
 
-#ifdef CONFIG_X86_32
-#define NR_restart_syscall	__NR_restart_syscall
-#else /* !CONFIG_X86_32 */
-#define NR_restart_syscall	\
-	test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall : __NR_restart_syscall
-#endif /* CONFIG_X86_32 */
+static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
+{
+#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
+	return __NR_restart_syscall;
+#else /* !CONFIG_X86_32 && CONFIG_X86_64 */
+	return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall :
+		__NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
+#endif /* CONFIG_X86_32 || !CONFIG_X86_64 */
+}
 
 /*
  * Note that 'init' is a special process: it doesn't get signals it doesn't
@@ -716,7 +719,7 @@ static void do_signal(struct pt_regs *regs)
 			break;
 
 		case -ERESTART_RESTARTBLOCK:
-			regs->ax = NR_restart_syscall;
+			regs->ax = get_nr_restart_syscall(regs);
 			regs->ip -= 2;
 			break;
 		}
-- 
2.7.0

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

* [PATCH 3.12 28/39] xen/gntdev: Grant maps should not be subject to NUMA balancing
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (26 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 27/39] x86/signal: Fix restart_syscall number for x32 tasks Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 29/39] x86/xen: don't reset vcpu_info on a cancelled suspend Jiri Slaby
                   ` (12 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Boris Ostrovsky, David Vrabel, Jiri Slaby

From: Boris Ostrovsky <boris.ostrovsky@oracle.com>

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

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

commit 9c17d96500f78d7ecdb71ca6942830158bc75a2b upstream.

Doing so will cause the grant to be unmapped and then, during
fault handling, the fault to be mistakenly treated as NUMA hint
fault.

In addition, even if those maps could partcipate in NUMA
balancing, it wouldn't provide any benefit since we are unable
to determine physical page's node (even if/when VNUMA is
implemented).

Marking grant maps' VMAs as VM_IO will exclude them from being
part of NUMA balancing.

Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/xen/gntdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/gntdev.c b/drivers/xen/gntdev.c
index 0b5806995718..27accc4cc999 100644
--- a/drivers/xen/gntdev.c
+++ b/drivers/xen/gntdev.c
@@ -763,7 +763,7 @@ static int gntdev_mmap(struct file *flip, struct vm_area_struct *vma)
 
 	vma->vm_ops = &gntdev_vmops;
 
-	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP;
+	vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP | VM_IO;
 
 	if (use_ptemod)
 		vma->vm_flags |= VM_DONTCOPY;
-- 
2.7.0

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

* [PATCH 3.12 29/39] x86/xen: don't reset vcpu_info on a cancelled suspend
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (27 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 28/39] xen/gntdev: Grant maps should not be subject to NUMA balancing Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 30/39] KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR Jiri Slaby
                   ` (11 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ouyang Zhaowei (Charles), David Vrabel, Jiri Slaby

From: "Ouyang Zhaowei (Charles)" <ouyangzhaowei@huawei.com>

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

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

commit 6a1f513776b78c994045287073e55bae44ed9f8c upstream.

On a cancelled suspend the vcpu_info location does not change (it's
still in the per-cpu area registered by xen_vcpu_setup()).  So do not
call xen_hvm_init_shared_info() which would make the kernel think its
back in the shared info.  With the wrong vcpu_info, events cannot be
received and the domain will hang after a cancelled suspend.

Signed-off-by: Charles Ouyang <ouyangzhaowei@huawei.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/xen/suspend.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 45329c8c226e..39e12c10b931 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -30,7 +30,8 @@ void xen_arch_hvm_post_suspend(int suspend_cancelled)
 {
 #ifdef CONFIG_XEN_PVHVM
 	int cpu;
-	xen_hvm_init_shared_info();
+	if (!suspend_cancelled)
+	    xen_hvm_init_shared_info();
 	xen_callback_vector();
 	xen_unplug_emulated_devices();
 	if (xen_feature(XENFEAT_hvm_safe_pvclock)) {
-- 
2.7.0

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

* [PATCH 3.12 30/39] KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (28 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 29/39] x86/xen: don't reset vcpu_info on a cancelled suspend Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 31/39] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] Jiri Slaby
                   ` (10 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Paul Mackerras, Paul Mackerras, Jiri Slaby

From: Paul Mackerras <paulus@ozlabs.org>

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

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

commit c20875a3e638e4a03e099b343ec798edd1af5cc6 upstream.

Currently it is possible for userspace (e.g. QEMU) to set a value
for the MSR for a guest VCPU which has both of the TS bits set,
which is an illegal combination.  The result of this is that when
we execute a hrfid (hypervisor return from interrupt doubleword)
instruction to enter the guest, the CPU will take a TM Bad Thing
type of program interrupt (vector 0x700).

Now, if PR KVM is configured in the kernel along with HV KVM, we
actually handle this without crashing the host or giving hypervisor
privilege to the guest; instead what happens is that we deliver a
program interrupt to the guest, with SRR0 reflecting the address
of the hrfid instruction and SRR1 containing the MSR value at that
point.  If PR KVM is not configured in the kernel, then we try to
run the host's program interrupt handler with the MMU set to the
guest context, which almost certainly causes a host crash.

This closes the hole by making kvmppc_set_msr_hv() check for the
illegal combination and force the TS field to a safe value (00,
meaning non-transactional).

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/kvm/book3s_hv.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
index 211974a386d6..ed6e0be80b3b 100644
--- a/arch/powerpc/kvm/book3s_hv.c
+++ b/arch/powerpc/kvm/book3s_hv.c
@@ -160,6 +160,12 @@ void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
 
 void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr)
 {
+	/*
+	 * Check for illegal transactional state bit combination
+	 * and if we find it, force the TS field to a safe state.
+	 */
+	if ((msr & MSR_TS_MASK) == MSR_TS_MASK)
+		msr &= ~MSR_TS_MASK;
 	vcpu->arch.shregs.msr = msr;
 	kvmppc_end_cede(vcpu);
 }
-- 
2.7.0

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

* [PATCH 3.12 31/39] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[]
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (29 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 30/39] KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 32/39] x86/boot: Double BOOT_HEAP_SIZE to 64KB Jiri Slaby
                   ` (9 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Mario Kleiner, Andy Lutomirski, Borislav Petkov,
	Brian Gerst, Dave Jones, Denys Vlasenko, H . Peter Anvin,
	Linus Torvalds, Peter Zijlstra, Thomas Gleixner, Ingo Molnar,
	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 2f0c0b2d96b1205efb14347009748d786c2d9ba5 upstream.

Without the reboot=pci method, the iMac 10,1 simply
hangs after printing "Restarting system" at the point
when it should reboot. This fixes it.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1450466646-26663-1-git-send-email-mario.kleiner.de@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kernel/reboot.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index cb74a04c56c8..8134735f98e4 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -180,6 +180,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1"),
 		},
 	},
+	{	/* Handle problems with rebooting on the iMac10,1. */
+		.callback = set_pci_reboot,
+		.ident = "Apple iMac10,1",
+		.matches = {
+		    DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
+		    DMI_MATCH(DMI_PRODUCT_NAME, "iMac10,1"),
+		},
+	},
 
 	/* ASRock */
 	{	/* Handle problems with rebooting on ASRock Q1900DC-ITX */
-- 
2.7.0

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

* [PATCH 3.12 32/39] x86/boot: Double BOOT_HEAP_SIZE to 64KB
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (30 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 31/39] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 33/39] ipmi: move timer init to before irq is setup Jiri Slaby
                   ` (8 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, H.J. Lu, Andy Lutomirski, Borislav Petkov,
	Brian Gerst, Denys Vlasenko, Linus Torvalds, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Jiri Slaby

From: "H.J. Lu" <hjl.tools@gmail.com>

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

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

commit 8c31902cffc4d716450be549c66a67a8a3dd479c upstream.

When decompressing kernel image during x86 bootup, malloc memory
for ELF program headers may run out of heap space, which leads
to system halt.  This patch doubles BOOT_HEAP_SIZE to 64KB.

Tested with 32-bit kernel which failed to boot without this patch.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/include/asm/boot.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h
index 4fa687a47a62..6b8d6e8cd449 100644
--- a/arch/x86/include/asm/boot.h
+++ b/arch/x86/include/asm/boot.h
@@ -27,7 +27,7 @@
 #define BOOT_HEAP_SIZE             0x400000
 #else /* !CONFIG_KERNEL_BZIP2 */
 
-#define BOOT_HEAP_SIZE	0x8000
+#define BOOT_HEAP_SIZE	0x10000
 
 #endif /* !CONFIG_KERNEL_BZIP2 */
 
-- 
2.7.0

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

* [PATCH 3.12 33/39] ipmi: move timer init to before irq is setup
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (31 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 32/39] x86/boot: Double BOOT_HEAP_SIZE to 64KB Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 34/39] ALSA: hda - Add Intel Lewisburg device IDs Audio Jiri Slaby
                   ` (7 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jan Stancek, Tony Camuso, Corey Minyard, Jiri Slaby

From: Jan Stancek <jstancek@redhat.com>

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

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

commit 27f972d3e00b50639deb4cc1392afaeb08d3cecc upstream.

We encountered a panic on boot in ipmi_si on a dell per320 due to an
uninitialized timer as follows.

static int smi_start_processing(void       *send_info,
                                ipmi_smi_t intf)
{
        /* Try to claim any interrupts. */
        if (new_smi->irq_setup)
                new_smi->irq_setup(new_smi);

 --> IRQ arrives here and irq handler tries to modify uninitialized timer

    which triggers BUG_ON(!timer->function) in __mod_timer().

 Call Trace:
   <IRQ>
   [<ffffffffa0532617>] start_new_msg+0x47/0x80 [ipmi_si]
   [<ffffffffa053269e>] start_check_enables+0x4e/0x60 [ipmi_si]
   [<ffffffffa0532bd8>] smi_event_handler+0x1e8/0x640 [ipmi_si]
   [<ffffffff810f5584>] ? __rcu_process_callbacks+0x54/0x350
   [<ffffffffa053327c>] si_irq_handler+0x3c/0x60 [ipmi_si]
   [<ffffffff810efaf0>] handle_IRQ_event+0x60/0x170
   [<ffffffff810f245e>] handle_edge_irq+0xde/0x180
   [<ffffffff8100fc59>] handle_irq+0x49/0xa0
   [<ffffffff8154643c>] do_IRQ+0x6c/0xf0
   [<ffffffff8100ba53>] ret_from_intr+0x0/0x11

        /* Set up the timer that drives the interface. */
        setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi);

The following patch fixes the problem.

To: Openipmi-developer@lists.sourceforge.net
To: Corey Minyard <minyard@acm.org>
CC: linux-kernel@vger.kernel.org

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Tony Camuso <tcamuso@redhat.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/char/ipmi/ipmi_si_intf.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 25ed69ffd8dd..c16fd35bd640 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1152,14 +1152,14 @@ static int smi_start_processing(void       *send_info,
 
 	new_smi->intf = intf;
 
-	/* Try to claim any interrupts. */
-	if (new_smi->irq_setup)
-		new_smi->irq_setup(new_smi);
-
 	/* Set up the timer that drives the interface. */
 	setup_timer(&new_smi->si_timer, smi_timeout, (long)new_smi);
 	smi_mod_timer(new_smi, jiffies + SI_TIMEOUT_JIFFIES);
 
+	/* Try to claim any interrupts. */
+	if (new_smi->irq_setup)
+		new_smi->irq_setup(new_smi);
+
 	/*
 	 * Check if the user forcefully enabled the daemon.
 	 */
-- 
2.7.0

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

* [PATCH 3.12 34/39] ALSA: hda - Add Intel Lewisburg device IDs Audio
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (32 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 33/39] ipmi: move timer init to before irq is setup Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 35/39] ALSA: hda - Apply pin fixup for HP ProBook 6550b Jiri Slaby
                   ` (6 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Alexandra Yates, Takashi Iwai, Jiri Slaby

From: Alexandra Yates <alexandra.yates@linux.intel.com>

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

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

commit 5cf92c8b3dc5da59e05dc81bdc069cedf6f38313 upstream.

Adding Intel codename Lewisburg platform device IDs for audio.

[rearranged the position by tiwai]

Signed-off-by: Alexandra Yates <alexandra.yates@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/pci/hda/hda_intel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index a7315298ee10..baf12f1a2820 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -4082,6 +4082,11 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
 	{ PCI_DEVICE(0x8086, 0x8d21),
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
+	/* Lewisburg */
+	{ PCI_DEVICE(0x8086, 0xa1f0),
+	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
+	{ PCI_DEVICE(0x8086, 0xa270),
+	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
 	/* Lynx Point-LP */
 	{ PCI_DEVICE(0x8086, 0x9c20),
 	  .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
-- 
2.7.0

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

* [PATCH 3.12 35/39] ALSA: hda - Apply pin fixup for HP ProBook 6550b
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (33 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 34/39] ALSA: hda - Add Intel Lewisburg device IDs Audio Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 36/39] MAINTAINERS: Add public mailing list for ARC Jiri Slaby
                   ` (5 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 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 c932b98c1e47312822d911c1bb76e81ef50e389c upstream.

HP ProBook 6550b needs the same pin fixup applied to other HP B-series
laptops with docks for making its headphone and dock headphone jacks
working properly.  We just need to add the codec SSID to the list.

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

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 984b75ef1190..d68f6af1da2b 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -712,6 +712,7 @@ static bool hp_bnb2011_with_dock(struct hda_codec *codec)
 static bool hp_blike_system(u32 subsystem_id)
 {
 	switch (subsystem_id) {
+	case 0x103c1473: /* HP ProBook 6550b */
 	case 0x103c1520:
 	case 0x103c1521:
 	case 0x103c1523:
-- 
2.7.0

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

* [PATCH 3.12 36/39] MAINTAINERS: Add public mailing list for ARC
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (34 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 35/39] ALSA: hda - Apply pin fixup for HP ProBook 6550b Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 37/39] ARC: Fix silly typo in MAINTAINERS file commit 30b9dbee895ff0d5cbf155bd1ef3f0f5992bca6f upstream. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Jiri Slaby
                   ` (4 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vineet Gupta, Jiri Slaby

From: Vineet Gupta <vgupta@synopsys.com>

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

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

commit 9acdc911b55569145034b01075adf658891afbd2 upstream.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index ffcaf975bed7..800a6b04727c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8151,6 +8151,7 @@ F:	include/linux/swiotlb.h
 
 SYNOPSYS ARC ARCHITECTURE
 M:	Vineet Gupta <vgupta@synopsys.com>
+L:	linux-snps-arc@lists.infraded.org
 S:	Supported
 F:	arch/arc/
 F:	Documentation/devicetree/bindings/arc/
-- 
2.7.0

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

* [PATCH 3.12 37/39] ARC: Fix silly typo in MAINTAINERS file commit 30b9dbee895ff0d5cbf155bd1ef3f0f5992bca6f upstream. Signed-off-by: Jiri Slaby <jslaby@suse.cz>
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (35 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 36/39] MAINTAINERS: Add public mailing list for ARC Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 38/39] isdn_ppp: Add checks for allocation failure in isdn_ppp_open() Jiri Slaby
                   ` (3 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vineet Gupta

From: Vineet Gupta <vgupta@synopsys.com>

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

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

---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 800a6b04727c..44881abcfb06 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8151,7 +8151,7 @@ F:	include/linux/swiotlb.h
 
 SYNOPSYS ARC ARCHITECTURE
 M:	Vineet Gupta <vgupta@synopsys.com>
-L:	linux-snps-arc@lists.infraded.org
+L:	linux-snps-arc@lists.infradead.org
 S:	Supported
 F:	arch/arc/
 F:	Documentation/devicetree/bindings/arc/
-- 
2.7.0

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

* [PATCH 3.12 38/39] isdn_ppp: Add checks for allocation failure in isdn_ppp_open()
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (36 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 37/39] ARC: Fix silly typo in MAINTAINERS file commit 30b9dbee895ff0d5cbf155bd1ef3f0f5992bca6f upstream. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 11:50 ` [PATCH 3.12 39/39] ppp, slip: Validate VJ compression slot parameters completely Jiri Slaby
                   ` (2 subsequent siblings)
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ben Hutchings, David S . Miller, Jiri Slaby

From: Ben Hutchings <ben@decadent.org.uk>

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

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

commit 0baa57d8dc32db78369d8b5176ef56c5e2e18ab3 upstream.

Compile-tested only.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/isdn/i4l/isdn_ppp.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index 38ceac5053a0..12bcce1b4025 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -301,6 +301,8 @@ isdn_ppp_open(int min, struct file *file)
 	is->compflags = 0;
 
 	is->reset = isdn_ppp_ccp_reset_alloc(is);
+	if (!is->reset)
+		return -ENOMEM;
 
 	is->lp = NULL;
 	is->mp_seqno = 0;       /* MP sequence number */
@@ -320,6 +322,10 @@ isdn_ppp_open(int min, struct file *file)
 	 * VJ header compression init
 	 */
 	is->slcomp = slhc_init(16, 16);	/* not necessary for 2. link in bundle */
+	if (!is->slcomp) {
+		isdn_ppp_ccp_reset_free(is);
+		return -ENOMEM;
+	}
 #endif
 #ifdef CONFIG_IPPP_FILTER
 	is->pass_filter = NULL;
-- 
2.7.0

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

* [PATCH 3.12 39/39] ppp, slip: Validate VJ compression slot parameters completely
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (37 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 38/39] isdn_ppp: Add checks for allocation failure in isdn_ppp_open() Jiri Slaby
@ 2016-01-25 11:50 ` Jiri Slaby
  2016-01-25 14:50 ` [PATCH 3.12 00/39] 3.12.53-stable review Guenter Roeck
  2016-01-25 17:00 ` Shuah Khan
  40 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 11:50 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ben Hutchings, David S . Miller, Jiri Slaby

From: Ben Hutchings <ben@decadent.org.uk>

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

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

commit 4ab42d78e37a294ac7bc56901d563c642e03c4ae upstream.

Currently slhc_init() treats out-of-range values of rslots and tslots
as equivalent to 0, except that if tslots is too large it will
dereference a null pointer (CVE-2015-7799).

Add a range-check at the top of the function and make it return an
ERR_PTR() on error instead of NULL.  Change the callers accordingly.

Compile-tested only.

Reported-by: 郭永刚 <guoyonggang@360.cn>
References: http://article.gmane.org/gmane.comp.security.oss.general/17908
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/isdn/i4l/isdn_ppp.c   | 10 ++++------
 drivers/net/ppp/ppp_generic.c |  6 ++----
 drivers/net/slip/slhc.c       | 12 ++++++++----
 drivers/net/slip/slip.c       |  2 +-
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c
index 12bcce1b4025..0ed6731396ef 100644
--- a/drivers/isdn/i4l/isdn_ppp.c
+++ b/drivers/isdn/i4l/isdn_ppp.c
@@ -322,9 +322,9 @@ isdn_ppp_open(int min, struct file *file)
 	 * VJ header compression init
 	 */
 	is->slcomp = slhc_init(16, 16);	/* not necessary for 2. link in bundle */
-	if (!is->slcomp) {
+	if (IS_ERR(is->slcomp)) {
 		isdn_ppp_ccp_reset_free(is);
-		return -ENOMEM;
+		return PTR_ERR(is->slcomp);
 	}
 #endif
 #ifdef CONFIG_IPPP_FILTER
@@ -574,10 +574,8 @@ isdn_ppp_ioctl(int min, struct file *file, unsigned int cmd, unsigned long arg)
 			is->maxcid = val;
 #ifdef CONFIG_ISDN_PPP_VJ
 			sltmp = slhc_init(16, val);
-			if (!sltmp) {
-				printk(KERN_ERR "ippp, can't realloc slhc struct\n");
-				return -ENOMEM;
-			}
+			if (IS_ERR(sltmp))
+				return PTR_ERR(sltmp);
 			if (is->slcomp)
 				slhc_free(is->slcomp);
 			is->slcomp = sltmp;
diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index 5a1897d86e94..a2d7d5f066f1 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -716,10 +716,8 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 			val &= 0xffff;
 		}
 		vj = slhc_init(val2+1, val+1);
-		if (!vj) {
-			netdev_err(ppp->dev,
-				   "PPP: no memory (VJ compressor)\n");
-			err = -ENOMEM;
+		if (IS_ERR(vj)) {
+			err = PTR_ERR(vj);
 			break;
 		}
 		ppp_lock(ppp);
diff --git a/drivers/net/slip/slhc.c b/drivers/net/slip/slhc.c
index 1252d9c726a7..b52eabc168a0 100644
--- a/drivers/net/slip/slhc.c
+++ b/drivers/net/slip/slhc.c
@@ -84,8 +84,9 @@ static long decode(unsigned char **cpp);
 static unsigned char * put16(unsigned char *cp, unsigned short x);
 static unsigned short pull16(unsigned char **cpp);
 
-/* Initialize compression data structure
+/* Allocate compression data structure
  *	slots must be in range 0 to 255 (zero meaning no compression)
+ * Returns pointer to structure or ERR_PTR() on error.
  */
 struct slcompress *
 slhc_init(int rslots, int tslots)
@@ -94,11 +95,14 @@ slhc_init(int rslots, int tslots)
 	register struct cstate *ts;
 	struct slcompress *comp;
 
+	if (rslots < 0 || rslots > 255 || tslots < 0 || tslots > 255)
+		return ERR_PTR(-EINVAL);
+
 	comp = kzalloc(sizeof(struct slcompress), GFP_KERNEL);
 	if (! comp)
 		goto out_fail;
 
-	if ( rslots > 0  &&  rslots < 256 ) {
+	if (rslots > 0) {
 		size_t rsize = rslots * sizeof(struct cstate);
 		comp->rstate = kzalloc(rsize, GFP_KERNEL);
 		if (! comp->rstate)
@@ -106,7 +110,7 @@ slhc_init(int rslots, int tslots)
 		comp->rslot_limit = rslots - 1;
 	}
 
-	if ( tslots > 0  &&  tslots < 256 ) {
+	if (tslots > 0) {
 		size_t tsize = tslots * sizeof(struct cstate);
 		comp->tstate = kzalloc(tsize, GFP_KERNEL);
 		if (! comp->tstate)
@@ -141,7 +145,7 @@ out_free2:
 out_free:
 	kfree(comp);
 out_fail:
-	return NULL;
+	return ERR_PTR(-ENOMEM);
 }
 
 
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
index 87526443841f..0641fccdc954 100644
--- a/drivers/net/slip/slip.c
+++ b/drivers/net/slip/slip.c
@@ -164,7 +164,7 @@ static int sl_alloc_bufs(struct slip *sl, int mtu)
 	if (cbuff == NULL)
 		goto err_exit;
 	slcomp = slhc_init(16, 16);
-	if (slcomp == NULL)
+	if (IS_ERR(slcomp))
 		goto err_exit;
 #endif
 	spin_lock_bh(&sl->lock);
-- 
2.7.0

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

* Re: [PATCH 3.12 00/39] 3.12.53-stable review
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (38 preceding siblings ...)
  2016-01-25 11:50 ` [PATCH 3.12 39/39] ppp, slip: Validate VJ compression slot parameters completely Jiri Slaby
@ 2016-01-25 14:50 ` Guenter Roeck
  2016-01-25 15:05   ` Jiri Slaby
  2016-01-25 17:00 ` Shuah Khan
  40 siblings, 1 reply; 43+ messages in thread
From: Guenter Roeck @ 2016-01-25 14:50 UTC (permalink / raw)
  To: Jiri Slaby, stable
  Cc: William Dauchy, shuah.kh, linux-kernel, Kirill A. Shutemov

On 01/25/2016 03:49 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.53 release.
> There are 39 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 Wed Jan 27 12:44:04 CET 2016.
> Anything received after that time might be too late.
>

Early feedback: m68k builds fail due to 'm68k: handle pgtable_page_ctor() fail',
which would also require upstream commit 390f44e2aa2ab ("mm: allow
pgtable_page_ctor() to fail"). However, that commit alone doesn't add any value;
it requires additional commits to make sense. I don't know what those are.
Copying Kirill for advice.

Guenter

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

* Re: [PATCH 3.12 00/39] 3.12.53-stable review
  2016-01-25 14:50 ` [PATCH 3.12 00/39] 3.12.53-stable review Guenter Roeck
@ 2016-01-25 15:05   ` Jiri Slaby
  0 siblings, 0 replies; 43+ messages in thread
From: Jiri Slaby @ 2016-01-25 15:05 UTC (permalink / raw)
  To: Guenter Roeck, stable
  Cc: William Dauchy, shuah.kh, linux-kernel, Kirill A. Shutemov

On 01/25/2016, 03:50 PM, Guenter Roeck wrote:
> On 01/25/2016 03:49 AM, Jiri Slaby wrote:
>> This is the start of the stable review cycle for the 3.12.53 release.
>> There are 39 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 Wed Jan 27 12:44:04 CET 2016.
>> Anything received after that time might be too late.
>>
> 
> Early feedback: m68k builds fail due to 'm68k: handle
> pgtable_page_ctor() fail',
> which would also require upstream commit 390f44e2aa2ab ("mm: allow
> pgtable_page_ctor() to fail").

I noticed and pushed a fixed tree without that commit :).

> However, that commit alone doesn't add
> any value;
> it requires additional commits to make sense. I don't know what those are.
> Copying Kirill for advice.

It needs the later rewrite where the function can actually fail.

thanks,
-- 
js
suse labs

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

* Re: [PATCH 3.12 00/39] 3.12.53-stable review
  2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
                   ` (39 preceding siblings ...)
  2016-01-25 14:50 ` [PATCH 3.12 00/39] 3.12.53-stable review Guenter Roeck
@ 2016-01-25 17:00 ` Shuah Khan
  40 siblings, 0 replies; 43+ messages in thread
From: Shuah Khan @ 2016-01-25 17:00 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: William Dauchy, linux, shuah.kh, linux-kernel

On 01/25/2016 04:49 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.53 release.
> There are 39 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 Wed Jan 27 12:44:04 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.53-rc1.xz
> and the diffstat can be found below.
> 
> thanks,
> js
> 

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

thanks,
-- Shuah


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

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

end of thread, other threads:[~2016-01-25 17:00 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-25 11:49 [PATCH 3.12 00/39] 3.12.53-stable review Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 01/39] efi: Disable interrupts around EFI calls, not in the epilog/prolog calls Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 02/39] tools: Add a "make all" rule Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 03/39] ALSA: hda - Fix noise problems on Thinkpad T440s Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 04/39] dlm: make posix locks interruptible Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 05/39] PCI: Drop "setting latency timer" messages Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 06/39] ipv4: Don't increase PMTU with Datagram Too Big message Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 07/39] route: Use ipv4_mtu instead of raw rt_pmtu Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 08/39] SUNRPC: Fix oops when trace sunrpc_task events in nfs client Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 09/39] ring-buffer: Always run per-cpu ring buffer resize with schedule_work_on() Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 10/39] drm/i915: Fix SRC_COPY width on 830/845g Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 11/39] lpfc: Fix null ndlp dereference in target_reset_handler Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 12/39] block: Always check queue limits for cloned requests Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 13/39] Input: aiptek - fix crash on detecting device without endpoints Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 14/39] qla2xxx: Fix hardware lock/unlock issue causing kernel panic Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 15/39] module: remove MODULE_GENERIC_TABLE Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 16/39] staging/dgnc: fix info leak in ioctl Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 17/39] pm: use GFP_ATOMIC when pm core call this function Jiri Slaby
2016-01-25 11:49 ` [PATCH 3.12 18/39] m32r: fix potential NULL-pointer dereference Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 19/39] m68k: handle pgtable_page_ctor() fail Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 20/39] m68k/mm: Check for mm != NULL in do_page_fault() debug code Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 21/39] m68k/mac: Make SCC reset work more reliably Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 22/39] sctp: Prevent soft lockup when sctp_accept() is called during a timeout event Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 23/39] USB: quirks: Fix another ELAN touchscreen Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 24/39] KEYS: Fix race between read and revoke Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 25/39] KEYS: Fix keyring ref leak in join_session_keyring() Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 26/39] udp: properly support MSG_PEEK with truncated buffers Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 27/39] x86/signal: Fix restart_syscall number for x32 tasks Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 28/39] xen/gntdev: Grant maps should not be subject to NUMA balancing Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 29/39] x86/xen: don't reset vcpu_info on a cancelled suspend Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 30/39] KVM: PPC: Book3S HV: Prohibit setting illegal transaction state in MSR Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 31/39] x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 32/39] x86/boot: Double BOOT_HEAP_SIZE to 64KB Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 33/39] ipmi: move timer init to before irq is setup Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 34/39] ALSA: hda - Add Intel Lewisburg device IDs Audio Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 35/39] ALSA: hda - Apply pin fixup for HP ProBook 6550b Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 36/39] MAINTAINERS: Add public mailing list for ARC Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 37/39] ARC: Fix silly typo in MAINTAINERS file commit 30b9dbee895ff0d5cbf155bd1ef3f0f5992bca6f upstream. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 38/39] isdn_ppp: Add checks for allocation failure in isdn_ppp_open() Jiri Slaby
2016-01-25 11:50 ` [PATCH 3.12 39/39] ppp, slip: Validate VJ compression slot parameters completely Jiri Slaby
2016-01-25 14:50 ` [PATCH 3.12 00/39] 3.12.53-stable review Guenter Roeck
2016-01-25 15:05   ` Jiri Slaby
2016-01-25 17:00 ` Shuah Khan

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.