linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.12 01/56] NFS: Don't attempt to decode missing directory entries
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
@ 2016-06-15  7:29 ` Jiri Slaby
  2016-06-15  7:29 ` [PATCH 3.12 02/56] IB/security: Restrict use of the write() interface Jiri Slaby
                   ` (56 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:29 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Benjamin Coddington, Trond Myklebust, Neil Brown,
	Jiri Slaby

From: Benjamin Coddington <bcodding@redhat.com>

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

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

commit ce85cfbed6fe3dbc01bd1976b23ac3e97878cde6 upstream.

If a READDIR reply comes back without any page data, avoid a NULL pointer
dereference in xdr_copy_to_scratch().

BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
IP: [<ffffffff813a378d>] memcpy+0xd/0x110
...
Call Trace:
	? xdr_inline_decode+0x7a/0xb0 [sunrpc]
	nfs3_decode_dirent+0x73/0x320 [nfsv3]
	nfs_readdir_page_filler+0xd5/0x4e0 [nfs]
	? nfs3_rpc_wrapper.constprop.9+0x42/0xc0 [nfsv3]
	nfs_readdir_xdr_to_array+0x1fa/0x330 [nfs]
	? mem_cgroup_commit_charge+0xac/0x160
	? nfs_readdir_xdr_to_array+0x330/0x330 [nfs]
	nfs_readdir_filler+0x22/0x90 [nfs]
	do_read_cache_page+0x7e/0x1a0
	read_cache_page+0x1c/0x20
	nfs_readdir+0x18e/0x660 [nfs]
	? nfs3_xdr_dec_getattr3res+0x80/0x80 [nfsv3]
	iterate_dir+0x97/0x130
	SyS_getdents+0x94/0x120
	? fillonedir+0xd0/0xd0
	system_call_fastpath+0x12/0x17

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Neil Brown <nfbrown@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/nfs/dir.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 140280623348..cf6ede69a2e2 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -510,6 +510,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
 	if (scratch == NULL)
 		return -ENOMEM;
 
+	if (buflen == 0)
+		goto out_nopages;
+
 	xdr_init_decode_pages(&stream, &buf, xdr_pages, buflen);
 	xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
 
@@ -531,6 +534,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
 			break;
 	} while (!entry->eof);
 
+out_nopages:
 	if (count == 0 || (status == -EBADCOOKIE && entry->eof != 0)) {
 		array = nfs_readdir_get_array(page);
 		if (!IS_ERR(array)) {
-- 
2.9.0

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

* [PATCH 3.12 02/56] IB/security: Restrict use of the write() interface
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
  2016-06-15  7:29 ` [PATCH 3.12 01/56] NFS: Don't attempt to decode missing directory entries Jiri Slaby
@ 2016-06-15  7:29 ` Jiri Slaby
  2016-06-15  7:29 ` [PATCH 3.12 03/56] HID: usbhid: quirks for Corsair RGB keyboard & mice (K70R, K95RGB, M65RGB, K70RGB, K65RGB) Jiri Slaby
                   ` (55 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:29 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Jason Gunthorpe, Linus Torvalds, Doug Ledford, Jiri Slaby

From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

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

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

commit e6bd18f57aad1a2d1ef40e646d03ed0f2515c9e3 upstream.

The drivers/infiniband stack uses write() as a replacement for
bi-directional ioctl().  This is not safe. There are ways to
trigger write calls that result in the return structure that
is normally written to user space being shunted off to user
specified kernel memory instead.

For the immediate repair, detect and deny suspicious accesses to
the write API.

For long term, update the user space libraries and the kernel API
to something that doesn't present the same security vulnerabilities
(likely a structured ioctl() interface).

The impacted uAPI interfaces are generally only available if
hardware from drivers/infiniband is installed in the system.

[js] backport to 3.12: hfi1 is not there yet (exclude), ipath is still
     there (include)

Reported-by: Jann Horn <jann@thejh.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
[ Expanded check to all known write() entry points ]
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/infiniband/core/ucm.c                |  4 ++++
 drivers/infiniband/core/ucma.c               |  3 +++
 drivers/infiniband/core/uverbs_main.c        |  5 +++++
 drivers/infiniband/hw/ipath/ipath_file_ops.c |  5 +++++
 drivers/infiniband/hw/qib/qib_file_ops.c     |  5 +++++
 include/rdma/ib.h                            | 16 ++++++++++++++++
 6 files changed, 38 insertions(+)

diff --git a/drivers/infiniband/core/ucm.c b/drivers/infiniband/core/ucm.c
index f2f63933e8a9..5befec118a18 100644
--- a/drivers/infiniband/core/ucm.c
+++ b/drivers/infiniband/core/ucm.c
@@ -48,6 +48,7 @@
 
 #include <asm/uaccess.h>
 
+#include <rdma/ib.h>
 #include <rdma/ib_cm.h>
 #include <rdma/ib_user_cm.h>
 #include <rdma/ib_marshall.h>
@@ -1104,6 +1105,9 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf,
 	struct ib_ucm_cmd_hdr hdr;
 	ssize_t result;
 
+	if (WARN_ON_ONCE(!ib_safe_file_access(filp)))
+		return -EACCES;
+
 	if (len < sizeof(hdr))
 		return -EINVAL;
 
diff --git a/drivers/infiniband/core/ucma.c b/drivers/infiniband/core/ucma.c
index b0f189be543b..da67839fc451 100644
--- a/drivers/infiniband/core/ucma.c
+++ b/drivers/infiniband/core/ucma.c
@@ -1494,6 +1494,9 @@ static ssize_t ucma_write(struct file *filp, const char __user *buf,
 	struct rdma_ucm_cmd_hdr hdr;
 	ssize_t ret;
 
+	if (WARN_ON_ONCE(!ib_safe_file_access(filp)))
+		return -EACCES;
+
 	if (len < sizeof(hdr))
 		return -EINVAL;
 
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 68e5496c5d58..ee5222168b68 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -48,6 +48,8 @@
 
 #include <asm/uaccess.h>
 
+#include <rdma/ib.h>
+
 #include "uverbs.h"
 
 MODULE_AUTHOR("Roland Dreier");
@@ -601,6 +603,9 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
 	struct ib_uverbs_file *file = filp->private_data;
 	struct ib_uverbs_cmd_hdr hdr;
 
+	if (WARN_ON_ONCE(!ib_safe_file_access(filp)))
+		return -EACCES;
+
 	if (count < sizeof hdr)
 		return -EINVAL;
 
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c
index 6d7f453b4d05..a0626b8c61c5 100644
--- a/drivers/infiniband/hw/ipath/ipath_file_ops.c
+++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c
@@ -45,6 +45,8 @@
 #include <linux/cpu.h>
 #include <asm/pgtable.h>
 
+#include <rdma/ib.h>
+
 #include "ipath_kernel.h"
 #include "ipath_common.h"
 #include "ipath_user_sdma.h"
@@ -2240,6 +2242,9 @@ static ssize_t ipath_write(struct file *fp, const char __user *data,
 	ssize_t ret = 0;
 	void *dest;
 
+	if (WARN_ON_ONCE(!ib_safe_file_access(fp)))
+		return -EACCES;
+
 	if (count < sizeof(cmd.type)) {
 		ret = -EINVAL;
 		goto bail;
diff --git a/drivers/infiniband/hw/qib/qib_file_ops.c b/drivers/infiniband/hw/qib/qib_file_ops.c
index 2023cd61b897..3c089ca85c64 100644
--- a/drivers/infiniband/hw/qib/qib_file_ops.c
+++ b/drivers/infiniband/hw/qib/qib_file_ops.c
@@ -45,6 +45,8 @@
 #include <linux/delay.h>
 #include <linux/export.h>
 
+#include <rdma/ib.h>
+
 #include "qib.h"
 #include "qib_common.h"
 #include "qib_user_sdma.h"
@@ -2058,6 +2060,9 @@ static ssize_t qib_write(struct file *fp, const char __user *data,
 	ssize_t ret = 0;
 	void *dest;
 
+	if (WARN_ON_ONCE(!ib_safe_file_access(fp)))
+		return -EACCES;
+
 	if (count < sizeof(cmd.type)) {
 		ret = -EINVAL;
 		goto bail;
diff --git a/include/rdma/ib.h b/include/rdma/ib.h
index cf8f9e700e48..a6b93706b0fc 100644
--- a/include/rdma/ib.h
+++ b/include/rdma/ib.h
@@ -34,6 +34,7 @@
 #define _RDMA_IB_H
 
 #include <linux/types.h>
+#include <linux/sched.h>
 
 struct ib_addr {
 	union {
@@ -86,4 +87,19 @@ struct sockaddr_ib {
 	__u64			sib_scope_id;
 };
 
+/*
+ * The IB interfaces that use write() as bi-directional ioctl() are
+ * fundamentally unsafe, since there are lots of ways to trigger "write()"
+ * calls from various contexts with elevated privileges. That includes the
+ * traditional suid executable error message writes, but also various kernel
+ * interfaces that can write to file descriptors.
+ *
+ * This function provides protection for the legacy API by restricting the
+ * calling context.
+ */
+static inline bool ib_safe_file_access(struct file *filp)
+{
+	return filp->f_cred == current_cred() && segment_eq(get_fs(), USER_DS);
+}
+
 #endif /* _RDMA_IB_H */
-- 
2.9.0

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

* [PATCH 3.12 03/56] HID: usbhid: quirks for Corsair RGB keyboard & mice (K70R, K95RGB, M65RGB, K70RGB, K65RGB)
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
  2016-06-15  7:29 ` [PATCH 3.12 01/56] NFS: Don't attempt to decode missing directory entries Jiri Slaby
  2016-06-15  7:29 ` [PATCH 3.12 02/56] IB/security: Restrict use of the write() interface Jiri Slaby
@ 2016-06-15  7:29 ` Jiri Slaby
  2016-06-15  7:29 ` [PATCH 3.12 04/56] HID: Fix boot delay for Creative SB Omni Surround 5.1 with quirk Jiri Slaby
                   ` (54 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:29 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Trent Lloyd, Jiri Kosina, Oliver Neukum, Jiri Slaby

From: Trent Lloyd <trent@lloyd.id.au>

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

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

commit 282bf1fe6dca4b768d6bedc14aea1b82c36241c1 upstream.

These devices feature multiple interfaces/endpoints: a legacy BIOS/boot
interface (endpoint 0x81), as well as 2 corsair-specific keyboard interfaces
(endpoint 0x82, 0x83 IN/0x03 OUT) and an RGB LED control interface (endpoint
0x84 IN/0x04 OUT)

Because the extra 3 interfaces are not of subclass USB_INTERFACE_SUBCLASS_BOOT,
HID_QUIRK_NOGET is not automatically set on them and a 10s timeout per-endpoint
(30s per device) occurs initialising reports on boot.  We configure
HID_QUIRK_NO_INIT_REPORTS for these devices.

Additionally the left-side G1-G18 macro keys on the K95RGB generate output on
the un-opened 0x82/0x83 endpoints which causes the keyboard to stop responding
waiting for this event to be collected.  We enable HID_QUIRK_ALWAYS_POLL to
prevent this situation from occurring.

Signed-off-by: Trent Lloyd <trent@lloyd.id.au>
Tested-by: SUGNIAUX Wilfried <wsu@ppharm2k20.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-ids.h           | 9 +++++++++
 drivers/hid/usbhid/hid-quirks.c | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 50b25fad982d..1ffecd312bb8 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -237,6 +237,15 @@
 #define USB_DEVICE_ID_CODEMERCS_IOW_FIRST	0x1500
 #define USB_DEVICE_ID_CODEMERCS_IOW_LAST	0x15ff
 
+#define USB_VENDOR_ID_CORSAIR		0x1b1c
+
+#define USB_VENDOR_ID_CORSAIR           0x1b1c
+#define USB_DEVICE_ID_CORSAIR_K70R      0x1b09
+#define USB_DEVICE_ID_CORSAIR_K95RGB    0x1b11
+#define USB_DEVICE_ID_CORSAIR_M65RGB    0x1b12
+#define USB_DEVICE_ID_CORSAIR_K70RGB    0x1b13
+#define USB_DEVICE_ID_CORSAIR_K65RGB    0x1b17
+
 #define USB_VENDOR_ID_CREATIVELABS	0x041e
 #define USB_DEVICE_ID_PRODIKEYS_PCMIDI	0x2801
 
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 7166d7fb43de..5f808789f145 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -70,6 +70,11 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_AXIS_295, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL },
+	{ USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70R, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_M65RGB, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K95RGB, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
+	{ USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
-- 
2.9.0

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

* [PATCH 3.12 04/56] HID: Fix boot delay for Creative SB Omni Surround 5.1 with quirk
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (2 preceding siblings ...)
  2016-06-15  7:29 ` [PATCH 3.12 03/56] HID: usbhid: quirks for Corsair RGB keyboard & mice (K70R, K95RGB, M65RGB, K70RGB, K65RGB) Jiri Slaby
@ 2016-06-15  7:29 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 05/56] HID: microsoft: Add Surface Power Cover Jiri Slaby
                   ` (53 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:29 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Nazar Mokrynskyi, Jiri Kosina, Oliver Neukum, Jiri Slaby

From: Nazar Mokrynskyi <nazar@mokrynskyi.com>

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

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

commit 567a44ecb44eb2584ddb93e962cfb133ce77e0bb upstream.

Needed for v2 of the device firmware, otherwise kernel will stuck for few
seconds and throw "usb_submit_urb(ctrl) failed: -1" early on system boot.

Signed-off-by: Nazar Mokrynskyi <nazar@mokrynskyi.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 1ffecd312bb8..fb200df1e78e 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -247,6 +247,7 @@
 #define USB_DEVICE_ID_CORSAIR_K65RGB    0x1b17
 
 #define USB_VENDOR_ID_CREATIVELABS	0x041e
+#define USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51	0x322c
 #define USB_DEVICE_ID_PRODIKEYS_PCMIDI	0x2801
 
 #define USB_VENDOR_ID_CVTOUCH		0x1ff7
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 5f808789f145..3771a7ef6395 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -75,6 +75,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K95RGB, HID_QUIRK_NO_INIT_REPORTS | HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K70RGB, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_CORSAIR, USB_DEVICE_ID_CORSAIR_K65RGB, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_CREATIVE_SB_OMNI_SURROUND_51, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_DMI, USB_DEVICE_ID_DMI_ENC, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
-- 
2.9.0

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

* [PATCH 3.12 00/56] 3.12.61-stable review
@ 2016-06-15  7:30 Jiri Slaby
  2016-06-15  7:29 ` [PATCH 3.12 01/56] NFS: Don't attempt to decode missing directory entries Jiri Slaby
                   ` (57 more replies)
  0 siblings, 58 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux, shuah.kh, linux-kernel, Jiri Slaby

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

Responses should be made by Fri Jun 17 09:29:40 CEST 2016.
Anything received after that time might be too late.

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

thanks,
js

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


Adrian Hunter (1):
  mmc: mmc: Fix partition switch timeout for some eMMCs

Alistair Leslie-Hughes (1):
  HID: microsoft: add support for 3 more devices

Antti Palosaari (1):
  [media] af9035: correct eeprom offsets

Benjamin Coddington (1):
  NFS: Don't attempt to decode missing directory entries

Chanwoo Choi (1):
  serial: samsung: Reorder the sequence of clock control when call
    s3c24xx_serial_set_termios()

Colin Ian King (1):
  pch_phub: return -ENODATA if ROM can't be mapped

Cyan Ogilvie (1):
  HID: wiimote: Fix wiimote mp scale linearization

Dan Bogdan Nechita (1):
  misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes

Daniel Bristot de Oliveira (1):
  HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2

Dave Chinner (3):
  xfs: xfs_iflush_cluster fails to abort on error
  xfs: fix inode validity check in xfs_iflush_cluster
  xfs: skip stale inodes in xfs_iflush_cluster

Dave Gerlach (1):
  cpuidle: Indicate when a device has been unregistered

Donavan Lance (1):
  HID: Add new Microsoft Type Cover 3 product ID

Hari Bathini (1):
  powerpc/book3s64: Fix branching to OOL handlers in relocatable kernel

Itai Handler (1):
  drm/gma500: Fix possible out of bounds read

James Hogan (1):
  MIPS: Fix siginfo.h to use strict posix types

Jason Gunthorpe (1):
  IB/security: Restrict use of the write() interface

Jiri Slaby (1):
  tty: vt, return error when con_startup fails

Johan Hovold (4):
  USB: serial: keyspan: fix use-after-free in probe error path
  USB: serial: quatech2: fix use-after-free in probe error path
  USB: serial: io_edgeport: fix memory leaks in attach error path
  USB: serial: io_edgeport: fix memory leaks in probe error path

Joseph Salisbury (1):
  ath5k: Change led pin configuration for compaq c700 laptop

Loic Poulain (1):
  Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data

Lv Zheng (1):
  ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA
    internal strings

Lyude (1):
  drm/fb_helper: Fix references to dev->mode_config.num_connector

Matt Gumbel (1):
  mmc: longer timeout for long read time quirk

Matthias Schiffer (1):
  MIPS: ath79: make bootconsole wait for both THRE and TEMT

Nazar Mokrynskyi (1):
  HID: Fix boot delay for Creative SB Omni Surround 5.1 with quirk

Nicolai Stange (2):
  ext4: address UBSAN warning in mb_find_order_for_block()
  ext4: silence UBSAN in ext4_mb_init()

Paul Burton (1):
  MIPS: math-emu: Fix jalr emulation when rd == $0

Prarit Bhargava (1):
  PCI: Disable all BAR sizing for devices with non-compliant BARs

Raghava Aditya Renukunta (2):
  aacraid: Relinquish CPU during timeout wait
  aacraid: Fix for aac_command_thread hang

Raimund Roth (1):
  HID: microsoft: Add Surface Power Cover

Ricky Liang (1):
  Input: uinput - handle compat ioctl for UI_SET_PHYS

Ross Lagerwall (1):
  xen/events: Don't move disabled irqs

Schemmel Hans-Christoph (1):
  USB: serial: option: add support for Cinterion PH8 and AHxx

Sean Young (1):
  HID: sjoy: support Super Joy Box 4

Slava Bacherikov (1):
  HID: microsoft: Add ID for MS Wireless Comfort Keyboard

Stefan Metzmacher (1):
  fs/cifs: correctly to anonymous authentication via NTLMSSP

Stephen Just (1):
  HID: microsoft: Add Surface 3 type cover

Steve French (1):
  remove directory incorrectly tries to set delete on close on non-empty
    directories

Steven Rostedt (Red Hat) (2):
  ring-buffer: Use long for nr_pages to avoid overflow failures
  ring-buffer: Prevent overflow of size in ring_buffer_resize()

Theodore Ts'o (1):
  ext4: fix hang when processing corrupted orphaned inode list

Tomáš Trnka (1):
  sunrpc: fix stripping of padded MIC tokens

Trent Lloyd (1):
  HID: usbhid: quirks for Corsair RGB keyboard & mice (K70R, K95RGB,
    M65RGB, K70RGB, K65RGB)

Ville Syrjälä (1):
  dma-debug: avoid spinlock recursion when disabling dma-debug

Vineet Gupta (1):
  ARC: use ASL assembler mnemonic

Vladis Dronov (1):
  [media] usbvision: revert commit 588afcc1

Wei-Ning Huang (1):
  Bluetooth: btmrvl_sdio: fix firmware activation failure

wang yanqing (1):
  rtlwifi: Fix logic error in enter/exit power-save mode

Николай Кудрявцев (1):
  HID: chicony: Add support for Acer Aspire Switch 12

 arch/arc/mm/tlbex.S                           |  6 ++--
 arch/mips/ath79/early_printk.c                |  6 ++--
 arch/mips/include/uapi/asm/siginfo.h          | 18 +++++-----
 arch/mips/math-emu/cp1emu.c                   |  8 +++--
 arch/powerpc/kernel/exceptions-64s.S          | 16 ++++++---
 drivers/acpi/osl.c                            | 16 ++++++---
 drivers/bluetooth/btmrvl_sdio.c               |  2 +-
 drivers/bluetooth/hci_ldisc.c                 | 11 +++---
 drivers/bluetooth/hci_uart.h                  |  1 +
 drivers/cpuidle/cpuidle.c                     |  2 ++
 drivers/gpu/drm/drm_fb_helper.c               |  5 ++-
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c |  2 +-
 drivers/hid/hid-chicony.c                     | 26 ++++++++++++++
 drivers/hid/hid-core.c                        | 18 ++++++++--
 drivers/hid/hid-ids.h                         | 26 ++++++++++++--
 drivers/hid/hid-microsoft.c                   | 16 ++++++++-
 drivers/hid/hid-sjoy.c                        |  3 ++
 drivers/hid/hid-wiimote-modules.c             | 14 ++++----
 drivers/hid/usbhid/hid-quirks.c               | 13 +++++--
 drivers/infiniband/core/ucm.c                 |  4 +++
 drivers/infiniband/core/ucma.c                |  3 ++
 drivers/infiniband/core/uverbs_main.c         |  5 +++
 drivers/infiniband/hw/ipath/ipath_file_ops.c  |  5 +++
 drivers/infiniband/hw/qib/qib_file_ops.c      |  5 +++
 drivers/input/misc/uinput.c                   |  6 ++++
 drivers/media/usb/dvb-usb-v2/af9035.h         | 24 ++++++-------
 drivers/media/usb/usbvision/usbvision-video.c |  7 ----
 drivers/misc/ad525x_dpot.c                    |  2 +-
 drivers/misc/pch_phub.c                       |  4 ++-
 drivers/mmc/card/block.c                      |  5 +--
 drivers/mmc/core/core.c                       |  4 +--
 drivers/mmc/core/mmc.c                        |  7 ++++
 drivers/net/wireless/ath/ath5k/led.c          |  2 +-
 drivers/net/wireless/rtlwifi/base.c           |  4 +--
 drivers/pci/probe.c                           |  6 ++--
 drivers/scsi/aacraid/commsup.c                | 12 ++++---
 drivers/tty/serial/samsung.c                  |  4 +--
 drivers/tty/vt/vt.c                           |  5 +--
 drivers/usb/serial/io_edgeport.c              | 50 ++++++++++++++++++---------
 drivers/usb/serial/keyspan.c                  |  4 +++
 drivers/usb/serial/option.c                   | 26 ++++++++++----
 drivers/usb/serial/quatech2.c                 |  1 +
 drivers/xen/events.c                          |  6 ++--
 fs/cifs/sess.c                                | 32 ++++++++++-------
 fs/cifs/smb2glob.h                            |  1 +
 fs/cifs/smb2inode.c                           |  8 +++--
 fs/cifs/smb2pdu.c                             | 16 +++++++++
 fs/cifs/smb2proto.h                           |  2 ++
 fs/ext4/ialloc.c                              | 10 +++---
 fs/ext4/mballoc.c                             | 10 ++++--
 fs/nfs/dir.c                                  |  4 +++
 fs/xfs/xfs_inode.c                            | 26 +++++++++-----
 include/rdma/ib.h                             | 16 +++++++++
 kernel/trace/ring_buffer.c                    | 35 ++++++++++---------
 lib/dma-debug.c                               |  2 +-
 net/sunrpc/auth_gss/svcauth_gss.c             |  4 +--
 56 files changed, 414 insertions(+), 162 deletions(-)

-- 
2.9.0

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

* [PATCH 3.12 05/56] HID: microsoft: Add Surface Power Cover
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (3 preceding siblings ...)
  2016-06-15  7:29 ` [PATCH 3.12 04/56] HID: Fix boot delay for Creative SB Omni Surround 5.1 with quirk Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 06/56] HID: microsoft: Add Surface 3 type cover Jiri Slaby
                   ` (52 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Raimund Roth, Raimund Roth, Jiri Kosina, Jiri Slaby

From: Raimund Roth <raimundmroth@googlemail.com>

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

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

commit 18eec2cd7e9746cd672ada102987534ae16f0f44 upstream.

Adding support for the Microsoft Surface Pro Power Cover.

Signed-off-by: Raimund Roth <raimundmroth@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c          | 4 +++-
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/hid-microsoft.c     | 2 ++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 7ca1b4a97a14..9d24332e1e27 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -705,7 +705,8 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 
 	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
 	    (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
-	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP) &&
+	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP ||
+	     hid->product == USB_DEVICE_ID_MS_POWER_COVER) &&
 	    hid->group == HID_GROUP_MULTITOUCH)
 		hid->group = HID_GROUP_GENERIC;
 }
@@ -1811,6 +1812,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index fb200df1e78e..64f8fd16e9d7 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -651,6 +651,7 @@
 #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500	0x076c
 #define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07dc
 #define USB_DEVICE_ID_MS_TYPE_COVER_3_JP 0x07dd
+#define USB_DEVICE_ID_MS_POWER_COVER     0x07da
 
 #define USB_VENDOR_ID_MOJO		0x8282
 #define USB_DEVICE_ID_RETRO_ADAPTER	0x3201
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 7e56e18665da..755c62d73896 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -260,6 +260,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_HIDINPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP),
 		.driver_data = MS_HIDINPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER),
