All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000
@ 2017-04-10 12:58 Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: iforce - validate number of endpoints before using them Jiri Slaby
                   ` (51 more replies)
  0 siblings, 52 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Kai-Heng Feng, Dmitry Torokhov, Jiri Slaby

From: Kai-Heng Feng <kai.heng.feng@canonical.com>

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

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

commit 45838660e34d90db8d4f7cbc8fd66e8aff79f4fe upstream.

The aux port does not get detected without noloop quirk, so external PS/2
mouse cannot work as result.

The PS/2 mouse can work with this quirk.

BugLink: https://bugs.launchpad.net/bugs/1591053
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/serio/i8042-x86ia64io.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 3f3c517f2039..9a2d2159bf0c 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -120,6 +120,13 @@ static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
 		},
 	},
 	{
+		/* Dell Embedded Box PC 3000 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+			DMI_MATCH(DMI_PRODUCT_NAME, "Embedded Box PC 3000"),
+		},
+	},
+	{
 		/* OQO Model 01 */
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
-- 
2.12.2

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

* [patch added to 3.12-stable] Input: iforce - validate number of endpoints before using them
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: ims-pcu " Jiri Slaby
                   ` (50 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Dmitry Torokhov, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 59cf8bed44a79ec42303151dd014fdb6434254bb upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory that lie beyond the end of the endpoint
array should a malicious device lack the expected endpoints.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/joystick/iforce/iforce-usb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index d96aa27dfcdc..db64adfbe1af 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -141,6 +141,9 @@ static int iforce_usb_probe(struct usb_interface *intf,
 
 	interface = intf->cur_altsetting;
 
+	if (interface->desc.bNumEndpoints < 2)
+		return -ENODEV;
+
 	epirq = &interface->endpoint[0].desc;
 	epout = &interface->endpoint[1].desc;
 
-- 
2.12.2

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

* [patch added to 3.12-stable] Input: ims-pcu - validate number of endpoints before using them
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: iforce - validate number of endpoints before using them Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: hanwang " Jiri Slaby
                   ` (49 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Dmitry Torokhov, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 1916d319271664241b7aa0cd2b05e32bdb310ce9 upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack control-interface endpoints.

Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/misc/ims-pcu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index 77164dc1bedd..8fb814ccfd7a 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1437,6 +1437,10 @@ static int ims_pcu_parse_cdc_data(struct usb_interface *intf, struct ims_pcu *pc
 		return -EINVAL;
 
 	alt = pcu->ctrl_intf->cur_altsetting;
+
+	if (alt->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	pcu->ep_ctrl = &alt->endpoint[0].desc;
 	pcu->max_ctrl_size = usb_endpoint_maxp(pcu->ep_ctrl);
 
-- 
2.12.2

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

* [patch added to 3.12-stable] Input: hanwang - validate number of endpoints before using them
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: iforce - validate number of endpoints before using them Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: ims-pcu " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: yealink " Jiri Slaby
                   ` (48 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Dmitry Torokhov, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit ba340d7b83703768ce566f53f857543359aa1b98 upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Fixes: bba5394ad3bd ("Input: add support for Hanwang tablets")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/tablet/hanwang.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/tablet/hanwang.c b/drivers/input/tablet/hanwang.c
index 5cc04124995c..263c85e72e14 100644
--- a/drivers/input/tablet/hanwang.c
+++ b/drivers/input/tablet/hanwang.c
@@ -341,6 +341,9 @@ static int hanwang_probe(struct usb_interface *intf, const struct usb_device_id
 	int error;
 	int i;
 
+	if (intf->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	hanwang = kzalloc(sizeof(struct hanwang), GFP_KERNEL);
 	input_dev = input_allocate_device();
 	if (!hanwang || !input_dev) {
-- 
2.12.2

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

* [patch added to 3.12-stable] Input: yealink - validate number of endpoints before using them
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (2 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: hanwang " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: cm109 " Jiri Slaby
                   ` (47 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Dmitry Torokhov, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 5cc4a1a9f5c179795c8a1f2b0f4361829d6a070e upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Fixes: aca951a22a1d ("[PATCH] input-driver-yealink-P1K-usb-phone")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/misc/yealink.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 285a5bd6cbc9..3b6fdb389a2d 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -876,6 +876,10 @@ static int usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
 	int ret, pipe, i;
 
 	interface = intf->cur_altsetting;
+
+	if (interface->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	endpoint = &interface->endpoint[0].desc;
 	if (!usb_endpoint_is_int_in(endpoint))
 		return -ENODEV;
-- 
2.12.2

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

* [patch added to 3.12-stable] Input: cm109 - validate number of endpoints before using them
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (3 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: yealink " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: kbtab " Jiri Slaby
                   ` (46 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Dmitry Torokhov, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit ac2ee9ba953afe88f7a673e1c0c839227b1d7891 upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Fixes: c04148f915e5 ("Input: add driver for USB VoIP phones with CM109...")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/misc/cm109.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c
index 9365535ba7f1..50a7faa504f7 100644
--- a/drivers/input/misc/cm109.c
+++ b/drivers/input/misc/cm109.c
@@ -675,6 +675,10 @@ static int cm109_usb_probe(struct usb_interface *intf,
 	int error = -ENOMEM;
 
 	interface = intf->cur_altsetting;
+
+	if (interface->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	endpoint = &interface->endpoint[0].desc;
 
 	if (!usb_endpoint_is_int_in(endpoint))
-- 
2.12.2

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

* [patch added to 3.12-stable] Input: kbtab - validate number of endpoints before using them
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (4 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: cm109 " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] ALSA: seq: Fix racy cell insertions during snd_seq_pool_done() Jiri Slaby
                   ` (45 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Dmitry Torokhov, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit cb1b494663e037253337623bf1ef2df727883cb7 upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/tablet/kbtab.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index 3fba74b9b602..f0d532684afd 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -123,6 +123,9 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
 	struct input_dev *input_dev;
 	int error = -ENOMEM;
 
+	if (intf->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	kbtab = kzalloc(sizeof(struct kbtab), GFP_KERNEL);
 	input_dev = input_allocate_device();
 	if (!kbtab || !input_dev)
-- 
2.12.2

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

* [patch added to 3.12-stable] ALSA: seq: Fix racy cell insertions during snd_seq_pool_done()
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (5 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] Input: kbtab " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems Jiri Slaby
                   ` (44 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Takashi Iwai, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

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

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

commit c520ff3d03f0b5db7146d9beed6373ad5d2a5e0e upstream.

When snd_seq_pool_done() is called, it marks the closing flag to
refuse the further cell insertions.  But snd_seq_pool_done() itself
doesn't clear the cells but just waits until all cells are cleared by
the caller side.  That is, it's racy, and this leads to the endless
stall as syzkaller spotted.

This patch addresses the racy by splitting the setup of pool->closing
flag out of snd_seq_pool_done(), and calling it properly before
snd_seq_pool_done().

BugLink: http://lkml.kernel.org/r/CACT4Y+aqqy8bZA1fFieifNxR2fAfFQQABcBHj801+u5ePV0URw@mail.gmail.com
Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/seq/seq_clientmgr.c |  1 +
 sound/core/seq/seq_fifo.c      |  3 +++
 sound/core/seq/seq_memory.c    | 17 +++++++++++++----
 sound/core/seq/seq_memory.h    |  1 +
 4 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 08865dcbf5f1..d449dde1bf50 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1909,6 +1909,7 @@ static int snd_seq_ioctl_set_client_pool(struct snd_seq_client *client,
 	     info.output_pool != client->pool->size)) {
 		if (snd_seq_write_pool_allocated(client)) {
 			/* remove all existing cells */
+			snd_seq_pool_mark_closing(client->pool);
 			snd_seq_queue_client_leave_cells(client->number);
 			snd_seq_pool_done(client->pool);
 		}
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
index 118481839d46..fc2c55b18f49 100644
--- a/sound/core/seq/seq_fifo.c
+++ b/sound/core/seq/seq_fifo.c
@@ -72,6 +72,9 @@ void snd_seq_fifo_delete(struct snd_seq_fifo **fifo)
 		return;
 	*fifo = NULL;
 
+	if (f->pool)
+		snd_seq_pool_mark_closing(f->pool);
+
 	snd_seq_fifo_clear(f);
 
 	/* wake up clients if any */
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 7204c0f1700b..4603bcae5e40 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -414,6 +414,18 @@ int snd_seq_pool_init(struct snd_seq_pool *pool)
 	return 0;
 }
 
+/* refuse the further insertion to the pool */
+void snd_seq_pool_mark_closing(struct snd_seq_pool *pool)
+{
+	unsigned long flags;
+
+	if (snd_BUG_ON(!pool))
+		return;
+	spin_lock_irqsave(&pool->lock, flags);
+	pool->closing = 1;
+	spin_unlock_irqrestore(&pool->lock, flags);
+}
+
 /* remove events */
 int snd_seq_pool_done(struct snd_seq_pool *pool)
 {
@@ -424,10 +436,6 @@ int snd_seq_pool_done(struct snd_seq_pool *pool)
 		return -EINVAL;
 
 	/* wait for closing all threads */
-	spin_lock_irqsave(&pool->lock, flags);
-	pool->closing = 1;
-	spin_unlock_irqrestore(&pool->lock, flags);
-
 	if (waitqueue_active(&pool->output_sleep))
 		wake_up(&pool->output_sleep);
 
@@ -486,6 +494,7 @@ int snd_seq_pool_delete(struct snd_seq_pool **ppool)
 	*ppool = NULL;
 	if (pool == NULL)
 		return 0;
+	snd_seq_pool_mark_closing(pool);
 	snd_seq_pool_done(pool);
 	kfree(pool);
 	return 0;
diff --git a/sound/core/seq/seq_memory.h b/sound/core/seq/seq_memory.h
index 4a2ec779b8a7..32f959c17786 100644
--- a/sound/core/seq/seq_memory.h
+++ b/sound/core/seq/seq_memory.h
@@ -84,6 +84,7 @@ static inline int snd_seq_total_cells(struct snd_seq_pool *pool)
 int snd_seq_pool_init(struct snd_seq_pool *pool);
 
 /* done pool - free events */
+void snd_seq_pool_mark_closing(struct snd_seq_pool *pool);
 int snd_seq_pool_done(struct snd_seq_pool *pool);
 
 /* create pool */
-- 
2.12.2

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

* [patch added to 3.12-stable] USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (6 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] ALSA: seq: Fix racy cell insertions during snd_seq_pool_done() Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: serial: qcserial: add Dell DW5811e Jiri Slaby
                   ` (43 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Dan Williams, Johan Hovold, Jiri Slaby

From: Dan Williams <dcbw@redhat.com>

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

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

commit 6e9f44eaaef0df7b846e9316fa9ca72a02025d44 upstream.

Add Quectel UC15, UC20, EC21, and EC25.  The EC20 is handled by
qcserial due to a USB VID/PID conflict with an existing Acer
device.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/option.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 49b668da6cf0..edadc7568eb7 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -234,6 +234,14 @@ static void option_instat_callback(struct urb *urb);
 #define BANDRICH_PRODUCT_1012			0x1012
 
 #define QUALCOMM_VENDOR_ID			0x05C6
+/* These Quectel products use Qualcomm's vendor ID */
+#define QUECTEL_PRODUCT_UC20			0x9003
+#define QUECTEL_PRODUCT_UC15			0x9090
+
+#define QUECTEL_VENDOR_ID			0x2c7c
+/* These Quectel products use Quectel's vendor ID */
+#define QUECTEL_PRODUCT_EC21			0x0121
+#define QUECTEL_PRODUCT_EC25			0x0125
 
 #define CMOTECH_VENDOR_ID			0x16d8
 #define CMOTECH_PRODUCT_6001			0x6001
@@ -1169,7 +1177,14 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */
 	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */
 	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
-	{ USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9003), /* Quectel UC20 */
+	/* Quectel products using Qualcomm vendor ID */
+	{ USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC15)},
+	{ USB_DEVICE(QUALCOMM_VENDOR_ID, QUECTEL_PRODUCT_UC20),
+	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	/* Quectel products using Quectel vendor ID */
+	{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC21),
+	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC25),
 	  .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
 	{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) },
 	{ USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) },
-- 
2.12.2

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

* [patch added to 3.12-stable] USB: serial: qcserial: add Dell DW5811e
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (7 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] ACM gadget: fix endianness in notifications Jiri Slaby
                   ` (42 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Bjørn Mork, Johan Hovold, Jiri Slaby

From: Bjørn Mork <bjorn@mork.no>

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

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

commit 436ecf5519d892397af133a79ccd38a17c25fa51 upstream.

This is a Dell branded Sierra Wireless EM7455.

Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/qcserial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 25f97da78989..c811c2dc1ae3 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -166,6 +166,8 @@ static const struct usb_device_id id_table[] = {
 	{DEVICE_SWI(0x413c, 0x81a9)},	/* Dell Wireless 5808e Gobi(TM) 4G LTE Mobile Broadband Card */
 	{DEVICE_SWI(0x413c, 0x81b1)},	/* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card */
 	{DEVICE_SWI(0x413c, 0x81b3)},	/* Dell Wireless 5809e Gobi(TM) 4G LTE Mobile Broadband Card (rev3) */
+	{DEVICE_SWI(0x413c, 0x81b5)},	/* Dell Wireless 5811e QDL */
+	{DEVICE_SWI(0x413c, 0x81b6)},	/* Dell Wireless 5811e QDL */
 
 	{ }				/* Terminating entry */
 };
-- 
2.12.2

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

* [patch added to 3.12-stable] ACM gadget: fix endianness in notifications
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (8 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: serial: qcserial: add Dell DW5811e Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk Jiri Slaby
                   ` (41 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Oliver Neukum, Jiri Slaby

From: Oliver Neukum <oneukum@suse.com>

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

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

commit cdd7928df0d2efaa3270d711963773a08a4cc8ab upstream.

The gadget code exports the bitfield for serial status changes
over the wire in its internal endianness. The fix is to convert
to little endian before sending it over the wire.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Tested-by: 家瑋 <momo1208@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/gadget/f_acm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
index 3384486c2884..ff30171b6926 100644
--- a/drivers/usb/gadget/f_acm.c
+++ b/drivers/usb/gadget/f_acm.c
@@ -535,13 +535,15 @@ static int acm_notify_serial_state(struct f_acm *acm)
 {
 	struct usb_composite_dev *cdev = acm->port.func.config->cdev;
 	int			status;
+	__le16			serial_state;
 
 	spin_lock(&acm->lock);
 	if (acm->notify_req) {
 		DBG(cdev, "acm ttyGS%d serial state %04x\n",
 				acm->port_num, acm->serial_state);
+		serial_state = cpu_to_le16(acm->serial_state);
 		status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE,
-				0, &acm->serial_state, sizeof(acm->serial_state));
+				0, &serial_state, sizeof(acm->serial_state));
 	} else {
 		acm->pending = true;
 		status = 0;
-- 
2.12.2

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

* [patch added to 3.12-stable] usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (9 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] ACM gadget: fix endianness in notifications Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: uss720: fix NULL-deref at probe Jiri Slaby
                   ` (40 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Samuel Thibault, Jiri Slaby

From: Samuel Thibault <samuel.thibault@ens-lyon.org>

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

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

commit 3243367b209faed5c320a4e5f9a565ee2a2ba958 upstream.

Some USB 2.0 devices erroneously report millisecond values in
bInterval. The generic config code manages to catch most of them,
but in some cases it's not completely enough.

The case at stake here is a USB 2.0 braille device, which wants to
announce 10ms and thus sets bInterval to 10, but with the USB 2.0
computation that yields to 64ms.  It happens that one can type fast
enough to reach this interval and get the device buffers overflown,
leading to problematic latencies.  The generic config code does not
catch this case because the 64ms is considered a sane enough value.

This change thus adds a USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL quirk
to mark devices which actually report milliseconds in bInterval,
and marks Vario Ultra devices as needing it.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/config.c  | 10 ++++++++++
 drivers/usb/core/quirks.c  |  8 ++++++++
 include/linux/usb/quirks.h |  6 ++++++
 3 files changed, 24 insertions(+)

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 15b39065f1dc..ee8e42064d25 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -248,6 +248,16 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, int inum,
 
 			/*
 			 * Adjust bInterval for quirked devices.
+			 */
+			/*
+			 * This quirk fixes bIntervals reported in ms.
+			 */
+			if (to_usb_device(ddev)->quirks &
+				USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL) {
+				n = clamp(fls(d->bInterval) + 3, i, j);
+				i = j = n;
+			}
+			/*
 			 * This quirk fixes bIntervals reported in
 			 * linear microframes.
 			 */
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index 094fe92ac21f..f792e6bea6b4 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -164,6 +164,14 @@ static const struct usb_device_id usb_quirk_list[] = {
 	/* M-Systems Flash Disk Pioneers */
 	{ USB_DEVICE(0x08ec, 0x1000), .driver_info = USB_QUIRK_RESET_RESUME },
 
+	/* Baum Vario Ultra */
+	{ USB_DEVICE(0x0904, 0x6101), .driver_info =
+			USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
+	{ USB_DEVICE(0x0904, 0x6102), .driver_info =
+			USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
+	{ USB_DEVICE(0x0904, 0x6103), .driver_info =
+			USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL },
+
 	/* Keytouch QWERTY Panel keyboard */
 	{ USB_DEVICE(0x0926, 0x3333), .driver_info =
 			USB_QUIRK_CONFIG_INTF_STRINGS },
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h
index 7eb814c60b5d..24872fc86962 100644
--- a/include/linux/usb/quirks.h
+++ b/include/linux/usb/quirks.h
@@ -50,4 +50,10 @@
 /* device can't handle Link Power Management */
 #define USB_QUIRK_NO_LPM			BIT(10)
 
+/*
+ * Device reports its bInterval as linear frames instead of the
+ * USB 2.0 calculation.
+ */
+#define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL	BIT(11)
+
 #endif /* __LINUX_USB_QUIRKS_H */
-- 
2.12.2

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

* [patch added to 3.12-stable] USB: uss720: fix NULL-deref at probe
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (10 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: idmouse: " Jiri Slaby
                   ` (39 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit f259ca3eed6e4b79ac3d5c5c9fb259fb46e86217 upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory beyond the endpoint array should a
malicious device lack the expected endpoints.

Note that the endpoint access that causes the NULL-deref is currently
only used for debugging purposes during probe so the oops only happens
when dynamic debugging is enabled. This means the driver could be
rewritten to continue to accept device with only two endpoints, should
such devices exist.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/misc/uss720.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c
index 40ef40affe83..3cb05eb5f1df 100644
--- a/drivers/usb/misc/uss720.c
+++ b/drivers/usb/misc/uss720.c
@@ -715,6 +715,11 @@ static int uss720_probe(struct usb_interface *intf,
 
 	interface = intf->cur_altsetting;
 
+	if (interface->desc.bNumEndpoints < 3) {
+		usb_put_dev(usbdev);
+		return -ENODEV;
+	}
+
 	/*
 	 * Allocate parport interface 
 	 */
-- 
2.12.2

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

* [patch added to 3.12-stable] USB: idmouse: fix NULL-deref at probe
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (11 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: uss720: fix NULL-deref at probe Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: wusbcore: " Jiri Slaby
                   ` (38 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit b0addd3fa6bcd119be9428996d5d4522479ab240 upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/misc/idmouse.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
index ce978384fda1..3b885c61b73e 100644
--- a/drivers/usb/misc/idmouse.c
+++ b/drivers/usb/misc/idmouse.c
@@ -347,6 +347,9 @@ static int idmouse_probe(struct usb_interface *interface,
 	if (iface_desc->desc.bInterfaceClass != 0x0A)
 		return -ENODEV;
 
+	if (iface_desc->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	/* allocate memory for our device state and initialize it */
 	dev = kzalloc(sizeof(*dev), GFP_KERNEL);
 	if (dev == NULL)
-- 
2.12.2

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

* [patch added to 3.12-stable] USB: wusbcore: fix NULL-deref at probe
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (12 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: idmouse: " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] usb: hub: Fix crash after failure to read BOS descriptor Jiri Slaby
                   ` (37 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Inaky Perez-Gonzalez, David Vrabel, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 03ace948a4eb89d1cf51c06afdfc41ebca5fdb27 upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer or accessing memory beyond the endpoint array should a
malicious device lack the expected endpoints.

This specifically fixes the NULL-pointer dereference when probing HWA HC
devices.

Fixes: df3654236e31 ("wusb: add the Wire Adapter (WA) core")
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/wusbcore/wa-hc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/wusbcore/wa-hc.c b/drivers/usb/wusbcore/wa-hc.c
index a09b65ebd9bb..2bb0fd3f3423 100644
--- a/drivers/usb/wusbcore/wa-hc.c
+++ b/drivers/usb/wusbcore/wa-hc.c
@@ -38,6 +38,9 @@ int wa_create(struct wahc *wa, struct usb_interface *iface)
 	int result;
 	struct device *dev = &iface->dev;
 
+	if (iface->cur_altsetting->desc.bNumEndpoints < 3)
+		return -ENODEV;
+
 	result = wa_rpipes_create(wa);
 	if (result < 0)
 		goto error_rpipes_create;
-- 
2.12.2

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

* [patch added to 3.12-stable] usb: hub: Fix crash after failure to read BOS descriptor
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (13 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] USB: wusbcore: " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] uwb: i1480-dfu: fix NULL-deref at probe Jiri Slaby
                   ` (36 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Guenter Roeck, Mathias Nyman, Jiri Slaby

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

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

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

commit 7b2db29fbb4e766fcd02207eb2e2087170bd6ebc upstream.

If usb_get_bos_descriptor() returns an error, usb->bos will be NULL.
Nevertheless, it is dereferenced unconditionally in
hub_set_initial_usb2_lpm_policy() if usb2_hw_lpm_capable is set.
This results in a crash.

usb 5-1: unable to get BOS descriptor
...
Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = ffffffc00165f000
[00000008] *pgd=000000000174f003, *pud=000000000174f003,
		*pmd=0000000001750003, *pte=00e8000001751713
Internal error: Oops: 96000005 [#1] PREEMPT SMP
Modules linked in: uinput uvcvideo videobuf2_vmalloc cmac [ ... ]
CPU: 5 PID: 3353 Comm: kworker/5:3 Tainted: G    B 4.4.52 #480
Hardware name: Google Kevin (DT)
Workqueue: events driver_set_config_work
task: ffffffc0c3690000 ti: ffffffc0ae9a8000 task.ti: ffffffc0ae9a8000
PC is at hub_port_init+0xc3c/0xd10
LR is at hub_port_init+0xc3c/0xd10
...
Call trace:
[<ffffffc0007fbbfc>] hub_port_init+0xc3c/0xd10
[<ffffffc0007fbe2c>] usb_reset_and_verify_device+0x15c/0x82c
[<ffffffc0007fc5e0>] usb_reset_device+0xe4/0x298
[<ffffffbffc0e3fcc>] rtl8152_probe+0x84/0x9b0 [r8152]
[<ffffffc00080ca8c>] usb_probe_interface+0x244/0x2f8
[<ffffffc000774a24>] driver_probe_device+0x180/0x3b4
[<ffffffc000774e48>] __device_attach_driver+0xb4/0xe0
[<ffffffc000772168>] bus_for_each_drv+0xb4/0xe4
[<ffffffc0007747ec>] __device_attach+0xd0/0x158
[<ffffffc000775080>] device_initial_probe+0x24/0x30
[<ffffffc0007739d4>] bus_probe_device+0x50/0xe4
[<ffffffc000770bd0>] device_add+0x414/0x738
[<ffffffc000809fe8>] usb_set_configuration+0x89c/0x914
[<ffffffc00080a120>] driver_set_config_work+0xc0/0xf0
[<ffffffc000249bb8>] process_one_work+0x390/0x6b8
[<ffffffc00024abcc>] worker_thread+0x480/0x610
[<ffffffc000251a80>] kthread+0x164/0x178
[<ffffffc0002045d0>] ret_from_fork+0x10/0x40

Since we don't know anything about LPM capabilities without BOS descriptor,
don't attempt to enable LPM if it is not available.

Fixes: 890dae886721 ("xhci: Enable LPM support only for hardwired ...")
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/hub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 770cea7de0ec..53aa23dee140 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -4004,7 +4004,7 @@ static void hub_set_initial_usb2_lpm_policy(struct usb_device *udev)
 {
 	int connect_type;
 
-	if (!udev->usb2_hw_lpm_capable)
+	if (!udev->usb2_hw_lpm_capable || !udev->bos)
 		return;
 
 	connect_type = usb_get_hub_port_connect_type(udev->parent,
-- 
2.12.2

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

* [patch added to 3.12-stable] uwb: i1480-dfu: fix NULL-deref at probe
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (14 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] usb: hub: Fix crash after failure to read BOS descriptor Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] uwb: hwa-rc: " Jiri Slaby
                   ` (35 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Inaky Perez-Gonzalez, David Vrabel, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 4ce362711d78a4999011add3115b8f4b0bc25e8c upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Note that the dereference happens in the cmd and wait_init_done
callbacks which are called during probe.

Fixes: 1ba47da52712 ("uwb: add the i1480 DFU driver")
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/uwb/i1480/dfu/usb.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/uwb/i1480/dfu/usb.c b/drivers/uwb/i1480/dfu/usb.c
index 2bfc846ac071..6345e85822a4 100644
--- a/drivers/uwb/i1480/dfu/usb.c
+++ b/drivers/uwb/i1480/dfu/usb.c
@@ -362,6 +362,9 @@ int i1480_usb_probe(struct usb_interface *iface, const struct usb_device_id *id)
 				 result);
 	}
 
+	if (iface->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	result = -ENOMEM;
 	i1480_usb = kzalloc(sizeof(*i1480_usb), GFP_KERNEL);
 	if (i1480_usb == NULL) {
-- 
2.12.2

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

* [patch added to 3.12-stable] uwb: hwa-rc: fix NULL-deref at probe
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (15 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] uwb: i1480-dfu: fix NULL-deref at probe Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] mmc: ushc: " Jiri Slaby
                   ` (34 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Inaky Perez-Gonzalez, David Vrabel, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit daf229b15907fbfdb6ee183aac8ca428cb57e361 upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Note that the dereference happens in the start callback which is called
during probe.

Fixes: de520b8bd552 ("uwb: add HWA radio controller driver")
Cc: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/uwb/hwa-rc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/uwb/hwa-rc.c b/drivers/uwb/hwa-rc.c
index 0257f35cfb9d..e75bbe5a10cd 100644
--- a/drivers/uwb/hwa-rc.c
+++ b/drivers/uwb/hwa-rc.c
@@ -825,6 +825,9 @@ static int hwarc_probe(struct usb_interface *iface,
 	struct hwarc *hwarc;
 	struct device *dev = &iface->dev;
 
+	if (iface->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	result = -ENOMEM;
 	uwb_rc = uwb_rc_alloc();
 	if (uwb_rc == NULL) {
-- 
2.12.2

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

* [patch added to 3.12-stable] mmc: ushc: fix NULL-deref at probe
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (16 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] uwb: hwa-rc: " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] ext4: mark inode dirty after converting inline directory Jiri Slaby
                   ` (33 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, David Vrabel, Ulf Hansson, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 181302dc7239add8ab1449c23ecab193f52ee6ab upstream.

Make sure to check the number of endpoints to avoid dereferencing a
NULL-pointer should a malicious device lack endpoints.

Fixes: 53f3a9e26ed5 ("mmc: USB SD Host Controller (USHC) driver")
Cc: David Vrabel <david.vrabel@csr.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mmc/host/ushc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/host/ushc.c b/drivers/mmc/host/ushc.c
index c0105a2e269a..d5493a5a7e7c 100644
--- a/drivers/mmc/host/ushc.c
+++ b/drivers/mmc/host/ushc.c
@@ -426,6 +426,9 @@ static int ushc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	struct ushc_data *ushc;
 	int ret;
 
+	if (intf->cur_altsetting->desc.bNumEndpoints < 1)
+		return -ENODEV;
+
 	mmc = mmc_alloc_host(sizeof(struct ushc_data), &intf->dev);
 	if (mmc == NULL)
 		return -ENOMEM;
-- 
2.12.2

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

* [patch added to 3.12-stable] ext4: mark inode dirty after converting inline directory
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (17 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] mmc: ushc: " Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] mmc: sdhci: Do not disable interrupts while waiting for clock Jiri Slaby
                   ` (32 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Eric Biggers, Theodore Ts'o, Jiri Slaby

From: Eric Biggers <ebiggers@google.com>

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

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

commit b9cf625d6ecde0d372e23ae022feead72b4228a6 upstream.

If ext4_convert_inline_data() was called on a directory with inline
data, the filesystem was left in an inconsistent state (as considered by
e2fsck) because the file size was not increased to cover the new block.
This happened because the inode was not marked dirty after i_disksize
was updated.  Fix this by marking the inode dirty at the end of
ext4_finish_convert_inline_dir().

This bug was probably not noticed before because most users mark the
inode dirty afterwards for other reasons.  But if userspace executed
FS_IOC_SET_ENCRYPTION_POLICY with invalid parameters, as exercised by
'kvm-xfstests -c adv generic/396', then the inode was never marked dirty
after updating i_disksize.

Fixes: 3c47d54170b6a678875566b1b8d6dcf57904e49b
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/inline.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index a4d6e9a953f9..af053f3105b8 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -1146,10 +1146,9 @@ static int ext4_finish_convert_inline_dir(handle_t *handle,
 	set_buffer_uptodate(dir_block);
 	err = ext4_handle_dirty_dirent_node(handle, inode, dir_block);
 	if (err)
-		goto out;
+		return err;
 	set_buffer_verified(dir_block);
-out:
-	return err;
+	return ext4_mark_inode_dirty(handle, inode);
 }
 
 static int ext4_convert_inline_data_nolock(handle_t *handle,
-- 
2.12.2

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

* [patch added to 3.12-stable] mmc: sdhci: Do not disable interrupts while waiting for clock
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (18 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] ext4: mark inode dirty after converting inline directory Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:58 ` [patch added to 3.12-stable] nl80211: fix dumpit error path RTNL deadlocks Jiri Slaby
                   ` (31 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Adrian Hunter, Ulf Hansson, Jiri Slaby

From: Adrian Hunter <adrian.hunter@intel.com>

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

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

commit e2ebfb2142acefecc2496e71360f50d25726040b upstream.

Disabling interrupts for even a millisecond can cause problems for some
devices. That can happen when sdhci changes clock frequency because it
waits for the clock to become stable under a spin lock.

The spin lock is not necessary here. Anything that is racing with changes
to the I/O state is already broken. The mmc core already provides
synchronization via "claiming" the host.

Although the spin lock probably should be removed from the code paths that
lead to this point, such a patch would touch too much code to be suitable
for stable trees. Consequently, for this patch, just drop the spin lock
while waiting.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Tested-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mmc/host/sdhci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 4e697ea67ae2..c3070ab2a05c 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1232,7 +1232,9 @@ clock_set:
 			return;
 		}
 		timeout--;
-		mdelay(1);
+		spin_unlock_irq(&host->lock);
+		usleep_range(900, 1100);
+		spin_lock_irq(&host->lock);
 	}
 
 	clk |= SDHCI_CLOCK_CARD_EN;
-- 
2.12.2

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

* [patch added to 3.12-stable] nl80211: fix dumpit error path RTNL deadlocks
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (19 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] mmc: sdhci: Do not disable interrupts while waiting for clock Jiri Slaby
@ 2017-04-10 12:58 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] USB: usbtmc: add missing endpoint sanity check Jiri Slaby
                   ` (30 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:58 UTC (permalink / raw)
  To: stable; +Cc: Johannes Berg, Jiri Slaby

From: Johannes Berg <johannes.berg@intel.com>

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

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

commit ea90e0dc8cecba6359b481e24d9c37160f6f524f upstream.

Sowmini pointed out Dmitry's RTNL deadlock report to me, and it turns out
to be perfectly accurate - there are various error paths that miss unlock
of the RTNL.

To fix those, change the locking a bit to not be conditional in all those
nl80211_prepare_*_dump() functions, but make those require the RTNL to
start with, and fix the buggy error paths. This also let me use sparse
(by appropriately overriding the rtnl_lock/rtnl_unlock functions) to
validate the changes.

[js] no mpp and vendor dumps in 3.12 yet

Reported-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/wireless/nl80211.c | 52 ++++++++++++++++++++------------------------------
 1 file changed, 21 insertions(+), 31 deletions(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index cda142009426..bb03e47bf887 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -438,21 +438,17 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
 {
 	int err;
 
-	rtnl_lock();
-
 	if (!cb->args[0]) {
 		err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
 				  nl80211_fam.attrbuf, nl80211_fam.maxattr,
 				  nl80211_policy);
 		if (err)
-			goto out_unlock;
+			return err;
 
 		*wdev = __cfg80211_wdev_from_attrs(sock_net(skb->sk),
 						   nl80211_fam.attrbuf);
-		if (IS_ERR(*wdev)) {
-			err = PTR_ERR(*wdev);
-			goto out_unlock;
-		}
+		if (IS_ERR(*wdev))
+			return PTR_ERR(*wdev);
 		*rdev = wiphy_to_dev((*wdev)->wiphy);
 		/* 0 is the first index - add 1 to parse only once */
 		cb->args[0] = (*rdev)->wiphy_idx + 1;
@@ -462,10 +458,8 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
 		struct wiphy *wiphy = wiphy_idx_to_wiphy(cb->args[0] - 1);
 		struct wireless_dev *tmp;
 
-		if (!wiphy) {
-			err = -ENODEV;
-			goto out_unlock;
-		}
+		if (!wiphy)
+			return -ENODEV;
 		*rdev = wiphy_to_dev(wiphy);
 		*wdev = NULL;
 
@@ -476,21 +470,11 @@ static int nl80211_prepare_wdev_dump(struct sk_buff *skb,
 			}
 		}
 
-		if (!*wdev) {
-			err = -ENODEV;
-			goto out_unlock;
-		}
+		if (!*wdev)
+			return -ENODEV;
 	}
 
 	return 0;
- out_unlock:
-	rtnl_unlock();
-	return err;
-}
-
-static void nl80211_finish_wdev_dump(struct cfg80211_registered_device *rdev)
-{
-	rtnl_unlock();
 }
 
 /* IE validation */
@@ -3607,9 +3591,10 @@ static int nl80211_dump_station(struct sk_buff *skb,
 	int sta_idx = cb->args[2];
 	int err;
 
+	rtnl_lock();
 	err = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev);
 	if (err)
-		return err;
+		goto out_err;
 
 	if (!wdev->netdev) {
 		err = -EINVAL;
@@ -3645,7 +3630,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
 	cb->args[2] = sta_idx;
 	err = skb->len;
  out_err:
-	nl80211_finish_wdev_dump(dev);
+	rtnl_unlock();
 
 	return err;
 }
@@ -4273,9 +4258,10 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
 	int path_idx = cb->args[2];
 	int err;
 
+	rtnl_lock();
 	err = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev);
 	if (err)
-		return err;
+		goto out_err;
 
 	if (!dev->ops->dump_mpath) {
 		err = -EOPNOTSUPP;
@@ -4309,7 +4295,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
 	cb->args[2] = path_idx;
 	err = skb->len;
  out_err:
-	nl80211_finish_wdev_dump(dev);
+	rtnl_unlock();
 	return err;
 }
 
@@ -5853,9 +5839,12 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb)
 	int start = cb->args[2], idx = 0;
 	int err;
 
+	rtnl_lock();
 	err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
-	if (err)
+	if (err) {
+		rtnl_unlock();
 		return err;
+	}
 
 	wdev_lock(wdev);
 	spin_lock_bh(&rdev->bss_lock);
@@ -5878,7 +5867,7 @@ static int nl80211_dump_scan(struct sk_buff *skb, struct netlink_callback *cb)
 	wdev_unlock(wdev);
 
 	cb->args[2] = idx;
-	nl80211_finish_wdev_dump(rdev);
+	rtnl_unlock();
 
 	return skb->len;
 }
@@ -5951,9 +5940,10 @@ static int nl80211_dump_survey(struct sk_buff *skb,
 	int survey_idx = cb->args[2];
 	int res;
 
+	rtnl_lock();
 	res = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev);
 	if (res)
-		return res;
+		goto out_err;
 
 	if (!wdev->netdev) {
 		res = -EINVAL;
@@ -5999,7 +5989,7 @@ static int nl80211_dump_survey(struct sk_buff *skb,
 	cb->args[2] = survey_idx;
 	res = skb->len;
  out_err:
-	nl80211_finish_wdev_dump(dev);
+	rtnl_unlock();
 	return res;
 }
 
-- 
2.12.2

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

* [patch added to 3.12-stable] USB: usbtmc: add missing endpoint sanity check
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (20 preceding siblings ...)
  2017-04-10 12:58 ` [patch added to 3.12-stable] nl80211: fix dumpit error path RTNL deadlocks Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] xfs: clear _XBF_PAGES from buffers when readahead page Jiri Slaby
                   ` (29 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 687e0687f71ec00e0132a21fef802dee88c2f1ad upstream.

USBTMC devices are required to have a bulk-in and a bulk-out endpoint,
but the driver failed to verify this, something which could lead to the
endpoint addresses being taken from uninitialised memory.

Make sure to zero all private data as part of allocation, and add the
missing endpoint sanity check.

Note that this also addresses a more recently introduced issue, where
the interrupt-in-presence flag would also be uninitialised whenever the
optional interrupt-in endpoint is not present. This in turn could lead
to an interrupt urb being allocated, initialised and submitted based on
uninitialised values.

Fixes: dbf3e7f654c0 ("Implement an ioctl to support the USMTMC-USB488 READ_STATUS_BYTE operation.")
Fixes: 5b775f672cc9 ("USB: add USB test and measurement class driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
[ johan: backport to v4.4 ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/class/usbtmc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
index 72ed4ac2cfad..13583a2edba7 100644
--- a/drivers/usb/class/usbtmc.c
+++ b/drivers/usb/class/usbtmc.c
@@ -1102,7 +1102,7 @@ static int usbtmc_probe(struct usb_interface *intf,
 
 	dev_dbg(&intf->dev, "%s called\n", __func__);
 
-	data = kmalloc(sizeof(*data), GFP_KERNEL);
+	data = kzalloc(sizeof(*data), GFP_KERNEL);
 	if (!data) {
 		dev_err(&intf->dev, "Unable to allocate kernel memory\n");
 		return -ENOMEM;
@@ -1162,6 +1162,12 @@ static int usbtmc_probe(struct usb_interface *intf,
 		}
 	}
 
+	if (!data->bulk_out || !data->bulk_in) {
+		dev_err(&intf->dev, "bulk endpoints not found\n");
+		retcode = -ENODEV;
+		goto err_put;
+	}
+
 	retcode = get_capabilities(data);
 	if (retcode)
 		dev_err(&intf->dev, "can't read capabilities\n");
@@ -1185,6 +1191,7 @@ static int usbtmc_probe(struct usb_interface *intf,
 error_register:
 	sysfs_remove_group(&intf->dev.kobj, &capability_attr_grp);
 	sysfs_remove_group(&intf->dev.kobj, &data_attr_grp);
+err_put:
 	kref_put(&data->kref, usbtmc_delete);
 	return retcode;
 }
-- 
2.12.2

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

* [patch added to 3.12-stable] xfs: clear _XBF_PAGES from buffers when readahead page
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (21 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] USB: usbtmc: add missing endpoint sanity check Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] block: allow WRITE_SAME commands with the SG_IO ioctl Jiri Slaby
                   ` (28 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Darrick J. Wong, Ivan Kozik, Jiri Slaby

From: "Darrick J. Wong" <darrick.wong@oracle.com>

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

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

commit 2aa6ba7b5ad3189cc27f14540aa2f57f0ed8df4b upstream.

If we try to allocate memory pages to back an xfs_buf that we're trying
to read, it's possible that we'll be so short on memory that the page
allocation fails.  For a blocking read we'll just wait, but for
readahead we simply dump all the pages we've collected so far.

Unfortunately, after dumping the pages we neglect to clear the
_XBF_PAGES state, which means that the subsequent call to xfs_buf_free
thinks that b_pages still points to pages we own.  It then double-frees
the b_pages pages.

This results in screaming about negative page refcounts from the memory
manager, which xfs oughtn't be triggering.  To reproduce this case,
mount a filesystem where the size of the inodes far outweighs the
availalble memory (a ~500M inode filesystem on a VM with 300MB memory
did the trick here) and run bulkstat in parallel with other memory
eating processes to put a huge load on the system.  The "check summary"
phase of xfs_scrub also works for this purpose.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Cc: Ivan Kozik <ivan@ludios.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/xfs/xfs_buf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
index c4a4ad0cd33e..e99655a1b372 100644
--- a/fs/xfs/xfs_buf.c
+++ b/fs/xfs/xfs_buf.c
@@ -376,6 +376,7 @@ retry:
 out_free_pages:
 	for (i = 0; i < bp->b_page_count; i++)
 		__free_page(bp->b_pages[i]);
+	bp->b_flags &= ~_XBF_PAGES;
 	return error;
 }
 
-- 
2.12.2

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

* [patch added to 3.12-stable] block: allow WRITE_SAME commands with the SG_IO ioctl
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (22 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] xfs: clear _XBF_PAGES from buffers when readahead page Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] uvcvideo: uvc_scan_fallback() for webcams with broken chain Jiri Slaby
                   ` (27 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable
  Cc: Sumit Semwal, Mauricio Faria de Oliveira, Brahadambal Srinivasan,
	Jens Axboe, Sasha Levin, Greg Kroah-Hartman, Jiri Slaby

From: Sumit Semwal <sumit.semwal@linaro.org>

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

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

From: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>

[ Upstream commit 25cdb64510644f3e854d502d69c73f21c6df88a9 ]

The WRITE_SAME commands are not present in the blk_default_cmd_filter
write_ok list, and thus are failed with -EPERM when the SG_IO ioctl()
is executed without CAP_SYS_RAWIO capability (e.g., unprivileged users).
[ sg_io() -> blk_fill_sghdr_rq() > blk_verify_command() -> -EPERM ]

The problem can be reproduced with the sg_write_same command

  # sg_write_same --num 1 --xferlen 512 /dev/sda
  #

  # capsh --drop=cap_sys_rawio -- -c \
    'sg_write_same --num 1 --xferlen 512 /dev/sda'
    Write same: pass through os error: Operation not permitted
  #

For comparison, the WRITE_VERIFY command does not observe this problem,
since it is in that list:

  # capsh --drop=cap_sys_rawio -- -c \
    'sg_write_verify --num 1 --ilen 512 --lba 0 /dev/sda'
  #

So, this patch adds the WRITE_SAME commands to the list, in order
for the SG_IO ioctl to finish successfully:

  # capsh --drop=cap_sys_rawio -- -c \
    'sg_write_same --num 1 --xferlen 512 /dev/sda'
  #

That case happens to be exercised by QEMU KVM guests with 'scsi-block' devices
(qemu "-device scsi-block" [1], libvirt "<disk type='block' device='lun'>" [2]),
which employs the SG_IO ioctl() and runs as an unprivileged user (libvirt-qemu).

In that scenario, when a filesystem (e.g., ext4) performs its zero-out calls,
which are translated to write-same calls in the guest kernel, and then into
SG_IO ioctls to the host kernel, SCSI I/O errors may be observed in the guest:

  [...] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
  [...] sd 0:0:0:0: [sda] tag#0 Sense Key : Aborted Command [current]
  [...] sd 0:0:0:0: [sda] tag#0 Add. Sense: I/O process terminated
  [...] sd 0:0:0:0: [sda] tag#0 CDB: Write Same(10) 41 00 01 04 e0 78 00 00 08 00
  [...] blk_update_request: I/O error, dev sda, sector 17096824

Links:
[1] http://git.qemu.org/?p=qemu.git;a=commit;h=336a6915bc7089fb20fea4ba99972ad9a97c5f52
[2] https://libvirt.org/formatdomain.html#elementsDisks (see 'disk' -> 'device')

Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Signed-off-by: Brahadambal Srinivasan <latha@linux.vnet.ibm.com>
Reported-by: Manjunatha H R <manjuhr1@in.ibm.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 block/scsi_ioctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 1b4988b4bc11..9bfbb51aa75e 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -175,6 +175,9 @@ static void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter)
 	__set_bit(WRITE_16, filter->write_ok);
 	__set_bit(WRITE_LONG, filter->write_ok);
 	__set_bit(WRITE_LONG_2, filter->write_ok);
+	__set_bit(WRITE_SAME, filter->write_ok);
+	__set_bit(WRITE_SAME_16, filter->write_ok);
+	__set_bit(WRITE_SAME_32, filter->write_ok);
 	__set_bit(ERASE, filter->write_ok);
 	__set_bit(GPCMD_MODE_SELECT_10, filter->write_ok);
 	__set_bit(MODE_SELECT, filter->write_ok);
-- 
2.12.2

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

* [patch added to 3.12-stable] uvcvideo: uvc_scan_fallback() for webcams with broken chain
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (23 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] block: allow WRITE_SAME commands with the SG_IO ioctl Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] fbcon: Fix vc attr at deinit Jiri Slaby
                   ` (26 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable
  Cc: Sumit Semwal, Henrik Ingo, Laurent Pinchart,
	Mauro Carvalho Chehab, Sasha Levin, Greg Kroah-Hartman,
	Jiri Slaby

From: Sumit Semwal <sumit.semwal@linaro.org>

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

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

From: Henrik Ingo <henrik.ingo@avoinelama.fi>

[ Upstream commit e950267ab802c8558f1100eafd4087fd039ad634 ]

Some devices have invalid baSourceID references, causing uvc_scan_chain()
to fail, but if we just take the entities we can find and put them
together in the most sensible chain we can think of, turns out they do
work anyway. Note: This heuristic assumes there is a single chain.

At the time of writing, devices known to have such a broken chain are
  - Acer Integrated Camera (5986:055a)
  - Realtek rtl157a7 (0bda:57a7)

Signed-off-by: Henrik Ingo <henrik.ingo@avoinelama.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/media/usb/uvc/uvc_driver.c | 118 +++++++++++++++++++++++++++++++++++--
 1 file changed, 112 insertions(+), 6 deletions(-)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 45314412b4a3..f47d1885b0d4 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1533,6 +1533,114 @@ static const char *uvc_print_chain(struct uvc_video_chain *chain)
 	return buffer;
 }
 
+static struct uvc_video_chain *uvc_alloc_chain(struct uvc_device *dev)
+{
+	struct uvc_video_chain *chain;
+
+	chain = kzalloc(sizeof(*chain), GFP_KERNEL);
+	if (chain == NULL)
+		return NULL;
+
+	INIT_LIST_HEAD(&chain->entities);
+	mutex_init(&chain->ctrl_mutex);
+	chain->dev = dev;
+	v4l2_prio_init(&chain->prio);
+
+	return chain;
+}
+
+/*
+ * Fallback heuristic for devices that don't connect units and terminals in a
+ * valid chain.
+ *
+ * Some devices have invalid baSourceID references, causing uvc_scan_chain()
+ * to fail, but if we just take the entities we can find and put them together
+ * in the most sensible chain we can think of, turns out they do work anyway.
+ * Note: This heuristic assumes there is a single chain.
+ *
+ * At the time of writing, devices known to have such a broken chain are
+ *  - Acer Integrated Camera (5986:055a)
+ *  - Realtek rtl157a7 (0bda:57a7)
+ */
+static int uvc_scan_fallback(struct uvc_device *dev)
+{
+	struct uvc_video_chain *chain;
+	struct uvc_entity *iterm = NULL;
+	struct uvc_entity *oterm = NULL;
+	struct uvc_entity *entity;
+	struct uvc_entity *prev;
+
+	/*
+	 * Start by locating the input and output terminals. We only support
+	 * devices with exactly one of each for now.
+	 */
+	list_for_each_entry(entity, &dev->entities, list) {
+		if (UVC_ENTITY_IS_ITERM(entity)) {
+			if (iterm)
+				return -EINVAL;
+			iterm = entity;
+		}
+
+		if (UVC_ENTITY_IS_OTERM(entity)) {
+			if (oterm)
+				return -EINVAL;
+			oterm = entity;
+		}
+	}
+
+	if (iterm == NULL || oterm == NULL)
+		return -EINVAL;
+
+	/* Allocate the chain and fill it. */
+	chain = uvc_alloc_chain(dev);
+	if (chain == NULL)
+		return -ENOMEM;
+
+	if (uvc_scan_chain_entity(chain, oterm) < 0)
+		goto error;
+
+	prev = oterm;
+
+	/*
+	 * Add all Processing and Extension Units with two pads. The order
+	 * doesn't matter much, use reverse list traversal to connect units in
+	 * UVC descriptor order as we build the chain from output to input. This
+	 * leads to units appearing in the order meant by the manufacturer for
+	 * the cameras known to require this heuristic.
+	 */
+	list_for_each_entry_reverse(entity, &dev->entities, list) {
+		if (entity->type != UVC_VC_PROCESSING_UNIT &&
+		    entity->type != UVC_VC_EXTENSION_UNIT)
+			continue;
+
+		if (entity->num_pads != 2)
+			continue;
+
+		if (uvc_scan_chain_entity(chain, entity) < 0)
+			goto error;
+
+		prev->baSourceID[0] = entity->id;
+		prev = entity;
+	}
+
+	if (uvc_scan_chain_entity(chain, iterm) < 0)
+		goto error;
+
+	prev->baSourceID[0] = iterm->id;
+
+	list_add_tail(&chain->list, &dev->chains);
+
+	uvc_trace(UVC_TRACE_PROBE,
+		  "Found a video chain by fallback heuristic (%s).\n",
+		  uvc_print_chain(chain));
+
+	return 0;
+
+error:
+	kfree(chain);
+	return -EINVAL;
+}
+
 /*
  * Scan the device for video chains and register video devices.
  *
@@ -1555,15 +1663,10 @@ static int uvc_scan_device(struct uvc_device *dev)
 		if (term->chain.next || term->chain.prev)
 			continue;
 
-		chain = kzalloc(sizeof(*chain), GFP_KERNEL);
+		chain = uvc_alloc_chain(dev);
 		if (chain == NULL)
 			return -ENOMEM;
 
-		INIT_LIST_HEAD(&chain->entities);
-		mutex_init(&chain->ctrl_mutex);
-		chain->dev = dev;
-		v4l2_prio_init(&chain->prio);
-
 		term->flags |= UVC_ENTITY_FLAG_DEFAULT;
 
 		if (uvc_scan_chain(chain, term) < 0) {
@@ -1577,6 +1680,9 @@ static int uvc_scan_device(struct uvc_device *dev)
 		list_add_tail(&chain->list, &dev->chains);
 	}
 
+	if (list_empty(&dev->chains))
+		uvc_scan_fallback(dev);
+
 	if (list_empty(&dev->chains)) {
 		uvc_printk(KERN_INFO, "No valid video chain found.\n");
 		return -1;
-- 
2.12.2

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

* [patch added to 3.12-stable] fbcon: Fix vc attr at deinit
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (24 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] uvcvideo: uvc_scan_fallback() for webcams with broken chain Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] crypto: algif_hash - avoid zero-sized array Jiri Slaby
                   ` (25 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Takashi Iwai, Bartlomiej Zolnierkiewicz, Arnd Bergmann, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

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

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

commit 8aac7f34369726d1a158788ae8aff3002d5eb528 upstream.

fbcon can deal with vc_hi_font_mask (the upper 256 chars) and adjust
the vc attrs dynamically when vc_hi_font_mask is changed at
fbcon_init().  When the vc_hi_font_mask is set, it remaps the attrs in
the existing console buffer with one bit shift up (for 9 bits), while
it remaps with one bit shift down (for 8 bits) when the value is
cleared.  It works fine as long as the font gets updated after fbcon
was initialized.

However, we hit a bizarre problem when the console is switched to
another fb driver (typically from vesafb or efifb to drmfb).  At
switching to the new fb driver, we temporarily rebind the console to
the dummy console, then rebind to the new driver.  During the
switching, we leave the modified attrs as is.  Thus, the new fbcon
takes over the old buffer as if it were to contain 8 bits chars
(although the attrs are still shifted for 9 bits), and effectively
this results in the yellow color texts instead of the original white
color, as found in the bugzilla entry below.

An easy fix for this is to re-adjust the attrs before leaving the
fbcon at con_deinit callback.  Since the code to adjust the attrs is
already present in the current fbcon code, in this patch, we simply
factor out the relevant code, and call it from fbcon_deinit().

Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1000619
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/video/console/fbcon.c | 67 ++++++++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 27 deletions(-)

diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index 9297a9b967fc..3939493bd3b3 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -1168,6 +1168,8 @@ static void fbcon_free_font(struct display *p, bool freefont)
 	p->userfont = 0;
 }
 
+static void set_vc_hi_font(struct vc_data *vc, bool set);
+
 static void fbcon_deinit(struct vc_data *vc)
 {
 	struct display *p = &fb_display[vc->vc_num];
@@ -1203,6 +1205,9 @@ finished:
 	if (free_font)
 		vc->vc_font.data = NULL;
 
+	if (vc->vc_hi_font_mask)
+		set_vc_hi_font(vc, false);
+
 	if (!con_is_bound(&fb_con))
 		fbcon_exit();
 
@@ -2438,32 +2443,10 @@ static int fbcon_get_font(struct vc_data *vc, struct console_font *font)
 	return 0;
 }
 
-static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
-			     const u8 * data, int userfont)
+/* set/clear vc_hi_font_mask and update vc attrs accordingly */
+static void set_vc_hi_font(struct vc_data *vc, bool set)
 {
-	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
-	struct fbcon_ops *ops = info->fbcon_par;
-	struct display *p = &fb_display[vc->vc_num];
-	int resize;
-	int cnt;
-	char *old_data = NULL;
-
-	if (CON_IS_VISIBLE(vc) && softback_lines)
-		fbcon_set_origin(vc);
-
-	resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
-	if (p->userfont)
-		old_data = vc->vc_font.data;
-	if (userfont)
-		cnt = FNTCHARCNT(data);
-	else
-		cnt = 256;
-	vc->vc_font.data = (void *)(p->fontdata = data);
-	if ((p->userfont = userfont))
-		REFCOUNT(data)++;
-	vc->vc_font.width = w;
-	vc->vc_font.height = h;
-	if (vc->vc_hi_font_mask && cnt == 256) {
+	if (!set) {
 		vc->vc_hi_font_mask = 0;
 		if (vc->vc_can_do_color) {
 			vc->vc_complement_mask >>= 1;
@@ -2486,7 +2469,7 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
 			    ((c & 0xfe00) >> 1) | (c & 0xff);
 			vc->vc_attr >>= 1;
 		}
-	} else if (!vc->vc_hi_font_mask && cnt == 512) {
+	} else {
 		vc->vc_hi_font_mask = 0x100;
 		if (vc->vc_can_do_color) {
 			vc->vc_complement_mask <<= 1;
@@ -2518,8 +2501,38 @@ static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
 			} else
 				vc->vc_video_erase_char = c & ~0x100;
 		}
-
 	}
+}
+
+static int fbcon_do_set_font(struct vc_data *vc, int w, int h,
+			     const u8 * data, int userfont)
+{
+	struct fb_info *info = registered_fb[con2fb_map[vc->vc_num]];
+	struct fbcon_ops *ops = info->fbcon_par;
+	struct display *p = &fb_display[vc->vc_num];
+	int resize;
+	int cnt;
+	char *old_data = NULL;
+
+	if (CON_IS_VISIBLE(vc) && softback_lines)
+		fbcon_set_origin(vc);
+
+	resize = (w != vc->vc_font.width) || (h != vc->vc_font.height);
+	if (p->userfont)
+		old_data = vc->vc_font.data;
+	if (userfont)
+		cnt = FNTCHARCNT(data);
+	else
+		cnt = 256;
+	vc->vc_font.data = (void *)(p->fontdata = data);
+	if ((p->userfont = userfont))
+		REFCOUNT(data)++;
+	vc->vc_font.width = w;
+	vc->vc_font.height = h;
+	if (vc->vc_hi_font_mask && cnt == 256)
+		set_vc_hi_font(vc, false);
+	else if (!vc->vc_hi_font_mask && cnt == 512)
+		set_vc_hi_font(vc, true);
 
 	if (resize) {
 		int cols, rows;
-- 
2.12.2

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

* [patch added to 3.12-stable] crypto: algif_hash - avoid zero-sized array
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (25 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] fbcon: Fix vc attr at deinit Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window Jiri Slaby
                   ` (24 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Jiri Slaby, Herbert Xu, David S. Miller, Arnd Bergmann

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

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

commit 6207119444595d287b1e9e83a2066c17209698f3 upstream.

With this reproducer:
  struct sockaddr_alg alg = {
          .salg_family = 0x26,
          .salg_type = "hash",
          .salg_feat = 0xf,
          .salg_mask = 0x5,
          .salg_name = "digest_null",
  };
  int sock, sock2;

  sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
  bind(sock, (struct sockaddr *)&alg, sizeof(alg));
  sock2 = accept(sock, NULL, NULL);
  setsockopt(sock, SOL_ALG, ALG_SET_KEY, "\x9b\xca", 2);
  accept(sock2, NULL, NULL);

==== 8< ======== 8< ======== 8< ======== 8< ====

one can immediatelly see an UBSAN warning:
UBSAN: Undefined behaviour in crypto/algif_hash.c:187:7
variable length array bound value 0 <= 0
CPU: 0 PID: 15949 Comm: syz-executor Tainted: G            E      4.4.30-0-default #1
...
Call Trace:
...
 [<ffffffff81d598fd>] ? __ubsan_handle_vla_bound_not_positive+0x13d/0x188
 [<ffffffff81d597c0>] ? __ubsan_handle_out_of_bounds+0x1bc/0x1bc
 [<ffffffffa0e2204d>] ? hash_accept+0x5bd/0x7d0 [algif_hash]
 [<ffffffffa0e2293f>] ? hash_accept_nokey+0x3f/0x51 [algif_hash]
 [<ffffffffa0e206b0>] ? hash_accept_parent_nokey+0x4a0/0x4a0 [algif_hash]
 [<ffffffff8235c42b>] ? SyS_accept+0x2b/0x40

It is a correct warning, as hash state is propagated to accept as zero,
but creating a zero-length variable array is not allowed in C.

Fix this as proposed by Herbert -- do "?: 1" on that site. No sizeof or
similar happens in the code there, so we just allocate one byte even
though we do not use the array.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "David S. Miller" <davem@davemloft.net> (maintainer:CRYPTO API)
Reported-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 crypto/algif_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c
index b351127426db..2c4df1304922 100644
--- a/crypto/algif_hash.c
+++ b/crypto/algif_hash.c
@@ -195,7 +195,7 @@ static int hash_accept(struct socket *sock, struct socket *newsock, int flags)
 	struct alg_sock *ask = alg_sk(sk);
 	struct hash_ctx *ctx = ask->private;
 	struct ahash_request *req = &ctx->req;
-	char state[crypto_ahash_statesize(crypto_ahash_reqtfm(req))];
+	char state[crypto_ahash_statesize(crypto_ahash_reqtfm(req)) ? : 1];
 	struct sock *sk2;
 	struct alg_sock *ask2;
 	struct hash_ctx *ctx2;
-- 
2.12.2

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

* [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (26 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] crypto: algif_hash - avoid zero-sized array Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder Jiri Slaby
                   ` (23 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Andy Whitcroft, Linus Torvalds, Jiri Slaby

From: Andy Whitcroft <apw@canonical.com>

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

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

commit 677e806da4d916052585301785d847c3b3e6186a upstream.

When a new xfrm state is created during an XFRM_MSG_NEWSA call we
validate the user supplied replay_esn to ensure that the size is valid
and to ensure that the replay_window size is within the allocated
buffer.  However later it is possible to update this replay_esn via a
XFRM_MSG_NEWAE call.  There we again validate the size of the supplied
buffer matches the existing state and if so inject the contents.  We do
not at this point check that the replay_window is within the allocated
memory.  This leads to out-of-bounds reads and writes triggered by
netlink packets.  This leads to memory corruption and the potential for
priviledge escalation.

We already attempt to validate the incoming replay information in
xfrm_new_ae() via xfrm_replay_verify_len().  This confirms that the user
is not trying to change the size of the replay state buffer which
includes the replay_esn.  It however does not check the replay_window
remains within that buffer.  Add validation of the contained
replay_window.

CVE-2017-7184
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/xfrm/xfrm_user.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 32a2dd39b785..9a6bd448468d 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -393,6 +393,9 @@ static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_es
 	if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)
 		return -EINVAL;
 
+	if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)
+		return -EINVAL;
+
 	return 0;
 }
 
-- 
2.12.2

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

* [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (27 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] virtio_balloon: init 1st buffer in stats vq Jiri Slaby
                   ` (22 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Andy Whitcroft, Linus Torvalds, Jiri Slaby

From: Andy Whitcroft <apw@canonical.com>

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

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

commit f843ee6dd019bcece3e74e76ad9df0155655d0df upstream.

Kees Cook has pointed out that xfrm_replay_state_esn_len() is subject to
wrapping issues.  To ensure we are correctly ensuring that the two ESN
structures are the same size compare both the overall size as reported
by xfrm_replay_state_esn_len() and the internal length are the same.

CVE-2017-7184
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/xfrm/xfrm_user.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 9a6bd448468d..52fe9a77a1b1 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -390,7 +390,11 @@ static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_es
 	up = nla_data(rp);
 	ulen = xfrm_replay_state_esn_len(up);
 
-	if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen)
+	/* Check the overall length and the internal bitmap length to avoid
+	 * potential overflow. */
+	if (nla_len(rp) < ulen ||
+	    xfrm_replay_state_esn_len(replay_esn) != ulen ||
+	    replay_esn->bmp_len != up->bmp_len)
 		return -EINVAL;
 
 	if (up->replay_window > up->bmp_len * sizeof(__u32) * 8)
-- 
2.12.2

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

* [patch added to 3.12-stable] virtio_balloon: init 1st buffer in stats vq
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (28 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation Jiri Slaby
                   ` (21 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Ladi Prosek, Michael S . Tsirkin, Jiri Slaby

From: Ladi Prosek <lprosek@redhat.com>

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

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

commit fc8653228c8588a120f6b5dad6983b7b61ff669e upstream.

When init_vqs runs, virtio_balloon.stats is either uninitialized or
contains stale values. The host updates its state with garbage data
because it has no way of knowing that this is just a marker buffer
used for signaling.

This patch updates the stats before pushing the initial buffer.

Alternative fixes:
* Push an empty buffer in init_vqs. Not easily done with the current
  virtio implementation and violates the spec "Driver MUST supply the
  same subset of statistics in all buffers submitted to the statsq".
* Push a buffer with invalid tags in init_vqs. Violates the same
  spec clause, plus "invalid tag" is not really defined.

Note: the spec says:
	When using the legacy interface, the device SHOULD ignore all values in
	the first buffer in the statsq supplied by the driver after device
	initialization. Note: Historically, drivers supplied an uninitialized
	buffer in the first buffer.

Unfortunately QEMU does not seem to implement the recommendation
even for the legacy interface.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/virtio/virtio_balloon.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index d6fa59e447c5..0dc571a3cf65 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -350,6 +350,8 @@ static int init_vqs(struct virtio_balloon *vb)
 		 * Prime this virtqueue with one buffer so the hypervisor can
 		 * use it to signal us later.
 		 */
+		update_balloon_stats(vb);
+
 		sg_init_one(&sg, vb->stats, sizeof vb->stats);
 		if (virtqueue_add_outbuf(vb->stats_vq, &sg, 1, vb, GFP_KERNEL)
 		    < 0)
-- 
2.12.2

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

* [patch added to 3.12-stable] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (29 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] virtio_balloon: init 1st buffer in stats vq Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] sparc/ptrace: Preserve previous registers for short regset write Jiri Slaby
                   ` (20 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Dave Martin, Linus Torvalds, Jiri Slaby

From: Dave Martin <Dave.Martin@arm.com>

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

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

commit fb411b837b587a32046dc4f369acb93a10b1def8 upstream.

gpr_set won't work correctly and can never have been tested, and the
correct behaviour is not clear due to the endianness-dependent task
layout.

So, just remove it.  The core code will now return -EOPNOTSUPPORT when
trying to set NT_PRSTATUS on this architecture until/unless a correct
implementation is supplied.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/c6x/kernel/ptrace.c | 41 -----------------------------------------
 1 file changed, 41 deletions(-)

diff --git a/arch/c6x/kernel/ptrace.c b/arch/c6x/kernel/ptrace.c
index 3c494e84444d..a511ac16a8e3 100644
--- a/arch/c6x/kernel/ptrace.c
+++ b/arch/c6x/kernel/ptrace.c
@@ -69,46 +69,6 @@ static int gpr_get(struct task_struct *target,
 				   0, sizeof(*regs));
 }
 
-static int gpr_set(struct task_struct *target,
-		   const struct user_regset *regset,
-		   unsigned int pos, unsigned int count,
-		   const void *kbuf, const void __user *ubuf)
-{
-	int ret;
-	struct pt_regs *regs = task_pt_regs(target);
-
-	/* Don't copyin TSR or CSR */
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-				 &regs,
-				 0, PT_TSR * sizeof(long));
-	if (ret)
-		return ret;
-
-	ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-					PT_TSR * sizeof(long),
-					(PT_TSR + 1) * sizeof(long));
-	if (ret)
-		return ret;
-
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-				 &regs,
-				 (PT_TSR + 1) * sizeof(long),
-				 PT_CSR * sizeof(long));
-	if (ret)
-		return ret;
-
-	ret = user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-					PT_CSR * sizeof(long),
-					(PT_CSR + 1) * sizeof(long));
-	if (ret)
-		return ret;
-
-	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
-				 &regs,
-				 (PT_CSR + 1) * sizeof(long), -1);
-	return ret;
-}
-
 enum c6x_regset {
 	REGSET_GPR,
 };
@@ -120,7 +80,6 @@ static const struct user_regset c6x_regsets[] = {
 		.size = sizeof(u32),
 		.align = sizeof(u32),
 		.get = gpr_get,
-		.set = gpr_set
 	},
 };
 
-- 
2.12.2

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

* [patch added to 3.12-stable] sparc/ptrace: Preserve previous registers for short regset write
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (30 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: " Jiri Slaby
                   ` (19 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Dave Martin, Linus Torvalds, Jiri Slaby

From: Dave Martin <Dave.Martin@arm.com>

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

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

commit d3805c546b275c8cc7d40f759d029ae92c7175f2 upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the registers, the thread's old registers are preserved.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/sparc/kernel/ptrace_64.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c
index 773c1f2983ce..89297b7c6261 100644
--- a/arch/sparc/kernel/ptrace_64.c
+++ b/arch/sparc/kernel/ptrace_64.c
@@ -310,7 +310,7 @@ static int genregs64_set(struct task_struct *target,
 	}
 
 	if (!ret) {
-		unsigned long y;
+		unsigned long y = regs->y;
 
 		ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 					 &y,
-- 
2.12.2

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

* [patch added to 3.12-stable] metag/ptrace: Preserve previous registers for short regset write
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (31 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] sparc/ptrace: Preserve previous registers for short regset write Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS Jiri Slaby
                   ` (18 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Dave Martin, Linus Torvalds, Jiri Slaby

From: Dave Martin <Dave.Martin@arm.com>

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

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

commit a78ce80d2c9178351b34d78fec805140c29c193e upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill all the registers, the thread's old registers are preserved.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/metag/kernel/ptrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c
index 7563628822bd..ae659ba61948 100644
--- a/arch/metag/kernel/ptrace.c
+++ b/arch/metag/kernel/ptrace.c
@@ -303,7 +303,7 @@ static int metag_tls_set(struct task_struct *target,
 			const void *kbuf, const void __user *ubuf)
 {
 	int ret;
-	void __user *tls;
+	void __user *tls = target->thread.tls_ptr;
 
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1);
 	if (ret)
-- 
2.12.2

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

* [patch added to 3.12-stable] metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (32 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: " Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: Reject partial NT_METAG_RPIPE writes Jiri Slaby
                   ` (17 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Dave Martin, Linus Torvalds, Jiri Slaby

From: Dave Martin <Dave.Martin@arm.com>

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

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

commit 5fe81fe98123ce41265c65e95d34418d30d005d1 upstream.

Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET
to fill TXSTATUS, a well-defined default value is used, based on the
task's current value.

Suggested-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/metag/kernel/ptrace.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c
index ae659ba61948..2e4dfc15abd3 100644
--- a/arch/metag/kernel/ptrace.c
+++ b/arch/metag/kernel/ptrace.c
@@ -24,6 +24,16 @@
  * user_regset definitions.
  */
 
+static unsigned long user_txstatus(const struct pt_regs *regs)
+{
+	unsigned long data = (unsigned long)regs->ctx.Flags;
+
+	if (regs->ctx.SaveMask & TBICTX_CBUF_BIT)
+		data |= USER_GP_REGS_STATUS_CATCH_BIT;
+
+	return data;
+}
+
 int metag_gp_regs_copyout(const struct pt_regs *regs,
 			  unsigned int pos, unsigned int count,
 			  void *kbuf, void __user *ubuf)
@@ -62,9 +72,7 @@ int metag_gp_regs_copyout(const struct pt_regs *regs,
 	if (ret)
 		goto out;
 	/* TXSTATUS */
-	data = (unsigned long)regs->ctx.Flags;
-	if (regs->ctx.SaveMask & TBICTX_CBUF_BIT)
-		data |= USER_GP_REGS_STATUS_CATCH_BIT;
+	data = user_txstatus(regs);
 	ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 				  &data, 4*25, 4*26);
 	if (ret)
@@ -119,6 +127,7 @@ int metag_gp_regs_copyin(struct pt_regs *regs,
 	if (ret)
 		goto out;
 	/* TXSTATUS */
+	data = user_txstatus(regs);
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				 &data, 4*25, 4*26);
 	if (ret)
-- 
2.12.2

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

* [patch added to 3.12-stable] metag/ptrace: Reject partial NT_METAG_RPIPE writes
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (33 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] sched/rt: Add a missing rescheduling point Jiri Slaby
                   ` (16 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Dave Martin, Linus Torvalds, Jiri Slaby

From: Dave Martin <Dave.Martin@arm.com>

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

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

commit 7195ee3120d878259e8d94a5d9f808116f34d5ea upstream.

It's not clear what behaviour is sensible when doing partial write of
NT_METAG_RPIPE, so just don't bother.

This patch assumes that userspace will never rely on a partial SETREGSET
in this case, since it's not clear what should happen anyway.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Acked-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/metag/kernel/ptrace.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c
index 2e4dfc15abd3..5e2dc7defd2c 100644
--- a/arch/metag/kernel/ptrace.c
+++ b/arch/metag/kernel/ptrace.c
@@ -253,6 +253,8 @@ int metag_rp_state_copyin(struct pt_regs *regs,
 	unsigned long long *ptr;
 	int ret, i;
 
+	if (count < 4*13)
+		return -EINVAL;
 	/* Read the entire pipeline before making any changes */
 	ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				 &rp, 0, 4*13);
-- 
2.12.2

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

* [patch added to 3.12-stable] sched/rt: Add a missing rescheduling point
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (34 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: Reject partial NT_METAG_RPIPE writes Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] libceph: force GFP_NOIO for socket allocations Jiri Slaby
                   ` (15 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable
  Cc: Sebastian Andrzej Siewior, Peter Zijlstra, Linus Torvalds,
	Mike Galbraith, Thomas Gleixner, Ingo Molnar, Jiri Slaby

From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

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

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

commit 619bd4a71874a8fd78eb6ccf9f272c5e98bcc7b7 upstream.

Since the change in commit:

  fd7a4bed1835 ("sched, rt: Convert switched_{from, to}_rt() / prio_changed_rt() to balance callbacks")

... we don't reschedule a task under certain circumstances:

Lets say task-A, SCHED_OTHER, is running on CPU0 (and it may run only on
CPU0) and holds a PI lock. This task is removed from the CPU because it
used up its time slice and another SCHED_OTHER task is running. Task-B on
CPU1 runs at RT priority and asks for the lock owned by task-A. This
results in a priority boost for task-A. Task-B goes to sleep until the
lock has been made available. Task-A is already runnable (but not active),
so it receives no wake up.

The reality now is that task-A gets on the CPU once the scheduler decides
to remove the current task despite the fact that a high priority task is
enqueued and waiting. This may take a long time.

The desired behaviour is that CPU0 immediately reschedules after the
priority boost which made task-A the task with the lowest priority.

[js] no deadline in 3.12 yet

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: fd7a4bed1835 ("sched, rt: Convert switched_{from, to}_rt() prio_changed_rt() to balance callbacks")
Link: http://lkml.kernel.org/r/20170124144006.29821-1-bigeasy@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/sched/rt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 10edf9d2a8b7..ce4ec3ae9abc 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1871,10 +1871,9 @@ static void switched_to_rt(struct rq *rq, struct task_struct *p)
 #ifdef CONFIG_SMP
 		if (rq->rt.overloaded)
 			queue_push_tasks(rq);
-#else
+#endif /* CONFIG_SMP */
 		if (p->prio < rq->curr->prio)
 			resched_task(rq->curr);
-#endif /* CONFIG_SMP */
 	}
 }
 
-- 
2.12.2

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

* [patch added to 3.12-stable] libceph: force GFP_NOIO for socket allocations
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (35 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] sched/rt: Add a missing rescheduling point Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] scsi: mpt3sas: fix hang on ata passthrough commands Jiri Slaby
                   ` (14 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Ilya Dryomov, Greg Kroah-Hartman

From: Ilya Dryomov <idryomov@gmail.com>

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

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

commit 633ee407b9d15a75ac9740ba9d3338815e1fcb95 upstream.

sock_alloc_inode() allocates socket+inode and socket_wq with
GFP_KERNEL, which is not allowed on the writeback path:

    Workqueue: ceph-msgr con_work [libceph]
    ffff8810871cb018 0000000000000046 0000000000000000 ffff881085d40000
    0000000000012b00 ffff881025cad428 ffff8810871cbfd8 0000000000012b00
    ffff880102fc1000 ffff881085d40000 ffff8810871cb038 ffff8810871cb148
    Call Trace:
    [<ffffffff816dd629>] schedule+0x29/0x70
    [<ffffffff816e066d>] schedule_timeout+0x1bd/0x200
    [<ffffffff81093ffc>] ? ttwu_do_wakeup+0x2c/0x120
    [<ffffffff81094266>] ? ttwu_do_activate.constprop.135+0x66/0x70
    [<ffffffff816deb5f>] wait_for_completion+0xbf/0x180
    [<ffffffff81097cd0>] ? try_to_wake_up+0x390/0x390
    [<ffffffff81086335>] flush_work+0x165/0x250
    [<ffffffff81082940>] ? worker_detach_from_pool+0xd0/0xd0
    [<ffffffffa03b65b1>] xlog_cil_force_lsn+0x81/0x200 [xfs]
    [<ffffffff816d6b42>] ? __slab_free+0xee/0x234
    [<ffffffffa03b4b1d>] _xfs_log_force_lsn+0x4d/0x2c0 [xfs]
    [<ffffffff811adc1e>] ? lookup_page_cgroup_used+0xe/0x30
    [<ffffffffa039a723>] ? xfs_reclaim_inode+0xa3/0x330 [xfs]
    [<ffffffffa03b4dcf>] xfs_log_force_lsn+0x3f/0xf0 [xfs]
    [<ffffffffa039a723>] ? xfs_reclaim_inode+0xa3/0x330 [xfs]
    [<ffffffffa03a62c6>] xfs_iunpin_wait+0xc6/0x1a0 [xfs]
    [<ffffffff810aa250>] ? wake_atomic_t_function+0x40/0x40
    [<ffffffffa039a723>] xfs_reclaim_inode+0xa3/0x330 [xfs]
    [<ffffffffa039ac07>] xfs_reclaim_inodes_ag+0x257/0x3d0 [xfs]
    [<ffffffffa039bb13>] xfs_reclaim_inodes_nr+0x33/0x40 [xfs]
    [<ffffffffa03ab745>] xfs_fs_free_cached_objects+0x15/0x20 [xfs]
    [<ffffffff811c0c18>] super_cache_scan+0x178/0x180
    [<ffffffff8115912e>] shrink_slab_node+0x14e/0x340
    [<ffffffff811afc3b>] ? mem_cgroup_iter+0x16b/0x450
    [<ffffffff8115af70>] shrink_slab+0x100/0x140
    [<ffffffff8115e425>] do_try_to_free_pages+0x335/0x490
    [<ffffffff8115e7f9>] try_to_free_pages+0xb9/0x1f0
    [<ffffffff816d56e4>] ? __alloc_pages_direct_compact+0x69/0x1be
    [<ffffffff81150cba>] __alloc_pages_nodemask+0x69a/0xb40
    [<ffffffff8119743e>] alloc_pages_current+0x9e/0x110
    [<ffffffff811a0ac5>] new_slab+0x2c5/0x390
    [<ffffffff816d71c4>] __slab_alloc+0x33b/0x459
    [<ffffffff815b906d>] ? sock_alloc_inode+0x2d/0xd0
    [<ffffffff8164bda1>] ? inet_sendmsg+0x71/0xc0
    [<ffffffff815b906d>] ? sock_alloc_inode+0x2d/0xd0
    [<ffffffff811a21f2>] kmem_cache_alloc+0x1a2/0x1b0
    [<ffffffff815b906d>] sock_alloc_inode+0x2d/0xd0
    [<ffffffff811d8566>] alloc_inode+0x26/0xa0
    [<ffffffff811da04a>] new_inode_pseudo+0x1a/0x70
    [<ffffffff815b933e>] sock_alloc+0x1e/0x80
    [<ffffffff815ba855>] __sock_create+0x95/0x220
    [<ffffffff815baa04>] sock_create_kern+0x24/0x30
    [<ffffffffa04794d9>] con_work+0xef9/0x2050 [libceph]
    [<ffffffffa04aa9ec>] ? rbd_img_request_submit+0x4c/0x60 [rbd]
    [<ffffffff81084c19>] process_one_work+0x159/0x4f0
    [<ffffffff8108561b>] worker_thread+0x11b/0x530
    [<ffffffff81085500>] ? create_worker+0x1d0/0x1d0
    [<ffffffff8108b6f9>] kthread+0xc9/0xe0
    [<ffffffff8108b630>] ? flush_kthread_worker+0x90/0x90
    [<ffffffff816e1b98>] ret_from_fork+0x58/0x90
    [<ffffffff8108b630>] ? flush_kthread_worker+0x90/0x90

Use memalloc_noio_{save,restore}() to temporarily force GFP_NOIO here.

Link: http://tracker.ceph.com/issues/19309
Reported-by: Sergey Jerusalimov <wintchester@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ceph/messenger.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index ecdf164c80fe..a61159bd5b02 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -6,6 +6,7 @@
 #include <linux/inet.h>
 #include <linux/kthread.h>
 #include <linux/net.h>
+#include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/socket.h>
 #include <linux/string.h>
@@ -475,11 +476,16 @@ static int ceph_tcp_connect(struct ceph_connection *con)
 {
 	struct sockaddr_storage *paddr = &con->peer_addr.in_addr;
 	struct socket *sock;
+	unsigned int noio_flag;
 	int ret;
 
 	BUG_ON(con->sock);
+
+	/* sock_create_kern() allocates with GFP_KERNEL */
+	noio_flag = memalloc_noio_save();
 	ret = sock_create_kern(con->peer_addr.in_addr.ss_family, SOCK_STREAM,
 			       IPPROTO_TCP, &sock);
+	memalloc_noio_restore(noio_flag);
 	if (ret)
 		return ret;
 	sock->sk->sk_allocation = GFP_NOFS;
-- 
2.12.2

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

* [patch added to 3.12-stable] scsi: mpt3sas: fix hang on ata passthrough commands
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (36 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] libceph: force GFP_NOIO for socket allocations Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] scsi: libsas: fix ata xfer length Jiri Slaby
                   ` (13 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: James Bottomley, Martin K . Petersen, Joe Korty, Jiri Slaby

From: James Bottomley <James.Bottomley@HansenPartnership.com>

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

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

commit ffb58456589443ca572221fabbdef3db8483a779 upstream.

mpt3sas has a firmware failure where it can only handle one pass through
ATA command at a time.  If another comes in, contrary to the SAT
standard, it will hang until the first one completes (causing long
commands like secure erase to timeout).  The original fix was to block
the device when an ATA command came in, but this caused a regression
with

commit 669f044170d8933c3d66d231b69ea97cb8447338
Author: Bart Van Assche <bart.vanassche@sandisk.com>
Date:   Tue Nov 22 16:17:13 2016 -0800

    scsi: srp_transport: Move queuecommand() wait code to SCSI core

So fix the original fix of the secure erase timeout by properly
returning SAM_STAT_BUSY like the SAT recommends.  The original patch
also had a concurrency problem since scsih_qcmd is lockless at that
point (this is fixed by using atomic bitops to set and test the flag).

[mkp: addressed feedback wrt. test_bit and fixed whitespace]

Fixes: 18f6084a989ba1b (mpt3sas: Fix secure erase premature termination)
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Acked-by: Sreekanth Reddy <Sreekanth.Reddy@broadcom.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reported-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Cc: Joe Korty <joe.korty@ccur.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/mpt3sas/mpt3sas_base.h  | 12 ++++++++++++
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 36 +++++++++++++++++++++++++-----------
 2 files changed, 37 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h b/drivers/scsi/mpt3sas/mpt3sas_base.h
index 0ebf5d913c80..c56ac73a8d05 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.h
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -219,6 +219,7 @@ struct MPT3SAS_TARGET {
  * @eedp_enable: eedp support enable bit
  * @eedp_type: 0(type_1), 1(type_2), 2(type_3)
  * @eedp_block_length: block size
+ * @ata_command_pending: SATL passthrough outstanding for device
  */
 struct MPT3SAS_DEVICE {
 	struct MPT3SAS_TARGET *sas_target;
@@ -227,6 +228,17 @@ struct MPT3SAS_DEVICE {
 	u8	configured_lun;
 	u8	block;
 	u8	tlr_snoop_check;
+	/*
+	 * Bug workaround for SATL handling: the mpt2/3sas firmware
+	 * doesn't return BUSY or TASK_SET_FULL for subsequent
+	 * commands while a SATL pass through is in operation as the
+	 * spec requires, it simply does nothing with them until the
+	 * pass through completes, causing them possibly to timeout if
+	 * the passthrough is a long executing command (like format or
+	 * secure erase).  This variable allows us to do the right
+	 * thing while a SATL command is pending.
+	 */
+	unsigned long ata_command_pending;
 };
 
 #define MPT3_CMD_NOT_USED	0x8000	/* free */
diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index ae1db5499ca6..3d3d37e4b37c 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -3516,9 +3516,18 @@ _scsih_eedp_error_handling(struct scsi_cmnd *scmd, u16 ioc_status)
 	    SAM_STAT_CHECK_CONDITION;
 }
 
-static inline bool ata_12_16_cmd(struct scsi_cmnd *scmd)
+static int _scsih_set_satl_pending(struct scsi_cmnd *scmd, bool pending)
 {
-	return (scmd->cmnd[0] == ATA_12 || scmd->cmnd[0] == ATA_16);
+	struct MPT3SAS_DEVICE *priv = scmd->device->hostdata;
+
+	if (scmd->cmnd[0] != ATA_12 && scmd->cmnd[0] != ATA_16)
+		return 0;
+
+	if (pending)
+		return test_and_set_bit(0, &priv->ata_command_pending);
+
+	clear_bit(0, &priv->ata_command_pending);
+	return 0;
 }
 
 /**
@@ -3548,13 +3557,6 @@ _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
 		scsi_print_command(scmd);
 #endif
 
-	/*
-	 * Lock the device for any subsequent command until command is
-	 * done.
-	 */
-	if (ata_12_16_cmd(scmd))
-		scsi_internal_device_block(scmd->device);
-
 	scmd->scsi_done = done;
 	sas_device_priv_data = scmd->device->hostdata;
 	if (!sas_device_priv_data || !sas_device_priv_data->sas_target) {
@@ -3569,6 +3571,19 @@ _scsih_qcmd_lck(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
 		return 0;
 	}
 
+	/*
+	 * Bug work around for firmware SATL handling.  The loop
+	 * is based on atomic operations and ensures consistency
+	 * since we're lockless at this point
+	 */
+	do {
+		if (test_bit(0, &sas_device_priv_data->ata_command_pending)) {
+			scmd->result = SAM_STAT_BUSY;
+			scmd->scsi_done(scmd);
+			return 0;
+		}
+	} while (_scsih_set_satl_pending(scmd, true));
+
 	sas_target_priv_data = sas_device_priv_data->sas_target;
 
 	/* invalid device handle */
@@ -4058,8 +4073,7 @@ _scsih_io_done(struct MPT3SAS_ADAPTER *ioc, u16 smid, u8 msix_index, u32 reply)
 	if (scmd == NULL)
 		return 1;
 
-	if (ata_12_16_cmd(scmd))
-		scsi_internal_device_unblock(scmd->device, SDEV_RUNNING);
+	_scsih_set_satl_pending(scmd, false);
 
 	mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
 
-- 
2.12.2

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

* [patch added to 3.12-stable] scsi: libsas: fix ata xfer length
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (37 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] scsi: mpt3sas: fix hang on ata passthrough commands Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] ALSA: seq: Fix race during FIFO resize Jiri Slaby
                   ` (12 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: John Garry, Martin K . Petersen, Jiri Slaby

From: John Garry <john.garry@huawei.com>

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

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

commit 9702c67c6066f583b629cf037d2056245bb7a8e6 upstream.

The total ata xfer length may not be calculated properly, in that we do
not use the proper method to get an sg element dma length.

According to the code comment, sg_dma_len() should be used after
dma_map_sg() is called.

This issue was found by turning on the SMMUv3 in front of the hisi_sas
controller in hip07. Multiple sg elements were being combined into a
single element, but the original first element length was being use as
the total xfer length.

Fixes: ff2aeb1eb64c8a4770a6 ("libata: convert to chained sg")
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/libsas/sas_ata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index d2895836f9fa..83e3ca703cd1 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -219,7 +219,7 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
 		task->num_scatter = qc->n_elem;
 	} else {
 		for_each_sg(qc->sg, sg, qc->n_elem, si)
-			xfer += sg->length;
+			xfer += sg_dma_len(sg);
 
 		task->total_xfer_len = xfer;
 		task->num_scatter = si;
-- 
2.12.2

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

* [patch added to 3.12-stable] ALSA: seq: Fix race during FIFO resize
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (38 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] scsi: libsas: fix ata xfer length Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] ACPI: Fix incompatibility with mcount-based function graph tracing Jiri Slaby
                   ` (11 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Takashi Iwai, Jiri Slaby

From: Takashi Iwai <tiwai@suse.de>

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

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

commit 2d7d54002e396c180db0c800c1046f0a3c471597 upstream.

When a new event is queued while processing to resize the FIFO in
snd_seq_fifo_clear(), it may lead to a use-after-free, as the old pool
that is being queued gets removed.  For avoiding this race, we need to
close the pool to be deleted and sync its usage before actually
deleting it.

The issue was spotted by syzkaller.

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

diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
index fc2c55b18f49..490b697e83ff 100644
--- a/sound/core/seq/seq_fifo.c
+++ b/sound/core/seq/seq_fifo.c
@@ -267,6 +267,10 @@ int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize)
 	/* NOTE: overflow flag is not cleared */
 	spin_unlock_irqrestore(&f->lock, flags);
 
+	/* close the old pool and wait until all users are gone */
+	snd_seq_pool_mark_closing(oldpool);
+	snd_use_lock_sync(&f->use_lock);
+
 	/* release cells in old pool */
 	for (cell = oldhead; cell; cell = next) {
 		next = cell->next;
-- 
2.12.2

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

* [patch added to 3.12-stable] ACPI: Fix incompatibility with mcount-based function graph tracing
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (39 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] ALSA: seq: Fix race during FIFO resize Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA) Jiri Slaby
                   ` (10 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Josh Poimboeuf, Rafael J . Wysocki, Jiri Slaby

From: Josh Poimboeuf <jpoimboe@redhat.com>

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

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

commit 61b79e16c68d703dde58c25d3935d67210b7d71b upstream.

Paul Menzel reported a warning:

  WARNING: CPU: 0 PID: 774 at /build/linux-ROBWaj/linux-4.9.13/kernel/trace/trace_functions_graph.c:233 ftrace_return_to_handler+0x1aa/0x1e0
  Bad frame pointer: expected f6919d98, received f6919db0
    from func acpi_pm_device_sleep_wake return to c43b6f9d

The warning means that function graph tracing is broken for the
acpi_pm_device_sleep_wake() function.  That's because the ACPI Makefile
unconditionally sets the '-Os' gcc flag to optimize for size.  That's an
issue because mcount-based function graph tracing is incompatible with
'-Os' on x86, thanks to the following gcc bug:

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42109

I have another patch pending which will ensure that mcount-based
function graph tracing is never used with CONFIG_CC_OPTIMIZE_FOR_SIZE on
x86.

But this patch is needed in addition to that one because the ACPI
Makefile overrides that config option for no apparent reason.  It has
had this flag since the beginning of git history, and there's no related
comment, so I don't know why it's there.  As far as I can tell, there's
no reason for it to be there.  The appropriate behavior is for it to
honor CONFIG_CC_OPTIMIZE_FOR_{SIZE,PERFORMANCE} like the rest of the
kernel.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index cdaf68b58b00..447ba3cd3f8c 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -2,7 +2,6 @@
 # Makefile for the Linux ACPI interpreter
 #
 
-ccflags-y			:= -Os
 ccflags-$(CONFIG_ACPI_DEBUG)	+= -DACPI_DEBUG_OUTPUT
 
 #
-- 
2.12.2

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

* [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA)
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (40 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] ACPI: Fix incompatibility with mcount-based function graph tracing Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 13:47   ` Richard Genoud
  2017-04-10 12:59 ` [patch added to 3.12-stable] USB: fix linked-list corruption in rh_call_control() Jiri Slaby
                   ` (9 subsequent siblings)
  51 siblings, 1 reply; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Richard Genoud, Jiri Slaby

From: Richard Genoud <richard.genoud@gmail.com>

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

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

commit 31ca2c63fdc0aee725cbd4f207c1256f5deaabde upstream.

If uart_flush_buffer() is called between atmel_tx_dma() and
atmel_complete_tx_dma(), the circular buffer has been cleared, but not
atmel_port->tx_len.
That leads to a circular buffer overflow (dumping (UART_XMIT_SIZE -
atmel_port->tx_len) bytes).

Tested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/atmel_serial.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index ab2e22bf54fd..0e0023f7c18d 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1690,6 +1690,11 @@ static void atmel_flush_buffer(struct uart_port *port)
 		UART_PUT_TCR(port, 0);
 		atmel_port->pdc_tx.ofs = 0;
 	}
+	/*
+	 * in uart_flush_buffer(), the xmit circular buffer has just
+	 * been cleared, so we have to reset tx_len accordingly.
+	 */
+	atmel_port->tx_len = 0;
 }
 
 /*
-- 
2.12.2

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

* [patch added to 3.12-stable] USB: fix linked-list corruption in rh_call_control()
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (41 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA) Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] KVM: x86: clear bus pointer when destroyed Jiri Slaby
                   ` (8 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Alan Stern, Jiri Slaby

From: Alan Stern <stern@rowland.harvard.edu>

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

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

commit 1633682053a7ee8058e10c76722b9b28e97fb73f upstream.

Using KASAN, Dmitry found a bug in the rh_call_control() routine: If
buffer allocation fails, the routine returns immediately without
unlinking its URB from the control endpoint, eventually leading to
linked-list corruption.

This patch fixes the problem by jumping to the end of the routine
(where the URB is unlinked) when an allocation failure occurs.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/core/hcd.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 79055b3df45a..9925e4b6e2d3 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -498,8 +498,10 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
 	 */
 	tbuf_size =  max_t(u16, sizeof(struct usb_hub_descriptor), wLength);
 	tbuf = kzalloc(tbuf_size, GFP_KERNEL);
-	if (!tbuf)
-		return -ENOMEM;
+	if (!tbuf) {
+		status = -ENOMEM;
+		goto err_alloc;
+	}
 
 	bufp = tbuf;
 
@@ -702,6 +704,7 @@ error:
 	}
 
 	kfree(tbuf);
+ err_alloc:
 
 	/* any errors get returned through the urb completion */
 	spin_lock_irq(&hcd_root_hub_lock);
-- 
2.12.2

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

* [patch added to 3.12-stable] KVM: x86: clear bus pointer when destroyed
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (42 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] USB: fix linked-list corruption in rh_call_control() Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd() Jiri Slaby
                   ` (7 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Peter Xu, Radim Krčmář, Jiri Slaby

From: Peter Xu <peterx@redhat.com>

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

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

commit df630b8c1e851b5e265dc2ca9c87222e342c093b upstream.

When releasing the bus, let's clear the bus pointers to mark it out. If
any further device unregister happens on this bus, we know that we're
done if we found the bus being released already.

Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 virt/kvm/kvm_main.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index e7a1166c3eb4..659556b28e83 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -587,8 +587,10 @@ static void kvm_destroy_vm(struct kvm *kvm)
 	list_del(&kvm->vm_list);
 	raw_spin_unlock(&kvm_lock);
 	kvm_free_irq_routing(kvm);
-	for (i = 0; i < KVM_NR_BUSES; i++)
+	for (i = 0; i < KVM_NR_BUSES; i++) {
 		kvm_io_bus_destroy(kvm->buses[i]);
+		kvm->buses[i] = NULL;
+	}
 	kvm_coalesced_mmio_free(kvm);
 #if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
 	mmu_notifier_unregister(&kvm->mmu_notifier, kvm->mm);
@@ -3045,6 +3047,14 @@ int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
 	struct kvm_io_bus *new_bus, *bus;
 
 	bus = kvm->buses[bus_idx];
+
+	/*
+	 * It's possible the bus being released before hand. If so,
+	 * we're done here.
+	 */
+	if (!bus)
+		return 0;
+
 	r = -ENOENT;
 	for (i = 0; i < bus->dev_count; i++)
 		if (bus->range[i].dev == dev) {
-- 
2.12.2

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

* [patch added to 3.12-stable] mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd()
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (43 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] KVM: x86: clear bus pointer when destroyed Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] MIPS: Lantiq: Fix cascaded IRQ setup Jiri Slaby
                   ` (6 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable
  Cc: Naoya Horiguchi, Hugh Dickins, Michal Hocko, Kirill A. Shutemov,
	Mike Kravetz, Christian Borntraeger, Gerald Schaefer,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

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

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

commit c9d398fa237882ea07167e23bcfc5e6847066518 upstream.

I found the race condition which triggers the following bug when
move_pages() and soft offline are called on a single hugetlb page
concurrently.

    Soft offlining page 0x119400 at 0x700000000000
    BUG: unable to handle kernel paging request at ffffea0011943820
    IP: follow_huge_pmd+0x143/0x190
    PGD 7ffd2067
    PUD 7ffd1067
    PMD 0
        [61163.582052] Oops: 0000 [#1] SMP
    Modules linked in: binfmt_misc ppdev virtio_balloon parport_pc pcspkr i2c_piix4 parport i2c_core acpi_cpufreq ip_tables xfs libcrc32c ata_generic pata_acpi virtio_blk 8139too crc32c_intel ata_piix serio_raw libata virtio_pci 8139cp virtio_ring virtio mii floppy dm_mirror dm_region_hash dm_log dm_mod [last unloaded: cap_check]
    CPU: 0 PID: 22573 Comm: iterate_numa_mo Tainted: P           OE   4.11.0-rc2-mm1+ #2
    Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
    RIP: 0010:follow_huge_pmd+0x143/0x190
    RSP: 0018:ffffc90004bdbcd0 EFLAGS: 00010202
    RAX: 0000000465003e80 RBX: ffffea0004e34d30 RCX: 00003ffffffff000
    RDX: 0000000011943800 RSI: 0000000000080001 RDI: 0000000465003e80
    RBP: ffffc90004bdbd18 R08: 0000000000000000 R09: ffff880138d34000
    R10: ffffea0004650000 R11: 0000000000c363b0 R12: ffffea0011943800
    R13: ffff8801b8d34000 R14: ffffea0000000000 R15: 000077ff80000000
    FS:  00007fc977710740(0000) GS:ffff88007dc00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffea0011943820 CR3: 000000007a746000 CR4: 00000000001406f0
    Call Trace:
     follow_page_mask+0x270/0x550
     SYSC_move_pages+0x4ea/0x8f0
     SyS_move_pages+0xe/0x10
     do_syscall_64+0x67/0x180
     entry_SYSCALL64_slow_path+0x25/0x25
    RIP: 0033:0x7fc976e03949
    RSP: 002b:00007ffe72221d88 EFLAGS: 00000246 ORIG_RAX: 0000000000000117
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fc976e03949
    RDX: 0000000000c22390 RSI: 0000000000001400 RDI: 0000000000005827
    RBP: 00007ffe72221e00 R08: 0000000000c2c3a0 R09: 0000000000000004
    R10: 0000000000c363b0 R11: 0000000000000246 R12: 0000000000400650
    R13: 00007ffe72221ee0 R14: 0000000000000000 R15: 0000000000000000
    Code: 81 e4 ff ff 1f 00 48 21 c2 49 c1 ec 0c 48 c1 ea 0c 4c 01 e2 49 bc 00 00 00 00 00 ea ff ff 48 c1 e2 06 49 01 d4 f6 45 bc 04 74 90 <49> 8b 7c 24 20 40 f6 c7 01 75 2b 4c 89 e7 8b 47 1c 85 c0 7e 2a
    RIP: follow_huge_pmd+0x143/0x190 RSP: ffffc90004bdbcd0
    CR2: ffffea0011943820
    ---[ end trace e4f81353a2d23232 ]---
    Kernel panic - not syncing: Fatal exception
    Kernel Offset: disabled

This bug is triggered when pmd_present() returns true for non-present
hugetlb, so fixing the present check in follow_huge_pmd() prevents it.
Using pmd_present() to determine present/non-present for hugetlb is not
correct, because pmd_present() checks multiple bits (not only
_PAGE_PRESENT) for historical reason and it can misjudge hugetlb state.

Fixes: e66f17ff7177 ("mm/hugetlb: take page table lock in follow_huge_pmd()")
Link: http://lkml.kernel.org/r/1490149898-20231-1-git-send-email-n-horiguchi@ah.jp.nec.com
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 mm/hugetlb.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 24d50334d51c..ea69c897330e 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -3512,6 +3512,7 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
 {
 	struct page *page = NULL;
 	spinlock_t *ptl;
+	pte_t pte;
 retry:
 	ptl = &mm->page_table_lock;
 	spin_lock(ptl);
@@ -3521,12 +3522,13 @@ retry:
 	 */
 	if (!pmd_huge(*pmd))
 		goto out;
-	if (pmd_present(*pmd)) {
+	pte = huge_ptep_get((pte_t *)pmd);
+	if (pte_present(pte)) {
 		page = pmd_page(*pmd) + ((address & ~PMD_MASK) >> PAGE_SHIFT);
 		if (flags & FOLL_GET)
 			get_page(page);
 	} else {
-		if (is_hugetlb_entry_migration(huge_ptep_get((pte_t *)pmd))) {
+		if (is_hugetlb_entry_migration(pte)) {
 			spin_unlock(ptl);
 			__migration_entry_wait(mm, (pte_t *)pmd, ptl);
 			goto retry;
-- 
2.12.2

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

* [patch added to 3.12-stable] MIPS: Lantiq: Fix cascaded IRQ setup
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (44 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd() Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 13:07   ` Amit Pundir
  2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: fix reading out alarm Jiri Slaby
                   ` (5 subsequent siblings)
  51 siblings, 1 reply; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Felix Fietkau, linux-mips, James Hogan, Amit Pundir, Jiri Slaby

From: Felix Fietkau <nbd@nbd.name>

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

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

commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd upstream.

With the IRQ stack changes integrated, the XRX200 devices started
emitting a constant stream of kernel messages like this:

[  565.415310] Spurious IRQ: CAUSE=0x1100c300

This is caused by IP0 getting handled by plat_irq_dispatch() rather than
its vectored interrupt handler, which is fixed by commit de856416e714
("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch").

Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly
by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ
for all MIPS CPU interrupts.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Acked-by: John Crispin <john@phrozen.org>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15077/
[james.hogan@imgtec.com: tweaked commit message]
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/lantiq/irq.c | 38 +++++++++++++++++---------------------
 1 file changed, 17 insertions(+), 21 deletions(-)

diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index eb3e18659630..1637f165deab 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -268,6 +268,11 @@ static void ltq_hw5_irqdispatch(void)
 DEFINE_HWx_IRQDISPATCH(5)
 #endif
 
+static void ltq_hw_irq_handler(struct irq_desc *desc)
+{
+	ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2);
+}
+
 #ifdef CONFIG_MIPS_MT_SMP
 void __init arch_init_ipiirq(int irq, struct irqaction *action)
 {
@@ -312,23 +317,19 @@ static struct irqaction irq_call = {
 asmlinkage void plat_irq_dispatch(void)
 {
 	unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
-	unsigned int i;
-
-	if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) {
-		do_IRQ(MIPS_CPU_TIMER_IRQ);
-		goto out;
-	} else {
-		for (i = 0; i < MAX_IM; i++) {
-			if (pending & (CAUSEF_IP2 << i)) {
-				ltq_hw_irqdispatch(i);
-				goto out;
-			}
-		}
+	int irq;
+
+	if (!pending) {
+		spurious_interrupt();
+		return;
 	}
-	pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
 
-out:
-	return;
+	pending >>= CAUSEB_IP;
+	while (pending) {
+		irq = fls(pending) - 1;
+		do_IRQ(MIPS_CPU_IRQ_BASE + irq);
+		pending &= ~BIT(irq);
+	}
 }
 
 static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
@@ -353,11 +354,6 @@ static const struct irq_domain_ops irq_domain_ops = {
 	.map = icu_map,
 };
 
-static struct irqaction cascade = {
-	.handler = no_action,
-	.name = "cascade",
-};
-
 int __init icu_of_init(struct device_node *node, struct device_node *parent)
 {
 	struct device_node *eiu_node;
@@ -413,7 +409,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
 	mips_cpu_irq_init();
 
 	for (i = 0; i < MAX_IM; i++)
-		setup_irq(i + 2, &cascade);
+		irq_set_chained_handler(i + 2, ltq_hw_irq_handler);
 
 	if (cpu_has_vint) {
 		pr_info("Setting up vectored interrupts\n");
-- 
2.12.2

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

* [patch added to 3.12-stable] rtc: s35390a: fix reading out alarm
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (45 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] MIPS: Lantiq: Fix cascaded IRQ setup Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: make sure all members in the output are set Jiri Slaby
                   ` (4 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Uwe Kleine-König, Alexandre Belloni, Jiri Slaby

From: Uwe Kleine-König <uwe@kleine-koenig.org>

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

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

commit f87e904ddd8f0ef120e46045b0addeb1cc88354e upstream.

There are several issues fixed in this patch:

 - When alarm isn't enabled, set .enabled to zero instead of returning
   -EINVAL.
 - Ignore how IRQ1 is configured when determining if IRQ2 is on.
 - The three alarm registers have an enable flag which must be
   evaluated.
 - The chip always triggers when the seconds register gets 0.

Note that the rtc framework however doesn't handle the result correctly
because it doesn't check wday being initialized and so interprets an
alarm being set for 10:00 AM in three days as 10:00 AM tomorrow (or
today if that's not over yet).

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/rtc/rtc-s35390a.c | 40 +++++++++++++++++++++++++++++++---------
 1 file changed, 31 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index f40afdd0e5f5..6507a01cf9ad 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -242,6 +242,8 @@ static int s35390a_set_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
 
 	if (alm->time.tm_wday != -1)
 		buf[S35390A_ALRM_BYTE_WDAY] = bin2bcd(alm->time.tm_wday) | 0x80;
+	else
+		buf[S35390A_ALRM_BYTE_WDAY] = 0;
 
 	buf[S35390A_ALRM_BYTE_HOURS] = s35390a_hr2reg(s35390a,
 			alm->time.tm_hour) | 0x80;
@@ -269,23 +271,43 @@ static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
 	if (err < 0)
 		return err;
 
-	if (bitrev8(sts) != S35390A_INT2_MODE_ALARM)
-		return -EINVAL;
+	if ((bitrev8(sts) & S35390A_INT2_MODE_MASK) != S35390A_INT2_MODE_ALARM) {
+		/*
+		 * When the alarm isn't enabled, the register to configure
+		 * the alarm time isn't accessible.
+		 */
+		alm->enabled = 0;
+		return 0;
+	} else {
+		alm->enabled = 1;
+	}
 
 	err = s35390a_get_reg(s35390a, S35390A_CMD_INT2_REG1, buf, sizeof(buf));
 	if (err < 0)
 		return err;
 
 	/* This chip returns the bits of each byte in reverse order */
-	for (i = 0; i < 3; ++i) {
+	for (i = 0; i < 3; ++i)
 		buf[i] = bitrev8(buf[i]);
-		buf[i] &= ~0x80;
-	}
 
-	alm->time.tm_wday = bcd2bin(buf[S35390A_ALRM_BYTE_WDAY]);
-	alm->time.tm_hour = s35390a_reg2hr(s35390a,
-						buf[S35390A_ALRM_BYTE_HOURS]);
-	alm->time.tm_min = bcd2bin(buf[S35390A_ALRM_BYTE_MINS]);
+	/*
+	 * B0 of the three matching registers is an enable flag. Iff it is set
+	 * the configured value is used for matching.
+	 */
+	if (buf[S35390A_ALRM_BYTE_WDAY] & 0x80)
+		alm->time.tm_wday =
+			bcd2bin(buf[S35390A_ALRM_BYTE_WDAY] & ~0x80);
+
+	if (buf[S35390A_ALRM_BYTE_HOURS] & 0x80)
+		alm->time.tm_hour =
+			s35390a_reg2hr(s35390a,
+				       buf[S35390A_ALRM_BYTE_HOURS] & ~0x80);
+
+	if (buf[S35390A_ALRM_BYTE_MINS] & 0x80)
+		alm->time.tm_min = bcd2bin(buf[S35390A_ALRM_BYTE_MINS] & ~0x80);
+
+	/* alarm triggers always at s=0 */
+	alm->time.tm_sec = 0;
 
 	dev_dbg(&client->dev, "%s: alm is mins=%d, hours=%d, wday=%d\n",
 			__func__, alm->time.tm_min, alm->time.tm_hour,
-- 
2.12.2

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

* [patch added to 3.12-stable] rtc: s35390a: make sure all members in the output are set
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (46 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: fix reading out alarm Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: implement reset routine as suggested by the reference Jiri Slaby
                   ` (3 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Uwe Kleine-König, Jiri Slaby

From: Uwe Kleine-König <uwe@kleine-koenig.org>

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

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

The rtc core calls the .read_alarm with all fields initialized to 0. As
the s35390a driver doesn't touch some fields the returned date is
interpreted as a date in January 1900. So make sure all fields are set
to -1; some of them are then overwritten with the right data depending
on the hardware state.

In mainline this is done by commit d68778b80dd7 ("rtc: initialize output
parameter for read alarm to "uninitialized"") in the core. This is
considered to dangerous for stable as it might have side effects for
other rtc drivers that might for example rely on alarm->time.tm_sec
being initialized to 0.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/rtc/rtc-s35390a.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 6507a01cf9ad..47b88bbe4ce7 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -267,6 +267,20 @@ static int s35390a_read_alarm(struct i2c_client *client, struct rtc_wkalrm *alm)
 	char buf[3], sts;
 	int i, err;
 
+	/*
+	 * initialize all members to -1 to signal the core that they are not
+	 * defined by the hardware.
+	 */
+	alm->time.tm_sec = -1;
+	alm->time.tm_min = -1;
+	alm->time.tm_hour = -1;
+	alm->time.tm_mday = -1;
+	alm->time.tm_mon = -1;
+	alm->time.tm_year = -1;
+	alm->time.tm_wday = -1;
+	alm->time.tm_yday = -1;
+	alm->time.tm_isdst = -1;
+
 	err = s35390a_get_reg(s35390a, S35390A_CMD_STATUS2, &sts, sizeof(sts));
 	if (err < 0)
 		return err;
-- 
2.12.2

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

* [patch added to 3.12-stable] rtc: s35390a: implement reset routine as suggested by the reference
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (47 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: make sure all members in the output are set Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: improve irq handling Jiri Slaby
                   ` (2 subsequent siblings)
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Uwe Kleine-König, Alexandre Belloni, Jiri Slaby

From: Uwe Kleine-König <uwe@kleine-koenig.org>

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

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

commit 8e6583f1b5d1f5f129b873f1428b7e414263d847 upstream.

There were two deviations from the reference manual: you have to wait
half a second when POC is active and you might have to repeat
initialization when POC or BLD are still set after the sequence.

Note however that as POC and BLD are cleared by read the driver might
not be able to detect that a reset is necessary. I don't have a good
idea how to fix this.

Additionally report the value read from STATUS1 to the caller. This
prepares the next patch.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/rtc/rtc-s35390a.c | 65 +++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 55 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 47b88bbe4ce7..c7c1fce69635 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -15,6 +15,7 @@
 #include <linux/bitrev.h>
 #include <linux/bcd.h>
 #include <linux/slab.h>
+#include <linux/delay.h>
 
 #define S35390A_CMD_STATUS1	0
 #define S35390A_CMD_STATUS2	1
@@ -94,19 +95,63 @@ static int s35390a_get_reg(struct s35390a *s35390a, int reg, char *buf, int len)
 	return 0;
 }
 
-static int s35390a_reset(struct s35390a *s35390a)
+/*
+ * Returns <0 on error, 0 if rtc is setup fine and 1 if the chip was reset.
+ * To keep the information if an irq is pending, pass the value read from
+ * STATUS1 to the caller.
+ */
+static int s35390a_reset(struct s35390a *s35390a, char *status1)
 {
-	char buf[1];
+	char buf;
+	int ret;
+	unsigned initcount = 0;
 
-	if (s35390a_get_reg(s35390a, S35390A_CMD_STATUS1, buf, sizeof(buf)) < 0)
-		return -EIO;
+	ret = s35390a_get_reg(s35390a, S35390A_CMD_STATUS1, status1, 1);
+	if (ret < 0)
+		return ret;
 
-	if (!(buf[0] & (S35390A_FLAG_POC | S35390A_FLAG_BLD)))
+	if (*status1 & S35390A_FLAG_POC)
+		/*
+		 * Do not communicate for 0.5 seconds since the power-on
+		 * detection circuit is in operation.
+		 */
+		msleep(500);
+	else if (!(*status1 & S35390A_FLAG_BLD))
+		/*
+		 * If both POC and BLD are unset everything is fine.
+		 */
 		return 0;
 
-	buf[0] |= (S35390A_FLAG_RESET | S35390A_FLAG_24H);
-	buf[0] &= 0xf0;
-	return s35390a_set_reg(s35390a, S35390A_CMD_STATUS1, buf, sizeof(buf));
+	/*
+	 * At least one of POC and BLD are set, so reinitialise chip. Keeping
+	 * this information in the hardware to know later that the time isn't
+	 * valid is unfortunately not possible because POC and BLD are cleared
+	 * on read. So the reset is best done now.
+	 *
+	 * The 24H bit is kept over reset, so set it already here.
+	 */
+initialize:
+	*status1 = S35390A_FLAG_24H;
+	buf = S35390A_FLAG_RESET | S35390A_FLAG_24H;
+	ret = s35390a_set_reg(s35390a, S35390A_CMD_STATUS1, &buf, 1);
+
+	if (ret < 0)
+		return ret;
+
+	ret = s35390a_get_reg(s35390a, S35390A_CMD_STATUS1, &buf, 1);
+	if (ret < 0)
+		return ret;
+
+	if (buf & (S35390A_FLAG_POC | S35390A_FLAG_BLD)) {
+		/* Try up to five times to reset the chip */
+		if (initcount < 5) {
+			++initcount;
+			goto initialize;
+		} else
+			return -EIO;
+	}
+
+	return 1;
 }
 
 static int s35390a_disable_test_mode(struct s35390a *s35390a)
@@ -367,7 +412,7 @@ static int s35390a_probe(struct i2c_client *client,
 	unsigned int i;
 	struct s35390a *s35390a;
 	struct rtc_time tm;
-	char buf[1];
+	char buf[1], status1;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		err = -ENODEV;
@@ -396,7 +441,7 @@ static int s35390a_probe(struct i2c_client *client,
 		}
 	}
 
-	err = s35390a_reset(s35390a);
+	err = s35390a_reset(s35390a, &status1);
 	if (err < 0) {
 		dev_err(&client->dev, "error resetting chip\n");
 		goto exit_dummy;
-- 
2.12.2

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

* [patch added to 3.12-stable] rtc: s35390a: improve irq handling
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (48 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: implement reset routine as suggested by the reference Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] KVM: kvm_io_bus_unregister_dev() should never fail Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] padata: avoid race in reordering Jiri Slaby
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Uwe Kleine-König, Alexandre Belloni, Jiri Slaby

From: Uwe Kleine-König <uwe@kleine-koenig.org>

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

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

commit 3bd32722c827d00eafe8e6d5b83e9f3148ea7c7e upstream.

On some QNAP NAS devices the rtc can wake the machine. Several people
noticed that once the machine was woken this way it fails to shut down.
That's because the driver fails to acknowledge the interrupt and so it
keeps active and restarts the machine immediatly after shutdown. See
https://bugs.debian.org/794266 for a bug report.

Doing this correctly requires to interpret the INT2 flag of the first read
of the STATUS1 register because this bit is cleared by read.

Note this is not maximally robust though because a pending irq isn't
detected when the STATUS1 register was already read (and so INT2 is not
set) but the irq was not disabled. But that is a hardware imposed problem
that cannot easily be fixed by software.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/rtc/rtc-s35390a.c | 48 ++++++++++++++++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 17 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index c7c1fce69635..00662dd28d66 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -35,10 +35,14 @@
 #define S35390A_ALRM_BYTE_HOURS	1
 #define S35390A_ALRM_BYTE_MINS	2
 
+/* flags for STATUS1 */
 #define S35390A_FLAG_POC	0x01
 #define S35390A_FLAG_BLD	0x02
+#define S35390A_FLAG_INT2	0x04
 #define S35390A_FLAG_24H	0x40
 #define S35390A_FLAG_RESET	0x80
+
+/* flag for STATUS2 */
 #define S35390A_FLAG_TEST	0x01
 
 #define S35390A_INT2_MODE_MASK		0xF0
@@ -408,11 +412,11 @@ static struct i2c_driver s35390a_driver;
 static int s35390a_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
-	int err;
+	int err, err_reset;
 	unsigned int i;
 	struct s35390a *s35390a;
 	struct rtc_time tm;
-	char buf[1], status1;
+	char buf, status1;
 
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
 		err = -ENODEV;
@@ -441,29 +445,35 @@ static int s35390a_probe(struct i2c_client *client,
 		}
 	}
 
-	err = s35390a_reset(s35390a, &status1);
-	if (err < 0) {
+	err_reset = s35390a_reset(s35390a, &status1);
+	if (err_reset < 0) {
+		err = err_reset;
 		dev_err(&client->dev, "error resetting chip\n");
 		goto exit_dummy;
 	}
 
-	err = s35390a_disable_test_mode(s35390a);
-	if (err < 0) {
-		dev_err(&client->dev, "error disabling test mode\n");
-		goto exit_dummy;
-	}
-
-	err = s35390a_get_reg(s35390a, S35390A_CMD_STATUS1, buf, sizeof(buf));
-	if (err < 0) {
-		dev_err(&client->dev, "error checking 12/24 hour mode\n");
-		goto exit_dummy;
-	}
-	if (buf[0] & S35390A_FLAG_24H)
+	if (status1 & S35390A_FLAG_24H)
 		s35390a->twentyfourhour = 1;
 	else
 		s35390a->twentyfourhour = 0;
 
-	if (s35390a_get_datetime(client, &tm) < 0)
+	if (status1 & S35390A_FLAG_INT2) {
+		/* disable alarm (and maybe test mode) */
+		buf = 0;
+		err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, 1);
+		if (err < 0) {
+			dev_err(&client->dev, "error disabling alarm");
+			goto exit_dummy;
+		}
+	} else {
+		err = s35390a_disable_test_mode(s35390a);
+		if (err < 0) {
+			dev_err(&client->dev, "error disabling test mode\n");
+			goto exit_dummy;
+		}
+	}
+
+	if (err_reset > 0 || s35390a_get_datetime(client, &tm) < 0)
 		dev_warn(&client->dev, "clock needs to be set\n");
 
 	device_set_wakeup_capable(&client->dev, 1);
@@ -476,6 +486,10 @@ static int s35390a_probe(struct i2c_client *client,
 		err = PTR_ERR(s35390a->rtc);
 		goto exit_dummy;
 	}
+
+	if (status1 & S35390A_FLAG_INT2)
+		rtc_update_irq(s35390a->rtc, 1, RTC_AF);
+
 	return 0;
 
 exit_dummy:
-- 
2.12.2

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

* [patch added to 3.12-stable] KVM: kvm_io_bus_unregister_dev() should never fail
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (49 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: improve irq handling Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  2017-04-10 12:59 ` [patch added to 3.12-stable] padata: avoid race in reordering Jiri Slaby
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: David Hildenbrand, Paolo Bonzini, Jiri Slaby

From: David Hildenbrand <david@redhat.com>

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

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

commit 90db10434b163e46da413d34db8d0e77404cc645 upstream.

No caller currently checks the return value of
kvm_io_bus_unregister_dev(). This is evil, as all callers silently go on
freeing their device. A stale reference will remain in the io_bus,
getting at least used again, when the iobus gets teared down on
kvm_destroy_vm() - leading to use after free errors.

There is nothing the callers could do, except retrying over and over
again.

So let's simply remove the bus altogether, print an error and make
sure no one can access this broken bus again (returning -ENOMEM on any
attempt to access it).

Fixes: e93f8a0f821e ("KVM: convert io_bus to SRCU")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 include/linux/kvm_host.h |  4 ++--
 virt/kvm/eventfd.c       |  3 ++-
 virt/kvm/kvm_main.c      | 40 +++++++++++++++++++++++-----------------
 3 files changed, 27 insertions(+), 20 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index e47c7e2f4d04..16a92b104264 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -176,8 +176,8 @@ int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 			   int len, void *val, long cookie);
 int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 			    int len, struct kvm_io_device *dev);
-int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
-			      struct kvm_io_device *dev);
+void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
+			       struct kvm_io_device *dev);
 
 #ifdef CONFIG_KVM_ASYNC_PF
 struct kvm_async_pf {
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index abe4d6043b36..06fa6f4ba35c 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -799,7 +799,8 @@ kvm_deassign_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
 			continue;
 
 		kvm_io_bus_unregister_dev(kvm, bus_idx, &p->dev);
-		kvm->buses[bus_idx]->ioeventfd_count--;
+		if (kvm->buses[bus_idx])
+			kvm->buses[bus_idx]->ioeventfd_count--;
 		ioeventfd_release(p);
 		ret = 0;
 		break;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 659556b28e83..96fe24ea1449 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -588,7 +588,8 @@ static void kvm_destroy_vm(struct kvm *kvm)
 	raw_spin_unlock(&kvm_lock);
 	kvm_free_irq_routing(kvm);
 	for (i = 0; i < KVM_NR_BUSES; i++) {
-		kvm_io_bus_destroy(kvm->buses[i]);
+		if (kvm->buses[i])
+			kvm_io_bus_destroy(kvm->buses[i]);
 		kvm->buses[i] = NULL;
 	}
 	kvm_coalesced_mmio_free(kvm);
@@ -2916,6 +2917,8 @@ int kvm_io_bus_write(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 	};
 
 	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
+	if (!bus)
+		return -ENOMEM;
 	r = __kvm_io_bus_write(bus, &range, val);
 	return r < 0 ? r : 0;
 }
@@ -2982,6 +2985,8 @@ int kvm_io_bus_read(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 	};
 
 	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
+	if (!bus)
+		return -ENOMEM;
 	r = __kvm_io_bus_read(bus, &range, val);
 	return r < 0 ? r : 0;
 }
@@ -2999,6 +3004,8 @@ int kvm_io_bus_read_cookie(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 	};
 
 	bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu);
+	if (!bus)
+		return -ENOMEM;
 
 	/* First try the device referenced by cookie. */
 	if ((cookie >= 0) && (cookie < bus->dev_count) &&
@@ -3021,6 +3028,9 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 	struct kvm_io_bus *new_bus, *bus;
 
 	bus = kvm->buses[bus_idx];
+	if (!bus)
+		return -ENOMEM;
+
 	/* exclude ioeventfd which is limited by maximum fd */
 	if (bus->dev_count - bus->ioeventfd_count > NR_IOBUS_DEVS - 1)
 		return -ENOSPC;
@@ -3040,45 +3050,41 @@ int kvm_io_bus_register_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr,
 }
 
 /* Caller must hold slots_lock. */
-int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
-			      struct kvm_io_device *dev)
+void kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
+			       struct kvm_io_device *dev)
 {
-	int i, r;
+	int i;
 	struct kvm_io_bus *new_bus, *bus;
 
 	bus = kvm->buses[bus_idx];
-
-	/*
-	 * It's possible the bus being released before hand. If so,
-	 * we're done here.
-	 */
 	if (!bus)
-		return 0;
+		return;
 
-	r = -ENOENT;
 	for (i = 0; i < bus->dev_count; i++)
 		if (bus->range[i].dev == dev) {
-			r = 0;
 			break;
 		}
 
-	if (r)
-		return r;
+	if (i == bus->dev_count)
+		return;
 
 	new_bus = kzalloc(sizeof(*bus) + ((bus->dev_count - 1) *
 			  sizeof(struct kvm_io_range)), GFP_KERNEL);
-	if (!new_bus)
-		return -ENOMEM;
+	if (!new_bus)  {
+		pr_err("kvm: failed to shrink bus, removing it completely\n");
+		goto broken;
+	}
 
 	memcpy(new_bus, bus, sizeof(*bus) + i * sizeof(struct kvm_io_range));
 	new_bus->dev_count--;
 	memcpy(new_bus->range + i, bus->range + i + 1,
 	       (new_bus->dev_count - i) * sizeof(struct kvm_io_range));
 
+broken:
 	rcu_assign_pointer(kvm->buses[bus_idx], new_bus);
 	synchronize_srcu_expedited(&kvm->srcu);
 	kfree(bus);
-	return r;
+	return;
 }
 
 static struct notifier_block kvm_cpu_notifier = {
-- 
2.12.2

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

* [patch added to 3.12-stable] padata: avoid race in reordering
  2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
                   ` (50 preceding siblings ...)
  2017-04-10 12:59 ` [patch added to 3.12-stable] KVM: kvm_io_bus_unregister_dev() should never fail Jiri Slaby
@ 2017-04-10 12:59 ` Jiri Slaby
  51 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 12:59 UTC (permalink / raw)
  To: stable; +Cc: Jason A. Donenfeld, Herbert Xu, Jiri Slaby

From: "Jason A. Donenfeld" <Jason@zx2c4.com>

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

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

commit de5540d088fe97ad583cc7d396586437b32149a5 upstream.

Under extremely heavy uses of padata, crashes occur, and with list
debugging turned on, this happens instead:

[87487.298728] WARNING: CPU: 1 PID: 882 at lib/list_debug.c:33
__list_add+0xae/0x130
[87487.301868] list_add corruption. prev->next should be next
(ffffb17abfc043d0), but was ffff8dba70872c80. (prev=ffff8dba70872b00).
[87487.339011]  [<ffffffff9a53d075>] dump_stack+0x68/0xa3
[87487.342198]  [<ffffffff99e119a1>] ? console_unlock+0x281/0x6d0
[87487.345364]  [<ffffffff99d6b91f>] __warn+0xff/0x140
[87487.348513]  [<ffffffff99d6b9aa>] warn_slowpath_fmt+0x4a/0x50
[87487.351659]  [<ffffffff9a58b5de>] __list_add+0xae/0x130
[87487.354772]  [<ffffffff9add5094>] ? _raw_spin_lock+0x64/0x70
[87487.357915]  [<ffffffff99eefd66>] padata_reorder+0x1e6/0x420
[87487.361084]  [<ffffffff99ef0055>] padata_do_serial+0xa5/0x120

padata_reorder calls list_add_tail with the list to which its adding
locked, which seems correct:

spin_lock(&squeue->serial.lock);
list_add_tail(&padata->list, &squeue->serial.list);
spin_unlock(&squeue->serial.lock);

This therefore leaves only place where such inconsistency could occur:
if padata->list is added at the same time on two different threads.
This pdata pointer comes from the function call to
padata_get_next(pd), which has in it the following block:

next_queue = per_cpu_ptr(pd->pqueue, cpu);
padata = NULL;
reorder = &next_queue->reorder;
if (!list_empty(&reorder->list)) {
       padata = list_entry(reorder->list.next,
                           struct padata_priv, list);
       spin_lock(&reorder->lock);
       list_del_init(&padata->list);
       atomic_dec(&pd->reorder_objects);
       spin_unlock(&reorder->lock);

       pd->processed++;

       goto out;
}
out:
return padata;

I strongly suspect that the problem here is that two threads can race
on reorder list. Even though the deletion is locked, call to
list_entry is not locked, which means it's feasible that two threads
pick up the same padata object and subsequently call list_add_tail on
them at the same time. The fix is thus be hoist that lock outside of
that block.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/padata.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 07af2c95dcfe..86473271650f 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -190,19 +190,20 @@ static struct padata_priv *padata_get_next(struct parallel_data *pd)
 
 	reorder = &next_queue->reorder;
 
+	spin_lock(&reorder->lock);
 	if (!list_empty(&reorder->list)) {
 		padata = list_entry(reorder->list.next,
 				    struct padata_priv, list);
 
-		spin_lock(&reorder->lock);
 		list_del_init(&padata->list);
 		atomic_dec(&pd->reorder_objects);
-		spin_unlock(&reorder->lock);
 
 		pd->processed++;
 
+		spin_unlock(&reorder->lock);
 		goto out;
 	}
+	spin_unlock(&reorder->lock);
 
 	if (__this_cpu_read(pd->pqueue->cpu_index) == next_queue->cpu_index) {
 		padata = ERR_PTR(-ENODATA);
-- 
2.12.2

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

* Re: [patch added to 3.12-stable] MIPS: Lantiq: Fix cascaded IRQ setup
  2017-04-10 12:59 ` [patch added to 3.12-stable] MIPS: Lantiq: Fix cascaded IRQ setup Jiri Slaby
@ 2017-04-10 13:07   ` Amit Pundir
  2017-04-10 13:09     ` Jiri Slaby
  0 siblings, 1 reply; 57+ messages in thread
From: Amit Pundir @ 2017-04-10 13:07 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: stable, Felix Fietkau, linux-mips, James Hogan

Hi Jiri,

On 10 April 2017 at 18:29, Jiri Slaby <jslaby@suse.cz> wrote:
> From: Felix Fietkau <nbd@nbd.name>
>
> This patch has been added to the 3.12 stable tree. If you have any
> objections, please let us know.
>
> ===============
>
> commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd upstream.
>
> With the IRQ stack changes integrated, the XRX200 devices started
> emitting a constant stream of kernel messages like this:
>
> [  565.415310] Spurious IRQ: CAUSE=0x1100c300
>
> This is caused by IP0 getting handled by plat_irq_dispatch() rather than
> its vectored interrupt handler, which is fixed by commit de856416e714
> ("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch").
>
> Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly
> by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ
> for all MIPS CPU interrupts.
>
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> Acked-by: John Crispin <john@phrozen.org>
> Cc: linux-mips@linux-mips.org
> Patchwork: https://patchwork.linux-mips.org/patch/15077/
> [james.hogan@imgtec.com: tweaked commit message]
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

Just to let you know that I cherry-picked this patch from LEDE source
for 4.4 and 4.9 stable but James pointed out that this patch fixes a
Mips IRQ bug introduced in later (4.10+) kernels. So we dropped it
from 4.4 and 4.9 plan as such. Thanks.

Regards,
Amit Pundir

> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  arch/mips/lantiq/irq.c | 38 +++++++++++++++++---------------------
>  1 file changed, 17 insertions(+), 21 deletions(-)
>
> diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
> index eb3e18659630..1637f165deab 100644
> --- a/arch/mips/lantiq/irq.c
> +++ b/arch/mips/lantiq/irq.c
> @@ -268,6 +268,11 @@ static void ltq_hw5_irqdispatch(void)
>  DEFINE_HWx_IRQDISPATCH(5)
>  #endif
>
> +static void ltq_hw_irq_handler(struct irq_desc *desc)
> +{
> +       ltq_hw_irqdispatch(irq_desc_get_irq(desc) - 2);
> +}
> +
>  #ifdef CONFIG_MIPS_MT_SMP
>  void __init arch_init_ipiirq(int irq, struct irqaction *action)
>  {
> @@ -312,23 +317,19 @@ static struct irqaction irq_call = {
>  asmlinkage void plat_irq_dispatch(void)
>  {
>         unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
> -       unsigned int i;
> -
> -       if ((MIPS_CPU_TIMER_IRQ == 7) && (pending & CAUSEF_IP7)) {
> -               do_IRQ(MIPS_CPU_TIMER_IRQ);
> -               goto out;
> -       } else {
> -               for (i = 0; i < MAX_IM; i++) {
> -                       if (pending & (CAUSEF_IP2 << i)) {
> -                               ltq_hw_irqdispatch(i);
> -                               goto out;
> -                       }
> -               }
> +       int irq;
> +
> +       if (!pending) {
> +               spurious_interrupt();
> +               return;
>         }
> -       pr_alert("Spurious IRQ: CAUSE=0x%08x\n", read_c0_status());
>
> -out:
> -       return;
> +       pending >>= CAUSEB_IP;
> +       while (pending) {
> +               irq = fls(pending) - 1;
> +               do_IRQ(MIPS_CPU_IRQ_BASE + irq);
> +               pending &= ~BIT(irq);
> +       }
>  }
>
>  static int icu_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
> @@ -353,11 +354,6 @@ static const struct irq_domain_ops irq_domain_ops = {
>         .map = icu_map,
>  };
>
> -static struct irqaction cascade = {
> -       .handler = no_action,
> -       .name = "cascade",
> -};
> -
>  int __init icu_of_init(struct device_node *node, struct device_node *parent)
>  {
>         struct device_node *eiu_node;
> @@ -413,7 +409,7 @@ int __init icu_of_init(struct device_node *node, struct device_node *parent)
>         mips_cpu_irq_init();
>
>         for (i = 0; i < MAX_IM; i++)
> -               setup_irq(i + 2, &cascade);
> +               irq_set_chained_handler(i + 2, ltq_hw_irq_handler);
>
>         if (cpu_has_vint) {
>                 pr_info("Setting up vectored interrupts\n");
> --
> 2.12.2
>

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

* Re: [patch added to 3.12-stable] MIPS: Lantiq: Fix cascaded IRQ setup
  2017-04-10 13:07   ` Amit Pundir
@ 2017-04-10 13:09     ` Jiri Slaby
  0 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 13:09 UTC (permalink / raw)
  To: Amit Pundir; +Cc: stable, Felix Fietkau, linux-mips, James Hogan

On 04/10/2017, 03:07 PM, Amit Pundir wrote:
> Hi Jiri,
> 
> On 10 April 2017 at 18:29, Jiri Slaby <jslaby@suse.cz> wrote:
>> From: Felix Fietkau <nbd@nbd.name>
>>
>> This patch has been added to the 3.12 stable tree. If you have any
>> objections, please let us know.
>>
>> ===============
>>
>> commit 6c356eda225e3ee134ed4176b9ae3a76f793f4dd upstream.
>>
>> With the IRQ stack changes integrated, the XRX200 devices started
>> emitting a constant stream of kernel messages like this:
>>
>> [  565.415310] Spurious IRQ: CAUSE=0x1100c300
>>
>> This is caused by IP0 getting handled by plat_irq_dispatch() rather than
>> its vectored interrupt handler, which is fixed by commit de856416e714
>> ("MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch").
>>
>> Fix plat_irq_dispatch() to handle non-vectored IPI interrupts correctly
>> by setting up IP2-6 as proper chained IRQ handlers and calling do_IRQ
>> for all MIPS CPU interrupts.
>>
>> Signed-off-by: Felix Fietkau <nbd@nbd.name>
>> Acked-by: John Crispin <john@phrozen.org>
>> Cc: linux-mips@linux-mips.org
>> Patchwork: https://patchwork.linux-mips.org/patch/15077/
>> [james.hogan@imgtec.com: tweaked commit message]
>> Signed-off-by: James Hogan <james.hogan@imgtec.com>
>> Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
> 
> Just to let you know that I cherry-picked this patch from LEDE source
> for 4.4 and 4.9 stable but James pointed out that this patch fixes a
> Mips IRQ bug introduced in later (4.10+) kernels. So we dropped it
> from 4.4 and 4.9 plan as such. Thanks.

Dropped too. Thanks!


-- 
js
suse labs

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

* Re: [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA)
  2017-04-10 12:59 ` [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA) Jiri Slaby
@ 2017-04-10 13:47   ` Richard Genoud
  2017-04-10 15:30     ` Jiri Slaby
  0 siblings, 1 reply; 57+ messages in thread
From: Richard Genoud @ 2017-04-10 13:47 UTC (permalink / raw)
  To: Jiri Slaby, stable

On 10/04/2017 14:59, Jiri Slaby wrote:
> From: Richard Genoud <richard.genoud@gmail.com>
> 
> This patch has been added to the 3.12 stable tree. If you have any
> objections, please let us know.
> 
> ===============
> 
> commit 31ca2c63fdc0aee725cbd4f207c1256f5deaabde upstream.
> 
> If uart_flush_buffer() is called between atmel_tx_dma() and
> atmel_complete_tx_dma(), the circular buffer has been cleared, but not
> atmel_port->tx_len.
> That leads to a circular buffer overflow (dumping (UART_XMIT_SIZE -
> atmel_port->tx_len) bytes).
> 
> Tested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  drivers/tty/serial/atmel_serial.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index ab2e22bf54fd..0e0023f7c18d 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -1690,6 +1690,11 @@ static void atmel_flush_buffer(struct uart_port *port)
>  		UART_PUT_TCR(port, 0);
>  		atmel_port->pdc_tx.ofs = 0;
>  	}
> +	/*
> +	 * in uart_flush_buffer(), the xmit circular buffer has just
> +	 * been cleared, so we have to reset tx_len accordingly.
> +	 */
> +	atmel_port->tx_len = 0;
>  }
>  
>  /*
> 
Hi,
This won't compile on 3.12 kernel since ->tx_len doesn't exist yet.

Here is the backported version of this patch:
Thanks !
======================

commit 31ca2c63fdc0aee725cbd4f207c1256f5deaabde upstream.

If uart_flush_buffer() is called between atmel_tx_dma() and
atmel_complete_tx_dma(), the circular buffer has been cleared, but not
atmel_port->tx_len.
That leads to a circular buffer overflow (dumping (UART_XMIT_SIZE -
atmel_port->tx_len) bytes).

Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/tty/serial/atmel_serial.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c
b/drivers/tty/serial/atmel_serial.c
index ab2e22bf54fd..04a809284d63 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1690,6 +1690,11 @@ static void atmel_flush_buffer(struct uart_port
*port)
 		UART_PUT_TCR(port, 0);
 		atmel_port->pdc_tx.ofs = 0;
 	}
+	/*
+	 * in uart_flush_buffer(), the xmit circular buffer has just
+	 * been cleared, so we have to reset its length accordingly.
+	 */
+	sg_dma_len(&atmel_port->sg_tx) = 0;
 }

 /*

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

* Re: [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA)
  2017-04-10 13:47   ` Richard Genoud
@ 2017-04-10 15:30     ` Jiri Slaby
  0 siblings, 0 replies; 57+ messages in thread
From: Jiri Slaby @ 2017-04-10 15:30 UTC (permalink / raw)
  To: Richard Genoud, stable

On 04/10/2017, 03:47 PM, Richard Genoud wrote:
> On 10/04/2017 14:59, Jiri Slaby wrote:
>> From: Richard Genoud <richard.genoud@gmail.com>
>>
>> This patch has been added to the 3.12 stable tree. If you have any
>> objections, please let us know.
>>
>> ===============
>>
>> commit 31ca2c63fdc0aee725cbd4f207c1256f5deaabde upstream.
>>
>> If uart_flush_buffer() is called between atmel_tx_dma() and
>> atmel_complete_tx_dma(), the circular buffer has been cleared, but not
>> atmel_port->tx_len.
>> That leads to a circular buffer overflow (dumping (UART_XMIT_SIZE -
>> atmel_port->tx_len) bytes).
>>
>> Tested-by: Nicolas Ferre <nicolas.ferre@microchip.com>
>> Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
>> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
>> ---
>>  drivers/tty/serial/atmel_serial.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
>> index ab2e22bf54fd..0e0023f7c18d 100644
>> --- a/drivers/tty/serial/atmel_serial.c
>> +++ b/drivers/tty/serial/atmel_serial.c
>> @@ -1690,6 +1690,11 @@ static void atmel_flush_buffer(struct uart_port *port)
>>  		UART_PUT_TCR(port, 0);
>>  		atmel_port->pdc_tx.ofs = 0;
>>  	}
>> +	/*
>> +	 * in uart_flush_buffer(), the xmit circular buffer has just
>> +	 * been cleared, so we have to reset tx_len accordingly.
>> +	 */
>> +	atmel_port->tx_len = 0;
>>  }
>>  
>>  /*
>>
> Hi,
> This won't compile on 3.12 kernel since ->tx_len doesn't exist yet.
> 
> Here is the backported version of this patch:

Ok, in the meantime I dropped it and now applied the backport. Thanks!

-- 
js
suse labs

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

end of thread, other threads:[~2017-04-10 15:30 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-10 12:58 [patch added to 3.12-stable] Input: i8042 - add noloop quirk for Dell Embedded Box PC 3000 Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: iforce - validate number of endpoints before using them Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: ims-pcu " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: hanwang " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: yealink " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: cm109 " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] Input: kbtab " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] ALSA: seq: Fix racy cell insertions during snd_seq_pool_done() Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: serial: option: add Quectel UC15, UC20, EC21, and EC25 modems Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: serial: qcserial: add Dell DW5811e Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] ACM gadget: fix endianness in notifications Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] usb-core: Add LINEAR_FRAME_INTR_BINTERVAL USB quirk Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: uss720: fix NULL-deref at probe Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: idmouse: " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] USB: wusbcore: " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] usb: hub: Fix crash after failure to read BOS descriptor Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] uwb: i1480-dfu: fix NULL-deref at probe Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] uwb: hwa-rc: " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] mmc: ushc: " Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] ext4: mark inode dirty after converting inline directory Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] mmc: sdhci: Do not disable interrupts while waiting for clock Jiri Slaby
2017-04-10 12:58 ` [patch added to 3.12-stable] nl80211: fix dumpit error path RTNL deadlocks Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] USB: usbtmc: add missing endpoint sanity check Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] xfs: clear _XBF_PAGES from buffers when readahead page Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] block: allow WRITE_SAME commands with the SG_IO ioctl Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] uvcvideo: uvc_scan_fallback() for webcams with broken chain Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] fbcon: Fix vc attr at deinit Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] crypto: algif_hash - avoid zero-sized array Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] virtio_balloon: init 1st buffer in stats vq Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] sparc/ptrace: Preserve previous registers for short regset write Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: " Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] metag/ptrace: Reject partial NT_METAG_RPIPE writes Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] sched/rt: Add a missing rescheduling point Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] libceph: force GFP_NOIO for socket allocations Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] scsi: mpt3sas: fix hang on ata passthrough commands Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] scsi: libsas: fix ata xfer length Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] ALSA: seq: Fix race during FIFO resize Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] ACPI: Fix incompatibility with mcount-based function graph tracing Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] tty/serial: atmel: fix race condition (TX+DMA) Jiri Slaby
2017-04-10 13:47   ` Richard Genoud
2017-04-10 15:30     ` Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] USB: fix linked-list corruption in rh_call_control() Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] KVM: x86: clear bus pointer when destroyed Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd() Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] MIPS: Lantiq: Fix cascaded IRQ setup Jiri Slaby
2017-04-10 13:07   ` Amit Pundir
2017-04-10 13:09     ` Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: fix reading out alarm Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: make sure all members in the output are set Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: implement reset routine as suggested by the reference Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] rtc: s35390a: improve irq handling Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] KVM: kvm_io_bus_unregister_dev() should never fail Jiri Slaby
2017-04-10 12:59 ` [patch added to 3.12-stable] padata: avoid race in reordering Jiri Slaby

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