All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch added to 3.12-stable] rtc: tegra: Implement clock handling
@ 2017-05-03 12:22 Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] mm: Tighten x86 /dev/mem with zeroing reads Jiri Slaby
                   ` (47 more replies)
  0 siblings, 48 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Thierry Reding, Alexandre Belloni, Ben Hutchings, Jiri Slaby

From: Thierry Reding <treding@nvidia.com>

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

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

commit 5fa4086987506b2ab8c92f8f99f2295db9918856 upstream.

Accessing the registers of the RTC block on Tegra requires the module
clock to be enabled. This only works because the RTC module clock will
be enabled by default during early boot. However, because the clock is
unused, the CCF will disable it at late_init time. This causes the RTC
to become unusable afterwards. This can easily be reproduced by trying
to use the RTC:

	$ hwclock --rtc /dev/rtc1

This will hang the system. I ran into this by following up on a report
by Martin Michlmayr that reboot wasn't working on Tegra210 systems. It
turns out that the rtc-tegra driver's ->shutdown() implementation will
hang the CPU, because of the disabled clock, before the system can be
rebooted.

What confused me for a while is that the same driver is used on prior
Tegra generations where the hang can not be observed. However, as Peter
De Schrijver pointed out, this is because on 32-bit Tegra chips the RTC
clock is enabled by the tegra20_timer.c clocksource driver, which uses
the RTC to provide a persistent clock. This code is never enabled on
64-bit Tegra because the persistent clock infrastructure does not exist
on 64-bit ARM.

The proper fix for this is to add proper clock handling to the RTC
driver in order to ensure that the clock is enabled when the driver
requires it. All device trees contain the clock already, therefore
no additional changes are required.

Reported-by: Martin Michlmayr <tbm@cyrius.com>
Acked-By Peter De Schrijver <pdeschrijver@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
[bwh: Backported to 4.9: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/rtc/rtc-tegra.c | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-tegra.c b/drivers/rtc/rtc-tegra.c
index 76af92ad5a8a..1a79a5f20f67 100644
--- a/drivers/rtc/rtc-tegra.c
+++ b/drivers/rtc/rtc-tegra.c
@@ -18,6 +18,7 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 #include <linux/kernel.h>
+#include <linux/clk.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/slab.h>
@@ -59,6 +60,7 @@ struct tegra_rtc_info {
 	struct platform_device	*pdev;
 	struct rtc_device	*rtc_dev;
 	void __iomem		*rtc_base; /* NULL if not initialized. */
+	struct clk		*clk;
 	int			tegra_rtc_irq; /* alarm and periodic irq */
 	spinlock_t		tegra_rtc_lock;
 };
@@ -330,6 +332,14 @@ static int __init tegra_rtc_probe(struct platform_device *pdev)
 	if (info->tegra_rtc_irq <= 0)
 		return -EBUSY;
 
+	info->clk = devm_clk_get(&pdev->dev, NULL);
+	if (IS_ERR(info->clk))
+		return PTR_ERR(info->clk);
+
+	ret = clk_prepare_enable(info->clk);
+	if (ret < 0)
+		return ret;
+
 	/* set context info. */
 	info->pdev = pdev;
 	spin_lock_init(&info->tegra_rtc_lock);
@@ -350,7 +360,7 @@ static int __init tegra_rtc_probe(struct platform_device *pdev)
 		ret = PTR_ERR(info->rtc_dev);
 		dev_err(&pdev->dev, "Unable to register device (err=%d).\n",
 			ret);
-		return ret;
+		goto disable_clk;
 	}
 
 	ret = devm_request_irq(&pdev->dev, info->tegra_rtc_irq,
@@ -360,12 +370,25 @@ static int __init tegra_rtc_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev,
 			"Unable to request interrupt for device (err=%d).\n",
 			ret);
-		return ret;
+		goto disable_clk;
 	}
 
 	dev_notice(&pdev->dev, "Tegra internal Real Time Clock\n");
 
 	return 0;
+
+disable_clk:
+	clk_disable_unprepare(info->clk);
+	return ret;
+}
+
+static int tegra_rtc_remove(struct platform_device *pdev)
+{
+	struct tegra_rtc_info *info = platform_get_drvdata(pdev);
+
+	clk_disable_unprepare(info->clk);
+
+	return 0;
 }
 
 #ifdef CONFIG_PM_SLEEP
@@ -417,6 +440,7 @@ static void tegra_rtc_shutdown(struct platform_device *pdev)
 
 MODULE_ALIAS("platform:tegra_rtc");
 static struct platform_driver tegra_rtc_driver = {
+	.remove		= tegra_rtc_remove,
 	.shutdown	= tegra_rtc_shutdown,
 	.driver		= {
 		.name	= "tegra_rtc",
-- 
2.12.2

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

* [patch added to 3.12-stable] mm: Tighten x86 /dev/mem with zeroing reads
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] virtio-console: avoid DMA from stack Jiri Slaby
                   ` (46 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Kees Cook, Brad Spengler, Jiri Slaby

From: Kees Cook <keescook@chromium.org>

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

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

commit a4866aa812518ed1a37d8ea0c881dc946409de94 upstream.

Under CONFIG_STRICT_DEVMEM, reading System RAM through /dev/mem is
disallowed. However, on x86, the first 1MB was always allowed for BIOS
and similar things, regardless of it actually being System RAM. It was
possible for heap to end up getting allocated in low 1MB RAM, and then
read by things like x86info or dd, which would trip hardened usercopy:

usercopy: kernel memory exposure attempt detected from ffff880000090000 (dma-kmalloc-256) (4096 bytes)

This changes the x86 exception for the low 1MB by reading back zeros for
System RAM areas instead of blindly allowing them. More work is needed to
extend this to mmap, but currently mmap doesn't go through usercopy, so
hardened usercopy won't Oops the kernel.

Reported-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Tested-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/mm/init.c | 41 +++++++++++++++++++--------
 drivers/char/mem.c | 82 ++++++++++++++++++++++++++++++++++--------------------
 2 files changed, 82 insertions(+), 41 deletions(-)

diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 04664cdb7fda..bee0b8b77beb 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -475,21 +475,40 @@ void __init init_mem_mapping(void)
  * devmem_is_allowed() checks to see if /dev/mem access to a certain address
  * is valid. The argument is a physical page number.
  *
- *
- * On x86, access has to be given to the first megabyte of ram because that area
- * contains bios code and data regions used by X and dosemu and similar apps.
- * Access has to be given to non-kernel-ram areas as well, these contain the PCI
- * mmio resources as well as potential bios/acpi data regions.
+ * On x86, access has to be given to the first megabyte of RAM because that
+ * area traditionally contains BIOS code and data regions used by X, dosemu,
+ * and similar apps. Since they map the entire memory range, the whole range
+ * must be allowed (for mapping), but any areas that would otherwise be
+ * disallowed are flagged as being "zero filled" instead of rejected.
+ * Access has to be given to non-kernel-ram areas as well, these contain the
+ * PCI mmio resources as well as potential bios/acpi data regions.
  */
 int devmem_is_allowed(unsigned long pagenr)
 {
-	if (pagenr < 256)
-		return 1;
-	if (iomem_is_exclusive(pagenr << PAGE_SHIFT))
+	if (page_is_ram(pagenr)) {
+		/*
+		 * For disallowed memory regions in the low 1MB range,
+		 * request that the page be shown as all zeros.
+		 */
+		if (pagenr < 256)
+			return 2;
+
+		return 0;
+	}
+
+	/*
+	 * This must follow RAM test, since System RAM is considered a
+	 * restricted resource under CONFIG_STRICT_IOMEM.
+	 */
+	if (iomem_is_exclusive(pagenr << PAGE_SHIFT)) {
+		/* Low 1MB bypasses iomem restrictions. */
+		if (pagenr < 256)
+			return 1;
+
 		return 0;
-	if (!page_is_ram(pagenr))
-		return 1;
-	return 0;
+	}
+
+	return 1;
 }
 
 void free_init_pages(char *what, unsigned long begin, unsigned long end)
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index ea424a261fff..f8f4dd84f8eb 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -60,6 +60,10 @@ static inline int valid_mmap_phys_addr_range(unsigned long pfn, size_t size)
 #endif
 
 #ifdef CONFIG_STRICT_DEVMEM
+static inline int page_is_allowed(unsigned long pfn)
+{
+	return devmem_is_allowed(pfn);
+}
 static inline int range_is_allowed(unsigned long pfn, unsigned long size)
 {
 	u64 from = ((u64)pfn) << PAGE_SHIFT;
@@ -75,6 +79,10 @@ static inline int range_is_allowed(unsigned long pfn, unsigned long size)
 	return 1;
 }
 #else
+static inline int page_is_allowed(unsigned long pfn)
+{
+	return 1;
+}
 static inline int range_is_allowed(unsigned long pfn, unsigned long size)
 {
 	return 1;
@@ -119,23 +127,31 @@ static ssize_t read_mem(struct file *file, char __user *buf,
 
 	while (count > 0) {
 		unsigned long remaining;
+		int allowed;
 
 		sz = size_inside_page(p, count);
 
-		if (!range_is_allowed(p >> PAGE_SHIFT, count))
+		allowed = page_is_allowed(p >> PAGE_SHIFT);
+		if (!allowed)
 			return -EPERM;
+		if (allowed == 2) {
+			/* Show zeros for restricted memory. */
+			remaining = clear_user(buf, sz);
+		} else {
+			/*
+			 * On ia64 if a page has been mapped somewhere as
+			 * uncached, then it must also be accessed uncached
+			 * by the kernel or data corruption may occur.
+			 */
+			ptr = xlate_dev_mem_ptr(p);
+			if (!ptr)
+				return -EFAULT;
 
-		/*
-		 * On ia64 if a page has been mapped somewhere as uncached, then
-		 * it must also be accessed uncached by the kernel or data
-		 * corruption may occur.
-		 */
-		ptr = xlate_dev_mem_ptr(p);
-		if (!ptr)
-			return -EFAULT;
+			remaining = copy_to_user(buf, ptr, sz);
+
+			unxlate_dev_mem_ptr(p, ptr);
+		}
 
-		remaining = copy_to_user(buf, ptr, sz);
-		unxlate_dev_mem_ptr(p, ptr);
 		if (remaining)
 			return -EFAULT;
 
@@ -178,30 +194,36 @@ static ssize_t write_mem(struct file *file, const char __user *buf,
 #endif
 
 	while (count > 0) {
+		int allowed;
+
 		sz = size_inside_page(p, count);
 
-		if (!range_is_allowed(p >> PAGE_SHIFT, sz))
+		allowed = page_is_allowed(p >> PAGE_SHIFT);
+		if (!allowed)
 			return -EPERM;
 
-		/*
-		 * On ia64 if a page has been mapped somewhere as uncached, then
-		 * it must also be accessed uncached by the kernel or data
-		 * corruption may occur.
-		 */
-		ptr = xlate_dev_mem_ptr(p);
-		if (!ptr) {
-			if (written)
-				break;
-			return -EFAULT;
-		}
+		/* Skip actual writing when a page is marked as restricted. */
+		if (allowed == 1) {
+			/*
+			 * On ia64 if a page has been mapped somewhere as
+			 * uncached, then it must also be accessed uncached
+			 * by the kernel or data corruption may occur.
+			 */
+			ptr = xlate_dev_mem_ptr(p);
+			if (!ptr) {
+				if (written)
+					break;
+				return -EFAULT;
+			}
 
-		copied = copy_from_user(ptr, buf, sz);
-		unxlate_dev_mem_ptr(p, ptr);
-		if (copied) {
-			written += sz - copied;
-			if (written)
-				break;
-			return -EFAULT;
+			copied = copy_from_user(ptr, buf, sz);
+			unxlate_dev_mem_ptr(p, ptr);
+			if (copied) {
+				written += sz - copied;
+				if (written)
+					break;
+				return -EFAULT;
+			}
 		}
 
 		buf += sz;
-- 
2.12.2

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

* [patch added to 3.12-stable] virtio-console: avoid DMA from stack
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] mm: Tighten x86 /dev/mem with zeroing reads Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] pegasus: Use heap buffers for all register access Jiri Slaby
                   ` (45 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable
  Cc: Omar Sandoval, Michael S . Tsirkin, Ben Hutchings, Brad Spengler,
	Jiri Slaby

From: Omar Sandoval <osandov@fb.com>

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

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

commit c4baad50297d84bde1a7ad45e50c73adae4a2192 upstream.

put_chars() stuffs the buffer it gets into an sg, but that buffer may be
on the stack. This breaks with CONFIG_VMAP_STACK=y (for me, it
manifested as printks getting turned into NUL bytes).

Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Amit Shah <amit.shah@redhat.com>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/char/virtio_console.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 15a3ec940723..55d8b073cc61 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -1130,6 +1130,8 @@ static int put_chars(u32 vtermno, const char *buf, int count)
 {
 	struct port *port;
 	struct scatterlist sg[1];
+	void *data;
+	int ret;
 
 	if (unlikely(early_put_chars))
 		return early_put_chars(vtermno, buf, count);
@@ -1138,8 +1140,14 @@ static int put_chars(u32 vtermno, const char *buf, int count)
 	if (!port)
 		return -EPIPE;
 
-	sg_init_one(sg, buf, count);
-	return __send_to_port(port, sg, 1, count, (void *)buf, false);
+	data = kmemdup(buf, count, GFP_ATOMIC);
+	if (!data)
+		return -ENOMEM;
+
+	sg_init_one(sg, data, count);
+	ret = __send_to_port(port, sg, 1, count, data, false);
+	kfree(data);
+	return ret;
 }
 
 /*
-- 
2.12.2

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

* [patch added to 3.12-stable] pegasus: Use heap buffers for all register access
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] mm: Tighten x86 /dev/mem with zeroing reads Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] virtio-console: avoid DMA from stack Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] rtl8150: " Jiri Slaby
                   ` (44 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Ben Hutchings, David S . Miller, Brad Spengler, Jiri Slaby

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

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

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

commit 5593523f968bc86d42a035c6df47d5e0979b5ace upstream.

Allocating USB buffers on the stack is not portable, and no longer
works on x86_64 (with VMAP_STACK enabled as per default).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
References: https://bugs.debian.org/852556
Reported-by: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
Tested-by: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/usb/pegasus.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 03e8a15d7deb..f32a57ed1d13 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -126,40 +126,61 @@ static void async_ctrl_callback(struct urb *urb)
 
 static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data)
 {
+	u8 *buf;
 	int ret;
 
+	buf = kmalloc(size, GFP_NOIO);
+	if (!buf)
+		return -ENOMEM;
+
 	ret = usb_control_msg(pegasus->usb, usb_rcvctrlpipe(pegasus->usb, 0),
 			      PEGASUS_REQ_GET_REGS, PEGASUS_REQT_READ, 0,
-			      indx, data, size, 1000);
+			      indx, buf, size, 1000);
 	if (ret < 0)
 		netif_dbg(pegasus, drv, pegasus->net,
 			  "%s returned %d\n", __func__, ret);
+	else if (ret <= size)
+		memcpy(data, buf, ret);
+	kfree(buf);
 	return ret;
 }
 
-static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data)
+static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
+			 const void *data)
 {
+	u8 *buf;
 	int ret;
 
+	buf = kmemdup(data, size, GFP_NOIO);
+	if (!buf)
+		return -ENOMEM;
+
 	ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0),
 			      PEGASUS_REQ_SET_REGS, PEGASUS_REQT_WRITE, 0,
-			      indx, data, size, 100);
+			      indx, buf, size, 100);
 	if (ret < 0)
 		netif_dbg(pegasus, drv, pegasus->net,
 			  "%s returned %d\n", __func__, ret);
+	kfree(buf);
 	return ret;
 }
 
 static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data)
 {
+	u8 *buf;
 	int ret;
 
+	buf = kmemdup(&data, 1, GFP_NOIO);
+	if (!buf)
+		return -ENOMEM;
+
 	ret = usb_control_msg(pegasus->usb, usb_sndctrlpipe(pegasus->usb, 0),
 			      PEGASUS_REQ_SET_REG, PEGASUS_REQT_WRITE, data,
-			      indx, &data, 1, 1000);
+			      indx, buf, 1, 1000);
 	if (ret < 0)
 		netif_dbg(pegasus, drv, pegasus->net,
 			  "%s returned %d\n", __func__, ret);