+		.driver_data = MS_HIDINPUT },
 
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
 		.driver_data = MS_PRESENTER },
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 3771a7ef6395..3b3fcbd28320 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -89,6 +89,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.9.0

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

* [PATCH 3.12 06/56] HID: microsoft: Add Surface 3 type cover
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (4 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 05/56] HID: microsoft: Add Surface Power Cover Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 07/56] HID: microsoft: add support for 3 more devices Jiri Slaby
                   ` (51 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Stephen Just, Jiri Kosina, Jiri Slaby

From: Stephen Just <stephenjust@gmail.com>

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

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

commit 0439de75d32c249bd9f5824ffd5e40c4c2109d77 upstream.

Adding support for the Microsoft Surface 3 (non-pro) Type Cover.

The existing definitions and quirks are actually for the Surface
Pro 3 type covers. I've renamed the old constants to reflect that
they belong to the Surface Pro 3, and added a new constant and
matching code for the Surface 3.

Signed-off-by: Stephen Just <stephenjust@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c          | 8 +++++---
 drivers/hid/hid-ids.h           | 8 ++++++--
 drivers/hid/hid-microsoft.c     | 6 ++++--
 drivers/hid/usbhid/hid-quirks.c | 3 ++-
 4 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 9d24332e1e27..c8c98f1f22d6 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -704,8 +704,9 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 		hid->group = HID_GROUP_SENSOR_HUB;
 
 	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
-	    (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
-	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP ||
+	    (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 ||
+	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP ||
+	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
 	     hid->product == USB_DEVICE_ID_MS_POWER_COVER) &&
 	    hid->group == HID_GROUP_MULTITOUCH)
 		hid->group = HID_GROUP_GENERIC;
@@ -1810,8 +1811,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
-	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 64f8fd16e9d7..b33fadc32100 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -649,8 +649,12 @@
 #define USB_DEVICE_ID_MS_NE7K		0x071d
 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K	0x0730
 #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500	0x076c
-#define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07dc
-#define USB_DEVICE_ID_MS_TYPE_COVER_3_JP 0x07dd
+#define USB_DEVICE_ID_MS_SURFACE_PRO_2   0x0799
+#define USB_DEVICE_ID_MS_TOUCH_COVER_2   0x07a7
+#define USB_DEVICE_ID_MS_TYPE_COVER_2    0x07a9
+#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3    0x07dc
+#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd
+#define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07de
 #define USB_DEVICE_ID_MS_POWER_COVER     0x07da
 
 #define USB_VENDOR_ID_MOJO		0x8282
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 755c62d73896..3afea9a98637 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -256,9 +256,11 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_NOGET },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
 		.driver_data = MS_DUPLICATE_USAGES },
-	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3),
+		.driver_data = MS_HIDINPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP),
 		.driver_data = MS_HIDINPUT },
-	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP),
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
 		.driver_data = MS_HIDINPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER),
 		.driver_data = MS_HIDINPUT },
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 3b3fcbd28320..825d052cd2cb 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -87,8 +87,9 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
+	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
-	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GX680R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.9.0

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

* [PATCH 3.12 07/56] HID: microsoft: add support for 3 more devices
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (5 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 06/56] HID: microsoft: Add Surface 3 type cover Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 08/56] HID: Add new Microsoft Type Cover 3 product ID Jiri Slaby
                   ` (50 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Alistair Leslie-Hughes, Jiri Kosina, Oliver Neukum,
	Jiri Slaby

From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>

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

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

commit c847a89a871e1ea21d45120c3045c9b443e258f5 upstream.

Adds support for the Micrsift Digital 4K, Media 600 and Media 3000 V1 Keyboards,
which have the same quirks as the already existing hardware MS_NE4K.

Fixes https://bugzilla.kernel.org/show_bug.cgi?id=52841

[jkosina@suse.cz: rephrase changelog]
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c      | 3 +++
 drivers/hid/hid-ids.h       | 3 +++
 drivers/hid/hid-microsoft.c | 6 ++++++
 3 files changed, 12 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index c8c98f1f22d6..bde7e255a6b0 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1814,6 +1814,9 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_7K) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_600) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index b33fadc32100..d974db4e36de 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -641,6 +641,7 @@
 #define USB_DEVICE_ID_SIDEWINDER_GV	0x003b
 #define USB_DEVICE_ID_MS_OFFICE_KB	0x0048
 #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d
+#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_7K 0x00b4
 #define USB_DEVICE_ID_MS_NE4K		0x00db
 #define USB_DEVICE_ID_MS_NE4K_JP	0x00dc
 #define USB_DEVICE_ID_MS_LK6K		0x00f9
@@ -648,6 +649,8 @@
 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB	0x0713
 #define USB_DEVICE_ID_MS_NE7K		0x071d
 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K	0x0730
+#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1 0x0732
+#define USB_DEVICE_ID_MS_DIGITAL_MEDIA_600  0x0750
 #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500	0x076c
 #define USB_DEVICE_ID_MS_SURFACE_PRO_2   0x0799
 #define USB_DEVICE_ID_MS_TOUCH_COVER_2   0x07a7
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 3afea9a98637..2f9d260539c9 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -252,6 +252,12 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_PRESENTER },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K),
 		.driver_data = MS_ERGONOMY | MS_RDESC_3K },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_7K),
+		.driver_data = MS_ERGONOMY },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_600),
+		.driver_data = MS_ERGONOMY },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1),
+		.driver_data = MS_ERGONOMY },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0),
 		.driver_data = MS_NOGET },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
-- 
2.9.0

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

* [PATCH 3.12 08/56] HID: Add new Microsoft Type Cover 3 product ID
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (6 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 07/56] HID: microsoft: add support for 3 more devices Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 09/56] HID: microsoft: Add ID for MS Wireless Comfort Keyboard Jiri Slaby
                   ` (49 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Donavan Lance, Jiri Kosina, Jiri Slaby

From: Donavan Lance <shvr@fedoraproject.org>

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

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

commit c6956eb70e2549a3c2fa6ee525e02776d293caf4 upstream.

Adds support for Microsoft Type Cover 3 with 0x07e2 product ID.

Signed-off-by: Donavan Lance <shvr@fedoraproject.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c          | 2 ++
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/hid-microsoft.c     | 2 ++
 drivers/hid/usbhid/hid-quirks.c | 1 +
 4 files changed, 6 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index bde7e255a6b0..b62ceaf1a11e 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -705,6 +705,7 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
 
 	if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
 	    (hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3 ||
+	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2 ||
 	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP ||
 	     hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
 	     hid->product == USB_DEVICE_ID_MS_POWER_COVER) &&
@@ -1812,6 +1813,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_7K) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index d974db4e36de..7ab974cafee8 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -656,6 +656,7 @@
 #define USB_DEVICE_ID_MS_TOUCH_COVER_2   0x07a7
 #define USB_DEVICE_ID_MS_TYPE_COVER_2    0x07a9
 #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3    0x07dc
+#define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2  0x07e2
 #define USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP 0x07dd
 #define USB_DEVICE_ID_MS_TYPE_COVER_3    0x07de
 #define USB_DEVICE_ID_MS_POWER_COVER     0x07da
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 2f9d260539c9..859ee53f630f 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_DUPLICATE_USAGES },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3),
 		.driver_data = MS_HIDINPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2),
+		.driver_data = MS_HIDINPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP),
 		.driver_data = MS_HIDINPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 825d052cd2cb..99e5407221e6 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -88,6 +88,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL },
 	{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_2, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_PRO_3_JP, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.9.0

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

* [PATCH 3.12 09/56] HID: microsoft: Add ID for MS Wireless Comfort Keyboard
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (7 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 08/56] HID: Add new Microsoft Type Cover 3 product ID Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 10/56] HID: chicony: Add support for Acer Aspire Switch 12 Jiri Slaby
                   ` (48 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Slava Bacherikov, Jiri Kosina, Jiri Slaby

From: Slava Bacherikov <slava@bacher09.org>

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

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

commit f9a82c2054bcdebdf81a63c26a3b41197bb6070a upstream.

Microsoft Wireless Comfort Keyboard has vendor specific My Favorites
1-5 keys. Linux already supports this buttons on other MS keyboards by
MS_ERGONOMY quirk. So apply MS_ERGONOMY quirk to USB PID 0x00e3
(Microsoft Wireless Optical Desktop Receiver 3.0A). After this
My Favorites 1..5 keys will be reported as KEY_F14..KEY_F15 events.

Signed-off-by: Slava Bacherikov <slava@bacher09.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c      | 1 +
 drivers/hid/hid-ids.h       | 1 +
 drivers/hid/hid-microsoft.c | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index b62ceaf1a11e..6ae4df439d06 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1803,6 +1803,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICOLCD_BOOTLOADER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_KEYBOARD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 7ab974cafee8..6a6b06ef31b1 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -652,6 +652,7 @@
 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3KV1 0x0732
 #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_600  0x0750
 #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500	0x076c
+#define USB_DEVICE_ID_MS_COMFORT_KEYBOARD 0x00e3
 #define USB_DEVICE_ID_MS_SURFACE_PRO_2   0x0799
 #define USB_DEVICE_ID_MS_TOUCH_COVER_2   0x07a7
 #define USB_DEVICE_ID_MS_TYPE_COVER_2    0x07a9
diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c
index 859ee53f630f..8dfc58ac9d52 100644
--- a/drivers/hid/hid-microsoft.c
+++ b/drivers/hid/hid-microsoft.c
@@ -272,6 +272,8 @@ static const struct hid_device_id ms_devices[] = {
 		.driver_data = MS_HIDINPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER),
 		.driver_data = MS_HIDINPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_KEYBOARD),
+		.driver_data = MS_ERGONOMY},
 
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
 		.driver_data = MS_PRESENTER },
-- 
2.9.0

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

* [PATCH 3.12 10/56] HID: chicony: Add support for Acer Aspire Switch 12
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (8 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 09/56] HID: microsoft: Add ID for MS Wireless Comfort Keyboard Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 11/56] HID: sjoy: support Super Joy Box 4 Jiri Slaby
                   ` (47 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel,
	Николай
	Кудрявцев,
	Jiri Kosina, Jiri Slaby

From: Николай Кудрявцев <nkudriavtsev@gmail.com>

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

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

commit 9a1d78a3780e0e37eeff11b377fc5fbb01446a36 upstream.

Acer Aspire Switch 12 keyboard Chicony's controller reports too big usage
index on the 1st interface. The patch fixes the report. The work based on
solution from drivers/hid/hid-holtek-mouse.c

Bug report: https://bugzilla.kernel.org/show_bug.cgi?id=101721

Signed-off-by: Nicholas Kudriavtsev <nkudriavtsev@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-chicony.c | 26 ++++++++++++++++++++++++++
 drivers/hid/hid-core.c    |  1 +
 drivers/hid/hid-ids.h     |  1 +
 3 files changed, 28 insertions(+)

diff --git a/drivers/hid/hid-chicony.c b/drivers/hid/hid-chicony.c
index b613d5a79684..bc3cec199fee 100644
--- a/drivers/hid/hid-chicony.c
+++ b/drivers/hid/hid-chicony.c
@@ -20,6 +20,7 @@
 #include <linux/input.h>
 #include <linux/hid.h>
 #include <linux/module.h>
+#include <linux/usb.h>
 
 #include "hid-ids.h"
 
@@ -57,10 +58,34 @@ static int ch_input_mapping(struct hid_device *hdev, struct hid_input *hi,
 	return 1;
 }
 
+static __u8 *ch_switch12_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+		unsigned int *rsize)
+{
+	struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
+	
+	if (intf->cur_altsetting->desc.bInterfaceNumber == 1) {
+		/* Change usage maximum and logical maximum from 0x7fff to
+		 * 0x2fff, so they don't exceed HID_MAX_USAGES */
+		switch (hdev->product) {
+		case USB_DEVICE_ID_CHICONY_ACER_SWITCH12:
+			if (*rsize >= 128 && rdesc[64] == 0xff && rdesc[65] == 0x7f
+					&& rdesc[69] == 0xff && rdesc[70] == 0x7f) {
+				hid_info(hdev, "Fixing up report descriptor\n");
+				rdesc[65] = rdesc[70] = 0x2f;
+			}
+			break;
+		}
+
+	}
+	return rdesc;
+}
+
+
 static const struct hid_device_id ch_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, ch_devices);
@@ -68,6 +93,7 @@ MODULE_DEVICE_TABLE(hid, ch_devices);
 static struct hid_driver ch_driver = {
 	.name = "chicony",
 	.id_table = ch_devices,
+	.report_fixup = ch_switch12_report_fixup,
 	.input_mapping = ch_input_mapping,
 };
 module_hid_driver(ch_driver);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 6ae4df439d06..05867d1d8cdc 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1719,6 +1719,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS2) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_AK1D) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_ACER_SWITCH12) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CREATIVELABS, USB_DEVICE_ID_PRODIKEYS_PCMIDI) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 6a6b06ef31b1..555dc61d2eb3 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -224,6 +224,7 @@
 #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE	0x1053
 #define USB_DEVICE_ID_CHICONY_WIRELESS2	0x1123
 #define USB_DEVICE_ID_CHICONY_AK1D	0x1125
+#define USB_DEVICE_ID_CHICONY_ACER_SWITCH12	0x1421
 
 #define USB_VENDOR_ID_CHUNGHWAT		0x2247
 #define USB_DEVICE_ID_CHUNGHWAT_MULTITOUCH	0x0001
-- 
2.9.0

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

* [PATCH 3.12 11/56] HID: sjoy: support Super Joy Box 4
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (9 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 10/56] HID: chicony: Add support for Acer Aspire Switch 12 Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 12/56] HID: wiimote: Fix wiimote mp scale linearization Jiri Slaby
                   ` (46 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Sean Young, Jiri Kosina, Jiri Slaby

From: Sean Young <sean@mess.org>

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

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

commit 6e5e9a06a206010eabd19b523fd0833c51afc0b0 upstream.

This device supports force feedback and has two ports.

Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-core.c          | 1 +
 drivers/hid/hid-sjoy.c          | 3 +++
 drivers/hid/usbhid/hid-quirks.c | 1 -
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 05867d1d8cdc..178651fe449b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1909,6 +1909,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) },
diff --git a/drivers/hid/hid-sjoy.c b/drivers/hid/hid-sjoy.c
index 37845eccddb5..36b6470af947 100644
--- a/drivers/hid/hid-sjoy.c
+++ b/drivers/hid/hid-sjoy.c
@@ -166,6 +166,9 @@ static const struct hid_device_id sjoy_devices[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD),
 		.driver_data = HID_QUIRK_MULTI_INPUT |
 			       HID_QUIRK_SKIP_OUTPUT_REPORTS },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII),
