3.12.61-stable review
Subsystems (2)
PATCH 1/56 NFS: Don't attempt to decode missing directory entries
In reply to Jiri SlabyFrom: Benjamin Coddington <[email protected]>
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
--- fs/nfs/dir.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/nfs/dir.c +4 -0
@@ -510,6 +510,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *enif (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 *enbreak ; }while (!entry->eof); +out_nopages:if (count ==0 || (status == -EBADCOOKIE && entry->eof !=0 )) { array =nfs_readdir_get_array (page);if (!IS_ERR (array)) {
Signature · 1 line
2.9.0
PATCH 4/56 HID: Fix boot delay for Creative SB Omni Surround 5.1 with quirk
From: Nazar Mokrynskyi <[email protected]>
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.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/usbhid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -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
drivers/hid/usbhid/hid-quirks.c +1 -0
@@ -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 },
Signature · 1 line
2.9.0
cover 3.12.61-stable review
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(-)
Signature · 1 line
2.9.0
PATCH 6/56 HID: microsoft: Add Surface 3 type cover
In reply to Jiri SlabyFrom: Stephen Just <[email protected]>
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.
--- 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(-)
drivers/hid/hid-core.c +5 -3
@@ -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) },
drivers/hid/hid-ids.h +6 -2
@@ -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
drivers/hid/hid-microsoft.c +4 -2
@@ -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 },
drivers/hid/usbhid/hid-quirks.c +2 -1
@@ -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 },
Signature · 1 line
2.9.0
PATCH 2/56 IB/security: Restrict use of the write() interface
In reply to Jiri SlabyFrom: Jason Gunthorpe <[email protected]>
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)
--- 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(+)
drivers/infiniband/core/ucm.c +4 -0
@@ -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 ;
drivers/infiniband/core/ucma.c +3 -0
@@ -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 ;
drivers/infiniband/core/uverbs_main.c +5 -0
@@ -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 ;
drivers/infiniband/hw/ipath/ipath_file_ops.c +5 -0
@@ -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;
drivers/infiniband/hw/qib/qib_file_ops.c +5 -0
@@ -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;
include/rdma/ib.h +16 -0
@@ -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 */
Signature · 1 line
2.9.0
PATCH 3/56 HID: usbhid: quirks for Corsair RGB keyboard & mice (K70R, K95RGB, M65RGB, K70RGB, K65RGB)
In reply to Jiri SlabyFrom: Trent Lloyd <[email protected]>
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.
--- drivers/hid/hid-ids.h | 9 +++++++++ drivers/hid/usbhid/hid-quirks.c | 5 +++++ 2 files changed, 14 insertions(+)
drivers/hid/hid-ids.h +9 -0
@@ -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
drivers/hid/usbhid/hid-quirks.c +5 -0
@@ -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 },
Signature · 1 line
2.9.0
PATCH 9/56 HID: microsoft: Add ID for MS Wireless Comfort Keyboard
In reply to Jiri SlabyFrom: Slava Bacherikov <[email protected]>
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.
--- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-microsoft.c | 2 ++ 3 files changed, 4 insertions(+)
drivers/hid/hid-core.c +1 -0
@@ -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) },
drivers/hid/hid-ids.h +1 -0
@@ -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
drivers/hid/hid-microsoft.c +2 -0
@@ -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 },
Signature · 1 line
2.9.0
PATCH 12/56 HID: wiimote: Fix wiimote mp scale linearization
In reply to Jiri SlabyFrom: Cyan Ogilvie <[email protected]>
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
--- drivers/hid/hid-wiimote-modules.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/hid/hid-wiimote-modules.c +8 -6
@@ -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 ;
Signature · 1 line
2.9.0
PATCH 13/56 HID: usbhid: enable NO_INIT_REPORTS quirk for Semico USB Keykoard2
In reply to Jiri SlabyFrom: Daniel Bristot de Oliveira <[email protected]>
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.
--- drivers/hid/hid-ids.h | 1 + drivers/hid/usbhid/hid-quirks.c | 1 + 2 files changed, 2 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -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
drivers/hid/usbhid/hid-quirks.c +1 -0
@@ -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 },
Signature · 1 line
2.9.0
PATCH 20/56 ACPI / osi: Fix an issue that acpi_osi=!* cannot disable ACPICA internal strings
In reply to Jiri SlabyFrom: Lv Zheng <[email protected]>
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.
--- drivers/acpi/osl.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/acpi/osl.c +11 -5
@@ -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++) {
Signature · 1 line
2.9.0
PATCH 23/56 USB: serial: keyspan: fix use-after-free in probe error path
In reply to Jiri SlabyFrom: Johan Hovold <[email protected]>
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.
release")
--- drivers/usb/serial/keyspan.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/keyspan.c +4 -0
@@ -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);
Signature · 1 line
2.9.0
PATCH 24/56 USB: serial: quatech2: fix use-after-free in probe error path
In reply to Jiri SlabyFrom: Johan Hovold <[email protected]>
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.
--- drivers/usb/serial/quatech2.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/quatech2.c +1 -0
@@ -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);
Signature · 1 line
2.9.0
PATCH 31/56 MIPS: Fix siginfo.h to use strict posix types
In reply to Jiri SlabyFrom: James Hogan <[email protected]>
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.
Patchwork: https://patchwork.linux-mips.org/patch/12477/
--- arch/mips/include/uapi/asm/siginfo.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
arch/mips/include/uapi/asm/siginfo.h +9 -9
@@ -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 */
Signature · 1 line
2.9.0
PATCH 32/56 MIPS: ath79: make bootconsole wait for both THRE and TEMT
In reply to Jiri SlabyFrom: Matthias Schiffer <[email protected]>
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.)
--- arch/mips/ath79/early_printk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/mips/ath79/early_printk.c +4 -2
@@ -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)
Signature · 1 line
2.9.0
PATCH 41/56 xen/events: Don't move disabled irqs
In reply to Jiri SlabyFrom: Ross Lagerwall <[email protected]>
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
--- drivers/xen/events.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/xen/events.c +4 -2
@@ -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);
Signature · 1 line
2.9.0
PATCH 42/56 sunrpc: fix stripping of padded MIC tokens
In reply to Jiri SlabyFrom: Tomáš Trnka <[email protected]>
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").
--- net/sunrpc/auth_gss/svcauth_gss.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/auth_gss/svcauth_gss.c +2 -2
@@ -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);
Signature · 1 line
2.9.0
PATCH 43/56 drm/gma500: Fix possible out of bounds read
In reply to Jiri SlabyFrom: Itai Handler <[email protected]>
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).
--- drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/mdfld_dsi_pkg_sender.c +1 -1
@@ -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", };
Signature · 1 line
2.9.0
PATCH 44/56 drm/fb_helper: Fix references to dev->mode_config.num_connector
In reply to Jiri SlabyFrom: Lyude <[email protected]>
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.
[danvet: Clarify why we need this. Also remove the now unused "dev" local variable to appease gcc.]
--- drivers/gpu/drm/drm_fb_helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_fb_helper.c +2 -3
@@ -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 *)); } }
Signature · 1 line
2.9.0
PATCH 45/56 ext4: fix hang when processing corrupted orphaned inode list
In reply to Jiri SlabyFrom: Theodore Ts'o <[email protected]>
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.)
Reported by: Vegard Nossum <[email protected]>
--- fs/ext4/ialloc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
fs/ext4/ialloc.c +6 -4
@@ -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)
Signature · 1 line
2.9.0
PATCH 47/56 ext4: silence UBSAN in ext4_mb_init()
In reply to Jiri SlabyFrom: Nicolai Stange <[email protected]>
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
--- fs/ext4/mballoc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ext4/mballoc.c +4 -2
@@ -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 );
Signature · 1 line
2.9.0
PATCH 48/56 dma-debug: avoid spinlock recursion when disabling dma-debug
In reply to Jiri SlabyFrom: Ville Syrjälä <[email protected]>
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.
--- lib/dma-debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dma-debug.c +1 -1
@@ -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 ; }
Signature · 1 line
2.9.0
PATCH 49/56 xfs: xfs_iflush_cluster fails to abort on error
In reply to Jiri SlabyFrom: Dave Chinner <[email protected]>
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
--- fs/xfs/xfs_inode.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
fs/xfs/xfs_inode.c +13 -4
@@ -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 );
Signature · 1 line
2.9.0
PATCH 52/56 af9035: correct eeprom offsets
In reply to Jiri SlabyFrom: Antti Palosaari <[email protected]>
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.
--- drivers/media/usb/dvb-usb-v2/af9035.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.h +12 -12
@@ -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
Signature · 1 line
2.9.0
PATCH 53/56 misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes
In reply to Jiri SlabyFrom: Dan Bogdan Nechita <[email protected]>
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.
--- drivers/misc/ad525x_dpot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/ad525x_dpot.c +1 -1
@@ -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);
Signature · 1 line
2.9.0
PATCH 56/56 Bluetooth: hci_ldisc: Fix null pointer derefence in case of early data
In reply to Jiri SlabyFrom: Loic Poulain <[email protected]>
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.
--- drivers/bluetooth/hci_ldisc.c | 11 +++++++---- drivers/bluetooth/hci_uart.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/bluetooth/hci_ldisc.c +7 -4
@@ -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 *fif (!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; }
drivers/bluetooth/hci_uart.h +1 -0
@@ -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
Signature · 1 line
2.9.0
PATCH 5/56 HID: microsoft: Add Surface Power Cover
In reply to Jiri SlabyFrom: Raimund Roth <[email protected]>
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.
--- 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(-)
drivers/hid/hid-core.c +3 -1
@@ -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) },
drivers/hid/hid-ids.h +1 -0
@@ -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
drivers/hid/hid-microsoft.c +2 -0
@@ -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 },
drivers/hid/usbhid/hid-quirks.c +1 -0
@@ -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 },
Signature · 1 line
2.9.0
PATCH 8/56 HID: Add new Microsoft Type Cover 3 product ID
From: Donavan Lance <[email protected]>
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.
--- 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(+)
drivers/hid/hid-core.c +2 -0
@@ -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) },
drivers/hid/hid-ids.h +1 -0
@@ -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
drivers/hid/hid-microsoft.c +2 -0
@@ -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),
drivers/hid/usbhid/hid-quirks.c +1 -0
@@ -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 },
Signature · 1 line
2.9.0
PATCH 10/56 HID: chicony: Add support for Acer Aspire Switch 12
In reply to Jiri SlabyFrom: Николай Кудрявцев <[email protected]>
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
--- drivers/hid/hid-chicony.c | 26 ++++++++++++++++++++++++++ drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + 3 files changed, 28 insertions(+)
drivers/hid/hid-chicony.c +26 -0
@@ -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);
drivers/hid/hid-core.c +1 -0
@@ -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) },
drivers/hid/hid-ids.h +1 -0
@@ -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
Signature · 1 line
2.9.0
PATCH 11/56 HID: sjoy: support Super Joy Box 4
In reply to Jiri SlabyFrom: Sean Young <[email protected]>
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.
--- 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(-)
drivers/hid/hid-core.c +1 -0
@@ -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) },
drivers/hid/hid-sjoy.c +3 -0
@@ -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);
drivers/hid/usbhid/hid-quirks.c +0 -1
@@ -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 },
Signature · 1 line
2.9.0
PATCH 14/56 ARC: use ASL assembler mnemonic
In reply to Jiri SlabyFrom: Vineet Gupta <[email protected]>
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.
--- arch/arc/mm/tlbex.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arc/mm/tlbex.S +3 -3
@@ -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
Signature · 1 line
2.9.0
PATCH 15/56 remove directory incorrectly tries to set delete on close on non-empty directories
In reply to Jiri SlabyFrom: Steve French <[email protected]>
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.
--- 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(-)
fs/cifs/smb2glob.h +1 -0
@@ -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
fs/cifs/smb2inode.c +6 -2
@@ -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
fs/cifs/smb2pdu.c +16 -0
@@ -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) {
fs/cifs/smb2proto.h +2 -0
@@ -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);
Signature · 1 line
2.9.0
PATCH 18/56 ring-buffer: Prevent overflow of size in ring_buffer_resize()
In reply to Jiri SlabyFrom: "Steven Rostedt (Red Hat)" <[email protected]>
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.
--- kernel/trace/ring_buffer.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
kernel/trace/ring_buffer.c +4 -5
@@ -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
Signature · 1 line
2.9.0
PATCH 17/56 ring-buffer: Use long for nr_pages to avoid overflow failures
In reply to Jiri SlabyFrom: "Steven Rostedt (Red Hat)" <[email protected]>
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.
--- kernel/trace/ring_buffer.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
kernel/trace/ring_buffer.c +14 -12
@@ -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 :
Signature · 1 line
2.9.0
PATCH 7/56 HID: microsoft: add support for 3 more devices
In reply to Jiri SlabyFrom: Alistair Leslie-Hughes <[email protected]>
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
--- drivers/hid/hid-core.c | 3 +++ drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-microsoft.c | 6 ++++++ 3 files changed, 12 insertions(+)
drivers/hid/hid-core.c +3 -0
@@ -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) },
drivers/hid/hid-ids.h +3 -0
@@ -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
drivers/hid/hid-microsoft.c +6 -0
@@ -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),
Signature · 1 line
2.9.0
PATCH 19/56 mmc: mmc: Fix partition switch timeout for some eMMCs
In reply to Jiri SlabyFrom: Adrian Hunter <[email protected]>
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.
--- drivers/mmc/core/mmc.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mmc/core/mmc.c +7 -0
@@ -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 )
Signature · 1 line
2.9.0
PATCH 21/56 mmc: longer timeout for long read time quirk
In reply to Jiri SlabyFrom: Matt Gumbel <[email protected]>
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
--- drivers/mmc/card/block.c | 5 +++-- drivers/mmc/core/core.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/mmc/card/block.c +3 -2
@@ -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
drivers/mmc/core/core.c +2 -2
@@ -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 ; }
Signature · 1 line
2.9.0
PATCH 22/56 usbvision: revert commit 588afcc1
In reply to Jiri SlabyFrom: Vladis Dronov <[email protected]>
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
--- drivers/media/usb/usbvision/usbvision-video.c | 7 ------- 1 file changed, 7 deletions(-)
drivers/media/usb/usbvision/usbvision-video.c +0 -7
@@ -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)
Signature · 1 line
2.9.0
PATCH 25/56 USB: serial: io_edgeport: fix memory leaks in attach error path
In reply to Jiri SlabyFrom: Johan Hovold <[email protected]>
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).
--- drivers/usb/serial/io_edgeport.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
drivers/usb/serial/io_edgeport.c +24 -9
@@ -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
Signature · 1 line
2.9.0
PATCH 26/56 USB: serial: io_edgeport: fix memory leaks in probe error path
In reply to Jiri SlabyFrom: Johan Hovold <[email protected]>
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.
release")
--- drivers/usb/serial/io_edgeport.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/usb/serial/io_edgeport.c +10 -7
@@ -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); }
Signature · 1 line
2.9.0
PATCH 27/56 USB: serial: option: add support for Cinterion PH8 and AHxx
In reply to Jiri SlabyFrom: Schemmel Hans-Christoph <[email protected]>
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.
--- drivers/usb/serial/option.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/usb/serial/option.c +20 -6
@@ -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) },
Signature · 1 line
2.9.0
PATCH 16/56 fs/cifs: correctly to anonymous authentication via NTLMSSP
In reply to Jiri SlabyFrom: Stefan Metzmacher <[email protected]>
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
--- fs/cifs/sess.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
fs/cifs/sess.c +20 -12
@@ -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);
Signature · 1 line
2.9.0
PATCH 28/56 tty: vt, return error when con_startup fails
In reply to Jiri Slaby3.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.
--- drivers/tty/vt/vt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/vt/vt.c +3 -2
@@ -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 ;
Signature · 1 line
2.9.0
PATCH 29/56 serial: samsung: Reorder the sequence of clock control when call s3c24xx_serial_set_termios()
In reply to Jiri SlabyFrom: Chanwoo Choi <[email protected]>
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.
--- drivers/tty/serial/samsung.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/samsung.c +2 -2
@@ -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 ; }
Signature · 1 line
2.9.0
PATCH 30/56 MIPS: math-emu: Fix jalr emulation when rd == $0
In reply to Jiri SlabyFrom: Paul Burton <[email protected]>
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.
Patchwork: https://patchwork.linux-mips.org/patch/13160/
--- arch/mips/math-emu/cp1emu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/mips/math-emu/cp1emu.c +5 -3
@@ -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];
Signature · 1 line
2.9.0
PATCH 33/56 Input: uinput - handle compat ioctl for UI_SET_PHYS
In reply to Jiri SlabyFrom: Ricky Liang <[email protected]>
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.
--- drivers/input/misc/uinput.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/input/misc/uinput.c +6 -0
@@ -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
Signature · 1 line
2.9.0
PATCH 34/56 ath5k: Change led pin configuration for compaq c700 laptop
In reply to Jiri SlabyFrom: Joseph Salisbury <[email protected]>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 7b9bc799a445aea95f64f15e0083cb19b5789abe upstream.
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
--- drivers/net/wireless/ath/ath5k/led.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath5k/led.c +1 -1
@@ -77,7 +77,7 @@ static DEFINE_PCI_DEVICE_TABLE(ath5k_led_devices) = {/* HP Compaq CQ60-206US ([email protected]) */ { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137a), ATH_LED(3, 1) },/* HP Compaq C700 ([email protected]) */ - { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 1) }, + { ATH_SDEVICE(PCI_VENDOR_ID_HP, 0x0137b), ATH_LED(3, 0) },/* LiteOn AR5BXB63 ([email protected]) */ { ATH_SDEVICE(PCI_VENDOR_ID_ATHEROS, 0x3067), ATH_LED(3, 0) },/* IBM-specific AR5212 (all others) */
Signature · 1 line
2.9.0
PATCH 35/56 aacraid: Relinquish CPU during timeout wait
In reply to Jiri SlabyFrom: Raghava Aditya Renukunta <[email protected]>
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()"
--- drivers/scsi/aacraid/commsup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/aacraid/commsup.c +4 -4
@@ -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
Signature · 1 line
2.9.0
PATCH 36/56 aacraid: Fix for aac_command_thread hang
In reply to Jiri SlabyFrom: Raghava Aditya Renukunta <[email protected]>
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()
--- drivers/scsi/aacraid/commsup.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/scsi/aacraid/commsup.c +4 -0
@@ -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 ())
Signature · 1 line
2.9.0
PATCH 37/56 cpuidle: Indicate when a device has been unregistered
In reply to Jiri SlabyFrom: Dave Gerlach <[email protected]>
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.
--- drivers/cpuidle/cpuidle.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpuidle/cpuidle.c +2 -0
@@ -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)
Signature · 1 line
2.9.0
PATCH 38/56 PCI: Disable all BAR sizing for devices with non-compliant BARs
In reply to Jiri SlabyFrom: Prarit Bhargava <[email protected]>
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.
--- drivers/pci/probe.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/pci/probe.c +3 -3
@@ -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 );
Signature · 1 line
2.9.0
PATCH 39/56 rtlwifi: Fix logic error in enter/exit power-save mode
In reply to Jiri SlabyFrom: wang yanqing <[email protected]>
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.
--- drivers/net/wireless/rtlwifi/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/rtlwifi/base.c +2 -2
@@ -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);
Signature · 1 line
2.9.0
PATCH 40/56 powerpc/book3s64: Fix branching to OOL handlers in relocatable kernel
In reply to Jiri SlabyFrom: Hari Bathini <[email protected]>
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.
--- arch/powerpc/kernel/exceptions-64s.S | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
arch/powerpc/kernel/exceptions-64s.S +11 -5
@@ -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.
Signature · 1 line
2.9.0
PATCH 46/56 ext4: address UBSAN warning in mb_find_order_for_block()
In reply to Jiri SlabyFrom: Nicolai Stange <[email protected]>
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
--- fs/ext4/mballoc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/ext4/mballoc.c +3 -1
@@ -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 ;
Signature · 1 line
2.9.0
PATCH 51/56 xfs: skip stale inodes in xfs_iflush_cluster
In reply to Jiri SlabyFrom: Dave Chinner <[email protected]>
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.
--- fs/xfs/xfs_inode.c | 1 + 1 file changed, 1 insertion(+)
fs/xfs/xfs_inode.c +1 -0
@@ -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 ;
Signature · 1 line
2.9.0
PATCH 55/56 Bluetooth: btmrvl_sdio: fix firmware activation failure
In reply to Jiri SlabyFrom: Wei-Ning Huang <[email protected]>
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.
--- drivers/bluetooth/btmrvl_sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bluetooth/btmrvl_sdio.c +1 -1
@@ -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 ;
Signature · 1 line
2.9.0
PATCH 50/56 xfs: fix inode validity check in xfs_iflush_cluster
In reply to Jiri SlabyFrom: Dave Chinner <[email protected]>
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 <[email protected]>
--- fs/xfs/xfs_inode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/xfs/xfs_inode.c +4 -4
@@ -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
Signature · 1 line
2.9.0
PATCH 54/56 pch_phub: return -ENODATA if ROM can't be mapped
In reply to Jiri SlabyFrom: Colin Ian King <[email protected]>
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.
--- drivers/misc/pch_phub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/misc/pch_phub.c +3 -1
@@ -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);
Signature · 1 line
2.9.0
Quoted 5 lines · 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.
Quoted 7 lines
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.xzand the diffstat can be found below.
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 8 lines · 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.
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
Quoted 1 line · Shuah Khan
Compiled and booted on my test system. No dmesg regressions.
Quoted 6 lines · Guenter Roeck
Build results:
total: 127 pass: 127 fail: 0 Qemu test results: total: 85 pass: 85 fail: 0Details are available at http://kerneltests.org/builders.
Thanks!
Signature · 2 lines
js suse labs