+	kfree(buf);
 	return ret;
 }
 
-- 
2.12.2

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

* [patch added to 3.12-stable] rtl8150: Use heap buffers for all register access
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (2 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] pegasus: Use heap buffers for all register access Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] catc: Combine failure cleanup code in catc_probe() Jiri Slaby
                   ` (43 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Ben Hutchings, David S . Miller, Brad Spengler, Jiri Slaby

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

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

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

commit 7926aff5c57b577ab0f43364ff0c59d968f6a414 upstream.

Allocating USB buffers on the stack is not portable, and no longer
works on x86_64 (with VMAP_STACK enabled as per default).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/usb/rtl8150.c | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 6cbdac67f3a0..59d6a3a5830a 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -156,16 +156,36 @@ static const char driver_name [] = "rtl8150";
 */
 static int get_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
 {
-	return usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
-			       RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
-			       indx, 0, data, size, 500);
+	void *buf;
+	int ret;
+
+	buf = kmalloc(size, GFP_NOIO);
+	if (!buf)
+		return -ENOMEM;
+
+	ret = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
+			      RTL8150_REQ_GET_REGS, RTL8150_REQT_READ,
+			      indx, 0, buf, size, 500);
+	if (ret > 0 && ret <= size)
+		memcpy(data, buf, ret);
+	kfree(buf);
+	return ret;
 }
 
-static int set_registers(rtl8150_t * dev, u16 indx, u16 size, void *data)
+static int set_registers(rtl8150_t * dev, u16 indx, u16 size, const void *data)
 {
-	return usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
-			       RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
-			       indx, 0, data, size, 500);
+	void *buf;
+	int ret;
+
+	buf = kmemdup(data, size, GFP_NOIO);
+	if (!buf)
+		return -ENOMEM;
+
+	ret = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
+			      RTL8150_REQ_SET_REGS, RTL8150_REQT_WRITE,
+			      indx, 0, buf, size, 500);
+	kfree(buf);
+	return ret;
 }
 
 static void async_set_reg_cb(struct urb *urb)
-- 
2.12.2

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

* [patch added to 3.12-stable] catc: Combine failure cleanup code in catc_probe()
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (3 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] rtl8150: " Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] catc: Use heap buffer for memory size test Jiri Slaby
                   ` (42 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Ben Hutchings, David S . Miller, Jiri Slaby

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

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

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

commit d41149145f98fe26dcd0bfd1d6cc095e6e041418 upstream.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/usb/catc.c | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 8d5cac2d8e33..bf6e083a9574 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -779,7 +779,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	struct net_device *netdev;
 	struct catc *catc;
 	u8 broadcast[6];
-	int i, pktsz;
+	int i, pktsz, ret;
 
 	if (usb_set_interface(usbdev,
 			intf->altsetting->desc.bInterfaceNumber, 1)) {
@@ -814,12 +814,8 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	if ((!catc->ctrl_urb) || (!catc->tx_urb) || 
 	    (!catc->rx_urb) || (!catc->irq_urb)) {
 		dev_err(&intf->dev, "No free urbs available.\n");
-		usb_free_urb(catc->ctrl_urb);
-		usb_free_urb(catc->tx_urb);
-		usb_free_urb(catc->rx_urb);
-		usb_free_urb(catc->irq_urb);
-		free_netdev(netdev);
-		return -ENOMEM;
+		ret = -ENOMEM;
+		goto fail_free;
 	}
 
 	/* The F5U011 has the same vendor/product as the netmate but a device version of 0x130 */
@@ -916,16 +912,21 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	usb_set_intfdata(intf, catc);
 
 	SET_NETDEV_DEV(netdev, &intf->dev);
-	if (register_netdev(netdev) != 0) {
-		usb_set_intfdata(intf, NULL);
-		usb_free_urb(catc->ctrl_urb);
-		usb_free_urb(catc->tx_urb);
-		usb_free_urb(catc->rx_urb);
-		usb_free_urb(catc->irq_urb);
-		free_netdev(netdev);
-		return -EIO;
-	}
+	ret = register_netdev(netdev);
+	if (ret)
+		goto fail_clear_intfdata;
+
 	return 0;
+
+fail_clear_intfdata:
+	usb_set_intfdata(intf, NULL);
+fail_free:
+	usb_free_urb(catc->ctrl_urb);
+	usb_free_urb(catc->tx_urb);
+	usb_free_urb(catc->rx_urb);
+	usb_free_urb(catc->irq_urb);
+	free_netdev(netdev);
+	return ret;
 }
 
 static void catc_disconnect(struct usb_interface *intf)
-- 
2.12.2

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

* [patch added to 3.12-stable] catc: Use heap buffer for memory size test
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (4 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] catc: Combine failure cleanup code in catc_probe() Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] net: ipv6: check route protocol when deleting routes Jiri Slaby
                   ` (41 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Ben Hutchings, David S . Miller, Brad Spengler, Jiri Slaby

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

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

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

commit 2d6a0e9de03ee658a9adc3bfb2f0ca55dff1e478 upstream.

Allocating USB buffers on the stack is not portable, and no longer
works on x86_64 (with VMAP_STACK enabled as per default).

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/usb/catc.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index bf6e083a9574..57da4c10c695 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -779,7 +779,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	struct net_device *netdev;
 	struct catc *catc;
 	u8 broadcast[6];
-	int i, pktsz, ret;
+	int pktsz, ret;
 
 	if (usb_set_interface(usbdev,
 			intf->altsetting->desc.bInterfaceNumber, 1)) {
@@ -843,15 +843,24 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
                 catc->irq_buf, 2, catc_irq_done, catc, 1);
 
 	if (!catc->is_f5u011) {
+		u32 *buf;
+		int i;
+
 		dev_dbg(dev, "Checking memory size\n");
 
-		i = 0x12345678;
-		catc_write_mem(catc, 0x7a80, &i, 4);
-		i = 0x87654321;	
-		catc_write_mem(catc, 0xfa80, &i, 4);
-		catc_read_mem(catc, 0x7a80, &i, 4);
+		buf = kmalloc(4, GFP_KERNEL);
+		if (!buf) {
+			ret = -ENOMEM;
+			goto fail_free;
+		}
+
+		*buf = 0x12345678;
+		catc_write_mem(catc, 0x7a80, buf, 4);
+		*buf = 0x87654321;
+		catc_write_mem(catc, 0xfa80, buf, 4);
+		catc_read_mem(catc, 0x7a80, buf, 4);
 	  
-		switch (i) {
+		switch (*buf) {
 		case 0x12345678:
 			catc_set_reg(catc, TxBufCount, 8);
 			catc_set_reg(catc, RxBufCount, 32);
@@ -866,6 +875,8 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 			dev_dbg(dev, "32k Memory\n");
 			break;
 		}
+
+		kfree(buf);
 	  
 		dev_dbg(dev, "Getting MAC from SEEROM.\n");
 	  
-- 
2.12.2

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

* [patch added to 3.12-stable] net: ipv6: check route protocol when deleting routes
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (5 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] catc: Use heap buffer for memory size test Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: Disallow keyrings beginning with '.' to be joined as session keyrings Jiri Slaby
                   ` (40 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Mantas M, David S . Miller, Ben Hutchings, Jiri Slaby

From: Mantas M <grawity@gmail.com>

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

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

commit c2ed1880fd61a998e3ce40254a99a2ad000f1a7d upstream.

The protocol field is checked when deleting IPv4 routes, but ignored for
IPv6, which causes problems with routing daemons accidentally deleting
externally set routes (observed by multiple bird6 users).

This can be verified using `ip -6 route del <prefix> proto something`.

Signed-off-by: Mantas Mikulėnas <grawity@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv6/route.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index e19817a090c7..a4238c684a91 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1754,6 +1754,8 @@ static int ip6_route_del(struct fib6_config *cfg)
 				continue;
 			if (cfg->fc_metric && cfg->fc_metric != rt->rt6i_metric)
 				continue;
+			if (cfg->fc_protocol && cfg->fc_protocol != rt->rt6i_protocol)
+				continue;
 			dst_hold(&rt->dst);
 			read_unlock_bh(&table->tb6_lock);
 
-- 
2.12.2

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

* [patch added to 3.12-stable] KEYS: Disallow keyrings beginning with '.' to be joined as session keyrings
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (6 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] net: ipv6: check route protocol when deleting routes Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: Change the name of the dead type to ".dead" to prevent user access Jiri Slaby
                   ` (39 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: David Howells, linux-ima-devel, Jiri Slaby

From: David Howells <dhowells@redhat.com>

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

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

commit ee8f844e3c5a73b999edf733df1c529d6503ec2f upstream.

This fixes CVE-2016-9604.

Keyrings whose name begin with a '.' are special internal keyrings and so
userspace isn't allowed to create keyrings by this name to prevent
shadowing.  However, the patch that added the guard didn't fix
KEYCTL_JOIN_SESSION_KEYRING.  Not only can that create dot-named keyrings,
it can also subscribe to them as a session keyring if they grant SEARCH
permission to the user.

This, for example, allows a root process to set .builtin_trusted_keys as
its session keyring, at which point it has full access because now the
possessor permissions are added.  This permits root to add extra public
keys, thereby bypassing module verification.

This also affects kexec and IMA.

This can be tested by (as root):

	keyctl session .builtin_trusted_keys
	keyctl add user a a @s
	keyctl list @s

which on my test box gives me:

	2 keys in keyring:
	180010936: ---lswrv     0     0 asymmetric: Build time autogenerated kernel key: ae3d4a31b82daa8e1a75b49dc2bba949fd992a05
	801382539: --alswrv     0     0 user: a


Fix this by rejecting names beginning with a '.' in the keyctl.

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
cc: linux-ima-devel@lists.sourceforge.net
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 security/keys/keyctl.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 3242195bfa95..1324b2e10286 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -271,7 +271,8 @@ error:
  * Create and join an anonymous session keyring or join a named session
  * keyring, creating it if necessary.  A named session keyring must have Search
  * permission for it to be joined.  Session keyrings without this permit will
- * be skipped over.
+ * be skipped over.  It is not permitted for userspace to create or join
+ * keyrings whose name begin with a dot.
  *
  * If successful, the ID of the joined session keyring will be returned.
  */
@@ -288,12 +289,16 @@ long keyctl_join_session_keyring(const char __user *_name)
 			ret = PTR_ERR(name);
 			goto error;
 		}
+
+		ret = -EPERM;
+		if (name[0] == '.')
+			goto error_name;
 	}
 
 	/* join the session */
 	ret = join_session_keyring(name);
+error_name:
 	kfree(name);
-
 error:
 	return ret;
 }
-- 
2.12.2

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

* [patch added to 3.12-stable] KEYS: Change the name of the dead type to ".dead" to prevent user access
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (7 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: Disallow keyrings beginning with '.' to be joined as session keyrings Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings Jiri Slaby
                   ` (38 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: David Howells, Jiri Slaby

From: David Howells <dhowells@redhat.com>

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

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

commit c1644fe041ebaf6519f6809146a77c3ead9193af upstream.

This fixes CVE-2017-6951.

Userspace should not be able to do things with the "dead" key type as it
doesn't have some of the helper functions set upon it that the kernel
needs.  Attempting to use it may cause the kernel to crash.

Fix this by changing the name of the type to ".dead" so that it's rejected
up front on userspace syscalls by key_get_type_from_user().

Though this doesn't seem to affect recent kernels, it does affect older
ones, certainly those prior to:

	commit c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81
	Author: David Howells <dhowells@redhat.com>
	Date:   Tue Sep 16 17:36:06 2014 +0100
	KEYS: Remove key_type::match in favour of overriding default by match_preparse

which went in before 3.18-rc1.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 security/keys/gc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/security/keys/gc.c b/security/keys/gc.c
index de34c290bd6f..2e01e23295aa 100644
--- a/security/keys/gc.c
+++ b/security/keys/gc.c
@@ -46,7 +46,7 @@ static unsigned long key_gc_flags;
  * immediately unlinked.
  */
 struct key_type key_type_dead = {
-	.name = "dead",
+	.name = ".dead",
 };
 
 /*
-- 
2.12.2

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

* [patch added to 3.12-stable] KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (8 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: Change the name of the dead type to ".dead" to prevent user access Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] tracing: Allocate the snapshot buffer before enabling probe Jiri Slaby
                   ` (37 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Eric Biggers, David Howells, 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 c9f838d104fed6f2f61d68164712e3204bf5271b upstream.

This fixes CVE-2017-7472.

Running the following program as an unprivileged user exhausts kernel
memory by leaking thread keyrings:

	#include <keyutils.h>

	int main()
	{
		for (;;)
			keyctl_set_reqkey_keyring(KEY_REQKEY_DEFL_THREAD_KEYRING);
	}

Fix it by only creating a new thread keyring if there wasn't one before.
To make things more consistent, make install_thread_keyring_to_cred()
and install_process_keyring_to_cred() both return 0 if the corresponding
keyring is already present.

Fixes: d84f4f992cbd ("CRED: Inaugurate COW credentials")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 security/keys/keyctl.c       | 11 ++++-------
 security/keys/process_keys.c | 44 +++++++++++++++++++++++++++-----------------
 2 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
index 1324b2e10286..066baa1926bb 100644
--- a/security/keys/keyctl.c
+++ b/security/keys/keyctl.c
@@ -1245,8 +1245,8 @@ error:
  * Read or set the default keyring in which request_key() will cache keys and
  * return the old setting.
  *
- * If a process keyring is specified then this will be created if it doesn't
- * yet exist.  The old setting will be returned if successful.
+ * If a thread or process keyring is specified then it will be created if it
+ * doesn't yet exist.  The old setting will be returned if successful.
  */
 long keyctl_set_reqkey_keyring(int reqkey_defl)
 {
@@ -1271,11 +1271,8 @@ long keyctl_set_reqkey_keyring(int reqkey_defl)
 
 	case KEY_REQKEY_DEFL_PROCESS_KEYRING:
 		ret = install_process_keyring_to_cred(new);
-		if (ret < 0) {
-			if (ret != -EEXIST)
-				goto error;
-			ret = 0;
-		}
+		if (ret < 0)
+			goto error;
 		goto set;
 
 	case KEY_REQKEY_DEFL_DEFAULT:
diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c
index cd871dc8b7c0..33384662fc82 100644
--- a/security/keys/process_keys.c
+++ b/security/keys/process_keys.c
@@ -125,13 +125,18 @@ error:
 }
 
 /*
- * Install a fresh thread keyring directly to new credentials.  This keyring is
- * allowed to overrun the quota.
+ * Install a thread keyring to the given credentials struct if it didn't have
+ * one already.  This is allowed to overrun the quota.
+ *
+ * Return: 0 if a thread keyring is now present; -errno on failure.
  */
 int install_thread_keyring_to_cred(struct cred *new)
 {
 	struct key *keyring;
 
+	if (new->thread_keyring)
+		return 0;
+
 	keyring = keyring_alloc("_tid", new->uid, new->gid, new,
 				KEY_POS_ALL | KEY_USR_VIEW,
 				KEY_ALLOC_QUOTA_OVERRUN, NULL);
@@ -143,7 +148,9 @@ int install_thread_keyring_to_cred(struct cred *new)
 }
 
 /*
- * Install a fresh thread keyring, discarding the old one.
+ * Install a thread keyring to the current task if it didn't have one already.
+ *
+ * Return: 0 if a thread keyring is now present; -errno on failure.
  */
 static int install_thread_keyring(void)
 {
@@ -154,8 +161,6 @@ static int install_thread_keyring(void)
 	if (!new)
 		return -ENOMEM;
 
-	BUG_ON(new->thread_keyring);
-
 	ret = install_thread_keyring_to_cred(new);
 	if (ret < 0) {
 		abort_creds(new);
@@ -166,17 +171,17 @@ static int install_thread_keyring(void)
 }
 
 /*
- * Install a process keyring directly to a credentials struct.
+ * Install a process keyring to the given credentials struct if it didn't have
+ * one already.  This is allowed to overrun the quota.
  *
- * Returns -EEXIST if there was already a process keyring, 0 if one installed,
- * and other value on any other error
+ * Return: 0 if a process keyring is now present; -errno on failure.
  */
 int install_process_keyring_to_cred(struct cred *new)
 {
 	struct key *keyring;
 
 	if (new->process_keyring)
-		return -EEXIST;
+		return 0;
 
 	keyring = keyring_alloc("_pid", new->uid, new->gid, new,
 				KEY_POS_ALL | KEY_USR_VIEW,
@@ -189,11 +194,9 @@ int install_process_keyring_to_cred(struct cred *new)
 }
 
 /*
- * Make sure a process keyring is installed for the current process.  The
- * existing process keyring is not replaced.
+ * Install a process keyring to the current task if it didn't have one already.
  *
- * Returns 0 if there is a process keyring by the end of this function, some
- * error otherwise.
+ * Return: 0 if a process keyring is now present; -errno on failure.
  */
 static int install_process_keyring(void)
 {
@@ -207,14 +210,18 @@ static int install_process_keyring(void)
 	ret = install_process_keyring_to_cred(new);
 	if (ret < 0) {
 		abort_creds(new);
-		return ret != -EEXIST ? ret : 0;
+		return ret;
 	}
 
 	return commit_creds(new);
 }
 
 /*
- * Install a session keyring directly to a credentials struct.
+ * Install the given keyring as the session keyring of the given credentials
+ * struct, replacing the existing one if any.  If the given keyring is NULL,
+ * then install a new anonymous session keyring.
+ *
+ * Return: 0 on success; -errno on failure.
  */
 int install_session_keyring_to_cred(struct cred *cred, struct key *keyring)
 {
@@ -249,8 +256,11 @@ int install_session_keyring_to_cred(struct cred *cred, struct key *keyring)
 }
 
 /*
- * Install a session keyring, discarding the old one.  If a keyring is not
- * supplied, an empty one is invented.
+ * Install the given keyring as the session keyring of the current task,
+ * replacing the existing one if any.  If the given keyring is NULL, then
+ * install a new anonymous session keyring.
+ *
+ * Return: 0 on success; -errno on failure.
  */
 static int install_session_keyring(struct key *keyring)
 {
-- 
2.12.2

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

* [patch added to 3.12-stable] tracing: Allocate the snapshot buffer before enabling probe
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (9 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] ring-buffer: Have ring_buffer_iter_empty() return true when empty Jiri Slaby
                   ` (36 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Steven Rostedt (VMware), Jiri Slaby

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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

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

commit df62db5be2e5f070ecd1a5ece5945b590ee112e0 upstream.

Currently the snapshot trigger enables the probe and then allocates the
snapshot. If the probe triggers before the allocation, it could cause the
snapshot to fail and turn tracing off. It's best to allocate the snapshot
buffer first, and then enable the trigger. If something goes wrong in the
enabling of the trigger, the snapshot buffer is still allocated, but it can
also be freed by the user by writting zero into the snapshot buffer file.

Also add a check of the return status of alloc_snapshot().

Fixes: 77fd5c15e3 ("tracing: Add snapshot trigger to function probes")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/trace/trace.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 174b9a6feea3..dbd488daec33 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5479,11 +5479,13 @@ ftrace_trace_snapshot_callback(struct ftrace_hash *hash,
 		return ret;
 
  out_reg:
-	ret = register_ftrace_function_probe(glob, ops, count);
+	ret = alloc_snapshot(&global_trace);
+	if (ret < 0)
+		goto out;
 
-	if (ret >= 0)
-		alloc_snapshot(&global_trace);
+	ret = register_ftrace_function_probe(glob, ops, count);
 
+ out:
 	return ret < 0 ? ret : 0;
 }
 
-- 
2.12.2

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

* [patch added to 3.12-stable] ring-buffer: Have ring_buffer_iter_empty() return true when empty
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (10 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] tracing: Allocate the snapshot buffer before enabling probe Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] cifs: Do not send echoes before Negotiate is complete Jiri Slaby
                   ` (35 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Steven Rostedt (VMware), Jiri Slaby

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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

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

commit 78f7a45dac2a2d2002f98a3a95f7979867868d73 upstream.

I noticed that reading the snapshot file when it is empty no longer gives a
status. It suppose to show the status of the snapshot buffer as well as how
to allocate and use it. For example:

 ># cat snapshot
 # tracer: nop
 #
 #
 # * Snapshot is allocated *
 #
 # Snapshot commands:
 # echo 0 > snapshot : Clears and frees snapshot buffer
 # echo 1 > snapshot : Allocates snapshot buffer, if not already allocated.
 #                      Takes a snapshot of the main buffer.
 # echo 2 > snapshot : Clears snapshot buffer (but does not allocate or free)
 #                      (Doesn't have to be '2' works with any number that
 #                       is not a '0' or '1')

But instead it just showed an empty buffer:

 ># cat snapshot
 # tracer: nop
 #
 # entries-in-buffer/entries-written: 0/0   #P:4
 #
 #                              _-----=> irqs-off
 #                             / _----=> need-resched
 #                            | / _---=> hardirq/softirq
 #                            || / _--=> preempt-depth
 #                            ||| /     delay
 #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
 #              | |       |   ||||       |         |

What happened was that it was using the ring_buffer_iter_empty() function to
see if it was empty, and if it was, it showed the status. But that function
was returning false when it was empty. The reason was that the iter header
page was on the reader page, and the reader page was empty, but so was the
buffer itself. The check only tested to see if the iter was on the commit
page, but the commit page was no longer pointing to the reader page, but as
all pages were empty, the buffer is also.

Fixes: 651e22f2701b ("ring-buffer: Always reset iterator to reader page")
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/trace/ring_buffer.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 579821bd2484..c31467a6c853 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3387,11 +3387,23 @@ EXPORT_SYMBOL_GPL(ring_buffer_iter_reset);
 int ring_buffer_iter_empty(struct ring_buffer_iter *iter)
 {
 	struct ring_buffer_per_cpu *cpu_buffer;
+	struct buffer_page *reader;
+	struct buffer_page *head_page;
+	struct buffer_page *commit_page;
+	unsigned commit;
 
 	cpu_buffer = iter->cpu_buffer;
 
-	return iter->head_page == cpu_buffer->commit_page &&
-		iter->head == rb_commit_index(cpu_buffer);
+	/* Remember, trace recording is off when iterator is in use */
+	reader = cpu_buffer->reader_page;
+	head_page = cpu_buffer->head_page;
+	commit_page = cpu_buffer->commit_page;
+	commit = rb_page_commit(commit_page);
+
+	return ((iter->head_page == commit_page && iter->head == commit) ||
+		(iter->head_page == reader && commit_page == head_page &&
+		 head_page->read == commit &&
+		 iter->head == rb_page_commit(cpu_buffer->reader_page)));
 }
 EXPORT_SYMBOL_GPL(ring_buffer_iter_empty);
 
-- 
2.12.2

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

* [patch added to 3.12-stable] cifs: Do not send echoes before Negotiate is complete
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (11 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] ring-buffer: Have ring_buffer_iter_empty() return true when empty Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] CIFS: remove bad_network_name flag Jiri Slaby
                   ` (34 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Sachin Prabhu, Steve French, Jiri Slaby

From: Sachin Prabhu <sprabhu@redhat.com>

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

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

commit 62a6cfddcc0a5313e7da3e8311ba16226fe0ac10 upstream.

commit 4fcd1813e640 ("Fix reconnect to not defer smb3 session reconnect
long after socket reconnect") added support for Negotiate requests to
be initiated by echo calls.

To avoid delays in calling echo after a reconnect, I added the patch
introduced by the commit b8c600120fc8 ("Call echo service immediately
after socket reconnect").

This has however caused a regression with cifs shares which do not have
support for echo calls to trigger Negotiate requests. On connections
which need to call Negotiation, the echo calls trigger an error which
triggers a reconnect which in turn triggers another echo call. This
results in a loop which is only broken when an operation is performed on
the cifs share. For an idle share, it can DOS a server.

The patch uses the smb_operation can_echo() for cifs so that it is
called only if connection has been already been setup.

kernel bz: 194531

Signed-off-by: Sachin Prabhu <sprabhu@redhat.com>
Tested-by: Jonathan Liu <net147@gmail.com>
Acked-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/cifs/smb1ops.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 09b0323a7727..a05375be8ac2 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -953,6 +953,15 @@ cifs_dir_needs_close(struct cifsFileInfo *cfile)
 	return !cfile->srch_inf.endOfSearch && !cfile->invalidHandle;
 }
 
+static bool
+cifs_can_echo(struct TCP_Server_Info *server)
+{
+	if (server->tcpStatus == CifsGood)
+		return true;
+
+	return false;
+}
+
 struct smb_version_operations smb1_operations = {
 	.send_cancel = send_nt_cancel,
 	.compare_fids = cifs_compare_fids,
@@ -986,6 +995,7 @@ struct smb_version_operations smb1_operations = {
 	.get_dfs_refer = CIFSGetDFSRefer,
 	.qfs_tcon = cifs_qfs_tcon,
 	.is_path_accessible = cifs_is_path_accessible,
+	.can_echo = cifs_can_echo,
 	.query_path_info = cifs_query_path_info,
 	.query_file_info = cifs_query_file_info,
 	.get_srv_inum = cifs_get_srv_inum,
-- 
2.12.2

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

* [patch added to 3.12-stable] CIFS: remove bad_network_name flag
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (12 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] cifs: Do not send echoes before Negotiate is complete Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] Drivers: hv: don't leak memory in vmbus_establish_gpadl() Jiri Slaby
                   ` (33 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Germano Percossi, Steve French, Jiri Slaby

From: Germano Percossi <germano.percossi@citrix.com>

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

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

commit a0918f1ce6a43ac980b42b300ec443c154970979 upstream.

STATUS_BAD_NETWORK_NAME can be received during node failover,
causing the flag to be set and making the reconnect thread
always unsuccessful, thereafter.

Once the only place where it is set is removed, the remaining
bits are rendered moot.

Removing it does not prevent "mount" from failing when a non
existent share is passed.

What happens when the share really ceases to exist while the
share is mounted is undefined now as much as it was before.

Signed-off-by: Germano Percossi <germano.percossi@citrix.com>
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/cifs/cifsglob.h | 1 -
 fs/cifs/smb2pdu.c  | 5 -----
 2 files changed, 6 deletions(-)

diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 4b87feaa507f..1472ee04cadd 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -837,7 +837,6 @@ struct cifs_tcon {
 	bool need_reconnect:1; /* connection reset, tid now invalid */
 #ifdef CONFIG_CIFS_SMB2
 	bool print:1;		/* set if connection to printer share */
-	bool bad_network_name:1; /* set if ret status STATUS_BAD_NETWORK_NAME */
 	__le32 capabilities;
 	__u32 share_flags;
 	__u32 maximal_access;
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index c7a400415d02..79db9c46ada9 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -839,9 +839,6 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 	else
 		return -EIO;
 
-	if (tcon && tcon->bad_network_name)
-		return -ENOENT;
-
 	unc_path = kmalloc(MAX_SHARENAME_LENGTH * 2, GFP_KERNEL);
 	if (unc_path == NULL)
 		return -ENOMEM;
@@ -935,8 +932,6 @@ tcon_exit:
 tcon_error_exit:
 	if (rsp->hdr.Status == STATUS_BAD_NETWORK_NAME) {
 		cifs_dbg(VFS, "BAD_NETWORK_NAME: %s\n", tree);
-		if (tcon)
-			tcon->bad_network_name = true;
 	}
 	goto tcon_exit;
 }
-- 
2.12.2

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

* [patch added to 3.12-stable] Drivers: hv: don't leak memory in vmbus_establish_gpadl()
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (13 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] CIFS: remove bad_network_name flag Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] Drivers: hv: get rid of timeout in vmbus_open() Jiri Slaby
                   ` (32 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Vitaly Kuznetsov, K . Y . Srinivasan, Sumit Semwal, Jiri Slaby

From: Vitaly Kuznetsov <vkuznets@redhat.com>

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

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

commit 7cc80c98070ccc7940fc28811c92cca0a681015d upstream.

In some cases create_gpadl_header() allocates submessages but we never
free them.

[sumits] Note for stable:
Upstream commit 4d63763296ab7865a98bc29cc7d77145815ef89f:
(Drivers: hv: get rid of redundant messagecount in create_gpadl_header())
changes the list usage to initialize list header in all cases; that patch
isn't added to stable, so the current patch is modified a little bit from
the upstream commit to check if the list is valid or not.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hv/channel.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 120237a90a86..8cddbd10dadb 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -403,7 +403,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer,
 	struct vmbus_channel_gpadl_header *gpadlmsg;
 	struct vmbus_channel_gpadl_body *gpadl_body;
 	struct vmbus_channel_msginfo *msginfo = NULL;
-	struct vmbus_channel_msginfo *submsginfo;
+	struct vmbus_channel_msginfo *submsginfo, *tmp;
 	u32 msgcount;
 	struct list_head *curr;
 	u32 next_gpadl_handle;
@@ -465,6 +465,13 @@ cleanup:
 	list_del(&msginfo->msglistentry);
 	spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
 
+	if (msgcount > 1) {
+		list_for_each_entry_safe(submsginfo, tmp, &msginfo->submsglist,
+			 msglistentry) {
+			kfree(submsginfo);
+		}
+	}
+
 	kfree(msginfo);
 	return ret;
 }
-- 
2.12.2

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

* [patch added to 3.12-stable] Drivers: hv: get rid of timeout in vmbus_open()
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (14 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] Drivers: hv: don't leak memory in vmbus_establish_gpadl() Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] Input: elantech - add Fujitsu Lifebook E547 to force crc_enabled Jiri Slaby
                   ` (31 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Vitaly Kuznetsov, K . Y . Srinivasan, Sumit Semwal, Jiri Slaby

From: Vitaly Kuznetsov <vkuznets@redhat.com>

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

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

commit 396e287fa2ff46e83ae016cdcb300c3faa3b02f6 upstream.

vmbus_teardown_gpadl() can result in infinite wait when it is called on 5
second timeout in vmbus_open(). The issue is caused by the fact that gpadl
teardown operation won't ever succeed for an opened channel and the timeout
isn't always enough. As a guest, we can always trust the host to respond to
our request (and there is nothing we can do if it doesn't).

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hv/channel.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 8cddbd10dadb..6f1731573097 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -114,7 +114,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
 	struct vmbus_channel_msginfo *open_info = NULL;
 	void *in, *out;
 	unsigned long flags;
-	int ret, t, err = 0;
+	int ret, err = 0;
 
 	spin_lock_irqsave(&newchannel->sc_lock, flags);
 	if (newchannel->state == CHANNEL_OPEN_STATE) {
@@ -213,11 +213,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size,
 		goto error1;
 	}
 
-	t = wait_for_completion_timeout(&open_info->waitevent, 5*HZ);
-	if (t == 0) {
-		err = -ETIMEDOUT;
-		goto error1;
-	}
+	wait_for_completion(&open_info->waitevent);
 
 
 	if (open_info->response.open_result.status)
-- 
2.12.2

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

* [patch added to 3.12-stable] Input: elantech - add Fujitsu Lifebook E547 to force crc_enabled
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (15 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] Drivers: hv: get rid of timeout in vmbus_open() Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] ACPI / power: Avoid maybe-uninitialized warning Jiri Slaby
                   ` (30 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Thorsten Leemhuis, Dmitry Torokhov, Jiri Slaby

From: Thorsten Leemhuis <linux@leemhuis.info>

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

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

commit 704de489e0e3640a2ee2d0daf173e9f7375582ba upstream.

Temporary got a Lifebook E547 into my hands and noticed the touchpad
only works after running:

	echo "1" > /sys/devices/platform/i8042/serio2/crc_enabled

Add it to the list of machines that need this workaround.

Signed-off-by: Thorsten Leemhuis <linux@leemhuis.info>
Reviewed-by: Ulrik De Bie <ulrik.debie-os@e2big.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/mouse/elantech.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index a25fc40522f3..05453836edc7 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1036,6 +1036,7 @@ static int elantech_get_resolution_v4(struct psmouse *psmouse,
  * Asus UX32VD             0x361f02        00, 15, 0e      clickpad
  * Avatar AVIU-145A2       0x361f00        ?               clickpad
  * Fujitsu LIFEBOOK E544   0x470f00        d0, 12, 09      2 hw buttons
+ * Fujitsu LIFEBOOK E547   0x470f00        50, 12, 09      2 hw buttons
  * Fujitsu LIFEBOOK E554   0x570f01        40, 14, 0c      2 hw buttons
  * Gigabyte U2442          0x450f01        58, 17, 0c      2 hw buttons
  * Lenovo L430             0x350f02        b9, 15, 0c      2 hw buttons (*)
@@ -1403,6 +1404,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = {
 		},
 	},
 	{
+		/* Fujitsu LIFEBOOK E547 does not work with crc_enabled == 0 */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E547"),
+		},
+	},
+	{
 		/* Fujitsu LIFEBOOK E554  does not work with crc_enabled == 0 */
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
-- 
2.12.2

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

* [patch added to 3.12-stable] ACPI / power: Avoid maybe-uninitialized warning
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (16 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] Input: elantech - add Fujitsu Lifebook E547 to force crc_enabled Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] ubi/upd: Always flush after prepared for an update Jiri Slaby
                   ` (29 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Arnd Bergmann, Rafael J . Wysocki, Jiri Slaby

From: Arnd Bergmann <arnd@arndb.de>

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

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

commit fe8c470ab87d90e4b5115902dd94eced7e3305c3 upstream.

gcc -O2 cannot always prove that the loop in acpi_power_get_inferred_state()
is enterered at least once, so it assumes that cur_state might not get
initialized:

drivers/acpi/power.c: In function 'acpi_power_get_inferred_state':
drivers/acpi/power.c:222:9: error: 'cur_state' may be used uninitialized in this function [-Werror=maybe-uninitialized]

This sets the variable to zero at the start of the loop, to ensure that
there is well-defined behavior even for an empty list. This gets rid of
the warning.

The warning first showed up when the -Os flag got removed in a bug fix
patch in linux-4.11-rc5.

I would suggest merging this addon patch on top of that bug fix to avoid
introducing a new warning in the stable kernels.

Fixes: 61b79e16c68d (ACPI: Fix incompatibility with mcount-based function graph tracing)
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/power.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c
index c2ad391d8041..4b35a115749c 100644
--- a/drivers/acpi/power.c
+++ b/drivers/acpi/power.c
@@ -204,6 +204,7 @@ static int acpi_power_get_list_state(struct list_head *list, int *state)
 		return -EINVAL;
 
 	/* The state of the list is 'on' IFF all resources are 'on'. */
+	cur_state = 0;
 	list_for_each_entry(entry, list, node) {
 		struct acpi_power_resource *resource = entry->resource;
 		acpi_handle handle = resource->device.handle;
-- 
2.12.2

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

* [patch added to 3.12-stable] ubi/upd: Always flush after prepared for an update
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (17 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] ACPI / power: Avoid maybe-uninitialized warning Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:22 ` [patch added to 3.12-stable] x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs Jiri Slaby
                   ` (28 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Sebastian Siewior, Richard Weinberger, Jiri Slaby

From: Sebastian 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 9cd9a21ce070be8a918ffd3381468315a7a76ba6 upstream.

In commit 6afaf8a484cb ("UBI: flush wl before clearing update marker") I
managed to trigger and fix a similar bug. Now here is another version of
which I assumed it wouldn't matter back then but it turns out UBI has a
check for it and will error out like this:

|ubi0 warning: validate_vid_hdr: inconsistent used_ebs
|ubi0 error: validate_vid_hdr: inconsistent VID header at PEB 592

All you need to trigger this is? "ubiupdatevol /dev/ubi0_0 file" + a
powercut in the middle of the operation.
ubi_start_update() sets the update-marker and puts all EBs on the erase
list. After that userland can proceed to write new data while the old EB
aren't erased completely. A powercut at this point is usually not that
much of a tragedy. UBI won't give read access to the static volume
because it has the update marker. It will most likely set the corrupted
flag because it misses some EBs.
So we are all good. Unless the size of the image that has been written
differs from the old image in the magnitude of at least one EB. In that
case UBI will find two different values for `used_ebs' and refuse to
attach the image with the error message mentioned above.

So in order not to get in the situation, the patch will ensure that we
wait until everything is removed before it tries to write any data.
The alternative would be to detect such a case and remove all EBs at the
attached time after we processed the volume-table and see the
update-marker set. The patch looks bigger and I doubt it is worth it
since usually the write() will wait from time to time for a new EB since
usually there not that many spare EB that can be used.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mtd/ubi/upd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
index 0134ba32a057..39712560b4c1 100644
--- a/drivers/mtd/ubi/upd.c
+++ b/drivers/mtd/ubi/upd.c
@@ -148,11 +148,11 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
 			return err;
 	}
 
-	if (bytes == 0) {
-		err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
-		if (err)
-			return err;
+	err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
+	if (err)
+		return err;
 
+	if (bytes == 0) {
 		err = clear_update_marker(ubi, vol, 0);
 		if (err)
 			return err;
-- 
2.12.2

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

* [patch added to 3.12-stable] x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (18 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] ubi/upd: Always flush after prepared for an update Jiri Slaby
@ 2017-05-03 12:22 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd Jiri Slaby
                   ` (27 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:22 UTC (permalink / raw)
  To: stable; +Cc: Yazen Ghannam, Borislav Petkov, Thomas Gleixner, Jiri Slaby

From: Yazen Ghannam <yazen.ghannam@amd.com>

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

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

commit 29f72ce3e4d18066ec75c79c857bee0618a3504b upstream.

MCA bank 3 is reserved on systems pre-Fam17h, so it didn't have a name.
However, MCA bank 3 is defined on Fam17h systems and can be accessed
using legacy MSRs. Without a name we get a stack trace on Fam17h systems
when trying to register sysfs files for bank 3 on kernels that don't
recognize Scalable MCA.

Call MCA bank 3 "decode_unit" since this is what it represents on
Fam17h. This will allow kernels without SMCA support to see this bank on
Fam17h+ and prevent the stack trace. This will not affect older systems
since this bank is reserved on them, i.e. it'll be ignored.

Tested on AMD Fam15h and Fam17h systems.

  WARNING: CPU: 26 PID: 1 at lib/kobject.c:210 kobject_add_internal
  kobject: (ffff88085bb256c0): attempted to be registered with empty name!
  ...
  Call Trace:
   kobject_add_internal
   kobject_add
   kobject_create_and_add
   threshold_create_device
   threshold_init_device

Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1490102285-3659-1-git-send-email-Yazen.Ghannam@amd.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kernel/cpu/mcheck/mce_amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index 603df4f74640..0c05ab602815 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -51,7 +51,7 @@ static const char * const th_names[] = {
 	"load_store",
 	"insn_fetch",
 	"combined_unit",
-	"",
+	"decode_unit",
 	"northbridge",
 	"execution_unit",
 };
-- 
2.12.2

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

* [patch added to 3.12-stable] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (19 preceding siblings ...)
  2017-05-03 12:22 ` [patch added to 3.12-stable] x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:39   ` Suzuki K Poulose
  2017-05-03 12:23 ` [patch added to 3.12-stable] block: fix del_gendisk() vs blkdev_ioctl crash Jiri Slaby
                   ` (26 subsequent siblings)
  47 siblings, 1 reply; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable
  Cc: Suzuki K Poulose, Paolo Bonzini, Marc Zyngier, Christoffer Dall,
	Mark Rutland, Christoffer Dall, Jiri Slaby

From: Suzuki K Poulose <suzuki.poulose@arm.com>

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

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

commit 8b3405e345b5a098101b0c31b264c812bba045d9 upstream.

In kvm_free_stage2_pgd() we don't hold the kvm->mmu_lock while calling
unmap_stage2_range() on the entire memory range for the guest. This could
cause problems with other callers (e.g, munmap on a memslot) trying to
unmap a range. And since we have to unmap the entire Guest memory range
holding a spinlock, make sure we yield the lock if necessary, after we
unmap each PUD range.

Fixes: commit d5d8184d35c9 ("KVM: ARM: Memory virtualization setup")
Cc: Paolo Bonzini <pbonzin@redhat.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
[ Avoid vCPU starvation and lockup detector warnings ]
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Christoffer Dall <cdall@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arm/kvm/mmu.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 683cac91a7f6..65f401ddb2a7 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -240,6 +240,14 @@ static void stage2_flush_memslot(struct kvm *kvm,
 	do {
 		next = kvm_pgd_addr_end(addr, end);
 		stage2_flush_puds(kvm, pgd, addr, next);
+		/*
+		 * If we are dealing with a large range in
+		 * stage2 table, release the kvm->mmu_lock
+		 * to prevent starvation and lockup detector
+		 * warnings.
+		 */
+		if (kvm && (next != end))
+			cond_resched_lock(&kvm->mmu_lock);
 	} while (pgd++, addr = next, addr != end);
 }
 
@@ -525,6 +533,7 @@ int kvm_alloc_stage2_pgd(struct kvm *kvm)
  */
 static void unmap_stage2_range(struct kvm *kvm, phys_addr_t start, u64 size)
 {
+	assert_spin_locked(&kvm->mmu_lock);
 	unmap_range(kvm, kvm->arch.pgd, start, size);
 }
 
@@ -609,7 +618,10 @@ void kvm_free_stage2_pgd(struct kvm *kvm)
 	if (kvm->arch.pgd == NULL)
 		return;
 
+	spin_lock(&kvm->mmu_lock);
 	unmap_stage2_range(kvm, 0, KVM_PHYS_SIZE);
+	spin_unlock(&kvm->mmu_lock);
+
 	free_pages((unsigned long)kvm->arch.pgd, S2_PGD_ORDER);
 	kvm->arch.pgd = NULL;
 }
-- 
2.12.2

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

* [patch added to 3.12-stable] block: fix del_gendisk() vs blkdev_ioctl crash
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (20 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] powerpc: Reject binutils 2.24 when building little endian Jiri Slaby
                   ` (25 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Dan Williams, Jan Kara, Jens Axboe, Jiri Slaby

From: Dan Williams <dan.j.williams@intel.com>

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

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

commit ac34f15e0c6d2fd58480052b6985f6991fb53bcc upstream.

When tearing down a block device early in its lifetime, userspace may
still be performing discovery actions like blkdev_ioctl() to re-read
partitions.

The nvdimm_revalidate_disk() implementation depends on
disk->driverfs_dev to be valid at entry.  However, it is set to NULL in
del_gendisk() and fatally this is happening *before* the disk device is
deleted from userspace view.

There's no reason for del_gendisk() to clear ->driverfs_dev.  That
device is the parent of the disk.  It is guaranteed to not be freed
until the disk, as a child, drops its ->parent reference.

We could also fix this issue locally in nvdimm_revalidate_disk() by
using disk_to_dev(disk)->parent, but lets fix it globally since
->driverfs_dev follows the lifetime of the parent.  Longer term we
should probably just add a @parent parameter to add_disk(), and stop
carrying this pointer in the gendisk.

 BUG: unable to handle kernel NULL pointer dereference at           (null)
 IP: [<ffffffffa00340a8>] nvdimm_revalidate_disk+0x18/0x90 [libnvdimm]
 CPU: 2 PID: 538 Comm: systemd-udevd Tainted: G           O    4.4.0-rc5 #2257
 [..]
 Call Trace:
  [<ffffffff8143e5c7>] rescan_partitions+0x87/0x2c0
  [<ffffffff810f37f9>] ? __lock_is_held+0x49/0x70
  [<ffffffff81438c62>] __blkdev_reread_part+0x72/0xb0
  [<ffffffff81438cc5>] blkdev_reread_part+0x25/0x40
  [<ffffffff8143982d>] blkdev_ioctl+0x4fd/0x9c0
  [<ffffffff811246c9>] ? current_kernel_time64+0x69/0xd0
  [<ffffffff812916dd>] block_ioctl+0x3d/0x50
  [<ffffffff81264c38>] do_vfs_ioctl+0x308/0x560
  [<ffffffff8115dbd1>] ? __audit_syscall_entry+0xb1/0x100
  [<ffffffff810031d6>] ? do_audit_syscall_entry+0x66/0x70
  [<ffffffff81264f09>] SyS_ioctl+0x79/0x90
  [<ffffffff81902672>] entry_SYSCALL_64_fastpath+0x12/0x76

Cc: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@fb.com>
Reported-by: Robert Hu <robert.hu@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 block/genhd.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/block/genhd.c b/block/genhd.c
index 38d4ba122a43..037cf3e8f1bd 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -662,7 +662,6 @@ void del_gendisk(struct gendisk *disk)
 
 	kobject_put(disk->part0.holder_dir);
 	kobject_put(disk->slave_dir);
-	disk->driverfs_dev = NULL;
 	if (!sysfs_deprecated)
 		sysfs_remove_link(block_depr, dev_name(disk_to_dev(disk)));
 	pm_runtime_set_memalloc_noio(disk_to_dev(disk), false);
-- 
2.12.2

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

* [patch added to 3.12-stable] powerpc: Reject binutils 2.24 when building little endian
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (21 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] block: fix del_gendisk() vs blkdev_ioctl crash Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] ping: implement proper locking Jiri Slaby
                   ` (24 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Michael Ellerman, Jiri Slaby

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

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

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

commit 60e065f70bdb0b0e916389024922ad40f3270c96 upstream.

There is a bug in binutils 2.24 which causes miscompilation if we're
building little endian and using weak symbols (which the kernel does).

It is fixed in binutils commit 57fa7b8c7e59 "Correct elf_merge_st_other
arguments for weak symbols", which is in binutils 2.25 and has been
backported to the binutils 2.24 branch and has been picked up by most
distros it seems.

However if we're running stock 2.24 (no extra version) then the bug is
present, so check for that and bail.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 994337bb529c..f45f740d5ccc 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -289,6 +289,14 @@ checkbin:
 		echo 'disable kernel modules' ; \
 		false ; \
 	fi
+	@if test "x${CONFIG_CPU_LITTLE_ENDIAN}" = "xy" \
+	    && $(LD) --version | head -1 | grep ' 2\.24$$' >/dev/null ; then \
+		echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \
+		echo 'in some circumstances.' ; \
+		echo -n '*** Please use a different binutils version.' ; \
+		false ; \
+	fi
+
 
 CLEAN_FILES += $(TOUT)
 
-- 
2.12.2

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

* [patch added to 3.12-stable] ping: implement proper locking
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (22 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] powerpc: Reject binutils 2.24 when building little endian Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] net/packet: fix overflow in check for tp_frame_nr Jiri Slaby
                   ` (23 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Eric Dumazet, David S . Miller, Jiri Slaby

From: Eric Dumazet <edumazet@google.com>

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

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

commit 43a6684519ab0a6c52024b5e25322476cabad893 upstream.

We got a report of yet another bug in ping

http://www.openwall.com/lists/oss-security/2017/03/24/6

->disconnect() is not called with socket lock held.

Fix this by acquiring ping rwlock earlier.

Thanks to Daniel, Alexander and Andrey for letting us know this problem.

Fixes: c319b4d76b9e ("net: ipv4: add IPPROTO_ICMP socket kind")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Daniel Jiang <danieljiang0415@gmail.com>
Reported-by: Solar Designer <solar@openwall.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/ping.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 6be49858c86f..3ec2f46cf8fc 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -150,17 +150,18 @@ void ping_hash(struct sock *sk)
 void ping_unhash(struct sock *sk)
 {
 	struct inet_sock *isk = inet_sk(sk);
+
 	pr_debug("ping_unhash(isk=%p,isk->num=%u)\n", isk, isk->inet_num);
+	write_lock_bh(&ping_table.lock);
 	if (sk_hashed(sk)) {
-		write_lock_bh(&ping_table.lock);
 		hlist_nulls_del(&sk->sk_nulls_node);
 		sk_nulls_node_init(&sk->sk_nulls_node);
 		sock_put(sk);
 		isk->inet_num = 0;
 		isk->inet_sport = 0;
 		sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
-		write_unlock_bh(&ping_table.lock);
 	}
+	write_unlock_bh(&ping_table.lock);
 }
 EXPORT_SYMBOL_GPL(ping_unhash);
 
-- 
2.12.2

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

* [patch added to 3.12-stable] net/packet: fix overflow in check for tp_frame_nr
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (23 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] ping: implement proper locking Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] net/packet: fix overflow in check for tp_reserve Jiri Slaby
                   ` (22 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Andrey Konovalov, David S . Miller, Jiri Slaby

From: Andrey Konovalov <andreyknvl@google.com>

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

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

commit 8f8d28e4d6d815a391285e121c3a53a0b6cb9e7b upstream.

When calculating rb->frames_per_block * req->tp_block_nr the result
can overflow.

Add a check that tp_block_size * tp_block_nr <= UINT_MAX.

Since frames_per_block <= tp_block_size, the expression would
never overflow.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/packet/af_packet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index ed1fed3330af..d6087b4359cc 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3665,6 +3665,8 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u,
 		rb->frames_per_block = req->tp_block_size/req->tp_frame_size;
 		if (unlikely(rb->frames_per_block <= 0))
 			goto out;
+		if (unlikely(req->tp_block_size > UINT_MAX / req->tp_block_nr))
+			goto out;
 		if (unlikely((rb->frames_per_block * req->tp_block_nr) !=
 					req->tp_frame_nr))
 			goto out;
-- 
2.12.2

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

* [patch added to 3.12-stable] net/packet: fix overflow in check for tp_reserve
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (24 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] net/packet: fix overflow in check for tp_frame_nr Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] netfilter: arp_tables: fix invoking 32bit "iptable -P INPUT ACCEPT" failed in 64bit kernel Jiri Slaby
                   ` (21 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Andrey Konovalov, David S . Miller, Jiri Slaby

From: Andrey Konovalov <andreyknvl@google.com>

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

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

commit bcc5364bdcfe131e6379363f089e7b4108d35b70 upstream.

When calculating po->tp_hdrlen + po->tp_reserve the result can overflow.

Fix by checking that tp_reserve <= INT_MAX on assign.

Signed-off-by: Andrey Konovalov <andreyknvl@google.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/packet/af_packet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d6087b4359cc..2455f1b08ac3 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3167,6 +3167,8 @@ packet_setsockopt(struct socket *sock, int level, int optname, char __user *optv
 			return -EBUSY;
 		if (copy_from_user(&val, optval, sizeof(val)))
 			return -EFAULT;
+		if (val > INT_MAX)
+			return -EINVAL;
 		po->tp_reserve = val;
 		return 0;
 	}
-- 
2.12.2

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

* [patch added to 3.12-stable] netfilter: arp_tables: fix invoking 32bit "iptable -P INPUT ACCEPT" failed in 64bit kernel
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (25 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] net/packet: fix overflow in check for tp_reserve Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] tty: nozomi: avoid a harmless gcc warning Jiri Slaby
                   ` (20 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Hongxu Jia, Pablo Neira Ayuso, Jiri Slaby

From: Hongxu Jia <hongxu.jia@windriver.com>

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

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

commit 17a49cd549d9dc8707dc9262210166455c612dde upstream.

Since 09d9686047db ("netfilter: x_tables: do compat validation via
translate_table"), it used compatr structure to assign newinfo
structure.  In translate_compat_table of ip_tables.c and ip6_tables.c,
it used compatr->hook_entry to replace info->hook_entry and
compatr->underflow to replace info->underflow, but not do the same
replacement in arp_tables.c.

It caused invoking 32-bit "arptbale -P INPUT ACCEPT" failed in 64bit
kernel.
--------------------------------------
root@qemux86-64:~# arptables -P INPUT ACCEPT
root@qemux86-64:~# arptables -P INPUT ACCEPT
ERROR: Policy for `INPUT' offset 448 != underflow 0
arptables: Incompatible with this kernel
--------------------------------------

Fixes: 09d9686047db ("netfilter: x_tables: do compat validation via translate_table")
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/ipv4/netfilter/arp_tables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index ab16b5c195da..3e3b3f75b3a0 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1328,8 +1328,8 @@ static int translate_compat_table(struct xt_table_info **pinfo,
 
 	newinfo->number = compatr->num_entries;
 	for (i = 0; i < NF_ARP_NUMHOOKS; i++) {
-		newinfo->hook_entry[i] = info->hook_entry[i];
-		newinfo->underflow[i] = info->underflow[i];
+		newinfo->hook_entry[i] = compatr->hook_entry[i];
+		newinfo->underflow[i] = compatr->underflow[i];
 	}
 	entry1 = newinfo->entries[raw_smp_processor_id()];
 	pos = entry1;
-- 
2.12.2

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

* [patch added to 3.12-stable] tty: nozomi: avoid a harmless gcc warning
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (26 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] netfilter: arp_tables: fix invoking 32bit "iptable -P INPUT ACCEPT" failed in 64bit kernel Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] hostap: avoid uninitialized variable use in hfa384x_get_rid Jiri Slaby
                   ` (19 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Arnd Bergmann, Jiri Slaby

From: Arnd Bergmann <arnd@arndb.de>

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

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

commit a4f642a8a3c2838ad09fe8313d45db46600e1478 upstream.

The nozomi wireless data driver has its own helper function to
transfer data from a FIFO, doing an extra byte swap on big-endian
architectures, presumably to bring the data back into byte-serial
order after readw() or readl() perform their implicit byteswap.

This helper function is used in the receive_data() function to
first read the length into a 32-bit variable, which causes
a compile-time warning:

drivers/tty/nozomi.c: In function 'receive_data':
drivers/tty/nozomi.c:857:9: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized]

The problem is that gcc is unsure whether the data was actually
read or not. We know that it is at this point, so we can replace
it with a single readl() to shut up that warning.

I am leaving the byteswap in there, to preserve the existing
behavior, even though this seems fishy: Reading the length of
the data into a cpu-endian variable should normally not use
a second byteswap on big-endian systems, unless the hardware
is aware of the CPU endianess.

There appears to be a lot more confusion about endianess in this
driver, so it probably has not worked on big-endian systems in
a long time, if ever, and I have no way to test it. It's well
possible that this driver has not been used by anyone in a while,
the last patch that looks like it was tested on the hardware is
from 2008.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/nozomi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index d6080c3831ef..ce2e5d508fe7 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -823,7 +823,7 @@ static int receive_data(enum port_type index, struct nozomi *dc)
 	struct tty_struct *tty = tty_port_tty_get(&port->port);
 	int i, ret;
 
-	read_mem32((u32 *) &size, addr, 4);
+	size = __le32_to_cpu(readl(addr));
 	/*  DBG1( "%d bytes port: %d", size, index); */
 
 	if (tty && test_bit(TTY_THROTTLED, &tty->flags)) {
-- 
2.12.2

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

* [patch added to 3.12-stable] hostap: avoid uninitialized variable use in hfa384x_get_rid
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (27 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] tty: nozomi: avoid a harmless gcc warning Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] gfs2: avoid uninitialized variable warning Jiri Slaby
                   ` (18 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Arnd Bergmann, Kalle Valo, Jiri Slaby

From: Arnd Bergmann <arnd@arndb.de>

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

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

commit 48dc5fb3ba53b20418de8514700f63d88c5de3a3 upstream.

The driver reads a value from hfa384x_from_bap(), which may fail,
and then assigns the value to a local variable. gcc detects that
in in the failure case, the 'rlen' variable now contains
uninitialized data:

In file included from ../drivers/net/wireless/intersil/hostap/hostap_pci.c:220:0:
drivers/net/wireless/intersil/hostap/hostap_hw.c: In function 'hfa384x_get_rid':
drivers/net/wireless/intersil/hostap/hostap_hw.c:842:5: warning: 'rec' may be used uninitialized in this function [-Wmaybe-uninitialized]
  if (le16_to_cpu(rec.len) == 0) {

This restructures the function as suggested by Russell King, to
make it more readable and get more reliable error handling, by
handling each failure mode using a goto.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/hostap/hostap_hw.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index c275dc1623fe..cd8c35787564 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -836,25 +836,30 @@ static int hfa384x_get_rid(struct net_device *dev, u16 rid, void *buf, int len,
 	spin_lock_bh(&local->baplock);
 
 	res = hfa384x_setup_bap(dev, BAP0, rid, 0);
-	if (!res)
-		res = hfa384x_from_bap(dev, BAP0, &rec, sizeof(rec));
+	if (res)
+		goto unlock;
+
+	res = hfa384x_from_bap(dev, BAP0, &rec, sizeof(rec));
+	if (res)
+		goto unlock;
 
 	if (le16_to_cpu(rec.len) == 0) {
 		/* RID not available */
 		res = -ENODATA;
+		goto unlock;
 	}
 
 	rlen = (le16_to_cpu(rec.len) - 1) * 2;
-	if (!res && exact_len && rlen != len) {
+	if (exact_len && rlen != len) {
 		printk(KERN_DEBUG "%s: hfa384x_get_rid - RID len mismatch: "
 		       "rid=0x%04x, len=%d (expected %d)\n",
 		       dev->name, rid, rlen, len);
 		res = -ENODATA;
 	}
 
-	if (!res)
-		res = hfa384x_from_bap(dev, BAP0, buf, len);
+	res = hfa384x_from_bap(dev, BAP0, buf, len);
 
+unlock:
 	spin_unlock_bh(&local->baplock);
 	mutex_unlock(&local->rid_bap_mtx);
 
-- 
2.12.2

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

* [patch added to 3.12-stable] gfs2: avoid uninitialized variable warning
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (28 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] hostap: avoid uninitialized variable use in hfa384x_get_rid Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] net: neigh: guard against NULL solicit() method Jiri Slaby
                   ` (17 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Arnd Bergmann, Bob Peterson, Jiri Slaby

From: Arnd Bergmann <arnd@arndb.de>

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

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

commit 67893f12e5374bbcaaffbc6e570acbc2714ea884 upstream.

We get a bogus warning about a potential uninitialized variable
use in gfs2, because the compiler does not figure out that we
never use the leaf number if get_leaf_nr() returns an error:

fs/gfs2/dir.c: In function 'get_first_leaf':
fs/gfs2/dir.c:802:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
fs/gfs2/dir.c: In function 'dir_split_leaf':
fs/gfs2/dir.c:1021:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]

Changing the 'if (!error)' to 'if (!IS_ERR_VALUE(error))' is
sufficient to let gcc understand that this is exactly the same
condition as in IS_ERR() so it can optimize the code path enough
to understand it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/gfs2/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 2e5fc268d324..bdef6fef651c 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -763,7 +763,7 @@ static int get_first_leaf(struct gfs2_inode *dip, u32 index,
 	int error;
 
 	error = get_leaf_nr(dip, index, &leaf_no);
-	if (!error)
+	if (!IS_ERR_VALUE(error))
 		error = get_leaf(dip, leaf_no, bh_out);
 
 	return error;
@@ -974,7 +974,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
 
 	index = name->hash >> (32 - dip->i_depth);
 	error = get_leaf_nr(dip, index, &leaf_no);
-	if (error)
+	if (IS_ERR_VALUE(error))
 		return error;
 
 	/*  Get the old leaf block  */
-- 
2.12.2

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

* [patch added to 3.12-stable] net: neigh: guard against NULL solicit() method
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (29 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] gfs2: avoid uninitialized variable warning Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] net: phy: handle state correctly in phy_stop_machine Jiri Slaby
                   ` (16 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Eric Dumazet, David S . Miller

From: Eric Dumazet <edumazet@google.com>

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

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

[ Upstream commit 48481c8fa16410ffa45939b13b6c53c2ca609e5f ]

Dmitry posted a nice reproducer of a bug triggering in neigh_probe()
when dereferencing a NULL neigh->ops->solicit method.

This can happen for arp_direct_ops/ndisc_direct_ops and similar,
which can be used for NUD_NOARP neighbours (created when dev->header_ops
is NULL). Admin can then force changing nud_state to some other state
that would fire neigh timer.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/core/neighbour.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 7957daa334cc..3a6a4f11e876 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -872,7 +872,8 @@ static void neigh_probe(struct neighbour *neigh)
 	if (skb)
 		skb = skb_copy(skb, GFP_ATOMIC);
 	write_unlock(&neigh->lock);
-	neigh->ops->solicit(neigh, skb);
+	if (neigh->ops->solicit)
+		neigh->ops->solicit(neigh, skb);
 	atomic_inc(&neigh->probes);
 	kfree_skb(skb);
 }
-- 
2.12.2

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

* [patch added to 3.12-stable] net: phy: handle state correctly in phy_stop_machine
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (30 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] net: neigh: guard against NULL solicit() method Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] l2tp: take reference on sessions being dumped Jiri Slaby
                   ` (15 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Nathan Sullivan, Brad Mouring, David S . Miller

From: Nathan Sullivan <nathan.sullivan@ni.com>

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

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

[ Upstream commit 49d52e8108a21749dc2114b924c907db43358984 ]

If the PHY is halted on stop, then do not set the state to PHY_UP.  This
ensures the phy will be restarted later in phy_start when the machine is
started again.

Fixes: 00db8189d984 ("This patch adds a PHY Abstraction Layer to the Linux Kernel, enabling ethernet drivers to remain as ignorant as is reasonable of the connected PHY's design and operation details.")
Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: Brad Mouring <brad.mouring@ni.com>
Acked-by: Xander Huff <xander.huff@ni.com>
Acked-by: Kyle Roeschley <kyle.roeschley@ni.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/phy/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 0bc73f2c24ba..eca07101dc0c 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -473,7 +473,7 @@ void phy_stop_machine(struct phy_device *phydev)
 	cancel_delayed_work_sync(&phydev->state_queue);
 
 	mutex_lock(&phydev->lock);
-	if (phydev->state > PHY_UP)
+	if (phydev->state > PHY_UP && phydev->state != PHY_HALTED)
 		phydev->state = PHY_UP;
 	mutex_unlock(&phydev->lock);
 
-- 
2.12.2

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

* [patch added to 3.12-stable] l2tp: take reference on sessions being dumped
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (31 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] net: phy: handle state correctly in phy_stop_machine Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given Jiri Slaby
                   ` (14 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Guillaume Nault, David S . Miller

From: Guillaume Nault <g.nault@alphalink.fr>

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

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

[ Upstream commit e08293a4ccbcc993ded0fdc46f1e57926b833d63 ]

Take a reference on the sessions returned by l2tp_session_find_nth()
(and rename it l2tp_session_get_nth() to reflect this change), so that
caller is assured that the session isn't going to disappear while
processing it.

For procfs and debugfs handlers, the session is held in the .start()
callback and dropped in .show(). Given that pppol2tp_seq_session_show()
dereferences the associated PPPoL2TP socket and that
l2tp_dfs_seq_session_show() might call pppol2tp_show(), we also need to
call the session's .ref() callback to prevent the socket from going
away from under us.

Fixes: fd558d186df2 ("l2tp: Split pppol2tp patch into separate l2tp and ppp parts")
Fixes: 0ad6614048cf ("l2tp: Add debugfs files for dumping l2tp debug info")
Fixes: 309795f4bec2 ("l2tp: Add netlink control API for L2TP")
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/l2tp/l2tp_core.c    |  8 ++++++--
 net/l2tp/l2tp_core.h    |  3 ++-
 net/l2tp/l2tp_debugfs.c | 10 +++++++---
 net/l2tp/l2tp_netlink.c |  7 +++++--
 net/l2tp/l2tp_ppp.c     | 10 +++++++---
 5 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 6639bc27edb9..d5c09cb249ea 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -280,7 +280,8 @@ struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunn
 }
 EXPORT_SYMBOL_GPL(l2tp_session_find);
 
-struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth)
+struct l2tp_session *l2tp_session_get_nth(struct l2tp_tunnel *tunnel, int nth,
+					  bool do_ref)
 {
 	int hash;
 	struct l2tp_session *session;
@@ -290,6 +291,9 @@ struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth)
 	for (hash = 0; hash < L2TP_HASH_SIZE; hash++) {
 		hlist_for_each_entry(session, &tunnel->session_hlist[hash], hlist) {
 			if (++count > nth) {
+				l2tp_session_inc_refcount(session);
+				if (do_ref && session->ref)
+					session->ref(session);
 				read_unlock_bh(&tunnel->hlist_lock);
 				return session;
 			}
@@ -300,7 +304,7 @@ struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth)
 
 	return NULL;
 }
-EXPORT_SYMBOL_GPL(l2tp_session_find_nth);
+EXPORT_SYMBOL_GPL(l2tp_session_get_nth);
 
 /* Lookup a session by interface name.
  * This is very inefficient but is only used by management interfaces.
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
index f8f1089ee8f2..bf8ad2f233fc 100644
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -241,7 +241,8 @@ out:
 extern struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel);
 extern void l2tp_tunnel_sock_put(struct sock *sk);
 extern struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunnel, u32 session_id);
-extern struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth);
+extern struct l2tp_session *l2tp_session_get_nth(struct l2tp_tunnel *tunnel, int nth,
+						 bool do_ref);
 extern struct l2tp_session *l2tp_session_find_by_ifname(struct net *net, char *ifname);
 extern struct l2tp_tunnel *l2tp_tunnel_find(struct net *net, u32 tunnel_id);
 extern struct l2tp_tunnel *l2tp_tunnel_find_nth(struct net *net, int nth);
diff --git a/net/l2tp/l2tp_debugfs.c b/net/l2tp/l2tp_debugfs.c
index 072d7202e182..c6bd783cfb1b 100644
--- a/net/l2tp/l2tp_debugfs.c
+++ b/net/l2tp/l2tp_debugfs.c
@@ -53,7 +53,7 @@ static void l2tp_dfs_next_tunnel(struct l2tp_dfs_seq_data *pd)
 
 static void l2tp_dfs_next_session(struct l2tp_dfs_seq_data *pd)
 {
-	pd->session = l2tp_session_find_nth(pd->tunnel, pd->session_idx);
+	pd->session = l2tp_session_get_nth(pd->tunnel, pd->session_idx, true);
 	pd->session_idx++;
 
 	if (pd->session == NULL) {
@@ -237,10 +237,14 @@ static int l2tp_dfs_seq_show(struct seq_file *m, void *v)
 	}
 
 	/* Show the tunnel or session context */
-	if (pd->session == NULL)
+	if (!pd->session) {
 		l2tp_dfs_seq_tunnel_show(m, pd->tunnel);
-	else
+	} else {
 		l2tp_dfs_seq_session_show(m, pd->session);
+		if (pd->session->deref)
+			pd->session->deref(pd->session);
+		l2tp_session_dec_refcount(pd->session);
+	}
 
 out:
 	return 0;
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 0825ff26e113..490024eaece8 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -719,7 +719,7 @@ static int l2tp_nl_cmd_session_dump(struct sk_buff *skb, struct netlink_callback
 				goto out;
 		}
 
-		session = l2tp_session_find_nth(tunnel, si);
+		session = l2tp_session_get_nth(tunnel, si, false);
 		if (session == NULL) {
 			ti++;
 			tunnel = NULL;
@@ -729,8 +729,11 @@ static int l2tp_nl_cmd_session_dump(struct sk_buff *skb, struct netlink_callback
 
 		if (l2tp_nl_session_send(skb, NETLINK_CB(cb->skb).portid,
 					 cb->nlh->nlmsg_seq, NLM_F_MULTI,
-					 session) <= 0)
+					 session) <= 0) {
+			l2tp_session_dec_refcount(session);
 			break;
+		}
+		l2tp_session_dec_refcount(session);
 
 		si++;
 	}
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index c3ae2411650c..c06c7ed47b69 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -1576,7 +1576,7 @@ static void pppol2tp_next_tunnel(struct net *net, struct pppol2tp_seq_data *pd)
 
 static void pppol2tp_next_session(struct net *net, struct pppol2tp_seq_data *pd)
 {
-	pd->session = l2tp_session_find_nth(pd->tunnel, pd->session_idx);
+	pd->session = l2tp_session_get_nth(pd->tunnel, pd->session_idx, true);
 	pd->session_idx++;
 
 	if (pd->session == NULL) {
@@ -1703,10 +1703,14 @@ static int pppol2tp_seq_show(struct seq_file *m, void *v)
 
 	/* Show the tunnel or session context.
 	 */
-	if (pd->session == NULL)
+	if (!pd->session) {
 		pppol2tp_seq_tunnel_show(m, pd->tunnel);
-	else
+	} else {
 		pppol2tp_seq_session_show(m, pd->session);
+		if (pd->session->deref)
+			pd->session->deref(pd->session);
+		l2tp_session_dec_refcount(pd->session);
+	}
 
 out:
 	return 0;
-- 
2.12.2

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

* [patch added to 3.12-stable] net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (32 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] l2tp: take reference on sessions being dumped Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] sctp: listen on the sock only when it's state is listening or closed Jiri Slaby
                   ` (13 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Florian Larysch, David S . Miller

From: Florian Larysch <fl@n621.de>

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

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

[ Upstream commit a8801799c6975601fd58ae62f48964caec2eb83f ]

inet_rtm_getroute synthesizes a skeletal ICMP skb, which is passed to
ip_route_input when iif is given. If a multipath route is present for
the designated destination, ip_multipath_icmp_hash ends up being called,
which uses the source/destination addresses within the skb to calculate
a hash. However, those are not set in the synthetic skb, causing it to
return an arbitrary and incorrect result.

Instead, use UDP, which gets no such special treatment.

Signed-off-by: Florian Larysch <fl@n621.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1b180691086c..778b3e9316db 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2492,7 +2492,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh)
 	skb_reset_network_header(skb);
 
 	/* Bugfix: need to give ip_route_input enough of an IP header to not gag. */
-	ip_hdr(skb)->protocol = IPPROTO_ICMP;
+	ip_hdr(skb)->protocol = IPPROTO_UDP;
 	skb_reserve(skb, MAX_HEADER + sizeof(struct iphdr));
 
 	src = tb[RTA_SRC] ? nla_get_be32(tb[RTA_SRC]) : 0;
-- 
2.12.2

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

* [patch added to 3.12-stable] sctp: listen on the sock only when it's state is listening or closed
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (33 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] ip6mr: fix notification device destruction Jiri Slaby
                   ` (12 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Xin Long, David S . Miller

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

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

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

[ Upstream commit 34b2789f1d9bf8dcca9b5cb553d076ca2cd898ee ]

Now sctp doesn't check sock's state before listening on it. It could
even cause changing a sock with any state to become a listening sock
when doing sctp_listen.

This patch is to fix it by checking sock's state in sctp_listen, so
that it will listen on the sock with right state.

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/sctp/socket.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 0059ce3fb747..16f03f76ff8f 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -6169,6 +6169,9 @@ int sctp_inet_listen(struct socket *sock, int backlog)
 	if (sock->state != SS_UNCONNECTED)
 		goto out;
 
+	if (!sctp_sstate(sk, LISTENING) && !sctp_sstate(sk, CLOSED))
+		goto out;
+
 	/* If backlog is zero, disable listening. */
 	if (!backlog) {
 		if (sctp_sstate(sk, CLOSED))
-- 
2.12.2

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

* [patch added to 3.12-stable] ip6mr: fix notification device destruction
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (34 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] sctp: listen on the sock only when it's state is listening or closed Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] ipv6: check raw payload size correctly in ioctl Jiri Slaby
                   ` (11 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Nikolay Aleksandrov, David S . Miller

From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>

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

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

[ Upstream commit 723b929ca0f79c0796f160c2eeda4597ee98d2b8 ]

Andrey Konovalov reported a BUG caused by the ip6mr code which is caused
because we call unregister_netdevice_many for a device that is already
being destroyed. In IPv4's ipmr that has been resolved by two commits
long time ago by introducing the "notify" parameter to the delete
function and avoiding the unregister when called from a notifier, so
let's do the same for ip6mr.

The trace from Andrey:
------------[ cut here ]------------
kernel BUG at net/core/dev.c:6813!
invalid opcode: 0000 [#1] SMP KASAN
Modules linked in:
CPU: 1 PID: 1165 Comm: kworker/u4:3 Not tainted 4.11.0-rc7+ #251
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs
01/01/2011
Workqueue: netns cleanup_net
task: ffff880069208000 task.stack: ffff8800692d8000
RIP: 0010:rollback_registered_many+0x348/0xeb0 net/core/dev.c:6813
RSP: 0018:ffff8800692de7f0 EFLAGS: 00010297
RAX: ffff880069208000 RBX: 0000000000000002 RCX: 0000000000000001
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88006af90569
RBP: ffff8800692de9f0 R08: ffff8800692dec60 R09: 0000000000000000
R10: 0000000000000006 R11: 0000000000000000 R12: ffff88006af90070
R13: ffff8800692debf0 R14: dffffc0000000000 R15: ffff88006af90000
FS:  0000000000000000(0000) GS:ffff88006cb00000(0000)
knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fe7e897d870 CR3: 00000000657e7000 CR4: 00000000000006e0
Call Trace:
 unregister_netdevice_many.part.105+0x87/0x440 net/core/dev.c:7881
 unregister_netdevice_many+0xc8/0x120 net/core/dev.c:7880
 ip6mr_device_event+0x362/0x3f0 net/ipv6/ip6mr.c:1346
 notifier_call_chain+0x145/0x2f0 kernel/notifier.c:93
 __raw_notifier_call_chain kernel/notifier.c:394
 raw_notifier_call_chain+0x2d/0x40 kernel/notifier.c:401
 call_netdevice_notifiers_info+0x51/0x90 net/core/dev.c:1647
 call_netdevice_notifiers net/core/dev.c:1663
 rollback_registered_many+0x919/0xeb0 net/core/dev.c:6841
 unregister_netdevice_many.part.105+0x87/0x440 net/core/dev.c:7881
 unregister_netdevice_many net/core/dev.c:7880
 default_device_exit_batch+0x4fa/0x640 net/core/dev.c:8333
 ops_exit_list.isra.4+0x100/0x150 net/core/net_namespace.c:144
 cleanup_net+0x5a8/0xb40 net/core/net_namespace.c:463
 process_one_work+0xc04/0x1c10 kernel/workqueue.c:2097
 worker_thread+0x223/0x19c0 kernel/workqueue.c:2231
 kthread+0x35e/0x430 kernel/kthread.c:231
 ret_from_fork+0x31/0x40 arch/x86/entry/entry_64.S:430
Code: 3c 32 00 0f 85 70 0b 00 00 48 b8 00 02 00 00 00 00 ad de 49 89
47 78 e9 93 fe ff ff 49 8d 57 70 49 8d 5f 78 eb 9e e8 88 7a 14 fe <0f>
0b 48 8b 9d 28 fe ff ff e8 7a 7a 14 fe 48 b8 00 00 00 00 00
RIP: rollback_registered_many+0x348/0xeb0 RSP: ffff8800692de7f0
---[ end trace e0b29c57e9b3292c ]---

Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Tested-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv6/ip6mr.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c
index 56aa540d77f6..2dcb19cb8f61 100644
--- a/net/ipv6/ip6mr.c
+++ b/net/ipv6/ip6mr.c
@@ -776,7 +776,8 @@ failure:
  *	Delete a VIF entry
  */
 
-static int mif6_delete(struct mr6_table *mrt, int vifi, struct list_head *head)
+static int mif6_delete(struct mr6_table *mrt, int vifi, int notify,
+		       struct list_head *head)
 {
 	struct mif_device *v;
 	struct net_device *dev;
@@ -822,7 +823,7 @@ static int mif6_delete(struct mr6_table *mrt, int vifi, struct list_head *head)
 					     dev->ifindex, &in6_dev->cnf);
 	}
 
-	if (v->flags & MIFF_REGISTER)
+	if ((v->flags & MIFF_REGISTER) && !notify)
 		unregister_netdevice_queue(dev, head);
 
 	dev_put(dev);
@@ -1332,7 +1333,6 @@ static int ip6mr_device_event(struct notifier_block *this,
 	struct mr6_table *mrt;
 	struct mif_device *v;
 	int ct;
-	LIST_HEAD(list);
 
 	if (event != NETDEV_UNREGISTER)
 		return NOTIFY_DONE;
@@ -1341,10 +1341,9 @@ static int ip6mr_device_event(struct notifier_block *this,
 		v = &mrt->vif6_table[0];
 		for (ct = 0; ct < mrt->maxvif; ct++, v++) {
 			if (v->dev == dev)
-				mif6_delete(mrt, ct, &list);
+				mif6_delete(mrt, ct, 1, NULL);
 		}
 	}
-	unregister_netdevice_many(&list);
 
 	return NOTIFY_DONE;
 }
@@ -1549,7 +1548,7 @@ static void mroute_clean_tables(struct mr6_table *mrt, bool all)
 	for (i = 0; i < mrt->maxvif; i++) {
 		if (!all && (mrt->vif6_table[i].flags & VIFF_STATIC))
 			continue;
-		mif6_delete(mrt, i, &list);
+		mif6_delete(mrt, i, 0, &list);
 	}
 	unregister_netdevice_many(&list);
 
@@ -1702,7 +1701,7 @@ int ip6_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, uns
 		if (copy_from_user(&mifi, optval, sizeof(mifi_t)))
 			return -EFAULT;
 		rtnl_lock();
-		ret = mif6_delete(mrt, mifi, NULL);
+		ret = mif6_delete(mrt, mifi, 0, NULL);
 		rtnl_unlock();
 		return ret;
 
-- 
2.12.2

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

* [patch added to 3.12-stable] ipv6: check raw payload size correctly in ioctl
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (35 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] ip6mr: fix notification device destruction Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea() Jiri Slaby
                   ` (10 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Jamie Bainbridge, David S . Miller

From: Jamie Bainbridge <jbainbri@redhat.com>

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

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

[ Upstream commit 105f5528b9bbaa08b526d3405a5bcd2ff0c953c8 ]

In situations where an skb is paged, the transport header pointer and
tail pointer can be the same because the skb contents are in frags.

This results in ioctl(SIOCINQ/FIONREAD) incorrectly returning a
length of 0 when the length to receive is actually greater than zero.

skb->len is already correctly set in ip6_input_finish() with
pskb_pull(), so use skb->len as it always returns the correct result
for both linear and paged data.

Signed-off-by: Jamie Bainbridge <jbainbri@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv6/raw.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index c2afb29dc1d7..581662201ba9 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -1145,8 +1145,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
 		spin_lock_bh(&sk->sk_receive_queue.lock);
 		skb = skb_peek(&sk->sk_receive_queue);
 		if (skb != NULL)
-			amount = skb_tail_pointer(skb) -
-				skb_transport_header(skb);
+			amount = skb->len;
 		spin_unlock_bh(&sk->sk_receive_queue.lock);
 		return put_user(amount, (int __user *)arg);
 	}
-- 
2.12.2

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

* [patch added to 3.12-stable] ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea()
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (36 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] ipv6: check raw payload size correctly in ioctl Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] md:raid1: fix a dead loop when read from a WriteMostly disk Jiri Slaby
                   ` (9 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Theodore Ts'o, Julia Lawall, Jiri Slaby

From: Theodore Ts'o <tytso@mit.edu>

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

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

commit 9e92f48c34eb2b9af9d12f892e2fe1fce5e8ce35 upstream.

We aren't checking to see if the in-inode extended attribute is
corrupted before we try to expand the inode's extra isize fields.

This can lead to potential crashes caused by the BUG_ON() check in
ext4_xattr_shift_entries().

[js] use EIO instead of undefined EFSCORRUPTED in 3.12

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/xattr.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index e5835f6e1466..4e7384b7608e 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -233,6 +233,27 @@ ext4_xattr_check_block(struct inode *inode, struct buffer_head *bh)
 	return error;
 }
 
+static int
+__xattr_check_inode(struct inode *inode, struct ext4_xattr_ibody_header *header,
+			 void *end, const char *function, unsigned int line)
+{
+	struct ext4_xattr_entry *entry = IFIRST(header);
+	int error = -EIO;
+
+	if (((void *) header >= end) ||
+	    (header->h_magic != le32_to_cpu(EXT4_XATTR_MAGIC)))
+		goto errout;
+	error = ext4_xattr_check_names(entry, end, entry);
+errout:
+	if (error)
+		__ext4_error_inode(inode, function, line, 0,
+				   "corrupted in-inode xattr");
+	return error;
+}
+
+#define xattr_check_inode(inode, header, end) \
+	__xattr_check_inode((inode), (header), (end), __func__, __LINE__)
+
 static inline int
 ext4_xattr_check_entry(struct ext4_xattr_entry *entry, size_t size)
 {
@@ -343,7 +364,7 @@ ext4_xattr_ibody_get(struct inode *inode, int name_index, const char *name,
 	header = IHDR(inode, raw_inode);
 	entry = IFIRST(header);
 	end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
-	error = ext4_xattr_check_names(entry, end, entry);
+	error = xattr_check_inode(inode, header, end);
 	if (error)
 		goto cleanup;
 	error = ext4_xattr_find_entry(&entry, name_index, name,
@@ -471,7 +492,7 @@ ext4_xattr_ibody_list(struct dentry *dentry, char *buffer, size_t buffer_size)
 	raw_inode = ext4_raw_inode(&iloc);
 	header = IHDR(inode, raw_inode);
 	end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
-	error = ext4_xattr_check_names(IFIRST(header), end, IFIRST(header));
+	error = xattr_check_inode(inode, header, end);
 	if (error)
 		goto cleanup;
 	error = ext4_xattr_list_entries(dentry, IFIRST(header),
@@ -986,8 +1007,7 @@ int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
 	is->s.here = is->s.first;
 	is->s.end = (void *)raw_inode + EXT4_SB(inode->i_sb)->s_inode_size;
 	if (ext4_test_inode_state(inode, EXT4_STATE_XATTR)) {
-		error = ext4_xattr_check_names(IFIRST(header), is->s.end,
-					       IFIRST(header));
+		error = xattr_check_inode(inode, header, is->s.end);
 		if (error)
 			return error;
 		/* Find the named attribute. */
@@ -1284,6 +1304,10 @@ retry:
 	last = entry;
 	total_ino = sizeof(struct ext4_xattr_ibody_header);
 
+	error = xattr_check_inode(inode, header, end);
+	if (error)
+		goto cleanup;
+
 	free = ext4_xattr_free_space(last, &min_offs, base, &total_ino);
 	if (free >= new_extra_isize) {
 		entry = IFIRST(header);
-- 
2.12.2

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

* [patch added to 3.12-stable] md:raid1: fix a dead loop when read from a WriteMostly disk
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (37 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea() Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] MIPS: Fix crash registers on non-crashing CPUs Jiri Slaby
                   ` (8 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Wei Fang, Shaohua Li, Julia Lawall, Jiri Slaby

From: Wei Fang <fangwei1@huawei.com>

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

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

commit 816b0acf3deb6d6be5d0519b286fdd4bafade905 upstream.

If first_bad == this_sector when we get the WriteMostly disk
in read_balance(), valid disk will be returned with zero
max_sectors. It'll lead to a dead loop in make_request(), and
OOM will happen because of endless allocation of struct bio.

Since we can't get data from this disk in this case, so
continue for another disk.

Signed-off-by: Wei Fang <fangwei1@huawei.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/md/raid1.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index 479828ad2021..e5f8fd19e47d 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -560,7 +560,7 @@ static int read_balance(struct r1conf *conf, struct r1bio *r1_bio, int *max_sect
 			if (best_dist_disk < 0) {
 				if (is_badblock(rdev, this_sector, sectors,
 						&first_bad, &bad_sectors)) {
-					if (first_bad < this_sector)
+					if (first_bad <= this_sector)
 						/* Cannot use this */
 						continue;
 					best_good_sectors = first_bad - this_sector;
-- 
2.12.2

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

* [patch added to 3.12-stable] MIPS: Fix crash registers on non-crashing CPUs
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (38 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] md:raid1: fix a dead loop when read from a WriteMostly disk Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] RDS: Fix the atomicity for congestion map update Jiri Slaby
                   ` (7 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable
  Cc: Corey Minyard, David Daney, linux-mips, Ralf Baechle,
	Julia Lawall, Jiri Slaby

From: Corey Minyard <cminyard@mvista.com>

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

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

commit c80e1b62ffca52e2d1d865ee58bc79c4c0c55005 upstream.

As part of handling a crash on an SMP system, an IPI is send to
all other CPUs to save their current registers and stop.  It was
using task_pt_regs(current) to get the registers, but that will
only be accurate if the CPU was interrupted running in userland.
Instead allow the architecture to pass in the registers (all
pass NULL now, but allow for the future) and then use get_irq_regs()
which should be accurate as we are in an interrupt.  Fall back to
task_pt_regs(current) if nothing else is available.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Cc: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/13050/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/kernel/crash.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/mips/kernel/crash.c b/arch/mips/kernel/crash.c
index 93aa302948d7..c68312947ed9 100644
--- a/arch/mips/kernel/crash.c
+++ b/arch/mips/kernel/crash.c
@@ -15,12 +15,22 @@ static int crashing_cpu = -1;
 static cpumask_t cpus_in_crash = CPU_MASK_NONE;
 
 #ifdef CONFIG_SMP
-static void crash_shutdown_secondary(void *ignore)
+static void crash_shutdown_secondary(void *passed_regs)
 {
-	struct pt_regs *regs;
+	struct pt_regs *regs = passed_regs;
 	int cpu = smp_processor_id();
 
-	regs = task_pt_regs(current);
+	/*
+	 * If we are passed registers, use those.  Otherwise get the
+	 * regs from the last interrupt, which should be correct, as
+	 * we are in an interrupt.  But if the regs are not there,
+	 * pull them from the top of the stack.  They are probably
+	 * wrong, but we need something to keep from crashing again.
+	 */
+	if (!regs)
+		regs = get_irq_regs();
+	if (!regs)
+		regs = task_pt_regs(current);
 
 	if (!cpu_online(cpu))
 		return;
-- 
2.12.2

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

* [patch added to 3.12-stable] RDS: Fix the atomicity for congestion map update
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (39 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] MIPS: Fix crash registers on non-crashing CPUs Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] xen/x86: don't lose event interrupts Jiri Slaby
                   ` (6 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable
  Cc: santosh.shilimkar, Wengang Wang, David S . Miller, Julia Lawall,
	Jiri Slaby

From: "santosh.shilimkar@oracle.com" <santosh.shilimkar@oracle.com>

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

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

commit e47db94e10447fc467777a40302f2b393e9af2fa upstream.

Two different threads with different rds sockets may be in
rds_recv_rcvbuf_delta() via receive path. If their ports
both map to the same word in the congestion map, then
using non-atomic ops to update it could cause the map to
be incorrect. Lets use atomics to avoid such an issue.

Full credit to Wengang <wen.gang.wang@oracle.com> for
finding the issue, analysing it and also pointing out
to offending code with spin lock based fix.

Reviewed-by: Leon Romanovsky <leon@leon.nu>
Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/rds/cong.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/rds/cong.c b/net/rds/cong.c
index e5b65acd650b..cec4c4e6d905 100644
--- a/net/rds/cong.c
+++ b/net/rds/cong.c
@@ -285,7 +285,7 @@ void rds_cong_set_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	__set_bit_le(off, (void *)map->m_page_addrs[i]);
+	set_bit_le(off, (void *)map->m_page_addrs[i]);
 }
 
 void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
@@ -299,7 +299,7 @@ void rds_cong_clear_bit(struct rds_cong_map *map, __be16 port)
 	i = be16_to_cpu(port) / RDS_CONG_MAP_PAGE_BITS;
 	off = be16_to_cpu(port) % RDS_CONG_MAP_PAGE_BITS;
 
-	__clear_bit_le(off, (void *)map->m_page_addrs[i]);
+	clear_bit_le(off, (void *)map->m_page_addrs[i]);
 }
 
 static int rds_cong_test_bit(struct rds_cong_map *map, __be16 port)
-- 
2.12.2

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

* [patch added to 3.12-stable] xen/x86: don't lose event interrupts
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (40 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] RDS: Fix the atomicity for congestion map update Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] ALSA: seq: Don't break snd_use_lock_sync() loop by timeout Jiri Slaby
                   ` (5 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Stefano Stabellini, Julia Lawall, Jiri Slaby

From: Stefano Stabellini <sstabellini@kernel.org>

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

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

commit c06b6d70feb32d28f04ba37aa3df17973fd37b6b upstream.

On slow platforms with unreliable TSC, such as QEMU emulated machines,
it is possible for the kernel to request the next event in the past. In
that case, in the current implementation of xen_vcpuop_clockevent, we
simply return -ETIME. To be precise the Xen returns -ETIME and we pass
it on. However the result of this is a missed event, which simply causes
the kernel to hang.

Instead it is better to always ask the hypervisor for a timer event,
even if the timeout is in the past. That way there are no lost
interrupts and the kernel survives. To do that, remove the
VCPU_SSHOTTMR_future flag.

Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Juergen Gross <jgross@suse.com>
Cc: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/xen/time.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 90bfa524b11c..86dc28ce11ab 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -362,11 +362,11 @@ static int xen_vcpuop_set_next_event(unsigned long delta,
 	WARN_ON(evt->mode != CLOCK_EVT_MODE_ONESHOT);
 
 	single.timeout_abs_ns = get_abs_timeout(delta);
-	single.flags = VCPU_SSHOTTMR_future;
+	/* Get an event anyway, even if the timeout is already expired */
+	single.flags = 0;
 
 	ret = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &single);
-
-	BUG_ON(ret != 0 && ret != -ETIME);
+	BUG_ON(ret != 0);
 
 	return ret;
 }
-- 
2.12.2

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

* [patch added to 3.12-stable] ALSA: seq: Don't break snd_use_lock_sync() loop by timeout
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (41 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] xen/x86: don't lose event interrupts Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] MIPS: KGDB: Use kernel context for sleeping threads Jiri Slaby
                   ` (4 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 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 4e7655fd4f47c23e5249ea260dc802f909a64611 upstream.

The snd_use_lock_sync() (thus its implementation
snd_use_lock_sync_helper()) has the 5 seconds timeout to break out of
the sync loop.  It was introduced from the beginning, just to be
"safer", in terms of avoiding the stupid bugs.

However, as Ben Hutchings suggested, this timeout rather introduces a
potential leak or use-after-free that was apparently fixed by the
commit 2d7d54002e39 ("ALSA: seq: Fix race during FIFO resize"):
for example, snd_seq_fifo_event_in() -> snd_seq_event_dup() ->
copy_from_user() could block for a long time, and snd_use_lock_sync()
goes timeout and still leaves the cell at releasing the pool.

For fixing such a problem, we remove the break by the timeout while
still keeping the warning.

Suggested-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 sound/core/seq/seq_lock.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/sound/core/seq/seq_lock.c b/sound/core/seq/seq_lock.c
index 2cfe50c71a9d..8a6b7baafa35 100644
--- a/sound/core/seq/seq_lock.c
+++ b/sound/core/seq/seq_lock.c
@@ -28,19 +28,16 @@
 /* wait until all locks are released */
 void snd_use_lock_sync_helper(snd_use_lock_t *lockp, const char *file, int line)
 {
-	int max_count = 5 * HZ;
+	int warn_count = 5 * HZ;
 
 	if (atomic_read(lockp) < 0) {
 		printk(KERN_WARNING "seq_lock: lock trouble [counter = %d] in %s:%d\n", atomic_read(lockp), file, line);
 		return;
 	}
 	while (atomic_read(lockp) > 0) {
-		if (max_count == 0) {
-			snd_printk(KERN_WARNING "seq_lock: timeout [%d left] in %s:%d\n", atomic_read(lockp), file, line);
-			break;
-		}
+		if (warn_count-- == 0)
+			pr_warn("ALSA: seq_lock: waiting [%d left] in %s:%d\n", atomic_read(lockp), file, line);
 		schedule_timeout_uninterruptible(1);
-		max_count--;
 	}
 }
 
-- 
2.12.2

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

* [patch added to 3.12-stable] MIPS: KGDB: Use kernel context for sleeping threads
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (42 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] ALSA: seq: Don't break snd_use_lock_sync() loop by timeout Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] p9_client_readdir() fix Jiri Slaby
                   ` (3 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: James Hogan, Jason Wessel, linux-mips, Ralf Baechle, Jiri Slaby

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

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

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

commit 162b270c664dca2e0944308e92f9fcc887151a72 upstream.

KGDB is a kernel debug stub and it can't be used to debug userland as it
can only safely access kernel memory.

On MIPS however KGDB has always got the register state of sleeping
processes from the userland register context at the beginning of the
kernel stack. This is meaningless for kernel threads (which never enter
userland), and for user threads it prevents the user seeing what it is
doing while in the kernel:

(gdb) info threads
  Id   Target Id         Frame
  ...
  3    Thread 2 (kthreadd) 0x0000000000000000 in ?? ()
  2    Thread 1 (init)   0x000000007705c4b4 in ?? ()
  1    Thread -2 (shadowCPU0) 0xffffffff8012524c in arch_kgdb_breakpoint () at arch/mips/kernel/kgdb.c:201

Get the register state instead from the (partial) kernel register
context stored in the task's thread_struct for resume() to restore. All
threads now correctly appear to be in context_switch():

(gdb) info threads
  Id   Target Id         Frame
  ...
  3    Thread 2 (kthreadd) context_switch (rq=<optimized out>, cookie=..., next=<optimized out>, prev=0x0) at kernel/sched/core.c:2903
  2    Thread 1 (init)   context_switch (rq=<optimized out>, cookie=..., next=<optimized out>, prev=0x0) at kernel/sched/core.c:2903
  1    Thread -2 (shadowCPU0) 0xffffffff8012524c in arch_kgdb_breakpoint () at arch/mips/kernel/kgdb.c:201

Call clobbered registers which aren't saved and exception registers
(BadVAddr & Cause) which can't be easily determined without stack
unwinding are reported as 0. The PC is taken from the return address,
such that the state presented matches that found immediately after
returning from resume().

Fixes: 8854700115ec ("[MIPS] kgdb: add arch support for the kernel's kgdb core")
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/15829/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/kernel/kgdb.c | 48 +++++++++++++++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 15 deletions(-)

diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index fcaac2f132f0..910db386d9ef 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -236,9 +236,6 @@ static int compute_signal(int tt)
 void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
 {
 	int reg;
-	struct thread_info *ti = task_thread_info(p);
-	unsigned long ksp = (unsigned long)ti + THREAD_SIZE - 32;
-	struct pt_regs *regs = (struct pt_regs *)ksp - 1;
 #if (KGDB_GDB_REG_SIZE == 32)
 	u32 *ptr = (u32 *)gdb_regs;
 #else
@@ -246,25 +243,46 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
 #endif
 
 	for (reg = 0; reg < 16; reg++)
-		*(ptr++) = regs->regs[reg];
+		*(ptr++) = 0;
 
 	/* S0 - S7 */
-	for (reg = 16; reg < 24; reg++)
-		*(ptr++) = regs->regs[reg];
+	*(ptr++) = p->thread.reg16;
+	*(ptr++) = p->thread.reg17;
+	*(ptr++) = p->thread.reg18;
+	*(ptr++) = p->thread.reg19;
+	*(ptr++) = p->thread.reg20;
+	*(ptr++) = p->thread.reg21;
+	*(ptr++) = p->thread.reg22;
+	*(ptr++) = p->thread.reg23;
 
 	for (reg = 24; reg < 28; reg++)
 		*(ptr++) = 0;
 
 	/* GP, SP, FP, RA */
-	for (reg = 28; reg < 32; reg++)
-		*(ptr++) = regs->regs[reg];
-
-	*(ptr++) = regs->cp0_status;
-	*(ptr++) = regs->lo;
-	*(ptr++) = regs->hi;
-	*(ptr++) = regs->cp0_badvaddr;
-	*(ptr++) = regs->cp0_cause;
-	*(ptr++) = regs->cp0_epc;
+	*(ptr++) = (long)p;
+	*(ptr++) = p->thread.reg29;
+	*(ptr++) = p->thread.reg30;
+	*(ptr++) = p->thread.reg31;
+
+	*(ptr++) = p->thread.cp0_status;
+
+	/* lo, hi */
+	*(ptr++) = 0;
+	*(ptr++) = 0;
+
+	/*
+	 * BadVAddr, Cause
+	 * Ideally these would come from the last exception frame up the stack
+	 * but that requires unwinding, otherwise we can't know much for sure.
+	 */
+	*(ptr++) = 0;
+	*(ptr++) = 0;
+
+	/*
+	 * PC
+	 * use return address (RA), i.e. the moment after return from resume()
+	 */
+	*(ptr++) = p->thread.reg31;
 }
 
 void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
-- 
2.12.2

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

* [patch added to 3.12-stable] p9_client_readdir() fix
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (43 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] MIPS: KGDB: Use kernel context for sleeping threads Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] Input: i8042 - add Clevo P650RS to the i8042 reset list Jiri Slaby
                   ` (2 subsequent siblings)
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Al Viro, Jiri Slaby

From: Al Viro <viro@zeniv.linux.org.uk>

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

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

commit 71d6ad08379304128e4bdfaf0b4185d54375423e upstream.

Don't assume that server is sane and won't return more data than
asked for.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/9p/client.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/9p/client.c b/net/9p/client.c
index ae4778c84559..bde453ae5e2e 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -2099,6 +2099,10 @@ int p9_client_readdir(struct p9_fid *fid, char *data, u32 count, u64 offset)
 		trace_9p_protocol_dump(clnt, req->rc);
 		goto free_and_error;
 	}
+	if (rsize < count) {
+		pr_err("bogus RREADDIR count (%d > %d)\n", count, rsize);
+		count = rsize;
+	}
 
 	p9_debug(P9_DEBUG_9P, "<<< RREADDIR count %d\n", count);
 
-- 
2.12.2

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

* [patch added to 3.12-stable] Input: i8042 - add Clevo P650RS to the i8042 reset list
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (44 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] p9_client_readdir() fix Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] nfsd: check for oversized NFSv2/v3 arguments Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram Jiri Slaby
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: Dmitry Torokhov, Jiri Slaby

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>

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

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

commit 7c5bb4ac2b76d2a09256aec8a7d584bf3e2b0466 upstream.

Clevo P650RS and other similar devices require i8042 to be reset in order
to detect Synaptics touchpad.

Reported-by: Paweł Bylica <chfast@gmail.com>
Tested-by: Ed Bordin <edbordin@gmail.com>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=190301
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 9a2d2159bf0c..04a2593f0a9a 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -594,6 +594,13 @@ static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "20046"),
 		},
 	},
+	{
+		/* Clevo P650RS, 650RP6, Sager NP8152-S, and others */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "P65xRP"),
+		},
+	},
 	{ }
 };
 
-- 
2.12.2

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

* [patch added to 3.12-stable] nfsd: check for oversized NFSv2/v3 arguments
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (45 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] Input: i8042 - add Clevo P650RS to the i8042 reset list Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  2017-05-03 12:23 ` [patch added to 3.12-stable] ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram Jiri Slaby
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable; +Cc: J. Bruce Fields, Jiri Slaby

From: "J. Bruce Fields" <bfields@redhat.com>

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

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

commit e6838a29ecb484c97e4efef9429643b9851fba6e upstream.

A client can append random data to the end of an NFSv2 or NFSv3 RPC call
without our complaining; we'll just stop parsing at the end of the
expected data and ignore the rest.

Encoded arguments and replies are stored together in an array of pages,
and if a call is too large it could leave inadequate space for the
reply.  This is normally OK because NFS RPC's typically have either
short arguments and long replies (like READ) or long arguments and short
replies (like WRITE).  But a client that sends an incorrectly long reply
can violate those assumptions.  This was observed to cause crashes.

Also, several operations increment rq_next_page in the decode routine
before checking the argument size, which can leave rq_next_page pointing
well past the end of the page array, causing trouble later in
svc_free_pages.

So, following a suggestion from Neil Brown, add a central check to
enforce our expectation that no NFSv2/v3 call has both a large call and
a large reply.

As followup we may also want to rewrite the encoding routines to check
more carefully that they aren't running off the end of the page array.

We may also consider rejecting calls that have any extra garbage
appended.  That would be safer, and within our rights by spec, but given
the age of our server and the NFS protocol, and the fact that we've
never enforced this before, we may need to balance that against the
possibility of breaking some oddball client.

Reported-by: Tuomas Haanpää <thaan@synopsys.com>
Reported-by: Ari Kauppi <ari@synopsys.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfsd/nfssvc.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index 4942f4370f60..a0903991a0fd 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -628,6 +628,37 @@ static __be32 map_new_errors(u32 vers, __be32 nfserr)
 	return nfserr;
 }
 
+/*
+ * A write procedure can have a large argument, and a read procedure can
+ * have a large reply, but no NFSv2 or NFSv3 procedure has argument and
+ * reply that can both be larger than a page.  The xdr code has taken
+ * advantage of this assumption to be a sloppy about bounds checking in
+ * some cases.  Pending a rewrite of the NFSv2/v3 xdr code to fix that
+ * problem, we enforce these assumptions here:
+ */
+static bool nfs_request_too_big(struct svc_rqst *rqstp,
+				struct svc_procedure *proc)
+{
+	/*
+	 * The ACL code has more careful bounds-checking and is not
+	 * susceptible to this problem:
+	 */
+	if (rqstp->rq_prog != NFS_PROGRAM)
+		return false;
+	/*
+	 * Ditto NFSv4 (which can in theory have argument and reply both
+	 * more than a page):
+	 */
+	if (rqstp->rq_vers >= 4)
+		return false;
+	/* The reply will be small, we're OK: */
+	if (proc->pc_xdrressize > 0 &&
+	    proc->pc_xdrressize < XDR_QUADLEN(PAGE_SIZE))
+		return false;
+
+	return rqstp->rq_arg.len > PAGE_SIZE;
+}
+
 int
 nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
 {
@@ -640,6 +671,11 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
 				rqstp->rq_vers, rqstp->rq_proc);
 	proc = rqstp->rq_procinfo;
 
+	if (nfs_request_too_big(rqstp, proc)) {
+		dprintk("nfsd: NFSv%d argument too large\n", rqstp->rq_vers);
+		*statp = rpc_garbage_args;
+		return 1;
+	}
 	/*
 	 * Give the xdr decoder a chance to change this if it wants
 	 * (necessary in the NFSv4.0 compound case)
-- 
2.12.2

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

* [patch added to 3.12-stable] ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram
  2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
                   ` (46 preceding siblings ...)
  2017-05-03 12:23 ` [patch added to 3.12-stable] nfsd: check for oversized NFSv2/v3 arguments Jiri Slaby
@ 2017-05-03 12:23 ` Jiri Slaby
  47 siblings, 0 replies; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 12:23 UTC (permalink / raw)
  To: stable
  Cc: Josh Poimboeuf, Rafael J . Wysocki, linux-acpi, Borislav Petkov,
	Len Brown, Thomas Gleixner, 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 34a477e5297cbaa6ecc6e17c042a866e1cbe80d6 upstream.

On x86-32, with CONFIG_FIRMWARE and multiple CPUs, if you enable function
graph tracing and then suspend to RAM, it will triple fault and reboot when
it resumes.

The first fault happens when booting a secondary CPU:

startup_32_smp()
  load_ucode_ap()
    prepare_ftrace_return()
      ftrace_graph_is_dead()
        (accesses 'kill_ftrace_graph')

The early head_32.S code calls into load_ucode_ap(), which has an an
ftrace hook, so it calls prepare_ftrace_return(), which calls
ftrace_graph_is_dead(), which tries to access the global
'kill_ftrace_graph' variable with a virtual address, causing a fault
because the CPU is still in real mode.

The fix is to add a check in prepare_ftrace_return() to make sure it's
running in protected mode before continuing.  The check makes sure the
stack pointer is a virtual kernel address.  It's a bit of a hack, but
it's not very intrusive and it works well enough.

For reference, here are a few other (more difficult) ways this could
have potentially been fixed:

- Move startup_32_smp()'s call to load_ucode_ap() down to *after* paging
  is enabled.  (No idea what that would break.)

- Track down load_ucode_ap()'s entire callee tree and mark all the
  functions 'notrace'.  (Probably not realistic.)

- Pause graph tracing in ftrace_suspend_notifier_call() or bringup_cpu()
  or __cpu_up(), and ensure that the pause facility can be queried from
  real mode.

Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>
Cc: linux-acpi@vger.kernel.org
Cc: Borislav Petkov <bp@alien8.de>
Cc: Len Brown <lenb@kernel.org>
Link: http://lkml.kernel.org/r/5c1272269a580660703ed2eccf44308e790c7a98.1492123841.git.jpoimboe@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/x86/kernel/ftrace.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index f8ab203fb676..b8162154e615 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -735,6 +735,18 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
 	unsigned long return_hooker = (unsigned long)
 				&return_to_handler;
 
+	/*
+	 * When resuming from suspend-to-ram, this function can be indirectly
+	 * called from early CPU startup code while the CPU is in real mode,
+	 * which would fail miserably.  Make sure the stack pointer is a
+	 * virtual address.
+	 *
+	 * This check isn't as accurate as virt_addr_valid(), but it should be
+	 * good enough for this purpose, and it's fast.
+	 */
+	if (unlikely((long)__builtin_frame_address(0) >= 0))
+		return;
+
 	if (unlikely(atomic_read(&current->tracing_graph_pause)))
 		return;
 
-- 
2.12.2


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

* Re: [patch added to 3.12-stable] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd
  2017-05-03 12:23 ` [patch added to 3.12-stable] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd Jiri Slaby
@ 2017-05-03 12:39   ` Suzuki K Poulose
  2017-05-03 13:21     ` Jiri Slaby
  0 siblings, 1 reply; 52+ messages in thread
From: Suzuki K Poulose @ 2017-05-03 12:39 UTC (permalink / raw)
  To: Jiri Slaby, stable
  Cc: Paolo Bonzini, Marc Zyngier, Christoffer Dall, Mark Rutland,
	Christoffer Dall

On 03/05/17 13:23, Jiri Slaby wrote:
> From: Suzuki K Poulose <suzuki.poulose@arm.com>
>
> This patch has been added to the 3.12 stable tree. If you have any
> objections, please let us know.
>
> ===============
>
> commit 8b3405e345b5a098101b0c31b264c812bba045d9 upstream.
>
> In kvm_free_stage2_pgd() we don't hold the kvm->mmu_lock while calling
> unmap_stage2_range() on the entire memory range for the guest. This could
> cause problems with other callers (e.g, munmap on a memslot) trying to
> unmap a range. And since we have to unmap the entire Guest memory range
> holding a spinlock, make sure we yield the lock if necessary, after we
> unmap each PUD range.
>
> Fixes: commit d5d8184d35c9 ("KVM: ARM: Memory virtualization setup")
> Cc: Paolo Bonzini <pbonzin@redhat.com>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Christoffer Dall <christoffer.dall@linaro.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> [ Avoid vCPU starvation and lockup detector warnings ]
> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> Signed-off-by: Christoffer Dall <cdall@linaro.org>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  arch/arm/kvm/mmu.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
> index 683cac91a7f6..65f401ddb2a7 100644
> --- a/arch/arm/kvm/mmu.c
> +++ b/arch/arm/kvm/mmu.c
> @@ -240,6 +240,14 @@ static void stage2_flush_memslot(struct kvm *kvm,
>  	do {
>  		next = kvm_pgd_addr_end(addr, end);
>  		stage2_flush_puds(kvm, pgd, addr, next);
> +		/*
> +		 * If we are dealing with a large range in
> +		 * stage2 table, release the kvm->mmu_lock
> +		 * to prevent starvation and lockup detector
> +		 * warnings.
> +		 */
> +		if (kvm && (next != end))
> +			cond_resched_lock(&kvm->mmu_lock);
>  	} while (pgd++, addr = next, addr != end);
>  }

This is wrong. Did you get a warning when you applied the original patch ?
The hunk should be applied to unmap_range(), something like :

diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 683cac9..a10f5f1 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -181,6 +181,13 @@ static void unmap_range(struct kvm *kvm, pgd_t *pgdp,
         do {
                 next = kvm_pgd_addr_end(addr, end);
                 unmap_puds(kvm, pgd, addr, next);
+		/*
+		 * If we are dealing with a large range in stage2 table,
+		 * release the kvm->mmu_lock to prevent starvation and
+		 * lockup detector warnings.
+		 */
+		if (kvm && next != end)
+			cond_resched_lock(&kvm->mmu_lock);
	} while (pgd++, addr = next, addr != end);
  }


Rest are fine. Do you want me to send the correct patch for 3.12 ? As such, the
above hunk is based on 3.12.

Suzuki

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

* Re: [patch added to 3.12-stable] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd
  2017-05-03 12:39   ` Suzuki K Poulose
@ 2017-05-03 13:21     ` Jiri Slaby
  2017-05-03 13:31       ` Suzuki K Poulose
  0 siblings, 1 reply; 52+ messages in thread
From: Jiri Slaby @ 2017-05-03 13:21 UTC (permalink / raw)
  To: Suzuki K Poulose, stable
  Cc: Paolo Bonzini, Marc Zyngier, Christoffer Dall, Mark Rutland,
	Christoffer Dall

On 05/03/2017, 02:39 PM, Suzuki K Poulose wrote:
> Rest are fine. Do you want me to send the correct patch for 3.12 ? As
> such, the
> above hunk is based on 3.12.

I have fixed it as you suggest, please check the new version.

Thanks!

-- 
js
suse labs

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

* Re: [patch added to 3.12-stable] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd
  2017-05-03 13:21     ` Jiri Slaby
@ 2017-05-03 13:31       ` Suzuki K Poulose
  0 siblings, 0 replies; 52+ messages in thread
From: Suzuki K Poulose @ 2017-05-03 13:31 UTC (permalink / raw)
  To: Jiri Slaby, stable
  Cc: Paolo Bonzini, Marc Zyngier, Christoffer Dall, Mark Rutland,
	Christoffer Dall

On 03/05/17 14:21, Jiri Slaby wrote:
> On 05/03/2017, 02:39 PM, Suzuki K Poulose wrote:
>> Rest are fine. Do you want me to send the correct patch for 3.12 ? As
>> such, the
>> above hunk is based on 3.12.
>
> I have fixed it as you suggest, please check the new version.
>
> Thanks!
>

The new one looks good to me.

Suzuki

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

end of thread, other threads:[~2017-05-03 13:31 UTC | newest]

Thread overview: 52+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-03 12:22 [patch added to 3.12-stable] rtc: tegra: Implement clock handling Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] mm: Tighten x86 /dev/mem with zeroing reads Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] virtio-console: avoid DMA from stack Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] pegasus: Use heap buffers for all register access Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] rtl8150: " Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] catc: Combine failure cleanup code in catc_probe() Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] catc: Use heap buffer for memory size test Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] net: ipv6: check route protocol when deleting routes Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: Disallow keyrings beginning with '.' to be joined as session keyrings Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: Change the name of the dead type to ".dead" to prevent user access Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] KEYS: fix keyctl_set_reqkey_keyring() to not leak thread keyrings Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] tracing: Allocate the snapshot buffer before enabling probe Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] ring-buffer: Have ring_buffer_iter_empty() return true when empty Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] cifs: Do not send echoes before Negotiate is complete Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] CIFS: remove bad_network_name flag Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] Drivers: hv: don't leak memory in vmbus_establish_gpadl() Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] Drivers: hv: get rid of timeout in vmbus_open() Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] Input: elantech - add Fujitsu Lifebook E547 to force crc_enabled Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] ACPI / power: Avoid maybe-uninitialized warning Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] ubi/upd: Always flush after prepared for an update Jiri Slaby
2017-05-03 12:22 ` [patch added to 3.12-stable] x86/mce/AMD: Give a name to MCA bank 3 when accessed with legacy MSRs Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] kvm: arm/arm64: Fix locking for kvm_free_stage2_pgd Jiri Slaby
2017-05-03 12:39   ` Suzuki K Poulose
2017-05-03 13:21     ` Jiri Slaby
2017-05-03 13:31       ` Suzuki K Poulose
2017-05-03 12:23 ` [patch added to 3.12-stable] block: fix del_gendisk() vs blkdev_ioctl crash Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] powerpc: Reject binutils 2.24 when building little endian Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] ping: implement proper locking Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] net/packet: fix overflow in check for tp_frame_nr Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] net/packet: fix overflow in check for tp_reserve Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] netfilter: arp_tables: fix invoking 32bit "iptable -P INPUT ACCEPT" failed in 64bit kernel Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] tty: nozomi: avoid a harmless gcc warning Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] hostap: avoid uninitialized variable use in hfa384x_get_rid Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] gfs2: avoid uninitialized variable warning Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] net: neigh: guard against NULL solicit() method Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] net: phy: handle state correctly in phy_stop_machine Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] l2tp: take reference on sessions being dumped Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] net: ipv4: fix multipath RTM_GETROUTE behavior when iif is given Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] sctp: listen on the sock only when it's state is listening or closed Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] ip6mr: fix notification device destruction Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] ipv6: check raw payload size correctly in ioctl Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea() Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] md:raid1: fix a dead loop when read from a WriteMostly disk Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] MIPS: Fix crash registers on non-crashing CPUs Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] RDS: Fix the atomicity for congestion map update Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] xen/x86: don't lose event interrupts Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] ALSA: seq: Don't break snd_use_lock_sync() loop by timeout Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] MIPS: KGDB: Use kernel context for sleeping threads Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] p9_client_readdir() fix Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] Input: i8042 - add Clevo P650RS to the i8042 reset list Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] nfsd: check for oversized NFSv2/v3 arguments Jiri Slaby
2017-05-03 12:23 ` [patch added to 3.12-stable] ftrace/x86: Fix triple fault with graph tracing and suspend-to-ram 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.