+		.driver_data = HID_QUIRK_MULTI_INPUT |
+			       HID_QUIRK_SKIP_OUTPUT_REPORTS },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sjoy_devices);
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 99e5407221e6..33a08738dba9 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -52,7 +52,6 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH_2968, HID_QUIRK_MULTI_INPUT },
 	{ USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT },
 	{ USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
-	{ USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT },
 	{ USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT },
 
 	{ USB_VENDOR_ID_AIREN, USB_DEVICE_ID_AIREN_SLIMPLUS, HID_QUIRK_NOGET },
-- 
2.9.0

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

* [PATCH 3.12 12/56] HID: wiimote: Fix wiimote mp scale linearization
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (10 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 11/56] HID: sjoy: support Super Joy Box 4 Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 13/56] HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2 Jiri Slaby
                   ` (45 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Cyan Ogilvie, Jiri Kosina, Oliver Neukum, Jiri Slaby

From: Cyan Ogilvie <cyan.ogilvie@gmail.com>

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

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

commit d30596737e8e7b2f1235d7ba20592b8309e3af04 upstream.

The wiimote motion plus gyros use two scales to report fast and slow
rotation - below 440 deg/s uses 8192/440 units / deg/s, and above uses
8192/2000 units / deg/s.

Previously this driver attempted to linearize the two by scaling the fast
rate by 18 and the slow by 9, but this results in a scale of
8192*9/440 = ~167.564 for slow and 8192*18/2000 = 73.728 for fast.

Correct the fast motion scale factor so that both report ~167.564
units / deg/s

Signed-off-by: Cyan Ogilvie <cyan.ogilvie@gmail.com>
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-wiimote-modules.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c
index e30567af42ed..20e102866549 100644
--- a/drivers/hid/hid-wiimote-modules.c
+++ b/drivers/hid/hid-wiimote-modules.c
@@ -1951,9 +1951,11 @@ static void wiimod_mp_in_mp(struct wiimote_data *wdata, const __u8 *ext)
 	 *   -----+------------------------------+-----+-----+
 	 * The single bits Yaw, Roll, Pitch in the lower right corner specify
 	 * whether the wiimote is rotating fast (0) or slow (1). Speed for slow
-	 * roation is 440 deg/s and for fast rotation 2000 deg/s. To get a
-	 * linear scale we multiply by 2000/440 = ~4.5454 which is 18 for fast
-	 * and 9 for slow.
+	 * roation is 8192/440 units / deg/s and for fast rotation 8192/2000
+	 * units / deg/s. To get a linear scale for fast rotation we multiply
+	 * by 2000/440 = ~4.5454 and scale both fast and slow by 9 to match the
+	 * previous scale reported by this driver.
+	 * This leaves a linear scale with 8192*9/440 (~167.564) units / deg/s.
 	 * If the wiimote is not rotating the sensor reports 2^13 = 8192.
 	 * Ext specifies whether an extension is connected to the motionp.
 	 * which is parsed by wiimote-core.
@@ -1972,15 +1974,15 @@ static void wiimod_mp_in_mp(struct wiimote_data *wdata, const __u8 *ext)
 	z -= 8192;
 
 	if (!(ext[3] & 0x02))
-		x *= 18;
+		x = (x * 2000 * 9) / 440;
 	else
 		x *= 9;
 	if (!(ext[4] & 0x02))
-		y *= 18;
+		y = (y * 2000 * 9) / 440;
 	else
 		y *= 9;
 	if (!(ext[3] & 0x01))
-		z *= 18;
+		z = (z * 2000 * 9) / 440;
 	else
 		z *= 9;
 
-- 
2.9.0

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

* [PATCH 3.12 13/56] HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (11 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 12/56] HID: wiimote: Fix wiimote mp scale linearization Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 14/56] ARC: use ASL assembler mnemonic Jiri Slaby
                   ` (44 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Daniel Bristot de Oliveira, Jiri Kosina,
	Oliver Neukum, Jiri Slaby

From: Daniel Bristot de Oliveira <bristot@redhat.com>

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

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

commit c14022bfd2eb2d2ece74a405dfbdb02a829c07bc upstream.

The device which identifies itself as a "USB Keykoard" (no typo)
with VID:PID 1a2c:0027 does not seem to be handling the reports
initialization very well.

This results in a "usb_submit_urb(ctrl) failed: -1" message from the
kernel when connected, and a delay before its initialization. It can
also cause the hang the system.

This patch adds the  quirk for this device, which causes the delay
to disappear. It is named as "USB Keykoard2" because the "USB Keykoard"
already exists.

Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/hid/hid-ids.h           | 1 +
 drivers/hid/usbhid/hid-quirks.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 555dc61d2eb3..8a33a5967917 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -802,6 +802,7 @@
 
 #define USB_VENDOR_ID_SEMICO			0x1a2c
 #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD	0x0023
+#define USB_DEVICE_ID_SEMICO_USB_KEYKOARD2	0x0027
 
 #define USB_VENDOR_ID_SENNHEISER	0x1395
 #define USB_DEVICE_ID_SENNHEISER_BTD500USB	0x002c
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 33a08738dba9..d63f7e45b539 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -141,6 +141,7 @@ static const struct hid_blacklist {
 	{ USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912, HID_QUIRK_MULTI_INPUT },
 	{ USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS },
+	{ USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS2, HID_QUIRK_NO_INIT_REPORTS },
 	{ USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_HD, HID_QUIRK_NO_INIT_REPORTS },
-- 
2.9.0

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

* [PATCH 3.12 14/56] ARC: use ASL assembler mnemonic
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (12 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 13/56] HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2 Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 15/56] remove directory incorrectly tries to set delete on close on non-empty directories Jiri Slaby
                   ` (43 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Vineet Gupta, Jiri Slaby

From: Vineet Gupta <vgupta@synopsys.com>

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

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

commit a6416f57ce57fb390b6ee30b12c01c29032a26af upstream.

ARCompact and ARCv2 only have ASL, while binutils used to support LSL as
a alias mnemonic.

Newer binutils (upstream) don't want to do that so replace it.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/arc/mm/tlbex.S | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arc/mm/tlbex.S b/arch/arc/mm/tlbex.S
index cf7d7d9ad695..98837a2bfd5e 100644
--- a/arch/arc/mm/tlbex.S
+++ b/arch/arc/mm/tlbex.S
@@ -89,7 +89,7 @@ ex_saved_reg1:
 #ifdef CONFIG_SMP
 	sr  r0, [ARC_REG_SCRATCH_DATA0]	; freeup r0 to code with
 	GET_CPU_ID  r0			; get to per cpu scratch mem,
-	lsl r0, r0, L1_CACHE_SHIFT	; cache line wide per cpu
+	asl r0, r0, L1_CACHE_SHIFT	; cache line wide per cpu
 	add r0, @ex_saved_reg1, r0
 #else
 	st    r0, [@ex_saved_reg1]
@@ -108,7 +108,7 @@ ex_saved_reg1:
 .macro TLBMISS_RESTORE_REGS
 #ifdef CONFIG_SMP
 	GET_CPU_ID  r0			; get to per cpu scratch mem
-	lsl r0, r0, L1_CACHE_SHIFT	; each is cache line wide
+	asl r0, r0, L1_CACHE_SHIFT	; each is cache line wide
 	add r0, @ex_saved_reg1, r0
 	ld_s  r3, [r0,12]
 	ld_s  r2, [r0, 8]
@@ -220,7 +220,7 @@ ex_saved_reg1:
 
 .macro CONV_PTE_TO_TLB
 	and    r3, r0, PTE_BITS_RWX	;       r w x
-	lsl    r2, r3, 3		; r w x 0 0 0
+	asl    r2, r3, 3		; Kr Kw Kx 0  0  0 (GLOBAL, kernel only)
 	and.f  0,  r0, _PAGE_GLOBAL
 	or.z   r2, r2, r3		; r w x r w x
 
-- 
2.9.0

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

* [PATCH 3.12 15/56] remove directory incorrectly tries to set delete on close on non-empty directories
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (13 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 14/56] ARC: use ASL assembler mnemonic Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 16/56] fs/cifs: correctly to anonymous authentication via NTLMSSP Jiri Slaby
                   ` (42 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Steve French, Steve French, Jiri Slaby

From: Steve French <smfrench@gmail.com>

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

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

commit 897fba1172d637d344f009d700f7eb8a1fa262f1 upstream.

Wrong return code was being returned on SMB3 rmdir of
non-empty directory.

For SMB3 (unlike for cifs), we attempt to delete a directory by
set of delete on close flag on the open. Windows clients set
this flag via a set info (SET_FILE_DISPOSITION to set this flag)
which properly checks if the directory is empty.

With this patch on smb3 mounts we correctly return
 "DIRECTORY NOT EMPTY"
on attempts to remove a non-empty directory.

Signed-off-by: Steve French <steve.french@primarydata.com>
Acked-by: Sachin Prabhu <sprabhu@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/cifs/smb2glob.h  |  1 +
 fs/cifs/smb2inode.c |  8 ++++++--
 fs/cifs/smb2pdu.c   | 16 ++++++++++++++++
 fs/cifs/smb2proto.h |  2 ++
 4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2glob.h b/fs/cifs/smb2glob.h
index bc0bb9c34f72..0ffa18094335 100644
--- a/fs/cifs/smb2glob.h
+++ b/fs/cifs/smb2glob.h
@@ -44,6 +44,7 @@
 #define SMB2_OP_DELETE 7
 #define SMB2_OP_HARDLINK 8
 #define SMB2_OP_SET_EOF 9
+#define SMB2_OP_RMDIR 10
 
 /* Used when constructing chained read requests. */
 #define CHAINED_REQUEST 1
diff --git a/fs/cifs/smb2inode.c b/fs/cifs/smb2inode.c
index 215f8d3e3e53..f970c5d5b253 100644
--- a/fs/cifs/smb2inode.c
+++ b/fs/cifs/smb2inode.c
@@ -80,6 +80,10 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
 		 * SMB2_open() call.
 		 */
 		break;
+	case SMB2_OP_RMDIR:
+		tmprc = SMB2_rmdir(xid, tcon, fid.persistent_fid,
+				   fid.volatile_fid);
+		break;
 	case SMB2_OP_RENAME:
 		tmprc = SMB2_rename(xid, tcon, fid.persistent_fid,
 				    fid.volatile_fid, (__le16 *)data);
@@ -191,8 +195,8 @@ smb2_rmdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
 	   struct cifs_sb_info *cifs_sb)
 {
 	return smb2_open_op_close(xid, tcon, cifs_sb, name, DELETE, FILE_OPEN,
-				  CREATE_NOT_FILE | CREATE_DELETE_ON_CLOSE,
-				  NULL, SMB2_OP_DELETE);
+				  CREATE_NOT_FILE,
+				  NULL, SMB2_OP_RMDIR);
 }
 
 int
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index a47ac835145b..439cb86ed488 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2254,6 +2254,22 @@ SMB2_rename(const unsigned int xid, struct cifs_tcon *tcon,
 }
 
 int
+SMB2_rmdir(const unsigned int xid, struct cifs_tcon *tcon,
+		  u64 persistent_fid, u64 volatile_fid)
+{
+	__u8 delete_pending = 1;
+	void *data;
+	unsigned int size;
+
+	data = &delete_pending;
+	size = 1; /* sizeof __u8 */
+
+	return send_set_info(xid, tcon, persistent_fid, volatile_fid,
+			current->tgid, FILE_DISPOSITION_INFORMATION, 1, &data,
+			&size);
+}
+
+int
 SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
 		  u64 persistent_fid, u64 volatile_fid, __le16 *target_file)
 {
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index d18b19ec1145..5793f3e39a31 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -133,6 +133,8 @@ extern int SMB2_query_directory(const unsigned int xid, struct cifs_tcon *tcon,
 extern int SMB2_rename(const unsigned int xid, struct cifs_tcon *tcon,
 		       u64 persistent_fid, u64 volatile_fid,
 		       __le16 *target_file);
+extern int SMB2_rmdir(const unsigned int xid, struct cifs_tcon *tcon,
+		      u64 persistent_fid, u64 volatile_fid);
 extern int SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
 			     u64 persistent_fid, u64 volatile_fid,
 			     __le16 *target_file);
-- 
2.9.0

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

* [PATCH 3.12 16/56] fs/cifs: correctly to anonymous authentication via NTLMSSP
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (14 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 15/56] remove directory incorrectly tries to set delete on close on non-empty directories Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 17/56] ring-buffer: Use long for nr_pages to avoid overflow failures Jiri Slaby
                   ` (41 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Stefan Metzmacher, Steve French, Jiri Slaby

From: Stefan Metzmacher <metze@samba.org>

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

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

commit cfda35d98298131bf38fbad3ce4cd5ecb3cf18db upstream.

See [MS-NLMP] 3.2.5.1.2 Server Receives an AUTHENTICATE_MESSAGE from the Client:

   ...
   Set NullSession to FALSE
   If (AUTHENTICATE_MESSAGE.UserNameLen == 0 AND
      AUTHENTICATE_MESSAGE.NtChallengeResponse.Length == 0 AND
      (AUTHENTICATE_MESSAGE.LmChallengeResponse == Z(1)
       OR
       AUTHENTICATE_MESSAGE.LmChallengeResponse.Length == 0))
       -- Special case: client requested anonymous authentication
       Set NullSession to TRUE
   ...

Only server which map unknown users to guest will allow
access using a non-null NTChallengeResponse.

For Samba it's the "map to guest = bad user" option.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11913

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/cifs/sess.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index e87387dbf39f..bbb50be00ef5 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -399,19 +399,27 @@ int build_ntlmssp_auth_blob(unsigned char *pbuffer,
 	sec_blob->LmChallengeResponse.MaximumLength = 0;
 
 	sec_blob->NtChallengeResponse.BufferOffset = cpu_to_le32(tmp - pbuffer);
-	rc = setup_ntlmv2_rsp(ses, nls_cp);
-	if (rc) {
-		cifs_dbg(VFS, "Error %d during NTLMSSP authentication\n", rc);
-		goto setup_ntlmv2_ret;
-	}
-	memcpy(tmp, ses->auth_key.response + CIFS_SESS_KEY_SIZE,
-			ses->auth_key.len - CIFS_SESS_KEY_SIZE);
-	tmp += ses->auth_key.len - CIFS_SESS_KEY_SIZE;
+	if (ses->user_name != NULL) {
+		rc = setup_ntlmv2_rsp(ses, nls_cp);
+		if (rc) {
+			cifs_dbg(VFS, "Error %d during NTLMSSP authentication\n", rc);
+			goto setup_ntlmv2_ret;
+		}
+		memcpy(tmp, ses->auth_key.response + CIFS_SESS_KEY_SIZE,
+				ses->auth_key.len - CIFS_SESS_KEY_SIZE);
+		tmp += ses->auth_key.len - CIFS_SESS_KEY_SIZE;
 
-	sec_blob->NtChallengeResponse.Length =
-			cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
-	sec_blob->NtChallengeResponse.MaximumLength =
-			cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
+		sec_blob->NtChallengeResponse.Length =
+				cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
+		sec_blob->NtChallengeResponse.MaximumLength =
+				cpu_to_le16(ses->auth_key.len - CIFS_SESS_KEY_SIZE);
+	} else {
+		/*
+		 * don't send an NT Response for anonymous access
+		 */
+		sec_blob->NtChallengeResponse.Length = 0;
+		sec_blob->NtChallengeResponse.MaximumLength = 0;
+	}
 
 	if (ses->domainName == NULL) {
 		sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - pbuffer);
-- 
2.9.0

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

* [PATCH 3.12 17/56] ring-buffer: Use long for nr_pages to avoid overflow failures
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (15 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 16/56] fs/cifs: correctly to anonymous authentication via NTLMSSP Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 18/56] ring-buffer: Prevent overflow of size in ring_buffer_resize() Jiri Slaby
                   ` (40 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Steven Rostedt (Red Hat), Jiri Slaby

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

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

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

commit 9b94a8fba501f38368aef6ac1b30e7335252a220 upstream.

The size variable to change the ring buffer in ftrace is a long. The
nr_pages used to update the ring buffer based on the size is int. On 64 bit
machines this can cause an overflow problem.

For example, the following will cause the ring buffer to crash:

 # cd /sys/kernel/debug/tracing
 # echo 10 > buffer_size_kb
 # echo 8556384240 > buffer_size_kb

Then you get the warning of:

 WARNING: CPU: 1 PID: 318 at kernel/trace/ring_buffer.c:1527 rb_update_pages+0x22f/0x260

Which is:

  RB_WARN_ON(cpu_buffer, nr_removed);

Note each ring buffer page holds 4080 bytes.

This is because:

 1) 10 causes the ring buffer to have 3 pages.
    (10kb requires 3 * 4080 pages to hold)

 2) (2^31 / 2^10  + 1) * 4080 = 8556384240
    The value written into buffer_size_kb is shifted by 10 and then passed
    to ring_buffer_resize(). 8556384240 * 2^10 = 8761737461760

 3) The size passed to ring_buffer_resize() is then divided by BUF_PAGE_SIZE
    which is 4080. 8761737461760 / 4080 = 2147484672

 4) nr_pages is subtracted from the current nr_pages (3) and we get:
    2147484669. This value is saved in a signed integer nr_pages_to_update

 5) 2147484669 is greater than 2^31 but smaller than 2^32, a signed int
    turns into the value of -2147482627

 6) As the value is a negative number, in update_pages_handler() it is
    negated and passed to rb_remove_pages() and 2147482627 pages will
    be removed, which is much larger than 3 and it causes the warning
    because not all the pages asked to be removed were removed.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=118001

Fixes: 7a8e76a3829f1 ("tracing: unified trace buffer")
Reported-by: Hao Qin <QEver.cn@gmail.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/trace/ring_buffer.c | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 321ee4205160..4940115bbf8d 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -463,7 +463,7 @@ struct ring_buffer_per_cpu {
 	raw_spinlock_t			reader_lock;	/* serialize readers */
 	arch_spinlock_t			lock;
 	struct lock_class_key		lock_key;
-	unsigned int			nr_pages;
+	unsigned long			nr_pages;
 	struct list_head		*pages;
 	struct buffer_page		*head_page;	/* read from head */
 	struct buffer_page		*tail_page;	/* write to tail */
@@ -483,7 +483,7 @@ struct ring_buffer_per_cpu {
 	u64				write_stamp;
 	u64				read_stamp;
 	/* ring buffer pages to update, > 0 to add, < 0 to remove */
-	int				nr_pages_to_update;
+	long				nr_pages_to_update;
 	struct list_head		new_pages; /* new pages to add */
 	struct work_struct		update_pages_work;
 	struct completion		update_done;
@@ -1120,10 +1120,10 @@ static int rb_check_pages(struct ring_buffer_per_cpu *cpu_buffer)
 	return 0;
 }
 
-static int __rb_allocate_pages(int nr_pages, struct list_head *pages, int cpu)
+static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu)
 {
-	int i;
 	struct buffer_page *bpage, *tmp;
+	long i;
 
 	for (i = 0; i < nr_pages; i++) {
 		struct page *page;
@@ -1160,7 +1160,7 @@ free_pages:
 }
 
 static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,
-			     unsigned nr_pages)
+			     unsigned long nr_pages)
 {
 	LIST_HEAD(pages);
 
@@ -1185,7 +1185,7 @@ static int rb_allocate_pages(struct ring_buffer_per_cpu *cpu_buffer,
 }
 
 static struct ring_buffer_per_cpu *
-rb_allocate_cpu_buffer(struct ring_buffer *buffer, int nr_pages, int cpu)
+rb_allocate_cpu_buffer(struct ring_buffer *buffer, long nr_pages, int cpu)
 {
 	struct ring_buffer_per_cpu *cpu_buffer;
 	struct buffer_page *bpage;
@@ -1284,8 +1284,9 @@ struct ring_buffer *__ring_buffer_alloc(unsigned long size, unsigned flags,
 					struct lock_class_key *key)
 {
 	struct ring_buffer *buffer;
+	long nr_pages;
 	int bsize;
-	int cpu, nr_pages;
+	int cpu;
 
 	/* keep it in its own cache line */
 	buffer = kzalloc(ALIGN(sizeof(*buffer), cache_line_size()),
@@ -1408,12 +1409,12 @@ static inline unsigned long rb_page_write(struct buffer_page *bpage)
 }
 
 static int
-rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned int nr_pages)
+rb_remove_pages(struct ring_buffer_per_cpu *cpu_buffer, unsigned long nr_pages)
 {
 	struct list_head *tail_page, *to_remove, *next_page;
 	struct buffer_page *to_remove_page, *tmp_iter_page;
 	struct buffer_page *last_page, *first_page;
-	unsigned int nr_removed;
+	unsigned long nr_removed;
 	unsigned long head_bit;
 	int page_entries;
 
@@ -1630,7 +1631,7 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
 			int cpu_id)
 {
 	struct ring_buffer_per_cpu *cpu_buffer;
-	unsigned nr_pages;
+	unsigned long nr_pages;
 	int cpu, err = 0;
 
 	/*
@@ -4593,8 +4594,9 @@ static int rb_cpu_notify(struct notifier_block *self,
 	struct ring_buffer *buffer =
 		container_of(self, struct ring_buffer, cpu_notify);
 	long cpu = (long)hcpu;
-	int cpu_i, nr_pages_same;
-	unsigned int nr_pages;
+	long nr_pages_same;
+	int cpu_i;
+	unsigned long nr_pages;
 
 	switch (action) {
 	case CPU_UP_PREPARE:
-- 
2.9.0

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

* [PATCH 3.12 18/56] ring-buffer: Prevent overflow of size in ring_buffer_resize()
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (16 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 17/56] ring-buffer: Use long for nr_pages to avoid overflow failures Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 19/56] mmc: mmc: Fix partition switch timeout for some eMMCs Jiri Slaby
                   ` (39 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Steven Rostedt (Red Hat), Jiri Slaby

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

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

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

commit 59643d1535eb220668692a5359de22545af579f6 upstream.

If the size passed to ring_buffer_resize() is greater than MAX_LONG - BUF_PAGE_SIZE
then the DIV_ROUND_UP() will return zero.

Here's the details:

  # echo 18014398509481980 > /sys/kernel/debug/tracing/buffer_size_kb

tracing_entries_write() processes this and converts kb to bytes.

 18014398509481980 << 10 = 18446744073709547520

and this is passed to ring_buffer_resize() as unsigned long size.

 size = DIV_ROUND_UP(size, BUF_PAGE_SIZE);

Where DIV_ROUND_UP(a, b) is (a + b - 1)/b

BUF_PAGE_SIZE is 4080 and here

 18446744073709547520 + 4080 - 1 = 18446744073709551599

where 18446744073709551599 is still smaller than 2^64

 2^64 - 18446744073709551599 = 17

But now 18446744073709551599 / 4080 = 4521260802379792

and size = size * 4080 = 18446744073709551360

This is checked to make sure its still greater than 2 * 4080,
which it is.

Then we convert to the number of buffer pages needed.

 nr_page = DIV_ROUND_UP(size, BUF_PAGE_SIZE)

but this time size is 18446744073709551360 and

 2^64 - (18446744073709551360 + 4080 - 1) = -3823

Thus it overflows and the resulting number is less than 4080, which makes

  3823 / 4080 = 0

an nr_pages is set to this. As we already checked against the minimum that
nr_pages may be, this causes the logic to fail as well, and we crash the
kernel.

There's no reason to have the two DIV_ROUND_UP() (that's just result of
historical code changes), clean up the code and fix this bug.

Fixes: 83f40318dab00 ("ring-buffer: Make removal of ring buffer pages atomic")
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 kernel/trace/ring_buffer.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 4940115bbf8d..f100767c8e0b 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -1645,14 +1645,13 @@ int ring_buffer_resize(struct ring_buffer *buffer, unsigned long size,
 	    !cpumask_test_cpu(cpu_id, buffer->cpumask))
 		return size;
 
-	size = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
-	size *= BUF_PAGE_SIZE;
+	nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
 
 	/* we need a minimum of two pages */
-	if (size < BUF_PAGE_SIZE * 2)
-		size = BUF_PAGE_SIZE * 2;
+	if (nr_pages < 2)
+		nr_pages = 2;
 
-	nr_pages = DIV_ROUND_UP(size, BUF_PAGE_SIZE);
+	size = nr_pages * BUF_PAGE_SIZE;
 
 	/*
 	 * Don't succeed if resizing is disabled, as a reader might be
-- 
2.9.0

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

* [PATCH 3.12 19/56] mmc: mmc: Fix partition switch timeout for some eMMCs
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (17 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 18/56] ring-buffer: Prevent overflow of size in ring_buffer_resize() Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 20/56] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Jiri Slaby
                   ` (38 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Adrian Hunter, Ulf Hansson, Jiri Slaby

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

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

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

commit 1c447116d017a98c90f8f71c8c5a611e0aa42178 upstream.

Some eMMCs set the partition switch timeout too low.

Now typically eMMCs are considered a critical component (e.g. because
they store the root file system) and consequently are expected to be
reliable.  Thus we can neglect the use case where eMMCs can't switch
reliably and we might want a lower timeout to facilitate speedy
recovery.

Although we could employ a quirk for the cards that are affected (if
we could identify them all), as described above, there is little
benefit to having a low timeout, so instead simply set a minimum
timeout.

The minimum is set to 300ms somewhat arbitrarily - the examples that
have been seen had a timeout of 10ms but were sometimes taking 60-70ms.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mmc/core/mmc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 36d6701de972..21fdf157d8f7 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -266,6 +266,9 @@ static void mmc_select_card_type(struct mmc_card *card)
 	card->ext_csd.card_type = card_type;
 }
 
+/* Minimum partition switch timeout in milliseconds */
+#define MMC_MIN_PART_SWITCH_TIME	300
+
 /*
  * Decode extended CSD.
  */
@@ -329,6 +332,10 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
 
 		/* EXT_CSD value is in units of 10ms, but we store in ms */
 		card->ext_csd.part_time = 10 * ext_csd[EXT_CSD_PART_SWITCH_TIME];
+		/* Some eMMC set the value too low so set a minimum */
+		if (card->ext_csd.part_time &&
+		    card->ext_csd.part_time < MMC_MIN_PART_SWITCH_TIME)
+			card->ext_csd.part_time = MMC_MIN_PART_SWITCH_TIME;
 
 		/* Sleep / awake timeout in 100ns units */
 		if (sa_shift > 0 && sa_shift <= 0x17)
-- 
2.9.0

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

* [PATCH 3.12 20/56] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (18 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 19/56] mmc: mmc: Fix partition switch timeout for some eMMCs Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 21/56] mmc: longer timeout for long read time quirk Jiri Slaby
                   ` (37 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lv Zheng, Rafael J . Wysocki, Jiri Slaby

From: Lv Zheng <lv.zheng@intel.com>

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

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

commit 30c9bb0d7603e7b3f4d6a0ea231e1cddae020c32 upstream.

The order of the _OSI related functionalities is as follows:

  acpi_blacklisted()
    acpi_dmi_osi_linux()
      acpi_osi_setup()
    acpi_osi_setup()
      acpi_update_interfaces() if "!*"
      <<<<<<<<<<<<<<<<<<<<<<<<
  parse_args()
    __setup("acpi_osi=")
      acpi_osi_setup_linux()
        acpi_update_interfaces() if "!*"
        <<<<<<<<<<<<<<<<<<<<<<<<
  acpi_early_init()
    acpi_initialize_subsystem()
      acpi_ut_initialize_interfaces()
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  acpi_bus_init()
    acpi_os_initialize1()
      acpi_install_interface_handler(acpi_osi_handler)
      acpi_osi_setup_late()
        acpi_update_interfaces() for "!"
        >>>>>>>>>>>>>>>>>>>>>>>>
  acpi_osi_handler()

Since acpi_osi_setup_linux() can override acpi_dmi_osi_linux(), the command
line setting can override the DMI detection. That's why acpi_blacklisted()
is put before __setup("acpi_osi=").

Then we can notice the following wrong invocation order. There are
acpi_update_interfaces() (marked by <<<<) calls invoked before
acpi_ut_initialize_interfaces() (marked by ^^^^). This makes it impossible
to use acpi_osi=!* correctly from OSI DMI table or from the command line.
The use of acpi_osi=!* is meant to disable both ACPICA
(acpi_gbl_supported_interfaces) and Linux specific strings
(osi_setup_entries) while the ACPICA part should have stopped working
because of the order issue.

This patch fixes this issue by moving acpi_update_interfaces() to where
it is invoked for acpi_osi=! (marked by >>>>) as this is ensured to be
invoked after acpi_ut_initialize_interfaces() (marked by ^^^^). Linux
specific strings are still handled in the original place in order to make
the following command line working: acpi_osi=!* acpi_osi="Module Device".

Note that since acpi_osi=!* is meant to further disable linux specific
string comparing to the acpi_osi=!, there is no such use case in our bug
fixing work and hence there is no one using acpi_osi=!* either from the
command line or from the DMI quirks, this issue is just a theoretical
issue.

Fixes: 741d81280ad2 (ACPI: Add facility to remove all _OSI strings)
Tested-by: Lukas Wunner <lukas@wunner.de>
Tested-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/acpi/osl.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 91f850585960..72eb7aaf9e8b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -143,7 +143,7 @@ static struct osi_linux {
 	unsigned int	enable:1;
 	unsigned int	dmi:1;
 	unsigned int	cmdline:1;
-	unsigned int	default_disabling:1;
+	u8		default_disabling;
 } osi_linux = {0, 0, 0, 0};
 
 static u32 acpi_osi_handler(acpi_string interface, u32 supported)
@@ -1382,10 +1382,13 @@ void __init acpi_osi_setup(char *str)
 	if (*str == '!') {
 		str++;
 		if (*str == '\0') {
-			osi_linux.default_disabling = 1;
+			/* Do not override acpi_osi=!* */
+			if (!osi_linux.default_disabling)
+				osi_linux.default_disabling =
+					ACPI_DISABLE_ALL_VENDOR_STRINGS;
 			return;
 		} else if (*str == '*') {
-			acpi_update_interfaces(ACPI_DISABLE_ALL_STRINGS);
+			osi_linux.default_disabling = ACPI_DISABLE_ALL_STRINGS;
 			for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
 				osi = &osi_setup_entries[i];
 				osi->enable = false;
@@ -1458,10 +1461,13 @@ static void __init acpi_osi_setup_late(void)
 	acpi_status status;
 
 	if (osi_linux.default_disabling) {
-		status = acpi_update_interfaces(ACPI_DISABLE_ALL_VENDOR_STRINGS);
+		status = acpi_update_interfaces(osi_linux.default_disabling);
 
 		if (ACPI_SUCCESS(status))
-			printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors\n");
+			printk(KERN_INFO PREFIX "Disabled all _OSI OS vendors%s\n",
+				osi_linux.default_disabling ==
+				ACPI_DISABLE_ALL_STRINGS ?
+				" and feature groups" : "");
 	}
 
 	for (i = 0; i < OSI_STRING_ENTRIES_MAX; i++) {
-- 
2.9.0

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

* [PATCH 3.12 21/56] mmc: longer timeout for long read time quirk
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (19 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 20/56] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 22/56] [media] usbvision: revert commit 588afcc1 Jiri Slaby
                   ` (36 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Matt Gumbel, Adrian Hunter, Ulf Hansson, Jiri Slaby

From: Matt Gumbel <matthew.k.gumbel@intel.com>

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

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

commit 32ecd320db39bcb007679ed42f283740641b81ea upstream.

008GE0 Toshiba mmc in some Intel Baytrail tablets responds to
MMC_SEND_EXT_CSD in 450-600ms.

This patch will...

() Increase the long read time quirk timeout from 300ms to 600ms. Original
   author of that quirk says 300ms was only a guess and that the number
   may need to be raised in the future.

() Add this specific MMC to the quirk

Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/mmc/card/block.c | 5 +++--
 drivers/mmc/core/core.c  | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 30076b4f3fee..ee76ff2af935 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2352,11 +2352,12 @@ static const struct mmc_fixup blk_fixups[] =
 		  MMC_QUIRK_BLK_NO_CMD23),
 
 	/*
-	 * Some Micron MMC cards needs longer data read timeout than
-	 * indicated in CSD.
+	 * Some MMC cards need longer data read timeout than indicated in CSD.
 	 */
 	MMC_FIXUP(CID_NAME_ANY, CID_MANFID_MICRON, 0x200, add_quirk_mmc,
 		  MMC_QUIRK_LONG_READ_TIME),
+	MMC_FIXUP("008GE0", CID_MANFID_TOSHIBA, CID_OEMID_ANY, add_quirk_mmc,
+		  MMC_QUIRK_LONG_READ_TIME),
 
 	/*
 	 * On these Samsung MoviNAND parts, performing secure erase or
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 4b12543b0826..3513a5a91c2a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -821,11 +821,11 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card)
 	/*
 	 * Some cards require longer data read timeout than indicated in CSD.
 	 * Address this by setting the read timeout to a "reasonably high"
-	 * value. For the cards tested, 300ms has proven enough. If necessary,
+	 * value. For the cards tested, 600ms has proven enough. If necessary,
 	 * this value can be increased if other problematic cards require this.
 	 */
 	if (mmc_card_long_read_time(card) && data->flags & MMC_DATA_READ) {
-		data->timeout_ns = 300000000;
+		data->timeout_ns = 600000000;
 		data->timeout_clks = 0;
 	}
 
-- 
2.9.0

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

* [PATCH 3.12 22/56] [media] usbvision: revert commit 588afcc1
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (20 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 21/56] mmc: longer timeout for long read time quirk Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 23/56] USB: serial: keyspan: fix use-after-free in probe error path Jiri Slaby
                   ` (35 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Vladis Dronov, Hans Verkuil, Mauro Carvalho Chehab,
	Jiri Slaby

From: Vladis Dronov <vdronov@redhat.com>

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

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

commit d5468d7afaa9c9e961e150f0455a14a9f4872a98 upstream.

Commit 588afcc1c0e4 ("[media] usbvision fix overflow of interfaces
array")' should be reverted, because:

* "!dev->actconfig->interface[ifnum]" won't catch a case where the value
is not NULL but some garbage. This way the system may crash later with
GPF.

* "(ifnum >= USB_MAXINTERFACES)" does not cover all the error
conditions. "ifnum" should be compared to "dev->actconfig->
desc.bNumInterfaces", i.e. compared to the number of "struct
usb_interface" kzalloc()-ed, not to USB_MAXINTERFACES.

* There is a "struct usb_device" leak in this error path, as there is
usb_get_dev(), but no usb_put_dev() on this path.

* There is a bug of the same type several lines below with number of
endpoints. The code is accessing hard-coded second endpoint
("interface->endpoint[1].desc") which may not exist. It would be great
to handle this in the same patch too.

* All the concerns above are resolved by already-accepted commit fa52bd50
("[media] usbvision: fix crash on detecting device with invalid
configuration")

* Mailing list message:
http://www.spinics.net/lists/linux-media/msg94832.html

Signed-off-by: Vladis Dronov <vdronov@redhat.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/media/usb/usbvision/usbvision-video.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/media/usb/usbvision/usbvision-video.c b/drivers/media/usb/usbvision/usbvision-video.c
index d4a222ea8197..bd8f4151884b 100644
--- a/drivers/media/usb/usbvision/usbvision-video.c
+++ b/drivers/media/usb/usbvision/usbvision-video.c
@@ -1539,13 +1539,6 @@ static int usbvision_probe(struct usb_interface *intf,
 	printk(KERN_INFO "%s: %s found\n", __func__,
 				usbvision_device_data[model].model_string);
 
-	/*
-	 * this is a security check.
-	 * an exploit using an incorrect bInterfaceNumber is known
-	 */
-	if (ifnum >= USB_MAXINTERFACES || !dev->actconfig->interface[ifnum])
-		return -ENODEV;
-
 	if (usbvision_device_data[model].interface >= 0)
 		interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0];
 	else if (ifnum < dev->actconfig->desc.bNumInterfaces)
-- 
2.9.0

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

* [PATCH 3.12 23/56] USB: serial: keyspan: fix use-after-free in probe error path
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (21 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 22/56] [media] usbvision: revert commit 588afcc1 Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 24/56] USB: serial: quatech2: " Jiri Slaby
                   ` (34 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 35be1a71d70775e7bd7e45fa6d2897342ff4c9d2 upstream.

The interface instat and indat URBs were submitted in attach, but never
unlinked in release before deallocating the corresponding transfer
buffers.

In the case of a late probe error (e.g. due to failed minor allocation),
disconnect would not have been called before release, causing the
buffers to be freed while the URBs are still in use. We'd also end up
with active URBs for an unbound interface.

Fixes: f9c99bb8b3a1 ("USB: usb-serial: replace shutdown with disconnect,
release")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/keyspan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index e58e21b46ef0..5419ccc72428 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -2411,6 +2411,10 @@ static void keyspan_release(struct usb_serial *serial)
 
 	s_priv = usb_get_serial_data(serial);
 
+	/* Make sure to unlink the URBs submitted in attach. */
+	usb_kill_urb(s_priv->instat_urb);
+	usb_kill_urb(s_priv->indat_urb);
+
 	usb_free_urb(s_priv->instat_urb);
 	usb_free_urb(s_priv->indat_urb);
 	usb_free_urb(s_priv->glocont_urb);
-- 
2.9.0

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

* [PATCH 3.12 24/56] USB: serial: quatech2: fix use-after-free in probe error path
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (22 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 23/56] USB: serial: keyspan: fix use-after-free in probe error path Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 25/56] USB: serial: io_edgeport: fix memory leaks in attach " Jiri Slaby
                   ` (33 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit 028c49f5e02a257c94129cd815f7c8485f51d4ef upstream.

The interface read URB is submitted in attach, but was only unlinked by
the driver at disconnect.

In case of a late probe error (e.g. due to failed minor allocation),
disconnect is never called and we would end up with active URBs for an
unbound interface. This in turn could lead to deallocated memory being
dereferenced in the completion callback.

Fixes: f7a33e608d9a ("USB: serial: add quatech2 usb to serial driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/quatech2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index a24d59ae4032..58ab9e52a938 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -142,6 +142,7 @@ static void qt2_release(struct usb_serial *serial)
 
 	serial_priv = usb_get_serial_data(serial);
 
+	usb_kill_urb(serial_priv->read_urb);
 	usb_free_urb(serial_priv->read_urb);
 	kfree(serial_priv->read_buffer);
 	kfree(serial_priv);
-- 
2.9.0

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

* [PATCH 3.12 25/56] USB: serial: io_edgeport: fix memory leaks in attach error path
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (23 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 24/56] USB: serial: quatech2: " Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 26/56] USB: serial: io_edgeport: fix memory leaks in probe " Jiri Slaby
                   ` (32 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit c5c0c55598cefc826d6cfb0a417eeaee3631715c upstream.

Private data, URBs and buffers allocated for Epic devices during
attach were never released on errors (e.g. missing endpoints).

Fixes: 6e8cf7751f9f ("USB: add EPIC support to the io_edgeport driver")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/io_edgeport.c | 33 ++++++++++++++++++++++++---------
 1 file changed, 24 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index c91481d74a14..60bff3b75609 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2879,14 +2879,15 @@ static int edge_startup(struct usb_serial *serial)
 						usb_alloc_urb(0, GFP_KERNEL);
 				if (!edge_serial->interrupt_read_urb) {
 					dev_err(ddev, "out of memory\n");
-					return -ENOMEM;
+					response = -ENOMEM;
+					break;
 				}
 				edge_serial->interrupt_in_buffer =
 					kmalloc(buffer_size, GFP_KERNEL);
 				if (!edge_serial->interrupt_in_buffer) {
 					dev_err(ddev, "out of memory\n");
-					usb_free_urb(edge_serial->interrupt_read_urb);
-					return -ENOMEM;
+					response = -ENOMEM;
+					break;
 				}
 				edge_serial->interrupt_in_endpoint =
 						endpoint->bEndpointAddress;
@@ -2916,14 +2917,15 @@ static int edge_startup(struct usb_serial *serial)
 						usb_alloc_urb(0, GFP_KERNEL);
 				if (!edge_serial->read_urb) {
 					dev_err(ddev, "out of memory\n");
-					return -ENOMEM;
+					response = -ENOMEM;
+					break;
 				}
 				edge_serial->bulk_in_buffer =
 					kmalloc(buffer_size, GFP_KERNEL);
 				if (!edge_serial->bulk_in_buffer) {
 					dev_err(&dev->dev, "out of memory\n");
-					usb_free_urb(edge_serial->read_urb);
-					return -ENOMEM;
+					response = -ENOMEM;
+					break;
 				}
 				edge_serial->bulk_in_endpoint =
 						endpoint->bEndpointAddress;
@@ -2949,9 +2951,22 @@ static int edge_startup(struct usb_serial *serial)
 			}
 		}
 
-		if (!interrupt_in_found || !bulk_in_found || !bulk_out_found) {
-			dev_err(ddev, "Error - the proper endpoints were not found!\n");
-			return -ENODEV;
+		if (response || !interrupt_in_found || !bulk_in_found ||
+							!bulk_out_found) {
+			if (!response) {
+				dev_err(ddev, "expected endpoints not found\n");
+				response = -ENODEV;
+			}
+
+			usb_free_urb(edge_serial->interrupt_read_urb);
+			kfree(edge_serial->interrupt_in_buffer);
+
+			usb_free_urb(edge_serial->read_urb);
+			kfree(edge_serial->bulk_in_buffer);
+
+			kfree(edge_serial);
+
+			return response;
 		}
 
 		/* start interrupt read for this edgeport this interrupt will
-- 
2.9.0

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

* [PATCH 3.12 26/56] USB: serial: io_edgeport: fix memory leaks in probe error path
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (24 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 25/56] USB: serial: io_edgeport: fix memory leaks in attach " Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 27/56] USB: serial: option: add support for Cinterion PH8 and AHxx Jiri Slaby
                   ` (31 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Johan Hovold, Jiri Slaby

From: Johan Hovold <johan@kernel.org>

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

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

commit c8d62957d450cc1a22ce3242908709fe367ddc8e upstream.

URBs and buffers allocated in attach for Epic devices would never be
deallocated in case of a later probe error (e.g. failure to allocate
minor numbers) as disconnect is then never called.

Fix by moving deallocation to release and making sure that the
URBs are first unlinked.

Fixes: f9c99bb8b3a1 ("USB: usb-serial: replace shutdown with disconnect,
release")
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/io_edgeport.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c
index 60bff3b75609..0d037cc40e51 100644
--- a/drivers/usb/serial/io_edgeport.c
+++ b/drivers/usb/serial/io_edgeport.c
@@ -2989,16 +2989,9 @@ static void edge_disconnect(struct usb_serial *serial)
 {
 	struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
 
-	/* stop reads and writes on all ports */
-	/* free up our endpoint stuff */
 	if (edge_serial->is_epic) {
 		usb_kill_urb(edge_serial->interrupt_read_urb);
-		usb_free_urb(edge_serial->interrupt_read_urb);
-		kfree(edge_serial->interrupt_in_buffer);
-
 		usb_kill_urb(edge_serial->read_urb);
-		usb_free_urb(edge_serial->read_urb);
-		kfree(edge_serial->bulk_in_buffer);
 	}
 }
 
@@ -3011,6 +3004,16 @@ static void edge_release(struct usb_serial *serial)
 {
 	struct edgeport_serial *edge_serial = usb_get_serial_data(serial);
 
+	if (edge_serial->is_epic) {
+		usb_kill_urb(edge_serial->interrupt_read_urb);
+		usb_free_urb(edge_serial->interrupt_read_urb);
+		kfree(edge_serial->interrupt_in_buffer);
+
+		usb_kill_urb(edge_serial->read_urb);
+		usb_free_urb(edge_serial->read_urb);
+		kfree(edge_serial->bulk_in_buffer);
+	}
+
 	kfree(edge_serial);
 }
 
-- 
2.9.0

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

* [PATCH 3.12 27/56] USB: serial: option: add support for Cinterion PH8 and AHxx
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (25 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 26/56] USB: serial: io_edgeport: fix memory leaks in probe " Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 28/56] tty: vt, return error when con_startup fails Jiri Slaby
                   ` (30 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Schemmel Hans-Christoph, Hans-Christoph Schemmel,
	Johan Hovold, Jiri Slaby

From: Schemmel Hans-Christoph <Hans-Christoph.Schemmel@gemalto.com>

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

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

commit 444f94e9e625f6ec6bbe2cb232a6451c637f35a3 upstream.

Added support for Gemalto's Cinterion PH8 and AHxx products
with 2 RmNet Interfaces and products with 1 RmNet + 1 USB Audio interface.

In addition some minor renaming and formatting.

Signed-off-by: Hans-Christoph Schemmel <hans-christoph.schemmel@gemalto.com>
[johan: sort current entries and trim trailing whitespace ]
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/usb/serial/option.c | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 99c89d7fa1ad..bcb6f5c2bae4 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -375,18 +375,22 @@ static void option_instat_callback(struct urb *urb);
 #define HAIER_PRODUCT_CE81B			0x10f8
 #define HAIER_PRODUCT_CE100			0x2009
 
-/* Cinterion (formerly Siemens) products */
-#define SIEMENS_VENDOR_ID				0x0681
-#define CINTERION_VENDOR_ID				0x1e2d
+/* Gemalto's Cinterion products (formerly Siemens) */
+#define SIEMENS_VENDOR_ID			0x0681
+#define CINTERION_VENDOR_ID			0x1e2d
+#define CINTERION_PRODUCT_HC25_MDMNET		0x0040
 #define CINTERION_PRODUCT_HC25_MDM		0x0047
-#define CINTERION_PRODUCT_HC25_MDMNET	0x0040
+#define CINTERION_PRODUCT_HC28_MDMNET		0x004A /* same for HC28J */
 #define CINTERION_PRODUCT_HC28_MDM		0x004C
-#define CINTERION_PRODUCT_HC28_MDMNET	0x004A /* same for HC28J */
 #define CINTERION_PRODUCT_EU3_E			0x0051
 #define CINTERION_PRODUCT_EU3_P			0x0052
 #define CINTERION_PRODUCT_PH8			0x0053
 #define CINTERION_PRODUCT_AHXX			0x0055
 #define CINTERION_PRODUCT_PLXX			0x0060
+#define CINTERION_PRODUCT_PH8_2RMNET		0x0082
+#define CINTERION_PRODUCT_PH8_AUDIO		0x0083
+#define CINTERION_PRODUCT_AHXX_2RMNET		0x0084
+#define CINTERION_PRODUCT_AHXX_AUDIO		0x0085
 
 /* Olivetti products */
 #define OLIVETTI_VENDOR_ID			0x0b3c
@@ -641,6 +645,10 @@ static const struct option_blacklist_info telit_le922_blacklist_usbcfg3 = {
 	.reserved = BIT(1) | BIT(2) | BIT(3),
 };
 
+static const struct option_blacklist_info cinterion_rmnet2_blacklist = {
+	.reserved = BIT(4) | BIT(5),
+};
+
 static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
 	{ USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -1712,7 +1720,13 @@ static const struct usb_device_id option_ids[] = {
 	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX, 0xff) },
 	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PLXX),
 		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
-	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) }, 
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8_2RMNET, 0xff),
+		.driver_info = (kernel_ulong_t)&cinterion_rmnet2_blacklist },
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_PH8_AUDIO, 0xff),
+		.driver_info = (kernel_ulong_t)&net_intf4_blacklist },
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_2RMNET, 0xff) },
+	{ USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_AHXX_AUDIO, 0xff) },
+	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDM) },
 	{ USB_DEVICE(CINTERION_VENDOR_ID, CINTERION_PRODUCT_HC28_MDMNET) },
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDM) },
 	{ USB_DEVICE(SIEMENS_VENDOR_ID, CINTERION_PRODUCT_HC25_MDMNET) },
-- 
2.9.0

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

* [PATCH 3.12 28/56] tty: vt, return error when con_startup fails
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (26 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 27/56] USB: serial: option: add support for Cinterion PH8 and AHxx Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 29/56] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios() Jiri Slaby
                   ` (29 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Jiri Slaby

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

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

commit 6798df4c5fe0a7e6d2065cf79649a794e5ba7114 upstream.

When csw->con_startup() fails in do_register_con_driver, we return no
error (i.e. 0). This was changed back in 2006 by commit 3e795de763.
Before that we used to return -ENODEV.

So fix the return value to be -ENODEV in that case again.

Fixes: 3e795de763 ("VT binding: Add binding/unbinding support for the VT console")
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Reported-by: "Dan Carpenter" <dan.carpenter@oracle.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/vt/vt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index e341fd52a80d..19aba5091408 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3503,9 +3503,10 @@ static int do_register_con_driver(const struct consw *csw, int first, int last)
 		goto err;
 
 	desc = csw->con_startup();
-
-	if (!desc)
+	if (!desc) {
+		retval = -ENODEV;
 		goto err;
+	}
 
 	retval = -EINVAL;
 
-- 
2.9.0

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

* [PATCH 3.12 29/56] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (27 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 28/56] tty: vt, return error when con_startup fails Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 30/56] MIPS: math-emu: Fix jalr emulation when rd == $0 Jiri Slaby
                   ` (28 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Chanwoo Choi, Greg Kroah-Hartman,
	Krzysztof Kozlowski, Jiri Slaby

From: Chanwoo Choi <cw00.choi@samsung.com>

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

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

commit b8995f527aac143e83d3900ff39357651ea4e0f6 upstream.

This patch fixes the broken serial log when changing the clock source
of uart device. Before disabling the original clock source, this patch
enables the new clock source to protect the clock off state for a split second.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/serial/samsung.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c
index 6b0adfbfacaf..663508b760d8 100644
--- a/drivers/tty/serial/samsung.c
+++ b/drivers/tty/serial/samsung.c
@@ -727,6 +727,8 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 	/* check to see if we need  to change clock source */
 
 	if (ourport->baudclk != clk) {
+		clk_prepare_enable(clk);
+
 		s3c24xx_serial_setsource(port, clk_sel);
 
 		if (!IS_ERR(ourport->baudclk)) {
@@ -734,8 +736,6 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
 			ourport->baudclk = ERR_PTR(-EINVAL);
 		}
 
-		clk_prepare_enable(clk);
-
 		ourport->baudclk = clk;
 		ourport->baudclk_rate = clk ? clk_get_rate(clk) : 0;
 	}
-- 
2.9.0

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

* [PATCH 3.12 30/56] MIPS: math-emu: Fix jalr emulation when rd == $0
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (28 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 29/56] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios() Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 31/56] MIPS: Fix siginfo.h to use strict posix types Jiri Slaby
                   ` (27 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Paul Burton, Maciej W . Rozycki, James Hogan,
	linux-mips, Ralf Baechle, Jiri Slaby

From: Paul Burton <paul.burton@imgtec.com>

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

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

commit ab4a92e66741b35ca12f8497896bafbe579c28a1 upstream.

When emulating a jalr instruction with rd == $0, the code in
isBranchInstr was incorrectly writing to GPR $0 which should actually
always remain zeroed. This would lead to any further instructions
emulated which use $0 operating on a bogus value until the task is next
context switched, at which point the value of $0 in the task context
would be restored to the correct zero by a store in SAVE_SOME. Fix this
by not writing to rd if it is $0.

Fixes: 102cedc32a6e ("MIPS: microMIPS: Floating point support.")
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Maciej W. Rozycki <macro@imgtec.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/13160/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/math-emu/cp1emu.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index efe008846ed0..95745858a694 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -670,9 +670,11 @@ static int isBranchInstr(struct pt_regs *regs, struct mm_decoded_insn dec_insn,
 	case spec_op:
 		switch (insn.r_format.func) {
 		case jalr_op:
-			regs->regs[insn.r_format.rd] =
-				regs->cp0_epc + dec_insn.pc_inc +
-				dec_insn.next_pc_inc;
+			if (insn.r_format.rd != 0) {
+				regs->regs[insn.r_format.rd] =
+					regs->cp0_epc + dec_insn.pc_inc +
+					dec_insn.next_pc_inc;
+			}
 			/* Fall through */
 		case jr_op:
 			*contpc = regs->regs[insn.r_format.rs];
-- 
2.9.0

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

* [PATCH 3.12 31/56] MIPS: Fix siginfo.h to use strict posix types
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (29 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 30/56] MIPS: math-emu: Fix jalr emulation when rd == $0 Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 32/56] MIPS: ath79: make bootconsole wait for both THRE and TEMT Jiri Slaby
                   ` (26 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, James Hogan, Christopher Ferris, linux-mips,
	Ralf Baechle, Jiri Slaby

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

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

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

commit 5daebc477da4dfeb31ae193d83084def58fd2697 upstream.

Commit 85efde6f4e0d ("make exported headers use strict posix types")
changed the asm-generic siginfo.h to use the __kernel_* types, and
commit 3a471cbc081b ("remove __KERNEL_STRICT_NAMES") make the internal
types accessible only to the kernel, but the MIPS implementation hasn't
been updated to match.

Switch to proper types now so that the exported asm/siginfo.h won't
produce quite so many compiler errors when included alone by a user
program.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Christopher Ferris <cferris@google.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/12477/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/include/uapi/asm/siginfo.h | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/include/uapi/asm/siginfo.h b/arch/mips/include/uapi/asm/siginfo.h
index 88e292b7719e..9997e4d48d70 100644
--- a/arch/mips/include/uapi/asm/siginfo.h
+++ b/arch/mips/include/uapi/asm/siginfo.h
@@ -46,13 +46,13 @@ typedef struct siginfo {
 
 		/* kill() */
 		struct {
-			pid_t _pid;		/* sender's pid */
+			__kernel_pid_t _pid;	/* sender's pid */
 			__ARCH_SI_UID_T _uid;	/* sender's uid */
 		} _kill;
 
 		/* POSIX.1b timers */
 		struct {
-			timer_t _tid;		/* timer id */
+			__kernel_timer_t _tid;	/* timer id */
 			int _overrun;		/* overrun count */
 			char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
 			sigval_t _sigval;	/* same as below */
@@ -61,26 +61,26 @@ typedef struct siginfo {
 
 		/* POSIX.1b signals */
 		struct {
-			pid_t _pid;		/* sender's pid */
+			__kernel_pid_t _pid;	/* sender's pid */
 			__ARCH_SI_UID_T _uid;	/* sender's uid */
 			sigval_t _sigval;
 		} _rt;
 
 		/* SIGCHLD */
 		struct {
-			pid_t _pid;		/* which child */
+			__kernel_pid_t _pid;	/* which child */
 			__ARCH_SI_UID_T _uid;	/* sender's uid */
 			int _status;		/* exit code */
-			clock_t _utime;
-			clock_t _stime;
+			__kernel_clock_t _utime;
+			__kernel_clock_t _stime;
 		} _sigchld;
 
 		/* IRIX SIGCHLD */
 		struct {
-			pid_t _pid;		/* which child */
-			clock_t _utime;
+			__kernel_pid_t _pid;	/* which child */
+			__kernel_clock_t _utime;
 			int _status;		/* exit code */
-			clock_t _stime;
+			__kernel_clock_t _stime;
 		} _irix_sigchld;
 
 		/* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
-- 
2.9.0

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

* [PATCH 3.12 32/56] MIPS: ath79: make bootconsole wait for both THRE and TEMT
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (30 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 31/56] MIPS: Fix siginfo.h to use strict posix types Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 33/56] Input: uinput - handle compat ioctl for UI_SET_PHYS Jiri Slaby
                   ` (25 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Matthias Schiffer, Greg Kroah-Hartman, Jiri Slaby

From: Matthias Schiffer <mschiffer@universe-factory.net>

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

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

commit f5b556c94c8490d42fea79d7b4ae0ecbc291e69d upstream.

This makes the ath79 bootconsole behave the same way as the generic 8250
bootconsole.

Also waiting for TEMT (transmit buffer is empty) instead of just THRE
(transmit buffer is not full) ensures that all characters have been
transmitted before the real serial driver starts reconfiguring the serial
controller (which would sometimes result in garbage being transmitted.)
This change does not cause a visible performance loss.

In addition, this seems to fix a hang observed in certain configurations on
many AR7xxx/AR9xxx SoCs during autoconfig of the real serial driver.

A more complete follow-up patch will disable 8250 autoconfig for ath79
altogether (the serial controller is detected as a 16550A, which is not
fully compatible with the ath79 serial, and the autoconfig may lead to
undefined behavior on ath79.)

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/mips/ath79/early_printk.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/mips/ath79/early_printk.c b/arch/mips/ath79/early_printk.c
index b955fafc58ba..d1adc59af5bf 100644
--- a/arch/mips/ath79/early_printk.c
+++ b/arch/mips/ath79/early_printk.c
@@ -31,13 +31,15 @@ static inline void prom_putchar_wait(void __iomem *reg, u32 mask, u32 val)
 	} while (1);
 }
 
+#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
+
 static void prom_putchar_ar71xx(unsigned char ch)
 {
 	void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE));
 
-	prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE);
+	prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
 	__raw_writel(ch, base + UART_TX * 4);
-	prom_putchar_wait(base + UART_LSR * 4, UART_LSR_THRE, UART_LSR_THRE);
+	prom_putchar_wait(base + UART_LSR * 4, BOTH_EMPTY, BOTH_EMPTY);
 }
 
 static void prom_putchar_ar933x(unsigned char ch)
-- 
2.9.0

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

* [PATCH 3.12 33/56] Input: uinput - handle compat ioctl for UI_SET_PHYS
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (31 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 32/56] MIPS: ath79: make bootconsole wait for both THRE and TEMT Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 34/56] ath5k: Change led pin configuration for compaq c700 laptop Jiri Slaby
                   ` (24 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ricky Liang, Dmitry Torokhov, Jiri Slaby

From: Ricky Liang <jcliang@chromium.org>

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

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

commit affa80bd97f7ca282d1faa91667b3ee9e4c590e6 upstream.

When running a 32-bit userspace on a 64-bit kernel, the UI_SET_PHYS
ioctl needs to be treated with special care, as it has the pointer
size encoded in the command.

Signed-off-by: Ricky Liang <jcliang@chromium.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/input/misc/uinput.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c
index a0a4bbaef02c..3f2f3ac96a55 100644
--- a/drivers/input/misc/uinput.c
+++ b/drivers/input/misc/uinput.c
@@ -835,9 +835,15 @@ static long uinput_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 }
 
 #ifdef CONFIG_COMPAT
+
+#define UI_SET_PHYS_COMPAT	_IOW(UINPUT_IOCTL_BASE, 108, compat_uptr_t)
+
 static long uinput_compat_ioctl(struct file *file,
 				unsigned int cmd, unsigned long arg)
 {
+	if (cmd == UI_SET_PHYS_COMPAT)
+		cmd = UI_SET_PHYS;
+
 	return uinput_ioctl_handler(file, cmd, arg, compat_ptr(arg));
 }
 #endif
-- 
2.9.0

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

* [PATCH 3.12 34/56] ath5k: Change led pin configuration for compaq c700 laptop
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (32 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 33/56] Input: uinput - handle compat ioctl for UI_SET_PHYS Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:30 ` [PATCH 3.12 35/56] aacraid: Relinquish CPU during timeout wait Jiri Slaby
                   ` (23 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Joseph Salisbury, Kalle Valo, Jiri Slaby

From: Joseph Salisbury <joseph.salisbury@canonical.com>

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

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

commit 7b9bc799a445aea95f64f15e0083cb19b5789abe upstream.

BugLink: http://bugs.launchpad.net/bugs/972604

Commit 09c9bae26b0d3c9472cb6ae45010460a2cee8b8d ("ath5k: add led pin
configuration for compaq c700 laptop") added a pin configuration for the Compaq
c700 laptop.  However, the polarity of the led pin is reversed.  It should be
red for wifi off and blue for wifi on, but it is the opposite.  This bug was
reported in the following bug report:
http://pad.lv/972604

Fixes: 09c9bae26b0d3c9472cb6ae45010460a2cee8b8d ("ath5k: add led pin configuration for compaq c700 laptop")
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/ath/ath5k/led.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath5k/led.c b/drivers/net/wireless/ath/ath5k/led.c
index f77ef36acf87..61879b1f7083 100644
--- a/drivers/net/wireless/ath/ath5k/led.c
+++ b/drivers/net/wireless/ath/ath5k/led.c
@@ -77,7 +77,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = {
 	/* HP Compaq CQ60-206US (ddreggors@jumptv.com) */
 	{ ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137a), ATH_LED(3, 1) },
 	/* HP Compaq C700 (nitrousnrg@gmail.com) */
-	{ ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 1) },
+	{ ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 0) },
 	/* LiteOn AR5BXB63 (magooz@salug.it) */
 	{ ATH_SDEVICE(PCI_VENDOR_ID_ATHEROS, 0x3067), ATH_LED(3, 0) },
 	/* IBM-specific AR5212 (all others) */
-- 
2.9.0

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

* [PATCH 3.12 35/56] aacraid: Relinquish CPU during timeout wait
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (33 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 34/56] ath5k: Change led pin configuration for compaq c700 laptop Jiri Slaby
@ 2016-06-15  7:30 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 36/56] aacraid: Fix for aac_command_thread hang Jiri Slaby
                   ` (22 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:30 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Raghava Aditya Renukunta, Martin K . Petersen, Jiri Slaby

From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>

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

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

commit 07beca2be24cc710461c0b131832524c9ee08910 upstream.

aac_fib_send has a special function case for initial commands during
driver initialization using wait < 0(pseudo sync mode). In this case,
the command does not sleep but rather spins checking for timeout.This
loop is calls cpu_relax() in an attempt to allow other processes/threads
to use the CPU, but this function does not relinquish the CPU and so the
command will hog the processor. This was observed in a KDUMP
"crashkernel" and that prevented the "command thread" (which is
responsible for completing the command from being timed out) from
starting because it could not get the CPU.

Fixed by replacing "cpu_relax()" call with "schedule()"
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/aacraid/commsup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 6b32ddcefc11..06f73d2c878c 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -590,10 +590,10 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
 					}
 					return -EFAULT;
 				}
-				/* We used to udelay() here but that absorbed
-				 * a CPU when a timeout occured. Not very
-				 * useful. */
-				cpu_relax();
+				/*
+				 * Allow other processes / CPUS to use core
+				 */
+				schedule();
 			}
 		} else if (down_interruptible(&fibptr->event_wait)) {
 			/* Do nothing ... satisfy
-- 
2.9.0

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

* [PATCH 3.12 36/56] aacraid: Fix for aac_command_thread hang
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (34 preceding siblings ...)
  2016-06-15  7:30 ` [PATCH 3.12 35/56] aacraid: Relinquish CPU during timeout wait Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 37/56] cpuidle: Indicate when a device has been unregistered Jiri Slaby
                   ` (21 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Raghava Aditya Renukunta, Martin K . Petersen, Jiri Slaby

From: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>

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

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

commit fc4bf75ea300a5e62a2419f89dd0e22189dd7ab7 upstream.

Typically under error conditions, it is possible for aac_command_thread()
to miss the wakeup from kthread_stop() and go back to sleep, causing it
to hang aac_shutdown.

In the observed scenario, the adapter is not functioning correctly and so
aac_fib_send() never completes (or time-outs depending on how it was
called). Shortly after aac_command_thread() starts it performs
aac_fib_send(SendHostTime) which hangs. When aac_probe_one
/aac_get_adapter_info send time outs, kthread_stop is called which breaks
the command thread out of it's hang.

The code will still go back to sleep in schedule_timeout() without
checking kthread_should_stop() so it causes aac_probe_one to hang until
the schedule_timeout() which is 30 minutes.

Fixed by: Adding another kthread_should_stop() before schedule_timeout()
Signed-off-by: Raghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/scsi/aacraid/commsup.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 06f73d2c878c..ce177a50ec05 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1921,6 +1921,10 @@ int aac_command_thread(void *data)
 		if (difference <= 0)
 			difference = 1;
 		set_current_state(TASK_INTERRUPTIBLE);
+
+		if (kthread_should_stop())
+			break;
+
 		schedule_timeout(difference);
 
 		if (kthread_should_stop())
-- 
2.9.0

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

* [PATCH 3.12 37/56] cpuidle: Indicate when a device has been unregistered
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (35 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 36/56] aacraid: Fix for aac_command_thread hang Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 38/56] PCI: Disable all BAR sizing for devices with non-compliant BARs Jiri Slaby
                   ` (20 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dave Gerlach, Rafael J . Wysocki, Jiri Slaby

From: Dave Gerlach <d-gerlach@ti.com>

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

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

commit c998c07836f985b24361629dc98506ec7893e7a0 upstream.

Currently the 'registered' member of the cpuidle_device struct is set
to 1 during cpuidle_register_device. In this same function there are
checks to see if the device is already registered to prevent duplicate
calls to register the device, but this value is never set to 0 even on
unregister of the device. Because of this, any attempt to call
cpuidle_register_device after a call to cpuidle_unregister_device will
fail which shouldn't be the case.

To prevent this, set registered to 0 when the device is unregistered.

Fixes: c878a52d3c7c (cpuidle: Check if device is already registered)
Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/cpuidle/cpuidle.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index ef44248a5c37..8626c4761e4d 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -359,6 +359,8 @@ static void __cpuidle_unregister_device(struct cpuidle_device *dev)
 	list_del(&dev->device_list);
 	per_cpu(cpuidle_devices, dev->cpu) = NULL;
 	module_put(drv->owner);
+
+	dev->registered = 0;
 }
 
 static int __cpuidle_device_init(struct cpuidle_device *dev)
-- 
2.9.0

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

* [PATCH 3.12 38/56] PCI: Disable all BAR sizing for devices with non-compliant BARs
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (36 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 37/56] cpuidle: Indicate when a device has been unregistered Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 39/56] rtlwifi: Fix logic error in enter/exit power-save mode Jiri Slaby
                   ` (19 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Prarit Bhargava, Bjorn Helgaas, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, Andi Kleen, Jiri Slaby

From: Prarit Bhargava <prarit@redhat.com>

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

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

commit ad67b437f187ea818b2860524d10f878fadfdd99 upstream.

b84106b4e229 ("PCI: Disable IO/MEM decoding for devices with non-compliant
BARs") disabled BAR sizing for BARs 0-5 of devices that don't comply with
the PCI spec.  But it didn't do anything for expansion ROM BARs, so we
still try to size them, resulting in warnings like this on Broadwell-EP:

  pci 0000:ff:12.0: BAR 6: failed to assign [mem size 0x00000001 pref]

Move the non-compliant BAR check from __pci_read_base() up to
pci_read_bases() so it applies to the expansion ROM BAR as well as
to BARs 0-5.

Note that direct callers of __pci_read_base(), like sriov_init(), will now
bypass this check.  We haven't had reports of devices with broken SR-IOV
BARs yet.

[bhelgaas: changelog]
Fixes: b84106b4e229 ("PCI: Disable IO/MEM decoding for devices with non-compliant BARs")
Signed-off-by: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/pci/probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 51379906c69c..53b23ff577b4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -175,9 +175,6 @@ int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type,
 	struct pci_bus_region region, inverted_region;
 	bool bar_too_big = false, bar_disabled = false;
 
-	if (dev->non_compliant_bars)
-		return 0;
-
 	mask = type ? PCI_ROM_ADDRESS_MASK : ~0;
 
 	/* No printks while decoding is disabled! */
@@ -319,6 +316,9 @@ static void pci_read_bases(struct pci_dev *dev, unsigned int howmany, int rom)
 {
 	unsigned int pos, reg;
 
+	if (dev->non_compliant_bars)
+		return;
+
 	for (pos = 0; pos < howmany; pos++) {
 		struct resource *res = &dev->resource[pos];
 		reg = PCI_BASE_ADDRESS_0 + (pos << 2);
-- 
2.9.0

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

* [PATCH 3.12 39/56] rtlwifi: Fix logic error in enter/exit power-save mode
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (37 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 38/56] PCI: Disable all BAR sizing for devices with non-compliant BARs Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 40/56] powerpc/book3s64: Fix branching to OOL handlers in relocatable kernel Jiri Slaby
                   ` (18 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, wang yanqing, Kalle Valo, Jiri Slaby

From: wang yanqing <udknight@gmail.com>

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

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

commit 873ffe154ae074c46ed2d72dbd9a2a99f06f55b4 upstream.

In commit a269913c52ad ("rtlwifi: Rework rtl_lps_leave() and
rtl_lps_enter() to use work queue"), the tests for enter/exit
power-save mode were inverted. With this change applied, the
wifi connection becomes much more stable.

Fixes: a269913c52ad ("rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue")
Signed-off-by: Wang YanQing <udknight@gmail.com>
Acked-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/net/wireless/rtlwifi/base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/base.c b/drivers/net/wireless/rtlwifi/base.c
index e99d8b1aa3bd..3fd83a87194f 100644
--- a/drivers/net/wireless/rtlwifi/base.c
+++ b/drivers/net/wireless/rtlwifi/base.c
@@ -1402,9 +1402,9 @@ void rtl_watchdog_wq_callback(void *data)
 		if (((rtlpriv->link_info.num_rx_inperiod +
 		      rtlpriv->link_info.num_tx_inperiod) > 8) ||
 		    (rtlpriv->link_info.num_rx_inperiod > 2))
-			rtlpriv->enter_ps = true;
-		else
 			rtlpriv->enter_ps = false;
+		else
+			rtlpriv->enter_ps = true;
 
 		/* LeisurePS only work in infra mode. */
 		schedule_work(&rtlpriv->works.lps_change_work);
-- 
2.9.0

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

* [PATCH 3.12 40/56] powerpc/book3s64: Fix branching to OOL handlers in relocatable kernel
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (38 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 39/56] rtlwifi: Fix logic error in enter/exit power-save mode Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 41/56] xen/events: Don't move disabled irqs Jiri Slaby
                   ` (17 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Hari Bathini, Mahesh Salgaonkar, Michael Ellerman,
	Jiri Slaby

From: Hari Bathini <hbathini@linux.vnet.ibm.com>

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

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

commit 8ed8ab40047a570fdd8043a40c104a57248dd3fd upstream.

Some of the interrupt vectors on 64-bit POWER server processors are only
32 bytes long (8 instructions), which is not enough for the full
first-level interrupt handler. For these we need to branch to an
out-of-line (OOL) handler. But when we are running a relocatable kernel,
interrupt vectors till __end_interrupts marker are copied down to real
address 0x100. So, branching to labels (ie. OOL handlers) outside this
section must be handled differently (see LOAD_HANDLER()), considering
relocatable kernel, which would need at least 4 instructions.

However, branching from interrupt vector means that we corrupt the
CFAR (come-from address register) on POWER7 and later processors as
mentioned in commit 1707dd16. So, EXCEPTION_PROLOG_0 (6 instructions)
that contains the part up to the point where the CFAR is saved in the
PACA should be part of the short interrupt vectors before we branch out
to OOL handlers.

But as mentioned already, there are interrupt vectors on 64-bit POWER
server processors that are only 32 bytes long (like vectors 0x4f00,
0x4f20, etc.), which cannot accomodate the above two cases at the same
time owing to space constraint. Currently, in these interrupt vectors,
we simply branch out to OOL handlers, without using LOAD_HANDLER(),
which leaves us vulnerable when running a relocatable kernel (eg. kdump
case). While this has been the case for sometime now and kdump is used
widely, we were fortunate not to see any problems so far, for three
reasons:

  1. In almost all cases, production kernel (relocatable) is used for
     kdump as well, which would mean that crashed kernel's OOL handler
     would be at the same place where we end up branching to, from short
     interrupt vector of kdump kernel.
  2. Also, OOL handler was unlikely the reason for crash in almost all
     the kdump scenarios, which meant we had a sane OOL handler from
     crashed kernel that we branched to.
  3. On most 64-bit POWER server processors, page size is large enough
     that marking interrupt vector code as executable (see commit
     429d2e83) leads to marking OOL handler code from crashed kernel,
     that sits right below interrupt vector code from kdump kernel, as
     executable as well.

Let us fix this by moving the __end_interrupts marker down past OOL
handlers to make sure that we also copy OOL handlers to real address
0x100 when running a relocatable kernel.

This fix has been tested successfully in kdump scenario, on an LPAR with
4K page size by using different default/production kernel and kdump
kernel.

Also tested by manually corrupting the OOL handlers in the first kernel
and then kdump'ing, and then causing the OOL handlers to fire - mpe.

Fixes: c1fb6816fb1b ("powerpc: Add relocation on exception vector handlers")
Signed-off-by: Hari Bathini <hbathini@linux.vnet.ibm.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 arch/powerpc/kernel/exceptions-64s.S | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 3a9ed6ac224b..3aaf76fd7975 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -864,11 +864,6 @@ hv_facility_unavailable_relon_trampoline:
 #endif
 	STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist)
 
-	/* Other future vectors */
-	.align	7
-	.globl	__end_interrupts
-__end_interrupts:
-
 	.align	7
 system_call_entry_direct:
 #if defined(CONFIG_RELOCATABLE)
@@ -1198,6 +1193,17 @@ __end_handlers:
 	STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
 	STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable)
 
+	/*
+	 * The __end_interrupts marker must be past the out-of-line (OOL)
+	 * handlers, so that they are copied to real address 0x100 when running
+	 * a relocatable kernel. This ensures they can be reached from the short
+	 * trampoline handlers (like 0x4f00, 0x4f20, etc.) which branch
+	 * directly, without using LOAD_HANDLER().
+	 */
+	.align	7
+	.globl	__end_interrupts
+__end_interrupts:
+
 #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
 /*
  * Data area reserved for FWNMI option.
-- 
2.9.0

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

* [PATCH 3.12 41/56] xen/events: Don't move disabled irqs
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (39 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 40/56] powerpc/book3s64: Fix branching to OOL handlers in relocatable kernel Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 42/56] sunrpc: fix stripping of padded MIC tokens Jiri Slaby
                   ` (16 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Ross Lagerwall, David Vrabel, Jiri Slaby

From: Ross Lagerwall <ross.lagerwall@citrix.com>

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

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

commit f0f393877c71ad227d36705d61d1e4062bc29cf5 upstream.

Commit ff1e22e7a638 ("xen/events: Mask a moving irq") open-coded
irq_move_irq() but left out checking if the IRQ is disabled. This broke
resuming from suspend since it tries to move a (disabled) irq without
holding the IRQ's desc->lock. Fix it by adding in a check for disabled
IRQs.

The resulting stacktrace was:
kernel BUG at /build/linux-UbQGH5/linux-4.4.0/kernel/irq/migration.c:31!
invalid opcode: 0000 [#1] SMP
Modules linked in: xenfs xen_privcmd ...
CPU: 0 PID: 9 Comm: migration/0 Not tainted 4.4.0-22-generic #39-Ubuntu
Hardware name: Xen HVM domU, BIOS 4.6.1-xs125180 05/04/2016
task: ffff88003d75ee00 ti: ffff88003d7bc000 task.ti: ffff88003d7bc000
RIP: 0010:[<ffffffff810e26e2>]  [<ffffffff810e26e2>] irq_move_masked_irq+0xd2/0xe0
RSP: 0018:ffff88003d7bfc50  EFLAGS: 00010046
RAX: 0000000000000000 RBX: ffff88003d40ba00 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000100 RDI: ffff88003d40bad8
RBP: ffff88003d7bfc68 R08: 0000000000000000 R09: ffff88003d000000
R10: 0000000000000000 R11: 000000000000023c R12: ffff88003d40bad0
R13: ffffffff81f3a4a0 R14: 0000000000000010 R15: 00000000ffffffff
FS:  0000000000000000(0000) GS:ffff88003da00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fd4264de624 CR3: 0000000037922000 CR4: 00000000003406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Stack:
 ffff88003d40ba38 0000000000000024 0000000000000000 ffff88003d7bfca0
 ffffffff814c8d92 00000010813ef89d 00000000805ea732 0000000000000009
 0000000000000024 ffff88003cc39b80 ffff88003d7bfce0 ffffffff814c8f66
Call Trace:
 [<ffffffff814c8d92>] eoi_pirq+0xb2/0xf0
 [<ffffffff814c8f66>] __startup_pirq+0xe6/0x150
 [<ffffffff814ca659>] xen_irq_resume+0x319/0x360
 [<ffffffff814c7e75>] xen_suspend+0xb5/0x180
 [<ffffffff81120155>] multi_cpu_stop+0xb5/0xe0
 [<ffffffff811200a0>] ? cpu_stop_queue_work+0x80/0x80
 [<ffffffff811203d0>] cpu_stopper_thread+0xb0/0x140
 [<ffffffff810a94e6>] ? finish_task_switch+0x76/0x220
 [<ffffffff810ca731>] ? __raw_callee_save___pv_queued_spin_unlock+0x11/0x20
 [<ffffffff810a3935>] smpboot_thread_fn+0x105/0x160
 [<ffffffff810a3830>] ? sort_range+0x30/0x30
 [<ffffffff810a0588>] kthread+0xd8/0xf0
 [<ffffffff810a04b0>] ? kthread_create_on_node+0x1e0/0x1e0
 [<ffffffff8182568f>] ret_from_fork+0x3f/0x70
 [<ffffffff810a04b0>] ? kthread_create_on_node+0x1e0/0x1e0

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/xen/events.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/xen/events.c b/drivers/xen/events.c
index 3715a54117bb..19bd74cf0aba 100644
--- a/drivers/xen/events.c
+++ b/drivers/xen/events.c
@@ -576,7 +576,8 @@ static void eoi_pirq(struct irq_data *data)
 	if (!VALID_EVTCHN(evtchn))
 		return;
 
-	if (unlikely(irqd_is_setaffinity_pending(data))) {
+	if (unlikely(irqd_is_setaffinity_pending(data)) &&
+	    likely(!irqd_irq_disabled(data))) {
 		int masked = test_and_set_mask(evtchn);
 
 		clear_evtchn(evtchn);
@@ -1616,7 +1617,8 @@ static void ack_dynirq(struct irq_data *data)
 	if (!VALID_EVTCHN(evtchn))
 		return;
 
-	if (unlikely(irqd_is_setaffinity_pending(data))) {
+	if (unlikely(irqd_is_setaffinity_pending(data)) &&
+	    likely(!irqd_irq_disabled(data))) {
 		int masked = test_and_set_mask(evtchn);
 
 		clear_evtchn(evtchn);
-- 
2.9.0

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

* [PATCH 3.12 42/56] sunrpc: fix stripping of padded MIC tokens
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (40 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 41/56] xen/events: Don't move disabled irqs Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 43/56] drm/gma500: Fix possible out of bounds read Jiri Slaby
                   ` (15 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Tomáš Trnka, J . Bruce Fields, Jiri Slaby

From: Tomáš Trnka <ttrnka@mail.muni.cz>

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

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

commit c0cb8bf3a8e4bd82e640862cdd8891400405cb89 upstream.

The length of the GSS MIC token need not be a multiple of four bytes.
It is then padded by XDR to a multiple of 4 B, but unwrap_integ_data()
would previously only trim mic.len + 4 B. The remaining up to three
bytes would then trigger a check in nfs4svc_decode_compoundargs(),
leading to a "garbage args" error and mount failure:

nfs4svc_decode_compoundargs: compound not properly padded!
nfsd: failed to decode arguments!

This would prevent older clients using the pre-RFC 4121 MIC format
(37-byte MIC including a 9-byte OID) from mounting exports from v3.9+
servers using krb5i.

The trimming was introduced by commit 4c190e2f913f ("sunrpc: trim off
trailing checksum before returning decrypted or integrity authenticated
buffer").

Fixes: 4c190e2f913f "unrpc: trim off trailing checksum..."
Signed-off-by: Tomáš Trnka <ttrnka@mail.muni.cz>
Acked-by: Jeff Layton <jlayton@poochiereds.net>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 net/sunrpc/auth_gss/svcauth_gss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index e18be86dc486..9d7e6097ef5b 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -855,8 +855,8 @@ unwrap_integ_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct g
 		goto out;
 	if (svc_getnl(&buf->head[0]) != seq)
 		goto out;
-	/* trim off the mic at the end before returning */
-	xdr_buf_trim(buf, mic.len + 4);
+	/* trim off the mic and padding at the end before returning */
+	xdr_buf_trim(buf, round_up_to_quad(mic.len) + 4);
 	stat = 0;
 out:
 	kfree(mic.data);
-- 
2.9.0

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

* [PATCH 3.12 43/56] drm/gma500: Fix possible out of bounds read
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (41 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 42/56] sunrpc: fix stripping of padded MIC tokens Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 44/56] drm/fb_helper: Fix references to dev->mode_config.num_connector Jiri Slaby
                   ` (14 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Itai Handler, Patrik Jakobsson, Jiri Slaby

From: Itai Handler <itai_handler@hotmail.com>

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

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

commit 7ccca1d5bf69fdd1d3c5fcf84faf1659a6e0ad11 upstream.

Fix possible out of bounds read, by adding missing comma.
The code may read pass the end of the dsi_errors array
when the most significant bit (bit #31) in the intr_stat register
is set.
This bug has been detected using CppCheck (static analysis tool).

Signed-off-by: Itai Handler <itai_handler@hotmail.com>
Signed-off-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
index 489ffd2c66e5..a3d37e4a84ae 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c
@@ -85,7 +85,7 @@ static const char *const dsi_errors[] = {
 	"RX Prot Violation",
 	"HS Generic Write FIFO Full",
 	"LP Generic Write FIFO Full",
-	"Generic Read Data Avail"
+	"Generic Read Data Avail",
 	"Special Packet Sent",
 	"Tearing Effect",
 };
-- 
2.9.0

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

* [PATCH 3.12 44/56] drm/fb_helper: Fix references to dev->mode_config.num_connector
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (42 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 43/56] drm/gma500: Fix possible out of bounds read Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 45/56] ext4: fix hang when processing corrupted orphaned inode list Jiri Slaby
                   ` (13 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Lyude, Daniel Vetter, Jiri Slaby

From: Lyude <cpaul@redhat.com>

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

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

commit 255f0e7c418ad95a4baeda017ae6182ba9b3c423 upstream.

During boot, MST hotplugs are generally expected (even if no physical
hotplugging occurs) and result in DRM's connector topology changing.
This means that using num_connector from the current mode configuration
can lead to the number of connectors changing under us. This can lead to
some nasty scenarios in fbcon:

- We allocate an array to the size of dev->mode_config.num_connectors.
- MST hotplug occurs, dev->mode_config.num_connectors gets incremented.
- We try to loop through each element in the array using the new value
  of dev->mode_config.num_connectors, and end up going out of bounds
  since dev->mode_config.num_connectors is now larger then the array we
  allocated.

fb_helper->connector_count however, will always remain consistent while
we do a modeset in fb_helper.

Note: This is just polish for 4.7, Dave Airlie's drm_connector
refcounting fixed these bugs for real. But it's good enough duct-tape
for stable kernel backporting, since backporting the refcounting
changes is way too invasive.

Signed-off-by: Lyude <cpaul@redhat.com>
[danvet: Clarify why we need this. Also remove the now unused "dev"
local variable to appease gcc.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463065021-18280-3-git-send-email-cpaul@redhat.com
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/gpu/drm/drm_fb_helper.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 49557c957be8..1965b8963606 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1359,7 +1359,6 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
 			  int n, int width, int height)
 {
 	int c, o;
-	struct drm_device *dev = fb_helper->dev;
 	struct drm_connector *connector;
 	struct drm_connector_helper_funcs *connector_funcs;
 	struct drm_encoder *encoder;
@@ -1380,7 +1379,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
 	if (modes[n] == NULL)
 		return best_score;
 
-	crtcs = kzalloc(dev->mode_config.num_connector *
+	crtcs = kzalloc(fb_helper->connector_count *
 			sizeof(struct drm_fb_helper_crtc *), GFP_KERNEL);
 	if (!crtcs)
 		return best_score;
@@ -1427,7 +1426,7 @@ static int drm_pick_crtcs(struct drm_fb_helper *fb_helper,
 			best_crtc = crtc;
 			best_score = score;
 			memcpy(best_crtcs, crtcs,
-			       dev->mode_config.num_connector *
+			       fb_helper->connector_count *
 			       sizeof(struct drm_fb_helper_crtc *));
 		}
 	}
-- 
2.9.0

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

* [PATCH 3.12 45/56] ext4: fix hang when processing corrupted orphaned inode list
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (43 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 44/56] drm/fb_helper: Fix references to dev->mode_config.num_connector Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 46/56] ext4: address UBSAN warning in mb_find_order_for_block() Jiri Slaby
                   ` (12 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Theodore Ts'o, Jiri Slaby

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

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

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

commit c9eb13a9105e2e418f72e46a2b6da3f49e696902 upstream.

If the orphaned inode list contains inode #5, ext4_iget() returns a
bad inode (since the bootloader inode should never be referenced
directly).  Because of the bad inode, we end up processing the inode
repeatedly and this hangs the machine.

This can be reproduced via:

   mke2fs -t ext4 /tmp/foo.img 100
   debugfs -w -R "ssv last_orphan 5" /tmp/foo.img
   mount -o loop /tmp/foo.img /mnt

(But don't do this if you are using an unpatched kernel if you care
about the system staying functional.  :-)

This bug was found by the port of American Fuzzy Lop into the kernel
to find file system problems[1].  (Since it *only* happens if inode #5
shows up on the orphan list --- 3, 7, 8, etc. won't do it, it's not
surprising that AFL needed two hours before it found it.)

[1] http://events.linuxfoundation.org/sites/events/files/slides/AFL%20filesystem%20fuzzing%2C%20Vault%202016_0.pdf

Reported by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/ialloc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index fbc6df7b895d..f49349dfebcc 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -1097,11 +1097,13 @@ struct inode *ext4_orphan_get(struct super_block *sb, unsigned long ino)
 		goto iget_failed;
 
 	/*
-	 * If the orphans has i_nlinks > 0 then it should be able to be
-	 * truncated, otherwise it won't be removed from the orphan list
-	 * during processing and an infinite loop will result.
+	 * If the orphans has i_nlinks > 0 then it should be able to
+	 * be truncated, otherwise it won't be removed from the orphan
+	 * list during processing and an infinite loop will result.
+	 * Similarly, it must not be a bad inode.
 	 */
-	if (inode->i_nlink && !ext4_can_truncate(inode))
+	if ((inode->i_nlink && !ext4_can_truncate(inode)) ||
+	    is_bad_inode(inode))
 		goto bad_orphan;
 
 	if (NEXT_ORPHAN(inode) > max_ino)
-- 
2.9.0

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

* [PATCH 3.12 46/56] ext4: address UBSAN warning in mb_find_order_for_block()
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (44 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 45/56] ext4: fix hang when processing corrupted orphaned inode list Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 47/56] ext4: silence UBSAN in ext4_mb_init() Jiri Slaby
                   ` (11 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nicolai Stange, Theodore Ts'o, Jiri Slaby

From: Nicolai Stange <nicstange@gmail.com>

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

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

commit b5cb316cdf3a3f5f6125412b0f6065185240cfdc upstream.

Currently, in mb_find_order_for_block(), there's a loop like the following:

  while (order <= e4b->bd_blkbits + 1) {
    ...
    bb += 1 << (e4b->bd_blkbits - order);
  }

Note that the updated bb is used in the loop's next iteration only.

However, at the last iteration, that is at order == e4b->bd_blkbits + 1,
the shift count becomes negative (c.f. C99 6.5.7(3)) and UBSAN reports

  UBSAN: Undefined behaviour in fs/ext4/mballoc.c:1281:11
  shift exponent -1 is negative
  [...]
  Call Trace:
   [<ffffffff818c4d35>] dump_stack+0xbc/0x117
   [<ffffffff818c4c79>] ? _atomic_dec_and_lock+0x169/0x169
   [<ffffffff819411bb>] ubsan_epilogue+0xd/0x4e
   [<ffffffff81941cbc>] __ubsan_handle_shift_out_of_bounds+0x1fb/0x254
   [<ffffffff81941ac1>] ? __ubsan_handle_load_invalid_value+0x158/0x158
   [<ffffffff816e93a0>] ? ext4_mb_generate_from_pa+0x590/0x590
   [<ffffffff816502c8>] ? ext4_read_block_bitmap_nowait+0x598/0xe80
   [<ffffffff816e7b7e>] mb_find_order_for_block+0x1ce/0x240
   [...]

Unless compilers start to do some fancy transformations (which at least
GCC 6.0.0 doesn't currently do), the issue is of cosmetic nature only: the
such calculated value of bb is never used again.

Silence UBSAN by introducing another variable, bb_incr, holding the next
increment to apply to bb and adjust that one by right shifting it by one
position per loop iteration.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=114701
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=112161

Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/mballoc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index c4a5e4df8ca3..4d42e50ab0a0 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -1236,6 +1236,7 @@ static void ext4_mb_unload_buddy(struct ext4_buddy *e4b)
 static int mb_find_order_for_block(struct ext4_buddy *e4b, int block)
 {
 	int order = 1;
+	int bb_incr = 1 << (e4b->bd_blkbits - 1);
 	void *bb;
 
 	BUG_ON(e4b->bd_bitmap == e4b->bd_buddy);
@@ -1248,7 +1249,8 @@ static int mb_find_order_for_block(struct ext4_buddy *e4b, int block)
 			/* this block is part of buddy of order 'order' */
 			return order;
 		}
-		bb += 1 << (e4b->bd_blkbits - order);
+		bb += bb_incr;
+		bb_incr >>= 1;
 		order++;
 	}
 	return 0;
-- 
2.9.0

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

* [PATCH 3.12 47/56] ext4: silence UBSAN in ext4_mb_init()
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (45 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 46/56] ext4: address UBSAN warning in mb_find_order_for_block() Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 48/56] dma-debug: avoid spinlock recursion when disabling dma-debug Jiri Slaby
                   ` (10 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Nicolai Stange, Theodore Ts'o, Jiri Slaby

From: Nicolai Stange <nicstange@gmail.com>

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

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

commit 935244cd54b86ca46e69bc6604d2adfb1aec2d42 upstream.

Currently, in ext4_mb_init(), there's a loop like the following:

  do {
    ...
    offset += 1 << (sb->s_blocksize_bits - i);
    i++;
  } while (i <= sb->s_blocksize_bits + 1);

Note that the updated offset is used in the loop's next iteration only.

However, at the last iteration, that is at i == sb->s_blocksize_bits + 1,
the shift count becomes equal to (unsigned)-1 > 31 (c.f. C99 6.5.7(3))
and UBSAN reports

  UBSAN: Undefined behaviour in fs/ext4/mballoc.c:2621:15
  shift exponent 4294967295 is too large for 32-bit type 'int'
  [...]
  Call Trace:
   [<ffffffff818c4d25>] dump_stack+0xbc/0x117
   [<ffffffff818c4c69>] ? _atomic_dec_and_lock+0x169/0x169
   [<ffffffff819411ab>] ubsan_epilogue+0xd/0x4e
   [<ffffffff81941cac>] __ubsan_handle_shift_out_of_bounds+0x1fb/0x254
   [<ffffffff81941ab1>] ? __ubsan_handle_load_invalid_value+0x158/0x158
   [<ffffffff814b6dc1>] ? kmem_cache_alloc+0x101/0x390
   [<ffffffff816fc13b>] ? ext4_mb_init+0x13b/0xfd0
   [<ffffffff814293c7>] ? create_cache+0x57/0x1f0
   [<ffffffff8142948a>] ? create_cache+0x11a/0x1f0
   [<ffffffff821c2168>] ? mutex_lock+0x38/0x60
   [<ffffffff821c23ab>] ? mutex_unlock+0x1b/0x50
   [<ffffffff814c26ab>] ? put_online_mems+0x5b/0xc0
   [<ffffffff81429677>] ? kmem_cache_create+0x117/0x2c0
   [<ffffffff816fcc49>] ext4_mb_init+0xc49/0xfd0
   [...]

Observe that the mentioned shift exponent, 4294967295, equals (unsigned)-1.

Unless compilers start to do some fancy transformations (which at least
GCC 6.0.0 doesn't currently do), the issue is of cosmetic nature only: the
such calculated value of offset is never used again.

Silence UBSAN by introducing another variable, offset_incr, holding the
next increment to apply to offset and adjust that one by right shifting it
by one position per loop iteration.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=114701
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=112161

Signed-off-by: Nicolai Stange <nicstange@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/ext4/mballoc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 4d42e50ab0a0..4a79ce1ecaa1 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2537,7 +2537,7 @@ int ext4_mb_init(struct super_block *sb)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	unsigned i, j;
-	unsigned offset;
+	unsigned offset, offset_incr;
 	unsigned max;
 	int ret;
 
@@ -2566,11 +2566,13 @@ int ext4_mb_init(struct super_block *sb)
 
 	i = 1;
 	offset = 0;
+	offset_incr = 1 << (sb->s_blocksize_bits - 1);
 	max = sb->s_blocksize << 2;
 	do {
 		sbi->s_mb_offsets[i] = offset;
 		sbi->s_mb_maxs[i] = max;
-		offset += 1 << (sb->s_blocksize_bits - i);
+		offset += offset_incr;
+		offset_incr = offset_incr >> 1;
 		max = max >> 1;
 		i++;
 	} while (i <= sb->s_blocksize_bits + 1);
-- 
2.9.0

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

* [PATCH 3.12 48/56] dma-debug: avoid spinlock recursion when disabling dma-debug
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (46 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 47/56] ext4: silence UBSAN in ext4_mb_init() Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 49/56] xfs: xfs_iflush_cluster fails to abort on error Jiri Slaby
                   ` (9 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Ville Syrjälä,
	Andrew Morton, Linus Torvalds, Jiri Slaby

From: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

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

commit 3017cd63f26fc655d56875aaf497153ba60e9edf upstream.

With netconsole (at least) the pr_err("...  disablingn") call can
recurse back into the dma-debug code, where it'll try to grab
free_entries_lock again.  Avoid the problem by doing the printk after
dropping the lock.

Link: http://lkml.kernel.org/r/1463678421-18683-1-git-send-email-ville.syrjala@linux.intel.com
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 lib/dma-debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index eb43517bf261..c32437f6be61 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -445,9 +445,9 @@ static struct dma_debug_entry *dma_entry_alloc(void)
 	spin_lock_irqsave(&free_entries_lock, flags);
 
 	if (list_empty(&free_entries)) {
-		pr_err("DMA-API: debugging out of memory - disabling\n");
 		global_disable = true;
 		spin_unlock_irqrestore(&free_entries_lock, flags);
+		pr_err("DMA-API: debugging out of memory - disabling\n");
 		return NULL;
 	}
 
-- 
2.9.0

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

* [PATCH 3.12 49/56] xfs: xfs_iflush_cluster fails to abort on error
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (47 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 48/56] dma-debug: avoid spinlock recursion when disabling dma-debug Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 50/56] xfs: fix inode validity check in xfs_iflush_cluster Jiri Slaby
                   ` (8 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dave Chinner, Dave Chinner, Jiri Slaby

From: Dave Chinner <dchinner@redhat.com>

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

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

commit b1438f477934f5a4d5a44df26f3079a7575d5946 upstream.

When a failure due to an inode buffer occurs, the error handling
fails to abort the inode writeback correctly. This can result in the
inode being reclaimed whilst still in the AIL, leading to
use-after-free situations as well as filesystems that cannot be
unmounted as the inode log items left in the AIL never get removed.

Fix this by ensuring fatal errors from xfs_imap_to_bp() result in
the inode flush being aborted correctly.

[js] 3.12 needs EAGAIN, not -EAGAIN

Reported-by: Shyam Kaushik <shyam@zadarastorage.com>
Diagnosed-by: Shyam Kaushik <shyam@zadarastorage.com>
Tested-by: Shyam Kaushik <shyam@zadarastorage.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/xfs/xfs_inode.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index e3606f26f82d..771f5359799c 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -3022,7 +3022,7 @@ xfs_iflush(
 	struct xfs_buf		**bpp)
 {
 	struct xfs_mount	*mp = ip->i_mount;
-	struct xfs_buf		*bp;
+	struct xfs_buf		*bp = NULL;
 	struct xfs_dinode	*dip;
 	int			error;
 
@@ -3064,14 +3064,22 @@ xfs_iflush(
 	}
 
 	/*
-	 * Get the buffer containing the on-disk inode.
+	 * Get the buffer containing the on-disk inode. We are doing a try-lock
+	 * operation here, so we may get  an EAGAIN error. In that case, we
+	 * simply want to return with the inode still dirty.
+	 *
+	 * If we get any other error, we effectively have a corruption situation
+	 * and we cannot flush the inode, so we treat it the same as failing
+	 * xfs_iflush_int().
 	 */
 	error = xfs_imap_to_bp(mp, NULL, &ip->i_imap, &dip, &bp, XBF_TRYLOCK,
 			       0);
-	if (error || !bp) {
+	if (error == EAGAIN) {
 		xfs_ifunlock(ip);
 		return error;
 	}
+	if (error)
+		goto corrupt_out;
 
 	/*
 	 * First flush out the inode that xfs_iflush was called with.
@@ -3099,7 +3107,8 @@ xfs_iflush(
 	return 0;
 
 corrupt_out:
-	xfs_buf_relse(bp);
+	if (bp)
+		xfs_buf_relse(bp);
 	xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
 cluster_corrupt_out:
 	error = XFS_ERROR(EFSCORRUPTED);
-- 
2.9.0

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

* [PATCH 3.12 50/56] xfs: fix inode validity check in xfs_iflush_cluster
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (48 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 49/56] xfs: xfs_iflush_cluster fails to abort on error Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 51/56] xfs: skip stale inodes " Jiri Slaby
                   ` (7 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dave Chinner, Dave Chinner, Jiri Slaby

From: Dave Chinner <dchinner@redhat.com>

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

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

commit 51b07f30a71c27405259a0248206ed4e22adbee2 upstream.

Some careless idiot(*) wrote crap code in commit 1a3e8f3 ("xfs:
convert inode cache lookups to use RCU locking") back in late 2010,
and so xfs_iflush_cluster checks the wrong inode for whether it is
still valid under RCU protection. Fix it to lock and check the
correct inode.

(*) Careless-idiot: Dave Chinner <dchinner@redhat.com>

Discovered-by: Brain Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/xfs/xfs_inode.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 771f5359799c..363bcd8eabf6 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2900,13 +2900,13 @@ xfs_iflush_cluster(
 		 * We need to check under the i_flags_lock for a valid inode
 		 * here. Skip it if it is not valid or the wrong inode.
 		 */
-		spin_lock(&ip->i_flags_lock);
-		if (!ip->i_ino ||
+		spin_lock(&iq->i_flags_lock);
+		if (!iq->i_ino ||
 		    (XFS_INO_TO_AGINO(mp, iq->i_ino) & mask) != first_index) {
-			spin_unlock(&ip->i_flags_lock);
+			spin_unlock(&iq->i_flags_lock);
 			continue;
 		}
-		spin_unlock(&ip->i_flags_lock);
+		spin_unlock(&iq->i_flags_lock);
 
 		/*
 		 * Do an un-protected check to see if the inode is dirty and
-- 
2.9.0

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

* [PATCH 3.12 51/56] xfs: skip stale inodes in xfs_iflush_cluster
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (49 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 50/56] xfs: fix inode validity check in xfs_iflush_cluster Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 52/56] [media] af9035: correct eeprom offsets Jiri Slaby
                   ` (6 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable; +Cc: linux-kernel, Dave Chinner, Dave Chinner, Jiri Slaby

From: Dave Chinner <dchinner@redhat.com>

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

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

commit 7d3aa7fe970791f1a674b14572a411accf2f4d4e upstream.

We don't write back stale inodes so we should skip them in
xfs_iflush_cluster, too.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 fs/xfs/xfs_inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 363bcd8eabf6..5d667f740eff 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2902,6 +2902,7 @@ xfs_iflush_cluster(
 		 */
 		spin_lock(&iq->i_flags_lock);
 		if (!iq->i_ino ||
+		    __xfs_iflags_test(iq, XFS_ISTALE) ||
 		    (XFS_INO_TO_AGINO(mp, iq->i_ino) & mask) != first_index) {
 			spin_unlock(&iq->i_flags_lock);
 			continue;
-- 
2.9.0

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

* [PATCH 3.12 52/56] [media] af9035: correct eeprom offsets
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (50 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 51/56] xfs: skip stale inodes " Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 53/56] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes Jiri Slaby
                   ` (5 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Antti Palosaari, Mauro Carvalho Chehab,
	Oliver Neukum, Jiri Slaby

From: Antti Palosaari <crope@iki.fi>

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

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

commit 9c574ad4d360353ec8dd6bc85e78d8b2d0f8e775 upstream.

Used memory mapped eeprom offsets were off-by 8 bytes.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/media/usb/dvb-usb-v2/af9035.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h
index a1c68d829b8c..39b0123fe36c 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.h
+++ b/drivers/media/usb/dvb-usb-v2/af9035.h
@@ -109,20 +109,20 @@ static const u32 clock_lut_it9135[] = {
  * Values 0 and 3 are seen to this day. 0 for single TS and 3 for dual TS.
  */
 
-#define EEPROM_BASE_AF9035        0x42fd
-#define EEPROM_BASE_IT9135        0x499c
+#define EEPROM_BASE_AF9035        0x42f5
+#define EEPROM_BASE_IT9135        0x4994
 #define EEPROM_SHIFT                0x10
 
-#define EEPROM_IR_MODE              0x10
-#define EEPROM_TS_MODE              0x29
-#define EEPROM_2ND_DEMOD_ADDR       0x2a
-#define EEPROM_IR_TYPE              0x2c
-#define EEPROM_1_IF_L               0x30
-#define EEPROM_1_IF_H               0x31
-#define EEPROM_1_TUNER_ID           0x34
-#define EEPROM_2_IF_L               0x40
-#define EEPROM_2_IF_H               0x41
-#define EEPROM_2_TUNER_ID           0x44
+#define EEPROM_IR_MODE              0x18
+#define EEPROM_TS_MODE              0x31
+#define EEPROM_2ND_DEMOD_ADDR       0x32
+#define EEPROM_IR_TYPE              0x34
+#define EEPROM_1_IF_L               0x38
+#define EEPROM_1_IF_H               0x39
+#define EEPROM_1_TUNER_ID           0x3c
+#define EEPROM_2_IF_L               0x48
+#define EEPROM_2_IF_H               0x49
+#define EEPROM_2_TUNER_ID           0x4c
 
 /* USB commands */
 #define CMD_MEM_RD                  0x00
-- 
2.9.0

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

* [PATCH 3.12 53/56] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (51 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 52/56] [media] af9035: correct eeprom offsets Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 54/56] pch_phub: return -ENODATA if ROM can't be mapped Jiri Slaby
                   ` (4 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Dan Bogdan Nechita, Greg Kroah-Hartman,
	Oliver Neukum, Jiri Slaby

From: Dan Bogdan Nechita <dan.bogdan.nechita@gmail.com>

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

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

commit 1bb850a1b7f68b66361e658e334f9fdf8231f17d upstream.

Currently writing the attributes with "echo" will result in comparing:
"enabled\n" with "enabled\0" and attribute is always set to false.

Use the sysfs_streq() instead because it treats both NUL and
new-line-then-NUL as equivalent string terminations.

Signed-off-by: Dan Bogdan Nechita <dan.bogdan.nechita@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/misc/ad525x_dpot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/ad525x_dpot.c b/drivers/misc/ad525x_dpot.c
index 65fb74402c37..49811a8a1b07 100644
--- a/drivers/misc/ad525x_dpot.c
+++ b/drivers/misc/ad525x_dpot.c
@@ -458,7 +458,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
 	int err;
 
 	if (reg & DPOT_ADDR_OTP_EN) {
-		if (!strncmp(buf, "enabled", sizeof("enabled")))
+		if (sysfs_streq(buf, "enabled"))
 			set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
 		else
 			clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
-- 
2.9.0

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

* [PATCH 3.12 54/56] pch_phub: return -ENODATA if ROM can't be mapped
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (52 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 53/56] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 55/56] Bluetooth: btmrvl_sdio: fix firmware activation failure Jiri Slaby
                   ` (3 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Colin Ian King, Greg Kroah-Hartman, Oliver Neukum,
	Jiri Slaby

From: Colin Ian King <colin.king@canonical.com>

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

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

commit a75fa128236bc2fdaa5e412145cbd577e42e14c2 upstream.

The error return err is not initialized for the case when pci_map_rom
fails and no ROM can me mapped.  Fix this by setting ret to -ENODATA;
(this is the same error value that is returned if the ROM data is
successfully mapped but does not match the expected ROM signature.).

Issue found from static code analysis using CoverityScan.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/misc/pch_phub.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c
index a5925f7f17f6..829ca77c143e 100644
--- a/drivers/misc/pch_phub.c
+++ b/drivers/misc/pch_phub.c
@@ -512,8 +512,10 @@ static ssize_t pch_phub_bin_read(struct file *filp, struct kobject *kobj,
 
 	/* Get Rom signature */
 	chip->pch_phub_extrom_base_address = pci_map_rom(chip->pdev, &rom_size);
-	if (!chip->pch_phub_extrom_base_address)
+	if (!chip->pch_phub_extrom_base_address) {
+		err = -ENODATA;
 		goto exrom_map_err;
+	}
 
 	pch_phub_read_serial_rom(chip, chip->pch_opt_rom_start_address,
 				(unsigned char *)&rom_signature);
-- 
2.9.0

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

* [PATCH 3.12 55/56] Bluetooth: btmrvl_sdio: fix firmware activation failure
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (53 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 54/56] pch_phub: return -ENODATA if ROM can't be mapped Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15  7:31 ` [PATCH 3.12 56/56] Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data Jiri Slaby
                   ` (2 subsequent siblings)
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Wei-Ning Huang, Wei-Ning Huang, Marcel Holtmann,
	Oliver Neukum, Jiri Slaby

From: Wei-Ning Huang <wnhuang@chromium.org>

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

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

commit 9a01242dc7fc4d5fe3f722afbf35b33aa414cd2f upstream.

In some case, the btmrvl_sdio firmware would fail to active within the
polling time. Increase the polling interval to 100 msec to fix the
issue.

Signed-off-by: Wei-Ning Huang <wnhuang@chromium.org>
Signed-off-by: Wei-Ning Huang <wnhuang@google.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/bluetooth/btmrvl_sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bluetooth/btmrvl_sdio.c b/drivers/bluetooth/btmrvl_sdio.c
index 00da6df9f71e..65c5f256a5d5 100644
--- a/drivers/bluetooth/btmrvl_sdio.c
+++ b/drivers/bluetooth/btmrvl_sdio.c
@@ -269,7 +269,7 @@ static int btmrvl_sdio_verify_fw_download(struct btmrvl_sdio_card *card,
 		if (firmwarestat == FIRMWARE_READY)
 			return 0;
 
-		msleep(10);
+		msleep(100);
 	}
 
 	return -ETIMEDOUT;
-- 
2.9.0

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

* [PATCH 3.12 56/56] Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (54 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 55/56] Bluetooth: btmrvl_sdio: fix firmware activation failure Jiri Slaby
@ 2016-06-15  7:31 ` Jiri Slaby
  2016-06-15 15:34 ` [PATCH 3.12 00/56] 3.12.61-stable review Shuah Khan
  2016-06-15 18:42 ` Guenter Roeck
  57 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-15  7:31 UTC (permalink / raw)
  To: stable
  Cc: linux-kernel, Loic Poulain, Marcel Holtmann, Oliver Neukum, Jiri Slaby

From: Loic Poulain <loic.poulain@intel.com>

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

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

commit 84cb3df02aea4b00405521e67c4c67c2d525c364 upstream.

HCI_UART_PROTO_SET flag is set before hci_uart_set_proto call. If we
receive data from tty layer during this procedure, proto pointer may
not be assigned yet, leading to null pointer dereference in rx method
hci_uart_tty_receive.

This patch fixes this issue by introducing HCI_UART_PROTO_READY flag in
order to avoid any proto operation before proto opening and assignment.

Signed-off-by: Loic Poulain <loic.poulain@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/bluetooth/hci_ldisc.c | 11 +++++++----
 drivers/bluetooth/hci_uart.h  |  1 +
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index c4d2f0e48685..3f6074f7d4bc 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -225,7 +225,7 @@ static int hci_uart_flush(struct hci_dev *hdev)
 	tty_ldisc_flush(tty);
 	tty_driver_flush_buffer(tty);
 
-	if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
+	if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
 		hu->proto->flush(hu);
 
 	return 0;
@@ -340,7 +340,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
 
 	cancel_work_sync(&hu->write_work);
 
-	if (test_and_clear_bit(HCI_UART_PROTO_SET, &hu->flags)) {
+	if (test_and_clear_bit(HCI_UART_PROTO_READY, &hu->flags)) {
 		if (hdev) {
 			if (test_bit(HCI_UART_REGISTERED, &hu->flags))
 				hci_unregister_dev(hdev);
@@ -348,6 +348,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
 		}
 		hu->proto->close(hu);
 	}
+	clear_bit(HCI_UART_PROTO_SET, &hu->flags);
 
 	kfree(hu);
 }
@@ -374,7 +375,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)
 	if (tty != hu->tty)
 		return;
 
-	if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
+	if (test_bit(HCI_UART_PROTO_READY, &hu->flags))
 		hci_uart_tx_wakeup(hu);
 }
 
@@ -397,7 +398,7 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, char *f
 	if (!hu || tty != hu->tty)
 		return;
 
-	if (!test_bit(HCI_UART_PROTO_SET, &hu->flags))
+	if (!test_bit(HCI_UART_PROTO_READY, &hu->flags))
 		return;
 
 	spin_lock(&hu->rx_lock);
@@ -474,9 +475,11 @@ static int hci_uart_set_proto(struct hci_uart *hu, int id)
 		return err;
 
 	hu->proto = p;
+	set_bit(HCI_UART_PROTO_READY, &hu->flags);
 
 	err = hci_uart_register_dev(hu);
 	if (err) {
+		clear_bit(HCI_UART_PROTO_READY, &hu->flags);
 		p->close(hu);
 		return err;
 	}
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
index 12df101ca942..51ecb664d961 100644
--- a/drivers/bluetooth/hci_uart.h
+++ b/drivers/bluetooth/hci_uart.h
@@ -81,6 +81,7 @@ struct hci_uart {
 /* HCI_UART proto flag bits */
 #define HCI_UART_PROTO_SET	0
 #define HCI_UART_REGISTERED	1
+#define HCI_UART_PROTO_READY	2
 
 /* TX states  */
 #define HCI_UART_SENDING	1
-- 
2.9.0

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

* Re: [PATCH 3.12 00/56] 3.12.61-stable review
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (55 preceding siblings ...)
  2016-06-15  7:31 ` [PATCH 3.12 56/56] Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data Jiri Slaby
@ 2016-06-15 15:34 ` Shuah Khan
  2016-06-20  8:07   ` Jiri Slaby
  2016-06-15 18:42 ` Guenter Roeck
  57 siblings, 1 reply; 60+ messages in thread
From: Shuah Khan @ 2016-06-15 15:34 UTC (permalink / raw)
  To: Jiri Slaby, stable; +Cc: linux, shuah.kh, linux-kernel, Shuah Khan

On 06/15/2016 01:30 AM, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.61 release.
> There are 56 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri Jun 17 09:29:40 CEST 2016.
> Anything received after that time might be too late.
> 
> The whole patch series can be found in one patch at:
> 	http://kernel.org/pub/linux/kernel/people/jirislaby/stable-review/patch-3.12.61-rc1.xz
> and the diffstat can be found below.
> 

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

thanks,
-- Shuah

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

* Re: [PATCH 3.12 00/56] 3.12.61-stable review
  2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
                   ` (56 preceding siblings ...)
  2016-06-15 15:34 ` [PATCH 3.12 00/56] 3.12.61-stable review Shuah Khan
@ 2016-06-15 18:42 ` Guenter Roeck
  57 siblings, 0 replies; 60+ messages in thread
From: Guenter Roeck @ 2016-06-15 18:42 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: stable, shuah.kh, linux-kernel

On Wed, Jun 15, 2016 at 09:30:14AM +0200, Jiri Slaby wrote:
> This is the start of the stable review cycle for the 3.12.61 release.
> There are 56 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
> 
> Responses should be made by Fri Jun 17 09:29:40 CEST 2016.
> Anything received after that time might be too late.
> 

Build results:
	total: 127 pass: 127 fail: 0
Qemu test results:
	total: 85 pass: 85 fail: 0

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

Guenter

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

* Re: [PATCH 3.12 00/56] 3.12.61-stable review
  2016-06-15 15:34 ` [PATCH 3.12 00/56] 3.12.61-stable review Shuah Khan
@ 2016-06-20  8:07   ` Jiri Slaby
  0 siblings, 0 replies; 60+ messages in thread
From: Jiri Slaby @ 2016-06-20  8:07 UTC (permalink / raw)
  To: Shuah Khan, stable, linux; +Cc: shuah.kh, linux-kernel

On 06/15/2016, 05:34 PM, Shuah Khan wrote:
> Compiled and booted on my test system. No dmesg regressions.

On 06/15/2016, 08:42 PM, Guenter Roeck wrote:
> Build results:
> 	total: 127 pass: 127 fail: 0
> Qemu test results:
> 	total: 85 pass: 85 fail: 0
>
> Details are available at http://kerneltests.org/builders.

Thanks!

-- 
js
suse labs

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

end of thread, other threads:[~2016-06-20  8:08 UTC | newest]

Thread overview: 60+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15  7:30 [PATCH 3.12 00/56] 3.12.61-stable review Jiri Slaby
2016-06-15  7:29 ` [PATCH 3.12 01/56] NFS: Don't attempt to decode missing directory entries Jiri Slaby
2016-06-15  7:29 ` [PATCH 3.12 02/56] IB/security: Restrict use of the write() interface Jiri Slaby
2016-06-15  7:29 ` [PATCH 3.12 03/56] HID: usbhid: quirks for Corsair RGB keyboard & mice (K70R, K95RGB, M65RGB, K70RGB, K65RGB) Jiri Slaby
2016-06-15  7:29 ` [PATCH 3.12 04/56] HID: Fix boot delay for Creative SB Omni Surround 5.1 with quirk Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 05/56] HID: microsoft: Add Surface Power Cover Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 06/56] HID: microsoft: Add Surface 3 type cover Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 07/56] HID: microsoft: add support for 3 more devices Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 08/56] HID: Add new Microsoft Type Cover 3 product ID Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 09/56] HID: microsoft: Add ID for MS Wireless Comfort Keyboard Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 10/56] HID: chicony: Add support for Acer Aspire Switch 12 Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 11/56] HID: sjoy: support Super Joy Box 4 Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 12/56] HID: wiimote: Fix wiimote mp scale linearization Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 13/56] HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2 Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 14/56] ARC: use ASL assembler mnemonic Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 15/56] remove directory incorrectly tries to set delete on close on non-empty directories Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 16/56] fs/cifs: correctly to anonymous authentication via NTLMSSP Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 17/56] ring-buffer: Use long for nr_pages to avoid overflow failures Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 18/56] ring-buffer: Prevent overflow of size in ring_buffer_resize() Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 19/56] mmc: mmc: Fix partition switch timeout for some eMMCs Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 20/56] ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 21/56] mmc: longer timeout for long read time quirk Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 22/56] [media] usbvision: revert commit 588afcc1 Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 23/56] USB: serial: keyspan: fix use-after-free in probe error path Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 24/56] USB: serial: quatech2: " Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 25/56] USB: serial: io_edgeport: fix memory leaks in attach " Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 26/56] USB: serial: io_edgeport: fix memory leaks in probe " Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 27/56] USB: serial: option: add support for Cinterion PH8 and AHxx Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 28/56] tty: vt, return error when con_startup fails Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 29/56] serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios() Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 30/56] MIPS: math-emu: Fix jalr emulation when rd == $0 Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 31/56] MIPS: Fix siginfo.h to use strict posix types Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 32/56] MIPS: ath79: make bootconsole wait for both THRE and TEMT Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 33/56] Input: uinput - handle compat ioctl for UI_SET_PHYS Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 34/56] ath5k: Change led pin configuration for compaq c700 laptop Jiri Slaby
2016-06-15  7:30 ` [PATCH 3.12 35/56] aacraid: Relinquish CPU during timeout wait Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 36/56] aacraid: Fix for aac_command_thread hang Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 37/56] cpuidle: Indicate when a device has been unregistered Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 38/56] PCI: Disable all BAR sizing for devices with non-compliant BARs Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 39/56] rtlwifi: Fix logic error in enter/exit power-save mode Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 40/56] powerpc/book3s64: Fix branching to OOL handlers in relocatable kernel Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 41/56] xen/events: Don't move disabled irqs Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 42/56] sunrpc: fix stripping of padded MIC tokens Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 43/56] drm/gma500: Fix possible out of bounds read Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 44/56] drm/fb_helper: Fix references to dev->mode_config.num_connector Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 45/56] ext4: fix hang when processing corrupted orphaned inode list Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 46/56] ext4: address UBSAN warning in mb_find_order_for_block() Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 47/56] ext4: silence UBSAN in ext4_mb_init() Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 48/56] dma-debug: avoid spinlock recursion when disabling dma-debug Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 49/56] xfs: xfs_iflush_cluster fails to abort on error Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 50/56] xfs: fix inode validity check in xfs_iflush_cluster Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 51/56] xfs: skip stale inodes " Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 52/56] [media] af9035: correct eeprom offsets Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 53/56] misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 54/56] pch_phub: return -ENODATA if ROM can't be mapped Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 55/56] Bluetooth: btmrvl_sdio: fix firmware activation failure Jiri Slaby
2016-06-15  7:31 ` [PATCH 3.12 56/56] Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data Jiri Slaby
2016-06-15 15:34 ` [PATCH 3.12 00/56] 3.12.61-stable review Shuah Khan
2016-06-20  8:07   ` Jiri Slaby
2016-06-15 18:42 ` Guenter Roeck

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