4.4.115-stable review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 4.4.115-stable review
This is the start of the stable review cycle for the 4.4.115 release. There are 67 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 Sun Feb 4 14:07:31 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.115-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.115-rc1
Stefan Agner <[email protected]>
spi: imx: do not access registers while clocks disabled
Fabio Estevam <[email protected]>
serial: imx: Only wakeup via RTSDEN bit if the system has RTS/CTS
Mark Salyzyn <[email protected]>
selinux: general protection fault in sock_has_perm
Oliver Neukum <[email protected]>
usb: uas: unconditionally bring back host after reset
Hemant Kumar <[email protected]>
usb: f_fs: Prevent gadget unbind if it is already unbound
Johan Hovold <[email protected]>
USB: serial: simple: add Motorola Tetra driver
Shuah Khan <[email protected]>
usbip: list: don't list devices attached to vhci_hcd
Shuah Khan <[email protected]>
usbip: prevent bind loops on devices attached to vhci_hcd
Jia-Ju Bai <[email protected]>
USB: serial: io_edgeport: fix possible sleep-in-atomic
Oliver Neukum <[email protected]>
CDC-ACM: apply quirk for card reader
Hans de Goede <[email protected]>
USB: cdc-acm: Do not log urb submission errors on disconnect
Greg Kroah-Hartman <[email protected]>
USB: serial: pl2303: new device id for Chilitag
OKAMOTO Yoshiaki <[email protected]>
usb: option: Add support for FS040U modem
Larry Finger <[email protected]>
staging: rtl8188eu: Fix incorrect response to SIOCGIWESSID
Colin Ian King <[email protected]>
usb: gadget: don't dereference g until after it has been null checked
Icenowy Zheng <[email protected]>
media: usbtv: add a new usbid
Gustavo A. R. Silva <[email protected]>
scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg
Guilherme G. Piccoli <[email protected]>
scsi: aacraid: Prevent crash in case of free interrupt during scsi EH path
Darrick J. Wong <[email protected]>
xfs: ubsan fixes
Christophe JAILLET <[email protected]>
drm/omap: Fix error handling path in 'omap_dmm_probe()'
Yisheng Xie <[email protected]>
kmemleak: add scheduling point to kmemleak_scan()
Trond Myklebust <[email protected]>
SUNRPC: Allow connect to return EHOSTUNREACH
Tetsuo Handa <[email protected]>
quota: Check for register_shrinker() failure.
Geert Uytterhoeven <[email protected]>
net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit
Robert Lippert <[email protected]>
hwmon: (pmbus) Use 64bit math for DIRECT format values
Vasily Averin <[email protected]>
lockd: fix "list_add double add" caused by legacy signal interface
Andrew Elble <[email protected]>
nfsd: check for use of the closed special stateid
Vasily Averin <[email protected]>
grace: replace BUG_ON by WARN_ONCE in exit_net hook
Trond Myklebust <[email protected]>
nfsd: Ensure we check stateid validity in the seqid operation checks
Trond Myklebust <[email protected]>
nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0)
Eduardo Otubo <[email protected]>
xen-netfront: remove warning when unloading module
Wanpeng Li <[email protected]>
KVM: VMX: Fix rflags cache during vCPU reset
Josef Bacik <[email protected]>
btrfs: fix deadlock when writing out space cache
Chun-Yeow Yeoh <[email protected]>
mac80211: fix the update of path metric for RANN frame
zhangliping <[email protected]>
openvswitch: fix the incorrect flow action alloc size
Felix Kuehling <[email protected]>
drm/amdkfd: Fix SDMA oversubsription handling
shaoyunl <[email protected]>
drm/amdkfd: Fix SDMA ring buffer size calculation
Felix Kuehling <[email protected]>
drm/amdgpu: Fix SDMA load/unload sequence on HWS disabled mode
Michael Lyle <[email protected]>
bcache: check return value of register_shrinker
James Hogan <[email protected]>
cpufreq: Add Loongson machine dependencies
Hans de Goede <[email protected]>
ACPI / bus: Leave modalias empty for devices which are not present
Nikita Leshenko <[email protected]>
KVM: x86: ioapic: Preserve read-only values in the redirection table
Nikita Leshenko <[email protected]>
KVM: x86: ioapic: Clear Remote IRR when entry is switched to edge-triggered
Nikita Leshenko <[email protected]>
KVM: x86: ioapic: Fix level-triggered EOI and IOAPIC reconfigure race
Wanpeng Li <[email protected]>
KVM: X86: Fix operand/address-size during instruction decoding
Liran Alon <[email protected]>
KVM: x86: Don't re-execute instruction when not passing CR2 value
Liran Alon <[email protected]>
KVM: x86: emulator: Return to user-mode on L1 CPL=0 emulation failure
Lyude Paul <[email protected]>
igb: Free IRQs when device is hotplugged
Jesse Chan <[email protected]>
mtd: nand: denali_pci: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
Jesse Chan <[email protected]>
gpio: ath79: add missing MODULE_DESCRIPTION/LICENSE
Jesse Chan <[email protected]>
gpio: iop: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
Jesse Chan <[email protected]>
power: reset: zx-reboot: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
Stephan Mueller <[email protected]>
crypto: af_alg - whitelist mask and type
Stephan Mueller <[email protected]>
crypto: aesni - handle zero length dst buffer
Takashi Iwai <[email protected]>
ALSA: seq: Make ioctls race-free
Hugh Dickins <[email protected]>
kaiser: fix intel_bts perf crashes
Dave Hansen <[email protected]>
x86/pti: Make unpoison of pgd for trusted boot work for real
Daniel Borkmann <[email protected]>
bpf: reject stores into ctx via st and xadd
Alexei Starovoitov <[email protected]>
bpf: fix 32-bit divide by zero
Eric Dumazet <[email protected]>
bpf: fix divides by zero
Daniel Borkmann <[email protected]>
bpf: avoid false sharing of map refcount with max_entries
Daniel Borkmann <[email protected]>
bpf: arsh is not supported in 32 bit alu thus reject it
Alexei Starovoitov <[email protected]>
bpf: introduce BPF_JIT_ALWAYS_ON config
Alexei Starovoitov <[email protected]>
bpf: fix bpf_tail_call() x64 JIT
Eric Dumazet <[email protected]>
x86: bpf_jit: small optimization in emit_bpf_tail_call()
Alexei Starovoitov <[email protected]>
bpf: fix branch pruning logic
Linus Torvalds <[email protected]>
loop: fix concurrent lo_open/lo_release
-------------
Diffstat:
Makefile | 4 +- arch/arm64/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/x86/Kconfig | 1 + arch/x86/crypto/aesni-intel_glue.c | 2 +- arch/x86/include/asm/kvm_host.h | 3 +- arch/x86/kernel/cpu/perf_event_intel_bts.c | 44 ++++++++++---- arch/x86/kernel/tboot.c | 10 ++++ arch/x86/kvm/emulate.c | 7 +++ arch/x86/kvm/ioapic.c | 20 ++++++- arch/x86/kvm/vmx.c | 4 +- arch/x86/kvm/x86.c | 2 +- arch/x86/net/bpf_jit_comp.c | 13 ++-- crypto/af_alg.c | 10 ++-- drivers/acpi/device_sysfs.c | 4 ++ drivers/block/loop.c | 10 +++- drivers/cpufreq/Kconfig | 2 + drivers/gpio/gpio-ath79.c | 3 + drivers/gpio/gpio-iop.c | 4 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 47 +++++++++++---- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c | 4 +- .../gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 18 ++++++ drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 3 +- drivers/hwmon/pmbus/pmbus_core.c | 21 ++++--- drivers/md/bcache/btree.c | 5 +- drivers/media/usb/usbtv/usbtv-core.c | 1 + drivers/mtd/nand/denali_pci.c | 4 ++ drivers/net/ethernet/intel/igb/igb_main.c | 2 +- drivers/net/ethernet/xilinx/Kconfig | 1 + drivers/net/xen-netfront.c | 18 ++++++ drivers/power/reset/zx-reboot.c | 4 ++ drivers/scsi/aacraid/commsup.c | 2 +- drivers/scsi/ufs/ufshcd.c | 7 ++- drivers/spi/spi-imx.c | 15 ++++- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 14 ++--- drivers/tty/serial/imx.c | 14 +++-- drivers/usb/class/cdc-acm.c | 5 +- drivers/usb/gadget/composite.c | 7 ++- drivers/usb/gadget/function/f_fs.c | 3 +- drivers/usb/serial/Kconfig | 1 + drivers/usb/serial/io_edgeport.c | 1 - drivers/usb/serial/option.c | 5 ++ drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 1 + drivers/usb/serial/usb-serial-simple.c | 7 +++ drivers/usb/storage/uas.c | 7 +-- fs/btrfs/free-space-cache.c | 3 +- fs/nfs_common/grace.c | 10 +++- fs/nfsd/nfs4state.c | 34 ++++++----- fs/quota/dquot.c | 3 +- fs/xfs/xfs_aops.c | 6 +- include/linux/bpf.h | 16 +++-- init/Kconfig | 7 +++ kernel/bpf/core.c | 30 ++++++++-- kernel/bpf/verifier.c | 70 ++++++++++++++++++++++ lib/test_bpf.c | 13 ++-- mm/kmemleak.c | 2 + net/Kconfig | 3 + net/core/filter.c | 8 ++- net/core/sysctl_net_core.c | 6 ++ net/mac80211/mesh_hwmp.c | 15 +++-- net/openvswitch/flow_netlink.c | 16 ++--- net/socket.c | 9 +++ net/sunrpc/xprtsock.c | 1 + security/selinux/hooks.c | 2 + sound/core/seq/seq_clientmgr.c | 10 +++- sound/core/seq/seq_clientmgr.h | 1 + tools/usb/usbip/src/usbip_bind.c | 9 +++ tools/usb/usbip/src/usbip_list.c | 9 +++ 69 files changed, 504 insertions(+), 142 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/67 loop: fix concurrent lo_open/lo_release
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit ae6650163c66a7eff1acd6eb8b0f752dcfa8eba5 upstream.
范龙飞 reports that KASAN can report a use-after-free in __lock_acquire. The reason is due to insufficient serialization in lo_release(), which will continue to use the loop device even after it has decremented the lo_refcnt to zero.
In the meantime, another process can come in, open the loop device again as it is being shut down. Confusion ensues.
--- drivers/block/loop.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/block/loop.c +8 -2
@@ -1569,9 +1569,8 @@ out:return err; } -static void lo_release (struct gendisk *disk,fmode_t mode) +static void __lo_release (struct loop_device *lo) { -struct loop_device *lo = disk->private_data;int err;if (atomic_dec_return (&lo->lo_refcnt))
@@ -1597,6 +1596,13 @@ static void lo_release(struct gendisk *dmutex_unlock (&lo->lo_ctl_mutex); } +static void lo_release (struct gendisk *disk,fmode_t mode) +{ +mutex_lock (&loop_index_mutex); +__lo_release (disk->private_data); +mutex_unlock (&loop_index_mutex); +} +static const struct block_device_operations lo_fops = { .owner =THIS_MODULE , .open = lo_open,
Greg Kroah-Hartman
maintainerPATCH 2/67 bpf: fix branch pruning logic
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <[email protected]>
[ Upstream commit c131187db2d3fa2f8bf32fdf4e9a4ef805168467 ]
when the verifier detects that register contains a runtime constant and it's compared with another constant it will prune exploration of the branch that is guaranteed not to be taken at runtime. This is all correct, but malicious program may be constructed in such a way that it always has a constant comparison and the other branch is never taken under any conditions.
In this case such path through the program will not be explored by the verifier. It won't be taken at run-time either, but since all instructions are JITed the malicious program may cause JITs to complain about using reserved fields, etc.
To fix the issue we have to track the instructions explored by the verifier and sanitize instructions that are dead at run time with NOPs. We cannot reject such dead code, since llvm generates it for valid C code, since it doesn't do as much data flow analysis as the verifier does.
--- kernel/bpf/verifier.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
kernel/bpf/verifier.c +28 -0
@@ -191,6 +191,7 @@ struct bpf_insn_aux_data {enum bpf_reg_type ptr_type;/* pointer type for load/store insns */ struct bpf_map *map_ptr;/* pointer for call insn into lookup_elem */ }; +bool seen;/* this insn was processed by the verifier */ };#define MAX_USED_MAPS 64/* max number of maps accessed by one eBPF program */
@@ -1793,6 +1794,7 @@ static int do_check(struct verifier_envprint_bpf_insn (env, insn); } + env->insn_aux_data[insn_idx].seen = true;if (class ==BPF_ALU || class ==BPF_ALU64 ) { err =check_alu_op (env, insn);if (err)
@@ -1988,6 +1990,7 @@ process_bpf_exit:return err; insn_idx++; + env->insn_aux_data[insn_idx].seen = true; }else {verbose ("invalid BPF_LD mode\n" );return -EINVAL ;
@@ -2125,6 +2128,7 @@ static int adjust_insn_aux_data(struct v u32 off, u32 cnt) {struct bpf_insn_aux_data *new_data, *old_data = env->insn_aux_data; +int i;if (cnt ==1 )return 0 ;
@@ -2134,6 +2138,8 @@ static int adjust_insn_aux_data(struct vmemcpy (new_data, old_data,sizeof (struct bpf_insn_aux_data ) * off);memcpy (new_data + off + cnt -1 , old_data + off,sizeof (struct bpf_insn_aux_data ) * (prog_len - off - cnt +1 )); +for (i = off; i < off + cnt -1 ; i++) + new_data[i].seen = true; env->insn_aux_data = new_data;vfree (old_data);return 0 ;
@@ -2152,6 +2158,25 @@ static struct bpf_prog *bpf_patch_insn_dreturn new_prog; } +/* The verifier does more data flow analysis than llvm and will not explore +* branches that are dead at run time. Malicious programs can have dead code +* too. Therefore replace all dead at-run-time code with nops. +*/ +static void sanitize_dead_code (struct verifier_env *env) +{ +struct bpf_insn_aux_data *aux_data = env->insn_aux_data; +struct bpf_insn nop =BPF_MOV64_REG (BPF_REG_0 ,BPF_REG_0 ); +struct bpf_insn *insn = env->prog->insnsi; +const int insn_cnt = env->prog->len; +int i; + +for (i =0 ; i < insn_cnt; i++) { +if (aux_data[i].seen) +continue ; +memcpy (insn + i, &nop,sizeof (nop)); + } +} +/* convert load instructions that access fields of 'struct __sk_buff' * into sequence of instructions that access fields of 'struct sk_buff' */
@@ -2371,6 +2396,9 @@ skip_full_check:free_states (env);if (ret ==0 ) +sanitize_dead_code (env); + +if (ret ==0 )/* program is valid, convert *(u32*)(ctx + off) accesses */ ret =convert_ctx_accesses (env);
Greg Kroah-Hartman
maintainerPATCH 3/67 x86: bpf_jit: small optimization in emit_bpf_tail_call()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ upstream commit 84ccac6e7854ebbfb56d2fc6d5bef9be49bb304c ]
Saves 4 bytes replacing following instructions :
lea rax, [rsi + rdx * 8 + offsetof(...)]
mov rax, qword ptr [rax]
cmp rax, 0
by :
mov rax, [rsi + rdx * 8 + offsetof(...)] test rax, rax
--- arch/x86/net/bpf_jit_comp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/x86/net/bpf_jit_comp.c +4 -5
@@ -269,7 +269,7 @@ static void emit_bpf_tail_call(u8 **pproEMIT4 (0x48 ,0x8B ,0x46 ,/* mov rax, qword ptr [rsi + 16] */ offsetof(struct bpf_array, map.max_entries));EMIT3 (0x48 ,0x39 ,0xD0 );/* cmp rax, rdx */ -#define OFFSET1 47/* number of bytes to jump */ +#define OFFSET1 43/* number of bytes to jump */ EMIT2 (X86_JBE ,OFFSET1 );/* jbe out */ label1 = cnt;
@@ -278,21 +278,20 @@ static void emit_bpf_tail_call(u8 **ppro*/ EMIT2_off32 (0x8B ,0x85 , -STACKSIZE +36 );/* mov eax, dword ptr [rbp - 516] */ EMIT3 (0x83 ,0xF8 ,MAX_TAIL_CALL_CNT );/* cmp eax, MAX_TAIL_CALL_CNT */ -#define OFFSET2 36 +#define OFFSET2 32EMIT2 (X86_JA ,OFFSET2 );/* ja out */ label2 = cnt;EMIT3 (0x83 ,0xC0 ,0x01 );/* add eax, 1 */ EMIT2_off32 (0x89 ,0x85 , -STACKSIZE +36 );/* mov dword ptr [rbp - 516], eax */ /* prog = array->ptrs[index]; */ -EMIT4_off32 (0x48 ,0x8D ,0x84 ,0xD6 ,/* lea rax, [rsi + rdx * 8 + offsetof(...)] */ +EMIT4_off32 (0x48 ,0x8B ,0x84 ,0xD6 ,/* mov rax, [rsi + rdx * 8 + offsetof(...)] */ offsetof(struct bpf_array , ptrs)); -EMIT3 (0x48 ,0x8B ,0x00 );/* mov rax, qword ptr [rax] */ /* if (prog == NULL) * goto out; */ -EMIT4 (0x48 ,0x83 ,0xF8 ,0x00 );/* cmp rax, 0 */ +EMIT3 (0x48 ,0x85 ,0xC0 );/* test rax,rax */ #define OFFSET3 10EMIT2 (X86_JE ,OFFSET3 );/* je out */ label3 = cnt;
Greg Kroah-Hartman
maintainerPATCH 4/67 bpf: fix bpf_tail_call() x64 JIT
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <[email protected]>
[ upstream commit 90caccdd8cc0215705f18b92771b449b01e2474a ]
- bpf prog_array just like all other types of bpf array accepts 32-bit index. Clarify that in the comment.
- fix x64 JIT of bpf_tail_call which was incorrectly loading 8 instead of 4 bytes
- tighten corresponding check in the interpreter to stay consistent
The JIT bug can be triggered after introduction of BPF_F_NUMA_NODE flag in commit 96eabe7a40aa in 4.14. Before that the map_flags would stay zero and though JIT code is wrong it will check bounds correctly.
Hence two fixes tags. All other JITs don't have this problem.
--- arch/x86/net/bpf_jit_comp.c | 4 ++-- kernel/bpf/core.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/net/bpf_jit_comp.c +2 -2
@@ -266,9 +266,9 @@ static void emit_bpf_tail_call(u8 **ppro/* if (index >= array->map.max_entries) * goto out; */ -EMIT4 (0x48 ,0x8B ,0x46 ,/* mov rax, qword ptr [rsi + 16] */ +EMIT2 (0x89 ,0xD2 );/* mov edx, edx */ +EMIT3 (0x39 ,0x56 ,/* cmp dword ptr [rsi + 16], edx */ offsetof(struct bpf_array, map.max_entries)); -EMIT3 (0x48 ,0x39 ,0xD0 );/* cmp rax, rdx */ #define OFFSET1 43/* number of bytes to jump */ EMIT2 (X86_JBE ,OFFSET1 );/* jbe out */ label1 = cnt;
kernel/bpf/core.c +1 -1
@@ -517,7 +517,7 @@ select_insn:struct bpf_map *map = (struct bpf_map *) (unsigned long )BPF_R2 ; struct bpf_array *array = container_of(map, struct bpf_array, map);struct bpf_prog *prog; -u64 index =BPF_R3 ; +u32 index =BPF_R3 ;if (unlikely (index >= array->map.max_entries)) goto out;
Greg Kroah-Hartman
maintainerPATCH 5/67 bpf: introduce BPF_JIT_ALWAYS_ON config
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <[email protected]>
[ upstream commit 290af86629b25ffd1ed6232c4e9107da031705cb ]
The BPF interpreter has been used as part of the spectre 2 attack CVE-2017-5715.
A quote from goolge project zero blog:
"At this point, it would normally be necessary to locate gadgets in the host kernel code that can be used to actually leak data by reading from an attacker-controlled location, shifting and masking the result appropriately and then using the result of that as offset to an attacker-controlled address for a load. But piecing gadgets together and figuring out which ones work in a speculation context seems annoying. So instead, we decided to use the eBPF interpreter, which is built into the host kernel - while there is no legitimate way to invoke it from inside a VM, the presence of the code in the host kernel's text section is sufficient to make it usable for the attack, just like with ordinary ROP gadgets."
To make attacker job harder introduce BPF_JIT_ALWAYS_ON config option that removes interpreter from the kernel in favor of JIT-only mode. So far eBPF JIT is supported by:
x64, arm64, arm32, sparc64, s390, powerpc64, mips64
The start of JITed program is randomized and code page is marked as read-only. In addition "constant blinding" can be turned on with net.core.bpf_jit_harden
v2->v3:
- move __bpf_prog_ret0 under ifdef (Daniel)
v1->v2:
- fix init order, test_bpf and cBPF (Daniel's feedback)
- fix offloaded bpf (Jakub's feedback)
- add 'return 0' dummy in case something can invoke prog->bpf_func
- retarget bpf tree. For bpf-next the patch would need one extra hunk. It will be sent when the trees are merged back to net-next
Considered doing:
int bpf_jit_enable __read_mostly = BPF_EBPF_JIT_DEFAULT;
but it seems better to land the patch as-is and in bpf-next remove bpf_jit_enable global variable from all JITs, consolidate in one place and remove this jit_init() function.
--- arch/arm64/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/x86/Kconfig | 1 + init/Kconfig | 7 +++++++ kernel/bpf/core.c | 24 +++++++++++++++++++++++- lib/test_bpf.c | 13 ++++++++----- net/Kconfig | 3 +++ net/core/filter.c | 4 +++- net/core/sysctl_net_core.c | 6 ++++++ net/socket.c | 9 +++++++++ 10 files changed, 62 insertions(+), 7 deletions(-)
arch/arm64/Kconfig +1 -0
@@ -54,6 +54,7 @@ config ARM64 select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK select HAVE_BPF_JIT + select HAVE_EBPF_JIT select HAVE_C_RECORDMCOUNT select HAVE_CC_STACKPROTECTOR select HAVE_CMPXCHG_DOUBLE
arch/s390/Kconfig +1 -0
@@ -123,6 +123,7 @@ config S390 select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_BPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES + select HAVE_EBPF_JIT if PACK_STACK && HAVE_MARCH_Z196_FEATURES select HAVE_CMPXCHG_DOUBLE select HAVE_CMPXCHG_LOCAL select HAVE_DEBUG_KMEMLEAK
arch/x86/Kconfig +1 -0
@@ -88,6 +88,7 @@ config X86 select HAVE_ARCH_TRACEHOOK select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_BPF_JIT if X86_64 + select HAVE_EBPF_JIT if X86_64 select HAVE_CC_STACKPROTECTOR select HAVE_CMPXCHG_DOUBLE select HAVE_CMPXCHG_LOCAL
init/Kconfig +7 -0
@@ -1556,6 +1556,13 @@ config BPF_SYSCALL Enable the bpf() system call that allows to manipulate eBPF programs and maps via file descriptors. +config BPF_JIT_ALWAYS_ON + bool "Permanently enable BPF JIT and remove BPF interpreter" + depends on BPF_SYSCALL && HAVE_EBPF_JIT && BPF_JIT + help + Enables BPF JIT and removes BPF interpreter to avoid + speculative execution of BPF instructions by the interpreter + config SHMEM bool "Use full shmem filesystem" if EXPERT default y
kernel/bpf/core.c +23 -1
@@ -256,6 +256,7 @@ noinline u64 __bpf_call_base(u64 r1, u64 }EXPORT_SYMBOL_GPL (__bpf_call_base); +#ifndef CONFIG_BPF_JIT_ALWAYS_ON /** * __bpf_prog_run - run eBPF program on a given context * @ctx: is the data we are operating on
@@ -725,6 +726,13 @@ load_byte: return 0; } +#else +static unsigned int __bpf_prog_ret0 (void *ctx,const struct bpf_insn *insn) +{ +return 0 ; +} +#endif +bool bpf_prog_array_compatible (struct bpf_array *array,const struct bpf_prog *fp) {
@@ -771,9 +779,23 @@ static int bpf_check_tail_call(const str*/ int bpf_prog_select_runtime (struct bpf_prog *fp) { +#ifndef CONFIG_BPF_JIT_ALWAYS_ON fp->bpf_func = (void *) __bpf_prog_run; - +#else + fp->bpf_func = (void *) __bpf_prog_ret0; +#endif + +/* eBPF JITs can rewrite the program in case constant +* blinding is active. However, in case of error during +* blinding, bpf_int_jit_compile() must always return a +* valid program, which in this case would simply not +* be JITed, but falls back to the interpreter. +*/ bpf_int_jit_compile (fp); +#ifdef CONFIG_BPF_JIT_ALWAYS_ON +if (!fp->jited) +return -ENOTSUPP ; +#endif bpf_prog_lock_ro (fp);/* The tail call compatibility check can only be done at
lib/test_bpf.c +8 -5
@@ -5304,9 +5304,8 @@ static struct bpf_prog *generate_filter(return NULL ; } } -/* We don't expect to fail. */ if (*err) { -pr_cont ("FAIL to attach err=%d len=%d\n" , +pr_cont ("FAIL to prog_create err=%d len=%d\n" , *err, fprog.len);return NULL ; }
@@ -5325,7 +5324,11 @@ static struct bpf_prog *generate_filter( fp->type =BPF_PROG_TYPE_SOCKET_FILTER ;memcpy (fp->insnsi, fptr, fp->len *sizeof (struct bpf_insn )); -bpf_prog_select_runtime (fp); + *err =bpf_prog_select_runtime (fp); +if (*err) { +pr_cont ("FAIL to select_runtime err=%d\n" , *err); +return NULL ; + }break ; }
@@ -5511,8 +5514,8 @@ static __init int test_bpf(void) pass_cnt++;continue ; } - -return err; + err_cnt++; +continue ; }pr_cont ("jited:%u " , fp->jited);
net/Kconfig +3 -0
@@ -388,3 +388,6 @@ endif # if NET # Used by archs to tell that they support BPF_JIT config HAVE_BPF_JIT bool + +config HAVE_EBPF_JIT + bool
net/core/filter.c +3 -1
@@ -984,7 +984,9 @@ static struct bpf_prog *bpf_migrate_filt*/ goto out_err_free; -bpf_prog_select_runtime (fp); + err =bpf_prog_select_runtime (fp); +if (err) + goto out_err_free;kfree (old_prog);return fp;
net/core/sysctl_net_core.c +6 -0
@@ -292,7 +292,13 @@ static struct ctl_table net_core_table[] .data = &bpf_jit_enable, .maxlen = sizeof(int), .mode =0644 , +#ifndef CONFIG_BPF_JIT_ALWAYS_ON .proc_handler = proc_dointvec +#else + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, + .extra2 = &one, +#endif }, #endif {
net/socket.c +9 -0
@@ -2534,6 +2534,15 @@ out_fs:core_initcall (sock_init);/* early initcall */ +static int __init jit_init (void ) +{ +#ifdef CONFIG_BPF_JIT_ALWAYS_ON + bpf_jit_enable =1 ; +#endif +return 0 ; +} +pure_initcall (jit_init); +#ifdef CONFIG_PROC_FS void socket_seq_show (struct seq_file *seq) {
Greg Kroah-Hartman
maintainerPATCH 6/67 bpf: arsh is not supported in 32 bit alu thus reject it
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ upstream commit 7891a87efc7116590eaba57acc3c422487802c6f ]
The following snippet was throwing an 'unknown opcode cc' warning in BPF interpreter:
0: (18) r0 = 0x0
2: (7b) *(u64 *)(r10 -16) = r0
3: (cc) (u32) r0 s>>= (u32) r0
4: (95) exit
Although a number of JITs do support BPF_ALU | BPF_ARSH | BPF_{K,X} generation, not all of them do and interpreter does neither. We can leave existing ones and implement it later in bpf-next for the remaining ones, but reject this properly in verifier for the time being.
--- kernel/bpf/verifier.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/bpf/verifier.c +5 -0
@@ -1165,6 +1165,11 @@ static int check_alu_op(struct verifier_return -EINVAL ; } +if (opcode ==BPF_ARSH &&BPF_CLASS (insn->code) !=BPF_ALU64 ) { +verbose ("BPF_ARSH not supported for 32 bit ALU\n" ); +return -EINVAL ; + } +if ((opcode ==BPF_LSH || opcode ==BPF_RSH || opcode ==BPF_ARSH ) &&BPF_SRC (insn->code) ==BPF_K ) {int size =BPF_CLASS (insn->code) ==BPF_ALU64 ?64 :32 ;
Greg Kroah-Hartman
maintainerPATCH 7/67 bpf: avoid false sharing of map refcount with max_entries
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ upstream commit be95a845cc4402272994ce290e3ad928aff06cb9 ]
In addition to commit b2157399cc98 ("bpf: prevent out-of-bounds speculation") also change the layout of struct bpf_map such that false sharing of fast-path members like max_entries is avoided when the maps reference counter is altered. Therefore enforce them to be placed into separate cachelines.
pahole dump after change:
struct bpf_map {
const struct bpf_map_ops * ops; /* 0 8 */
struct bpf_map * inner_map_meta; /* 8 8 */
void * security; /* 16 8 */
enum bpf_map_type map_type; /* 24 4 */
u32 key_size; /* 28 4 */
u32 value_size; /* 32 4 */
u32 max_entries; /* 36 4 */
u32 map_flags; /* 40 4 */
u32 pages; /* 44 4 */
u32 id; /* 48 4 */
int numa_node; /* 52 4 */
bool unpriv_array; /* 56 1 *//* XXX 7 bytes hole, try to pack */
/* --- cacheline 1 boundary (64 bytes) --- */
struct user_struct * user; /* 64 8 */
atomic_t refcnt; /* 72 4 */
atomic_t usercnt; /* 76 4 */
struct work_struct work; /* 80 32 */
char name[16]; /* 112 16 */
/* --- cacheline 2 boundary (128 bytes) --- */
/* size: 128, cachelines: 2, members: 17 */ /* sum members: 121, holes: 1, sum holes: 7 */
};
Now all entries in the first cacheline are read only throughout the life time of the map, set up once during map creation. Overall struct size and number of cachelines doesn't change from the reordering. struct bpf_map is usually first member and embedded in map structs in specific map implementations, so also avoid those members to sit at the end where it could potentially share the cacheline with first map values e.g. in the array since remote CPUs could trigger map updates just as well for those (easily dirtying members like max_entries intentionally as well) while having subsequent values in cache.
Quoting from Google's Project Zero blog [1]:
Additionally, at least on the Intel machine on which this was tested, bouncing modified cache lines between cores is slow, apparently because the MESI protocol is used for cache coherence [8]. Changing the reference counter of an eBPF array on one physical CPU core causes the cache line containing the reference counter to be bounced over to that CPU core, making reads of the reference counter on all other CPU cores slow until the changed reference counter has been written back to memory. Because the length and the reference counter of an eBPF array are stored in the same cache line, this also means that changing the reference counter on one physical CPU core causes reads of the eBPF array's length to be slow on other physical CPU cores (intentional false sharing).
While this doesn't 'control' the out-of-bounds speculation through masking the index as in commit b2157399cc98, triggering a manipulation of the map's reference counter is really trivial, so lets not allow to easily affect max_entries from it.
Splitting to separate cachelines also generally makes sense from a performance perspective anyway in that fast-path won't have a cache miss if the map gets pinned, reused in other progs, etc out of control path, thus also avoids unintentional false sharing.
[1] https://googleprojectzero.blogspot.ch/2018/01/reading-privileged-memory-with-side.html
--- include/linux/bpf.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
include/linux/bpf.h +12 -4
@@ -31,17 +31,25 @@ struct bpf_map_ops { };struct bpf_map { -atomic_t refcnt; +/* 1st cacheline with read-mostly members of which some +* are also accessed in fast-path (e.g. ops, max_entries). +*/ +const struct bpf_map_ops *ops____cacheline_aligned ;enum bpf_map_type map_type;u32 key_size;u32 value_size;u32 max_entries;u32 pages;bool unpriv_array; -struct user_struct *user; -const struct bpf_map_ops *ops; -struct work_struct work; +/* 7 bytes hole */ + +/* 2nd cacheline with misc members to avoid false sharing +* particularly with refcounting. +*/ +struct user_struct *user____cacheline_aligned ; +atomic_t refcnt;atomic_t usercnt; +struct work_struct work; };struct bpf_map_type_list {
Greg Kroah-Hartman
maintainerPATCH 8/67 bpf: fix divides by zero
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ upstream commit c366287ebd698ef5e3de300d90cd62ee9ee7373e ]
Divides by zero are not nice, lets avoid them if possible.
Also do_div() seems not needed when dealing with 32bit operands, but this seems a minor detail.
--- kernel/bpf/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/bpf/core.c +2 -2
@@ -444,7 +444,7 @@ select_insn:DST = tmp;CONT ; ALU_MOD_X: -if (unlikely (SRC ==0 )) +if (unlikely ((u32 )SRC ==0 ))return 0 ; tmp = (u32 )DST ;DST =do_div (tmp, (u32 )SRC );
@@ -463,7 +463,7 @@ select_insn:DST =div64_u64 (DST ,SRC );CONT ; ALU_DIV_X: -if (unlikely (SRC ==0 )) +if (unlikely ((u32 )SRC ==0 ))return 0 ; tmp = (u32 )DST ;do_div (tmp, (u32 )SRC );
Greg Kroah-Hartman
maintainerPATCH 9/67 bpf: fix 32-bit divide by zero
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexei Starovoitov <[email protected]>
[ upstream commit 68fda450a7df51cff9e5a4d4a4d9d0d5f2589153 ]
due to some JITs doing if (src_reg == 0) check in 64-bit mode for div/mod operations mask upper 32-bits of src register before doing the check
--- kernel/bpf/verifier.c | 18 ++++++++++++++++++ net/core/filter.c | 4 ++++ 2 files changed, 22 insertions(+)
kernel/bpf/verifier.c +18 -0
@@ -2248,6 +2248,24 @@ static int fixup_bpf_calls(struct verifiint i, cnt, delta =0 ;for (i =0 ; i < insn_cnt; i++, insn++) { +if (insn->code == (BPF_ALU |BPF_MOD |BPF_X ) || + insn->code == (BPF_ALU |BPF_DIV |BPF_X )) { +/* due to JIT bugs clear upper 32-bits of src register +* before div/mod operation +*/ + insn_buf[0 ] =BPF_MOV32_REG (insn->src_reg, insn->src_reg); + insn_buf[1 ] = *insn; + cnt =2 ; + new_prog =bpf_patch_insn_data (env, i + delta, insn_buf, cnt); +if (!new_prog) +return -ENOMEM ; + + delta += cnt -1 ; + env->prog = prog = new_prog; + insn = new_prog->insnsi + i + delta; +continue ; + } +if (insn->code != (BPF_JMP |BPF_CALL ))continue ;
net/core/filter.c +4 -0
@@ -430,6 +430,10 @@ do_pass: convert_bpf_extensions(fp, &insn))break ; +if (fp->code == (BPF_ALU |BPF_DIV |BPF_X ) || + fp->code == (BPF_ALU |BPF_MOD |BPF_X )) + *insn++ =BPF_MOV32_REG (BPF_REG_X ,BPF_REG_X ); + *insn =BPF_RAW_INSN (fp->code,BPF_REG_A ,BPF_REG_X ,0 , fp->k);break ;
Greg Kroah-Hartman
maintainerPATCH 10/67 bpf: reject stores into ctx via st and xadd
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ upstream commit f37a8cb84cce18762e8f86a70bd6a49a66ab964c ]
Alexei found that verifier does not reject stores into context via BPF_ST instead of BPF_STX. And while looking at it, we also should not allow XADD variant of BPF_STX.
The context rewriter is only assuming either BPF_LDX_MEM- or BPF_STX_MEM-type operations, thus reject anything other than that so that assumptions in the rewriter properly hold. Add test cases as well for BPF selftests.
--- kernel/bpf/verifier.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
kernel/bpf/verifier.c +19 -0
@@ -683,6 +683,13 @@ static bool is_pointer_value(struct veri } } +static bool is_ctx_reg (struct verifier_env *env,int regno) +{ +const struct reg_state *reg = &env->cur_state.regs[regno]; + +return reg->type ==PTR_TO_CTX ; +} +/* check whether memory at (regno + off) is accessible for t = (read | write) * if t==write, value_regno is a register which value is stored into memory * if t==read, value_regno is a register which will receive the value from memory
@@ -779,6 +786,12 @@ static int check_xadd(struct verifier_enreturn -EACCES ; } +if (is_ctx_reg (env, insn->dst_reg)) { +verbose ("BPF_XADD stores into R%d context is not allowed\n" , + insn->dst_reg); +return -EACCES ; + } +/* check whether atomic_add can read the memory */ err =check_mem_access (env, insn->dst_reg, insn->off,BPF_SIZE (insn->code),BPF_READ ,-1 );
@@ -1909,6 +1922,12 @@ static int do_check(struct verifier_envif (err)return err; +if (is_ctx_reg (env, insn->dst_reg)) { +verbose ("BPF_ST stores into R%d context is not allowed\n" , + insn->dst_reg); +return -EACCES ; + } +/* check that memory (dst_reg + off) is writeable */ err = check_mem_access(env, insn->dst_reg, insn->off, BPF_SIZE(insn->code), BPF_WRITE,
Greg Kroah-Hartman
maintainerPATCH 11/67 x86/pti: Make unpoison of pgd for trusted boot work for real
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Hansen <[email protected]>
commit 445b69e3b75e42362a5bdc13c8b8f61599e2228a upstream.
The inital fix for trusted boot and PTI potentially misses the pgd clearing if pud_alloc() sets a PGD. It probably works in *practice* because for two adjacent calls to map_tboot_page() that share a PGD entry, the first will clear NX, *then* allocate and set the PGD (without NX clear). The second call will *not* allocate but will clear the NX bit.
Defer the NX clearing to a point after it is known that all top-level allocations have occurred. Add a comment to clarify why.
[ tglx: Massaged changelog ]
[hughd notes: I have not tested tboot, but this looks to me as necessary and as safe in old-Kaiser backports as it is upstream; I'm not submitting the commit-to-be-fixed 262b6b30087, since it was undone by 445b69e3b75e, and makes conflict trouble because of 5-level's p4d versus 4-level's pgd.]
--- arch/x86/kernel/tboot.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/x86/kernel/tboot.c +10 -0
@@ -140,6 +140,16 @@ static int map_tboot_page(unsigned longreturn -1 ;set_pte_at (&tboot_mm, vaddr, pte,pfn_pte (pfn, prot));pte_unmap (pte); + +/* +* PTI poisons low addresses in the kernel page tables in the +* name of making them unusable for userspace. To execute +* code at such a low address, the poison must be cleared. +* +* Note: 'pgd' actually gets set in pud_alloc(). +*/ + pgd->pgd &= ~_PAGE_NX; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 12/67 kaiser: fix intel_bts perf crashes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugh Dickins <[email protected]>
Vince reported perf_fuzzer quickly locks up on 4.15-rc7 with PTI; Robert reported Bad RIP with KPTI and Intel BTS also on 4.15-rc7:
honggfuzz -f /tmp/somedirectorywithatleastonefile \
--linux_perf_bts_edge -s -- /bin/true
(honggfuzz from https://github.com/google/honggfuzz) crashed with
BUG: unable to handle kernel paging request at ffff9d3215100000(then narrowed it down to
perf record --per-thread -e intel_bts//u -- /bin/ls).
The intel_bts driver does not use the 'normal' BTS buffer which is exposed through kaiser_add_mapping(), but instead uses the memory allocated for the perf AUX buffer.
This obviously comes apart when using PTI, because then the kernel mapping, which includes that AUX buffer memory, disappears while switched to user page tables.
Easily fixed in old-Kaiser backports, by applying kaiser_add_mapping() to those pages; perhaps not so easy for upstream, where 4.15-rc8 commit 99a9dc98ba52 ("x86,perf: Disable intel_bts when PTI") disables for now.
Slightly reorganized surrounding code in bts_buffer_setup_aux(), so it can better match bts_buffer_free_aux(): free_aux with an #ifdef to avoid the loop when PTI is off, but setup_aux needs to loop anyway (and kaiser_add_mapping() is cheap when PTI config is off or "pti=off").
--- arch/x86/kernel/cpu/perf_event_intel_bts.c | 44 +++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 11 deletions(-)
arch/x86/kernel/cpu/perf_event_intel_bts.c +33 -11
@@ -22,6 +22,7 @@#include <linux/debugfs.h> #include <linux/device.h> #include <linux/coredump.h> +#include <linux/kaiser.h> #include <asm-generic/sizes.h> #include <asm/perf_event.h>
@@ -67,6 +68,23 @@ static size_t buf_size(struct page *pagereturn 1 << (PAGE_SHIFT +page_private (page)); } +static void bts_buffer_free_aux (void *data) +{ +#ifdef CONFIG_PAGE_TABLE_ISOLATION +struct bts_buffer *buf = data; +int nbuf; + +for (nbuf =0 ; nbuf < buf->nr_bufs; nbuf++) { +struct page *page = buf->buf[nbuf].page; +void *kaddr =page_address (page); +size_t page_size =buf_size (page); + +kaiser_remove_mapping ((unsigned long )kaddr, page_size); + } +#endif +kfree (data); +} +static void *bts_buffer_setup_aux (int cpu,void **pages,int nr_pages,bool overwrite) {
@@ -103,29 +121,33 @@ bts_buffer_setup_aux(int cpu, void **pag buf->real_size = size - size %BTS_RECORD_SIZE ;for (pg =0 , nbuf =0 , offset =0 , pad =0 ; nbuf < buf->nr_bufs; nbuf++) { -unsigned int __nr_pages; +void *kaddr = pages[pg]; +size_t page_size; + + page =virt_to_page (kaddr); + page_size =buf_size (page); + +if (kaiser_add_mapping ((unsigned long )kaddr, + page_size, __PAGE_KERNEL) <0 ) { + buf->nr_bufs = nbuf; +bts_buffer_free_aux (buf); +return NULL ; + } - page =virt_to_page (pages[pg]); - __nr_pages =PagePrivate (page) ?1 <<page_private (page) :1 ; buf->buf[nbuf].page = page; buf->buf[nbuf].offset = offset; buf->buf[nbuf].displacement = (pad ?BTS_RECORD_SIZE - pad :0 ); - buf->buf[nbuf].size =buf_size (page) - buf->buf[nbuf].displacement; + buf->buf[nbuf].size = page_size - buf->buf[nbuf].displacement; pad = buf->buf[nbuf].size %BTS_RECORD_SIZE ; buf->buf[nbuf].size -= pad; - pg += __nr_pages; - offset += __nr_pages <<PAGE_SHIFT ; + pg += page_size >>PAGE_SHIFT ; + offset += page_size; }return buf; } -static void bts_buffer_free_aux (void *data) -{ -kfree (data); -} -static unsigned long bts_buffer_offset (struct bts_buffer *buf,unsigned int idx) {return buf->buf[idx].offset + buf->buf[idx].displacement;
Greg Kroah-Hartman
maintainerPATCH 13/67 ALSA: seq: Make ioctls race-free
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit b3defb791b26ea0683a93a4f49c77ec45ec96f10 upstream.
The ALSA sequencer ioctls have no protection against racy calls while the concurrent operations may lead to interfere with each other. As reported recently, for example, the concurrent calls of setting client pool with a combination of write calls may lead to either the unkillable dead-lock or UAF.
As a slightly big hammer solution, this patch introduces the mutex to make each ioctl exclusive. Although this may reduce performance via parallel ioctl calls, usually it's not demanded for sequencer usages, hence it should be negligible.
[bwh: Backported to 4.4: ioctl dispatch is done from snd_seq_do_ioctl();
take the mutex and add ret variable there.]
--- sound/core/seq/seq_clientmgr.c | 10 ++++++++-- sound/core/seq/seq_clientmgr.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-)
sound/core/seq/seq_clientmgr.c +8 -2
@@ -236,6 +236,7 @@ static struct snd_seq_client *seq_createrwlock_init (&client->ports_lock);mutex_init (&client->ports_mutex);INIT_LIST_HEAD (&client->ports_list_head); +mutex_init (&client->ioctl_mutex);/* find free slot in the client table */ spin_lock_irqsave (&clients_lock, flags);
@@ -2195,6 +2196,7 @@ static int snd_seq_do_ioctl(struct snd_s void __user *arg) {struct seq_ioctl_table *p; +int ret;switch (cmd) {case SNDRV_SEQ_IOCTL_PVERSION :
@@ -2208,8 +2210,12 @@ static int snd_seq_do_ioctl(struct snd_sif (! arg)return -EFAULT ;for (p = ioctl_tables; p->cmd; p++) { -if (p->cmd == cmd) -return p->func (client, arg); +if (p->cmd == cmd) { +mutex_lock (&client->ioctl_mutex); + ret = p->func (client, arg); +mutex_unlock (&client->ioctl_mutex); +return ret; + } }pr_debug ("ALSA: seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n" , cmd,_IOC_TYPE (cmd),_IOC_NR (cmd));
sound/core/seq/seq_clientmgr.h +1 -0
@@ -59,6 +59,7 @@ struct snd_seq_client {struct list_head ports_list_head;rwlock_t ports_lock;struct mutex ports_mutex; +struct mutex ioctl_mutex;int convert32;/* convert 32->64bit */ /* output pool */
Greg Kroah-Hartman
maintainerPATCH 14/67 crypto: aesni - handle zero length dst buffer
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Mueller <[email protected]>
commit 9c674e1e2f9e24fa4392167efe343749008338e0 upstream.
GCM can be invoked with a zero destination buffer. This is possible if the AAD and the ciphertext have zero lengths and only the tag exists in the source buffer (i.e. a source buffer cannot be zero). In this case, the GCM cipher only performs the authentication and no decryption operation.
When the destination buffer has zero length, it is possible that no page is mapped to the SG pointing to the destination. In this case, sg_page(req->dst) is an invalid access. Therefore, page accesses should only be allowed if the req->dst->length is non-zero which is the indicator that a page must exist.
This fixes a crash that can be triggered by user space via AF_ALG.
--- arch/x86/crypto/aesni-intel_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/crypto/aesni-intel_glue.c +1 -1
@@ -965,7 +965,7 @@ static int helper_rfc4106_encrypt(structif (sg_is_last (req->src) && req->src->offset + req->src->length <=PAGE_SIZE && -sg_is_last (req->dst) && +sg_is_last (req->dst) && req->dst->length && req->dst->offset + req->dst->length <=PAGE_SIZE ) { one_entry_in_sg =1 ;scatterwalk_start (&src_sg_walk, req->src);
Greg Kroah-Hartman
maintainerPATCH 15/67 crypto: af_alg - whitelist mask and type
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephan Mueller <[email protected]>
commit bb30b8848c85e18ca7e371d0a869e94b3e383bdf upstream.
The user space interface allows specifying the type and mask field used to allocate the cipher. Only a subset of the possible flags are intended for user space. Therefore, white-list the allowed flags.
In case the user space caller uses at least one non-allowed flag, EINVAL is returned.
--- crypto/af_alg.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
crypto/af_alg.c +6 -4
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(af_alg_release_parent)static int alg_bind (struct socket *sock,struct sockaddr *uaddr,int addr_len) { -const u32 forbidden =CRYPTO_ALG_INTERNAL ; +const u32 allowed =CRYPTO_ALG_KERN_DRIVER_ONLY ;struct sock *sk = sock->sk;struct alg_sock *ask =alg_sk (sk);struct sockaddr_alg *sa = (void *)uaddr;
@@ -157,6 +157,10 @@ static int alg_bind(struct socket *sock,void *private;int err; +/* If caller uses non-allowed flag, return error. */ +if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed)) +return -EINVAL ; +if (sock->state ==SS_CONNECTED )return -EINVAL ;
@@ -175,9 +179,7 @@ static int alg_bind(struct socket *sock,if (IS_ERR (type))return PTR_ERR (type); - private = type->bind (sa->salg_name, - sa->salg_feat & ~forbidden, - sa->salg_mask & ~forbidden); + private = type->bind (sa->salg_name, sa->salg_feat, sa->salg_mask);if (IS_ERR (private)) {module_put (type->owner);return PTR_ERR (private);
Greg Kroah-Hartman
maintainerPATCH 16/67 power: reset: zx-reboot: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Chan <[email protected]>
commit 348c7cf5fcbcb68838255759d4cb45d039af36d2 upstream.
This change resolves a new compile-time warning
when built as a loadable module:
WARNING: modpost: missing MODULE_LICENSE() in drivers/power/reset/zx-reboot.o see include/linux/module.h for more information
This adds the license as "GPL v2", which matches the header of the file.
MODULE_DESCRIPTION and MODULE_AUTHOR are also added.
--- drivers/power/reset/zx-reboot.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/power/reset/zx-reboot.c +4 -0
@@ -78,3 +78,7 @@ static struct platform_driver zx_reboot_ }, };module_platform_driver (zx_reboot_driver); + +MODULE_DESCRIPTION ("ZTE SoCs reset driver" ); +MODULE_AUTHOR ("Jun Nie <[email protected]>" ); +MODULE_LICENSE ("GPL v2" );
Greg Kroah-Hartman
maintainerPATCH 17/67 gpio: iop: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Chan <[email protected]>
commit 97b03136e1b637d7a9d2274c099e44ecf23f1103 upstream.
This change resolves a new compile-time warning
when built as a loadable module:
WARNING: modpost: missing MODULE_LICENSE() in drivers/gpio/gpio-iop.o see include/linux/module.h for more information
This adds the license as "GPL", which matches the header of the file.
MODULE_DESCRIPTION and MODULE_AUTHOR are also added.
--- drivers/gpio/gpio-iop.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpio/gpio-iop.c +4 -0
@@ -129,3 +129,7 @@ static int __init iop3xx_gpio_init(void)return platform_driver_register (&iop3xx_gpio_driver); }arch_initcall (iop3xx_gpio_init); + +MODULE_DESCRIPTION ("GPIO handling for Intel IOP3xx processors" ); +MODULE_AUTHOR ("Lennert Buytenhek <[email protected]>" ); +MODULE_LICENSE ("GPL" );
Greg Kroah-Hartman
maintainerPATCH 18/67 gpio: ath79: add missing MODULE_DESCRIPTION/LICENSE
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Chan <[email protected]>
commit 539340f37e6d6ed4cd93e8e18c9b2e4eafd4b842 upstream.
This change resolves a new compile-time warning
when built as a loadable module:
WARNING: modpost: missing MODULE_LICENSE() in drivers/gpio/gpio-ath79.o see include/linux/module.h for more information
This adds the license as "GPL v2", which matches the header of the file.
MODULE_DESCRIPTION is also added.
--- drivers/gpio/gpio-ath79.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpio/gpio-ath79.c +3 -0
@@ -203,3 +203,6 @@ static struct platform_driver ath79_gpio };module_platform_driver (ath79_gpio_driver); + +MODULE_DESCRIPTION ("Atheros AR71XX/AR724X/AR913X GPIO API support" ); +MODULE_LICENSE ("GPL v2" );
Greg Kroah-Hartman
maintainerPATCH 19/67 mtd: nand: denali_pci: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Chan <[email protected]>
commit d822401d1c6898a4a4ee03977b78b8cec402e88a upstream.
This change resolves a new compile-time warning
when built as a loadable module:
WARNING: modpost: missing MODULE_LICENSE() in drivers/mtd/nand/denali_pci.o see include/linux/module.h for more information
This adds the license as "GPL v2", which matches the header of the file.
MODULE_DESCRIPTION and MODULE_AUTHOR are also added.
--- drivers/mtd/nand/denali_pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/mtd/nand/denali_pci.c +4 -0
@@ -119,3 +119,7 @@ static struct pci_driver denali_pci_driv };module_pci_driver (denali_pci_driver); + +MODULE_DESCRIPTION ("PCI driver for Denali NAND controller" ); +MODULE_AUTHOR ("Intel Corporation and its suppliers" ); +MODULE_LICENSE ("GPL v2" );
Greg Kroah-Hartman
maintainerPATCH 20/67 igb: Free IRQs when device is hotplugged
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lyude Paul <[email protected]>
commit 888f22931478a05bc81ceb7295c626e1292bf0ed upstream.
Recently I got a Caldigit TS3 Thunderbolt 3 dock, and noticed that upon hotplugging my kernel would immediately crash due to igb:
[ 680.825801] kernel BUG at drivers/pci/msi.c:352! [ 680.828388] invalid opcode: 0000 [#1] SMP [ 680.829194] Modules linked in: igb(O) thunderbolt i2c_algo_bit joydev vfat fat btusb btrtl btbcm btintel bluetooth ecdh_generic hp_wmi sparse_keymap rfkill wmi_bmof iTCO_wdt intel_rapl x86_pkg_temp_thermal coretemp crc32_pclmul snd_pcm rtsx_pci_ms mei_me snd_timer memstick snd pcspkr mei soundcore i2c_i801 tpm_tis psmouse shpchp wmi tpm_tis_core tpm video hp_wireless acpi_pad rtsx_pci_sdmmc mmc_core crc32c_intel serio_raw rtsx_pci mfd_core xhci_pci xhci_hcd i2c_hid i2c_core [last unloaded: igb] [ 680.831085] CPU: 1 PID: 78 Comm: kworker/u16:1 Tainted: G O 4.15.0-rc3Lyude-Test+ #6 [ 680.831596] Hardware name: HP HP ZBook Studio G4/826B, BIOS P71 Ver. 01.03 06/09/2017 [ 680.832168] Workqueue: kacpi_hotplug acpi_hotplug_work_fn [ 680.832687] RIP: 0010:free_msi_irqs+0x180/0x1b0 [ 680.833271] RSP: 0018:ffffc9000030fbf0 EFLAGS: 00010286 [ 680.833761] RAX: ffff8803405f9c00 RBX: ffff88033e3d2e40 RCX: 000000000000002c [ 680.834278] RDX: 0000000000000000 RSI: 00000000000000ac RDI: ffff880340be2178 [ 680.834832] RBP: 0000000000000000 R08: ffff880340be1ff0 R09: ffff8803405f9c00 [ 680.835342] R10: 0000000000000000 R11: 0000000000000040 R12: ffff88033d63a298 [ 680.835822] R13: ffff88033d63a000 R14: 0000000000000060 R15: ffff880341959000 [ 680.836332] FS: 0000000000000000(0000) GS:ffff88034f440000(0000) knlGS:0000000000000000 [ 680.836817] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 680.837360] CR2: 000055e64044afdf CR3: 0000000001c09002 CR4: 00000000003606e0 [ 680.837954] Call Trace: [ 680.838853] pci_disable_msix+0xce/0xf0 [ 680.839616] igb_reset_interrupt_capability+0x5d/0x60 [igb] [ 680.840278] igb_remove+0x9d/0x110 [igb] [ 680.840764] pci_device_remove+0x36/0xb0 [ 680.841279] device_release_driver_internal+0x157/0x220 [ 680.841739] pci_stop_bus_device+0x7d/0xa0 [ 680.842255] pci_stop_bus_device+0x2b/0xa0 [ 680.842722] pci_stop_bus_device+0x3d/0xa0 [ 680.843189] pci_stop_and_remove_bus_device+0xe/0x20 [ 680.843627] trim_stale_devices+0xf3/0x140 [ 680.844086] trim_stale_devices+0x94/0x140 [ 680.844532] trim_stale_devices+0xa6/0x140 [ 680.845031] ? get_slot_status+0x90/0xc0 [ 680.845536] acpiphp_check_bridge.part.5+0xfe/0x140 [ 680.846021] acpiphp_hotplug_notify+0x175/0x200 [ 680.846581] ? free_bridge+0x100/0x100 [ 680.847113] acpi_device_hotplug+0x8a/0x490 [ 680.847535] acpi_hotplug_work_fn+0x1a/0x30 [ 680.848076] process_one_work+0x182/0x3a0 [ 680.848543] worker_thread+0x2e/0x380 [ 680.848963] ? process_one_work+0x3a0/0x3a0 [ 680.849373] kthread+0x111/0x130 [ 680.849776] ? kthread_create_worker_on_cpu+0x50/0x50 [ 680.850188] ret_from_fork+0x1f/0x30 [ 680.850601] Code: 43 14 85 c0 0f 84 d5 fe ff ff 31 ed eb 0f 83 c5 01 39 6b 14 0f 86 c5 fe ff ff 8b 7b 10 01 ef e8 b7 e4 d2 ff 48 83 78 70 00 74 e3 <0f> 0b 49 8d b5 a0 00 00 00 e8 62 6f d3 ff e9 c7 fe ff ff 48 8b [ 680.851497] RIP: free_msi_irqs+0x180/0x1b0 RSP: ffffc9000030fbf0
As it turns out, normally the freeing of IRQs that would fix this is called inside of the scope of __igb_close(). However, since the device is already gone by the point we try to unregister the netdevice from the driver due to a hotplug we end up seeing that the netif isn't present and thus, forget to free any of the device IRQs.
So: make sure that if we're in the process of dismantling the netdev, we always allow __igb_close() to be called so that IRQs may be freed normally. Additionally, only allow igb_close() to be called from __igb_close() if it hasn't already been called for the given adapter.
--- drivers/net/ethernet/intel/igb/igb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/igb_main.c +1 -1
@@ -3174,7 +3174,7 @@ static int __igb_close(struct net_devicestatic int igb_close (struct net_device *netdev) { -if (netif_device_present (netdev)) +if (netif_device_present (netdev) || netdev->dismantle)return __igb_close (netdev, false);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 21/67 KVM: x86: emulator: Return to user-mode on L1 CPL=0 emulation failure
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liran Alon <[email protected]>
[ Upstream commit 1f4dcb3b213235e642088709a1c54964d23365e9 ]
On this case, handle_emulation_failure() fills kvm_run with internal-error information which it expects to be delivered to user-mode for further processing.
However, the code reports a wrong return-value which makes KVM to never return to user-mode on this scenario.
userspace")
--- arch/x86/kvm/x86.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
@@ -5153,7 +5153,7 @@ static int handle_emulation_failure(stru vcpu->run->exit_reason =KVM_EXIT_INTERNAL_ERROR ; vcpu->run->internal.suberror =KVM_INTERNAL_ERROR_EMULATION ; vcpu->run->internal.ndata =0 ; - r =EMULATE_FAIL ; + r =EMULATE_USER_EXIT ; }kvm_queue_exception (vcpu,UD_VECTOR );
Greg Kroah-Hartman
maintainerPATCH 22/67 KVM: x86: Dont re-execute instruction when not passing CR2 value
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liran Alon <[email protected]>
[ Upstream commit 9b8ae63798cb97e785a667ff27e43fa6220cb734 ]
In case of instruction-decode failure or emulation failure, x86_emulate_instruction() will call reexecute_instruction() which will attempt to use the cr2 value passed to x86_emulate_instruction(). However, when x86_emulate_instruction() is called from emulate_instruction(), cr2 is not passed (passed as 0) and therefore it doesn't make sense to execute reexecute_instruction() logic at all.
--- arch/x86/include/asm/kvm_host.h | 3 ++- arch/x86/kvm/vmx.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/include/asm/kvm_host.h +2 -1
@@ -998,7 +998,8 @@ int x86_emulate_instruction(struct kvm_vstatic inline int emulate_instruction (struct kvm_vcpu *vcpu,int emulation_type) { -return x86_emulate_instruction (vcpu,0 , emulation_type,NULL ,0 ); +return x86_emulate_instruction (vcpu,0 , + emulation_type |EMULTYPE_NO_REEXECUTE ,NULL ,0 ); }void kvm_enable_efer_bits (u64 );
arch/x86/kvm/vmx.c +1 -1
@@ -6023,7 +6023,7 @@ static int handle_invalid_guest_state(stif (test_bit (KVM_REQ_EVENT , &vcpu->requests))return 1 ; - err =emulate_instruction (vcpu,EMULTYPE_NO_REEXECUTE ); + err =emulate_instruction (vcpu,0 );if (err ==EMULATE_USER_EXIT ) { ++vcpu->stat.mmio_exits;
Greg Kroah-Hartman
maintainerPATCH 23/67 KVM: X86: Fix operand/address-size during instruction decoding
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
[ Upstream commit 3853be2603191829b442b64dac6ae8ba0c027bf9 ]
Pedro reported:
During tests that we conducted on KVM, we noticed that executing a "PUSH %ES" instruction under KVM produces different results on both memory and the SP register depending on whether EPT support is enabled. With EPT the SP is reduced by 4 bytes (and the written value is 0-padded) but without EPT support it is only reduced by 2 bytes. The difference can be observed when the CS.DB field is 1 (32-bit) but not when it's 0 (16-bit).
The internal segment descriptor cache exist even in real/vm8096 mode. The CS.D also should be respected instead of just default operand/address-size/66H prefix/67H prefix during instruction decoding. This patch fixes it by also adjusting operand/address-size according to CS.D.
--- arch/x86/kvm/emulate.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kvm/emulate.c +7 -0
@@ -4978,6 +4978,8 @@ int x86_decode_insn(struct x86_emulate_cbool op_prefix = false;bool has_seg_override = false;struct opcode opcode; +u16 dummy; +struct desc_struct desc; ctxt->memop.type =OP_NONE ; ctxt->memopp =NULL ;
@@ -4996,6 +4998,11 @@ int x86_decode_insn(struct x86_emulate_cswitch (mode) {case X86EMUL_MODE_REAL :case X86EMUL_MODE_VM86 : + def_op_bytes = def_ad_bytes =2 ; + ctxt->ops->get_segment (ctxt, &dummy, &desc,NULL ,VCPU_SREG_CS ); +if (desc.d) + def_op_bytes = def_ad_bytes =4 ; +break ;case X86EMUL_MODE_PROT16 : def_op_bytes = def_ad_bytes =2 ;break ;
Greg Kroah-Hartman
maintainerPATCH 24/67 KVM: x86: ioapic: Fix level-triggered EOI and IOAPIC reconfigure race
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Leshenko <[email protected]>
[ Upstream commit 0fc5a36dd6b345eb0d251a65c236e53bead3eef7 ]
KVM uses ioapic_handled_vectors to track vectors that need to notify the IOAPIC on EOI. The problem is that IOAPIC can be reconfigured while an interrupt with old configuration is pending or running and ioapic_handled_vectors only remembers the newest configuration; thus EOI from the old interrupt is not delievered to the IOAPIC.
A previous commit db2bdcbbbd32
("KVM: x86: fix edge EOI and IOAPIC reconfig race") addressed this issue by adding pending edge-triggered interrupts to ioapic_handled_vectors, fixing this race for edge-triggered interrupts. The commit explicitly ignored level-triggered interrupts, but this race applies to them as well:
1) IOAPIC sends a level triggered interrupt vector to VCPU0
2) VCPU0's handler deasserts the irq line and reconfigures the IOAPIC to route the vector to VCPU1. The reconfiguration rewrites only the upper 32 bits of the IOREDTBLn register. (Causes KVM to update ioapic_handled_vectors for VCPU0 and it no longer includes the vector.)
3) VCPU0 sends EOI for the vector, but it's not delievered to the IOAPIC because the ioapic_handled_vectors doesn't include the vector.
4) New interrupts are not delievered to VCPU1 because remote_irr bit is set forever.
Therefore, the correct behavior is to add all pending and running interrupts to ioapic_handled_vectors.
This commit introduces a slight performance hit similar to commit db2bdcbbbd32 ("KVM: x86: fix edge EOI and IOAPIC reconfig race") for the rare case that the vector is reused by a non-IOAPIC source on VCPU0. We prefer to keep solution simple and not handle this case just as the original commit does.
--- arch/x86/kvm/ioapic.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kvm/ioapic.c +1 -2
@@ -247,8 +247,7 @@ void kvm_ioapic_scan_entry(struct kvm_vc index == RTC_GSI) {if (kvm_apic_match_dest (vcpu,NULL ,0 , e->fields.dest_id, e->fields.dest_mode) || - (e->fields.trig_mode ==IOAPIC_EDGE_TRIG && -kvm_apic_pending_eoi (vcpu, e->fields.vector))) +kvm_apic_pending_eoi (vcpu, e->fields.vector))__set_bit (e->fields.vector, (unsigned long *)eoi_exit_bitmap); }
Greg Kroah-Hartman
maintainerPATCH 25/67 KVM: x86: ioapic: Clear Remote IRR when entry is switched to edge-triggered
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Leshenko <[email protected]>
[ Upstream commit a8bfec2930525808c01f038825d1df3904638631 ]
Some OSes (Linux, Xen) use this behavior to clear the Remote IRR bit for IOAPICs without an EOI register. They simulate the EOI message manually by changing the trigger mode to edge and then back to level, with the entry being masked during this.
QEMU implements this feature in commit ed1263c363c9 ("ioapic: clear remote irr bit for edge-triggered interrupts")
As a side effect, this commit removes an incorrect behavior where Remote IRR was cleared when the redirection table entry was rewritten. This is not consistent with the manual and also opens an opportunity for a strange behavior when a redirection table entry is modified from an interrupt handler that handles the same entry: The modification will clear the Remote IRR bit even though the interrupt handler is still running.
--- arch/x86/kvm/ioapic.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/x86/kvm/ioapic.c +10 -1
@@ -296,8 +296,17 @@ static void ioapic_write_indirect(struct }else { e->bits &= ~0xffffffffULL ; e->bits |= (u32 ) val; - e->fields.remote_irr =0 ; } + +/* +* Some OSes (Linux, Xen) assume that Remote IRR bit will +* be cleared by IOAPIC hardware when the entry is configured +* as edge-triggered. This behavior is used to simulate an +* explicit EOI on IOAPICs that don't have the EOI register. +*/ +if (e->fields.trig_mode ==IOAPIC_EDGE_TRIG ) + e->fields.remote_irr =0 ; + mask_after = e->fields.mask;if (mask_before != mask_after)kvm_fire_mask_notifiers (ioapic->kvm,KVM_IRQCHIP_IOAPIC , index, mask_after);
Greg Kroah-Hartman
maintainerPATCH 26/67 KVM: x86: ioapic: Preserve read-only values in the redirection table
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikita Leshenko <[email protected]>
[ Upstream commit b200dded0a6974a3b69599832b2203483920ab25 ]
According to 82093AA (IOAPIC) manual, Remote IRR and Delivery Status are read-only. QEMU implements the bits as RO in commit 479c2a1cb7fb ("ioapic: keep RO bits for IOAPIC entry").
--- arch/x86/kvm/ioapic.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/x86/kvm/ioapic.c +6 -0
@@ -268,6 +268,7 @@ static void ioapic_write_indirect(struct {unsigned index;bool mask_before, mask_after; +int old_remote_irr, old_delivery_status;union kvm_ioapic_redirect_entry *e;switch (ioapic->ioregsel) {
@@ -290,6 +291,9 @@ static void ioapic_write_indirect(structreturn ; e = &ioapic->redirtbl[index]; mask_before = e->fields.mask; +/* Preserve read-only fields */ + old_remote_irr = e->fields.remote_irr; + old_delivery_status = e->fields.delivery_status;if (ioapic->ioregsel &1 ) { e->bits &=0xffffffff ; e->bits |= (u64 ) val <<32 ;
@@ -297,6 +301,8 @@ static void ioapic_write_indirect(struct e->bits &= ~0xffffffffULL ; e->bits |= (u32 ) val; } + e->fields.remote_irr = old_remote_irr; + e->fields.delivery_status = old_delivery_status;/* * Some OSes (Linux, Xen) assume that Remote IRR bit will
Greg Kroah-Hartman
maintainerPATCH 27/67 ACPI / bus: Leave modalias empty for devices which are not present
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
[ Upstream commit 10809bb976648ac58194a629e3d7af99e7400297 ]
Most Bay and Cherry Trail devices use a generic DSDT with all possible peripheral devices present in the DSDT, with their _STA returning 0x00 or 0x0f based on AML variables which describe what is actually present on the board.
Since ACPI device objects with a 0x00 status (not present) still get an entry under /sys/bus/acpi/devices, and those entry had an acpi:PNPID modalias, userspace would end up loading modules for non present hardware.
This commit fixes this by leaving the modalias empty for non present devices. This results in 10 modules less being loaded with a generic distro kernel config on my Cherry Trail test-device (a GPD pocket).
--- drivers/acpi/device_sysfs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/acpi/device_sysfs.c +4 -0
@@ -146,6 +146,10 @@ static int create_pnp_modalias(struct acint count;struct acpi_hardware_id *id; +/* Avoid unnecessarily loading modules for non present devices. */ +if (!acpi_device_is_present (acpi_dev)) +return 0 ; +/* * Since we skip ACPI_DT_NAMESPACE_HID from the modalias below, 0 should * be returned if ACPI_DT_NAMESPACE_HID is the only ACPI/PNP ID in the
Greg Kroah-Hartman
maintainerPATCH 28/67 cpufreq: Add Loongson machine dependencies
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
[ Upstream commit 0d307935fefa6389eb726c6362351c162c949101 ]
The MIPS loongson cpufreq drivers don't build unless configured for the correct machine type, due to dependency on machine specific architecture headers and symbols in machine specific platform code.
More specifically loongson1-cpufreq.c uses RST_CPU_EN and RST_CPU, neither of which is defined in asm/mach-loongson32/regs-clk.h unless CONFIG_LOONGSON1_LS1B=y, and loongson2_cpufreq.c references loongson2_clockmod_table[], which is only defined in arch/mips/loongson64/lemote-2f/clock.c, i.e. when CONFIG_LEMOTE_MACH2F=y.
Add these dependencies to Kconfig to avoid randconfig / allyesconfig build failures (e.g. when based on BMIPS which also has a cpufreq driver).
--- drivers/cpufreq/Kconfig | 2 ++ 1 file changed, 2 insertions(+)
drivers/cpufreq/Kconfig +2 -0
@@ -236,6 +236,7 @@ endif if MIPS config LOONGSON2_CPUFREQ tristate "Loongson2 CPUFreq Driver" + depends on LEMOTE_MACH2F help This option adds a CPUFreq driver for loongson processors which support software configurable cpu frequency.
@@ -248,6 +249,7 @@ config LOONGSON2_CPUFREQ config LOONGSON1_CPUFREQ tristate "Loongson1 CPUFreq Driver" + depends on LOONGSON1_LS1B help This option adds a CPUFreq driver for loongson1 processors which support software configurable cpu frequency.
Greg Kroah-Hartman
maintainerPATCH 29/67 bcache: check return value of register_shrinker
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Lyle <[email protected]>
[ Upstream commit 6c4ca1e36cdc1a0a7a84797804b87920ccbebf51 ]
register_shrinker is now __must_check, so check it to kill a warning. Caller of bch_btree_cache_alloc in super.c appropriately checks return value so this is fully plumbed through.
This V2 fixes checkpatch warnings and improves the commit description, as I was too hasty getting the previous version out.
--- drivers/md/bcache/btree.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/md/bcache/btree.c +4 -1
@@ -808,7 +808,10 @@ int bch_btree_cache_alloc(struct cache_s c->shrink.scan_objects = bch_mca_scan; c->shrink.seeks =4 ; c->shrink.batch = c->btree_pages *2 ; -register_shrinker (&c->shrink); + +if (register_shrinker (&c->shrink)) +pr_warn ("bcache: %s: could not register shrinker" , + __func__);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 30/67 drm/amdgpu: Fix SDMA load/unload sequence on HWS disabled mode
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <[email protected]>
[ Upstream commit cf21654b40968609779751b34e7923180968fe5b ]
Fix the SDMA load and unload sequence as suggested by HW document.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 47 +++++++++++++++------- 1 file changed, 34 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c +34 -13
@@ -367,29 +367,50 @@ static int kgd_hqd_sdma_load(struct kgd_ {struct amdgpu_device *adev =get_amdgpu_device (kgd);struct cik_sdma_rlc_registers *m; +unsigned long end_jiffies;uint32_t sdma_base_addr; +uint32_t data; m =get_sdma_mqd (mqd); sdma_base_addr =get_sdma_base_addr (m); -WREG32 (sdma_base_addr + mmSDMA0_RLC0_VIRTUAL_ADDR, - m->sdma_rlc_virtual_addr); +WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, + m->sdma_rlc_rb_cntl & (~SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK )); -WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_BASE, - m->sdma_rlc_rb_base); + end_jiffies =msecs_to_jiffies (2000 ) + jiffies; +while (true) { + data =RREG32 (sdma_base_addr + mmSDMA0_RLC0_CONTEXT_STATUS); +if (data &SDMA0_RLC0_CONTEXT_STATUS__IDLE_MASK ) +break ; +if (time_after (jiffies, end_jiffies)) +return -ETIME ; +usleep_range (500 ,1000 ); + } +if (m->sdma_engine_id) { + data =RREG32 (mmSDMA1_GFX_CONTEXT_CNTL); + data =REG_SET_FIELD (data,SDMA1_GFX_CONTEXT_CNTL , +RESUME_CTX ,0 ); +WREG32 (mmSDMA1_GFX_CONTEXT_CNTL, data); + }else { + data =RREG32 (mmSDMA0_GFX_CONTEXT_CNTL); + data =REG_SET_FIELD (data,SDMA0_GFX_CONTEXT_CNTL , +RESUME_CTX ,0 ); +WREG32 (mmSDMA0_GFX_CONTEXT_CNTL, data); + } +WREG32 (sdma_base_addr + mmSDMA0_RLC0_DOORBELL, + m->sdma_rlc_doorbell); +WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_RPTR,0 ); +WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_WPTR,0 ); +WREG32 (sdma_base_addr + mmSDMA0_RLC0_VIRTUAL_ADDR, + m->sdma_rlc_virtual_addr); +WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_BASE, m->sdma_rlc_rb_base);WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_BASE_HI, m->sdma_rlc_rb_base_hi); -WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_LO, m->sdma_rlc_rb_rptr_addr_lo); -WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_RPTR_ADDR_HI, m->sdma_rlc_rb_rptr_addr_hi); - -WREG32 (sdma_base_addr + mmSDMA0_RLC0_DOORBELL, - m->sdma_rlc_doorbell); -WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, m->sdma_rlc_rb_cntl);
@@ -492,9 +513,9 @@ static int kgd_hqd_sdma_destroy(struct k }WREG32 (sdma_base_addr + mmSDMA0_RLC0_DOORBELL,0 ); -WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_RPTR,0 ); -WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_WPTR,0 ); -WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_BASE,0 ); +WREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_CNTL, +RREG32 (sdma_base_addr + mmSDMA0_RLC0_RB_CNTL) | +SDMA0_RLC0_RB_CNTL__RB_ENABLE_MASK );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 31/67 drm/amdkfd: Fix SDMA ring buffer size calculation
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: shaoyunl <[email protected]>
[ Upstream commit d12fb13f23199faa7e536acec1db49068e5a067d ]
ffs function return the position of the first bit set on 1 based. (bit zero returns 1).
--- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_cik.c +2 -2
@@ -215,8 +215,8 @@ static int update_mqd_sdma(struct mqd_maBUG_ON (!mm || !mqd || !q); m =get_sdma_mqd (mqd); - m->sdma_rlc_rb_cntl =ffs (q->queue_size /sizeof (unsigned int )) << -SDMA0_RLC0_RB_CNTL__RB_SIZE__SHIFT | + m->sdma_rlc_rb_cntl = (ffs (q->queue_size /sizeof (unsigned int )) -1 ) + <<SDMA0_RLC0_RB_CNTL__RB_SIZE__SHIFT | q->vmid <<SDMA0_RLC0_RB_CNTL__RB_VMID__SHIFT |1 <<SDMA0_RLC0_RB_CNTL__RPTR_WRITEBACK_ENABLE__SHIFT |6 <<SDMA0_RLC0_RB_CNTL__RPTR_WRITEBACK_TIMER__SHIFT ;
Greg Kroah-Hartman
maintainerPATCH 32/67 drm/amdkfd: Fix SDMA oversubsription handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <[email protected]>
[ Upstream commit 8c946b8988acec785bcf67088b6bd0747f36d2d3 ]
SDMA only supports a fixed number of queues. HWS cannot handle oversubscription.
--- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 18 +++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +18 -0
@@ -205,6 +205,24 @@ int pqm_create_queue(struct process_queuswitch (type) {case KFD_QUEUE_TYPE_SDMA : +if (dev->dqm->queue_count >= +CIK_SDMA_QUEUES_PER_ENGINE *CIK_SDMA_ENGINE_NUM ) { +pr_err ("Over-subscription is not allowed for SDMA.\n" ); + retval = -EPERM ; + goto err_create_queue; + } + + retval =create_cp_queue (pqm, dev, &q, properties, f, *qid); +if (retval !=0 ) + goto err_create_queue; + pqn->q = q; + pqn->kq =NULL ; + retval = dev->dqm->ops.create_queue (dev->dqm, q, &pdd->qpd, + &q->properties.vmid); +pr_debug ("DQM returned %d for create_queue\n" , retval); +print_queue (q); +break ; +case KFD_QUEUE_TYPE_COMPUTE :/* check if there is over subscription */ if ((sched_policy == KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION) &&
Greg Kroah-Hartman
maintainerPATCH 33/67 openvswitch: fix the incorrect flow action alloc size
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: zhangliping <[email protected]>
[ Upstream commit 67c8d22a73128ff910e2287567132530abcf5b71 ]
If we want to add a datapath flow, which has more than 500 vxlan outputs' action, we will get the following error reports:
openvswitch: netlink: Flow action size 32832 bytes exceeds max
openvswitch: netlink: Flow action size 32832 bytes exceeds max
openvswitch: netlink: Actions may not be safe on all matching packets ... ...
It seems that we can simply enlarge the MAX_ACTIONS_BUFSIZE to fix it, but this is not the root cause. For example, for a vxlan output action, we need about 60 bytes for the nlattr, but after it is converted to the flow action, it only occupies 24 bytes. This means that we can still support more than 1000 vxlan output actions for a single datapath flow under the the current 32k max limitation.
So even if the nla_len(attr) is larger than MAX_ACTIONS_BUFSIZE, we shouldn't report EINVAL and keep it move on, as the judgement can be done by the reserve_sfa_size.
--- net/openvswitch/flow_netlink.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
net/openvswitch/flow_netlink.c +8 -8
@@ -1672,14 +1672,11 @@ int ovs_nla_put_mask(const struct sw_flo#define MAX_ACTIONS_BUFSIZE (32 * 1024) -static struct sw_flow_actions *nla_alloc_flow_actions (int size,bool log) +static struct sw_flow_actions *nla_alloc_flow_actions (int size) {struct sw_flow_actions *sfa; -if (size >MAX_ACTIONS_BUFSIZE ) { -OVS_NLERR (log,"Flow action size %u bytes exceeds max" , size); -return ERR_PTR (-EINVAL ); - } +WARN_ON_ONCE (size >MAX_ACTIONS_BUFSIZE ); sfa =kmalloc (sizeof (*sfa) + size,GFP_KERNEL );if (!sfa)
@@ -1752,12 +1749,15 @@ static struct nlattr *reserve_sfa_size(s new_acts_size =ksize (*sfa) *2 ;if (new_acts_size >MAX_ACTIONS_BUFSIZE ) { -if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) +if ((MAX_ACTIONS_BUFSIZE - next_offset) < req_size) { +OVS_NLERR (log,"Flow action size exceeds max %u" , +MAX_ACTIONS_BUFSIZE );return ERR_PTR (-EMSGSIZE ); + } new_acts_size =MAX_ACTIONS_BUFSIZE ; } - acts =nla_alloc_flow_actions (new_acts_size, log); + acts =nla_alloc_flow_actions (new_acts_size);if (IS_ERR (acts))return (void *)acts;
@@ -2369,7 +2369,7 @@ int ovs_nla_copy_actions(struct net *net {int err; - *sfa =nla_alloc_flow_actions (nla_len (attr), log); + *sfa =nla_alloc_flow_actions (min (nla_len (attr),MAX_ACTIONS_BUFSIZE ));if (IS_ERR (*sfa))return PTR_ERR (*sfa);
Greg Kroah-Hartman
maintainerPATCH 34/67 mac80211: fix the update of path metric for RANN frame
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chun-Yeow Yeoh <[email protected]>
[ Upstream commit fbbdad5edf0bb59786a51b94a9d006bc8c2da9a2 ]
The previous path metric update from RANN frame has not considered the own link metric toward the transmitting mesh STA. Fix this.
--- net/mac80211/mesh_hwmp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
net/mac80211/mesh_hwmp.c +9 -6
@@ -776,7 +776,7 @@ static void hwmp_rann_frame_process(strustruct mesh_path *mpath;u8 ttl, flags, hopcount;const u8 *orig_addr; -u32 orig_sn, metric, metric_txsta, interval; +u32 orig_sn, new_metric, orig_metric, last_hop_metric, interval;bool root_is_gate; ttl = rann->rann_ttl;
@@ -787,7 +787,7 @@ static void hwmp_rann_frame_process(stru interval =le32_to_cpu (rann->rann_interval); hopcount = rann->rann_hopcount; hopcount++; - metric =le32_to_cpu (rann->rann_metric); + orig_metric =le32_to_cpu (rann->rann_metric);/* Ignore our own RANNs */ if (ether_addr_equal (orig_addr, sdata->vif.addr))
@@ -804,7 +804,10 @@ static void hwmp_rann_frame_process(strureturn ; } - metric_txsta =airtime_link_metric_get (local, sta); + last_hop_metric =airtime_link_metric_get (local, sta); + new_metric = orig_metric + last_hop_metric; +if (new_metric < orig_metric) + new_metric =MAX_METRIC ; mpath =mesh_path_lookup (sdata, orig_addr);if (!mpath) {
@@ -817,7 +820,7 @@ static void hwmp_rann_frame_process(stru }if (!(SN_LT (mpath->sn, orig_sn)) && - !(mpath->sn == orig_sn && metric < mpath->rann_metric)) { + !(mpath->sn == orig_sn && new_metric < mpath->rann_metric)) {rcu_read_unlock ();return ; }
@@ -835,7 +838,7 @@ static void hwmp_rann_frame_process(stru } mpath->sn = orig_sn; - mpath->rann_metric = metric + metric_txsta; + mpath->rann_metric = new_metric; mpath->is_root = true;/* Recording RANNs sender address to send individually * addressed PREQs destined for root mesh STA */
@@ -855,7 +858,7 @@ static void hwmp_rann_frame_process(strumesh_path_sel_frame_tx (MPATH_RANN , flags, orig_addr, orig_sn,0 ,NULL ,0 , broadcast_addr, hopcount, ttl, interval, - metric + metric_txsta,0 , sdata); + new_metric,0 , sdata); }rcu_read_unlock ();
Greg Kroah-Hartman
maintainerPATCH 35/67 btrfs: fix deadlock when writing out space cache
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
[ Upstream commit b77000ed558daa3bef0899d29bf171b8c9b5e6a8 ]
If we fail to prepare our pages for whatever reason (out of memory in our case) we need to make sure to drop the block_group->data_rwsem, otherwise hilarity ensues.
--- fs/btrfs/free-space-cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/free-space-cache.c +2 -1
@@ -1258,7 +1258,7 @@ static int __btrfs_write_out_cache(struc/* Lock all pages first so we can lock the extent safely. */ ret =io_ctl_prepare_pages (io_ctl, inode,0 );if (ret) - goto out; + goto out_unlock;lock_extent_bits (&BTRFS_I (inode)->io_tree,0 ,i_size_read (inode) -1 ,0 , &cached_state);
@@ -1351,6 +1351,7 @@ out_nospc_locked: out_nospc:cleanup_write_cache_enospc (inode, io_ctl, &cached_state, &bitmap_list); +out_unlock:if (block_group && (block_group->flags &BTRFS_BLOCK_GROUP_DATA ))up_write (&block_group->data_rwsem);
Greg Kroah-Hartman
maintainerPATCH 36/67 KVM: VMX: Fix rflags cache during vCPU reset
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wanpeng Li <[email protected]>
[ Upstream commit c37c28730bb031cc8a44a130c2555c0f3efbe2d0 ]
Reported by syzkaller:
*** Guest State ***
CR0: actual=0x0000000080010031, shadow=0x0000000060000010, gh_mask=fffffffffffffff7
CR4: actual=0x0000000000002061, shadow=0x0000000000000000, gh_mask=ffffffffffffe8f1 CR3 = 0x000000002081e000
RSP = 0x000000000000fffa RIP = 0x0000000000000000
RFLAGS=0x00023000 DR7 = 0x00000000000000
^^^^^^^^^^
------------[ cut here ]------------
WARNING: CPU: 6 PID: 24431 at /home/kernel/linux/arch/x86/kvm//x86.c:7302 kvm_arch_vcpu_ioctl_run+0x651/0x2ea0 [kvm]
CPU: 6 PID: 24431 Comm: reprotest Tainted: G W OE 4.14.0+ #26
RIP: 0010:kvm_arch_vcpu_ioctl_run+0x651/0x2ea0 [kvm]
RSP: 0018:ffff880291d179e0 EFLAGS: 00010202
Call Trace:
kvm_vcpu_ioctl+0x479/0x880 [kvm]
do_vfs_ioctl+0x142/0x9a0
SyS_ioctl+0x74/0x80
entry_SYSCALL_64_fastpath+0x23/0x9aThe failed vmentry is triggered by the following beautified testcase:
#include <unistd.h>
#include <sys/syscall.h>
#include <string.h>
#include <stdint.h>
#include <linux/kvm.h>
#include <fcntl.h>
#include <sys/ioctl.h>
long r[5];
int main()
{
struct kvm_debugregs dr = { 0 };
r[2] = open("/dev/kvm", O_RDONLY);
r[3] = ioctl(r[2], KVM_CREATE_VM, 0);
r[4] = ioctl(r[3], KVM_CREATE_VCPU, 7);
struct kvm_guest_debug debug = {
.control = 0xf0403,
.arch = {
.debugreg[6] = 0x2,
.debugreg[7] = 0x2
}
};
ioctl(r[4], KVM_SET_GUEST_DEBUG, &debug);
ioctl(r[4], KVM_RUN, 0);
}which testcase tries to setup the processor specific debug registers and configure vCPU for handling guest debug events through KVM_SET_GUEST_DEBUG. The KVM_SET_GUEST_DEBUG ioctl will get and set rflags in order to set TF bit if single step is needed. All regs' caches are reset to avail and GUEST_RFLAGS vmcs field is reset to 0x2 during vCPU reset. However, the cache of rflags is not reset during vCPU reset. The function vmx_get_rflags() returns an unreset rflags cache value since the cache is marked avail, it is 0 after boot. Vmentry fails if the rflags reserved bit 1 is 0.
This patch fixes it by resetting both the GUEST_RFLAGS vmcs field and its cache to 0x2 during vCPU reset.
--- arch/x86/kvm/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/vmx.c +1 -1
@@ -4954,7 +4954,7 @@ static void vmx_vcpu_reset(struct kvm_vcvmcs_write64 (GUEST_IA32_DEBUGCTL ,0 ); } -vmcs_writel (GUEST_RFLAGS ,0x02 ); +kvm_set_rflags (vcpu,X86_EFLAGS_FIXED );kvm_rip_write (vcpu,0xfff0 );vmcs_writel (GUEST_GDTR_BASE ,0 );
Greg Kroah-Hartman
maintainerPATCH 37/67 xen-netfront: remove warning when unloading module
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eduardo Otubo <[email protected]>
[ Upstream commit 5b5971df3bc2775107ddad164018a8a8db633b81 ]
v2:
* Replace busy wait with wait_event()/wake_up_all()
* Cannot garantee that at the time xennet_remove is called, the xen_netback state will not be XenbusStateClosed, so added a condition for that
* There's a small chance for the xen_netback state is XenbusStateUnknown by the time the xen_netfront switches to Closed, so added a condition for that.
When unloading module xen_netfront from guest, dmesg would output warning messages like below:
[ 105.236836] xen:grant_table: WARNING: g.e. 0x903 still in use! [ 105.236839] deferring g.e. 0x903 (pfn 0x35805)
This problem relies on netfront and netback being out of sync. By the time netfront revokes the g.e.'s netback didn't have enough time to free all of them, hence displaying the warnings on dmesg.
The trick here is to make netfront to wait until netback frees all the g.e.'s and only then continue to cleanup for the module removal, and this is done by manipulating both device states.
--- drivers/net/xen-netfront.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/net/xen-netfront.c +18 -0
@@ -86,6 +86,8 @@ struct netfront_cb {/* IRQ name is queue name with "-tx" or "-rx" appended */ #define IRQ_NAME_SIZE (QUEUE_NAME_SIZE + 3) +static DECLARE_WAIT_QUEUE_HEAD (module_unload_q); +struct netfront_stats {u64 packets;u64 bytes;
@@ -2037,10 +2039,12 @@ static void netback_changed(struct xenbubreak ;case XenbusStateClosed: +wake_up_all (&module_unload_q);if (dev->state == XenbusStateClosed)break ;/* Missed the backend's CLOSING state -- fallthrough */ case XenbusStateClosing: +wake_up_all (&module_unload_q);xenbus_frontend_closed (dev);break ; }
@@ -2146,6 +2150,20 @@ static int xennet_remove(struct xenbus_ddev_dbg (&dev->dev,"%s\n" , dev->nodename); +if (xenbus_read_driver_state (dev->otherend) != XenbusStateClosed) { +xenbus_switch_state (dev, XenbusStateClosing); +wait_event (module_unload_q, +xenbus_read_driver_state (dev->otherend) == + XenbusStateClosing); + +xenbus_switch_state (dev, XenbusStateClosed); +wait_event (module_unload_q, +xenbus_read_driver_state (dev->otherend) == + XenbusStateClosed || +xenbus_read_driver_state (dev->otherend) == + XenbusStateUnknown); + } +xennet_disconnect_backend (info);unregister_netdev (info->netdev);
Greg Kroah-Hartman
maintainerPATCH 38/67 nfsd: CLOSE SHOULD return the invalid special stateid for NFSv4.x (x>0)
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit fb500a7cfee7f2f447d2bbf30cb59629feab6ac1 ]
--- fs/nfsd/nfs4state.c | 8 ++++++++ 1 file changed, 8 insertions(+)
fs/nfsd/nfs4state.c +8 -0
@@ -63,6 +63,9 @@ static const stateid_t zero_stateid = {static const stateid_t currentstateid = { .si_generation =1 , }; +static const stateid_t close_stateid = { + .si_generation =0xffffffffU , +};static u64 current_sessionid =1 ;
@@ -5243,6 +5246,11 @@ nfsd4_close(struct svc_rqst *rqstp, strunfsd4_close_open_stateid (stp);mutex_unlock (&stp->st_mutex); +/* See RFC5661 sectionm 18.2.4 */ +if (stp->st_stid.sc_client->cl_minorversion) +memcpy (&close->cl_stateid, &close_stateid, +sizeof (close->cl_stateid)); +/* put reference from nfs4_preprocess_seqid_op */ nfs4_put_stid (&stp->st_stid); out:
Greg Kroah-Hartman
maintainerPATCH 39/67 nfsd: Ensure we check stateid validity in the seqid operation checks
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 9271d7e509c1bfc0b9a418caec29ec8d1ac38270 ]
After taking the stateid st_mutex, we want to know that the stateid still represents valid state before performing any non-idempotent actions.
--- fs/nfsd/nfs4state.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
fs/nfsd/nfs4state.c +3 -9
@@ -5014,15 +5014,9 @@ static __be32 nfs4_seqid_op_checks(struc status =nfsd4_check_seqid (cstate, sop, seqid);if (status)return status; -if (stp->st_stid.sc_type ==NFS4_CLOSED_STID - || stp->st_stid.sc_type ==NFS4_REVOKED_DELEG_STID ) -/* -* "Closed" stateid's exist *only* to return -* nfserr_replay_me from the previous step, and -* revoked delegations are kept only for free_stateid. -*/ -return nfserr_bad_stateid; -mutex_lock (&stp->st_mutex); + status =nfsd4_lock_ol_stateid (stp); +if (status != nfs_ok) +return status; status =check_stateid_generation (stateid, &stp->st_stid.sc_stateid,nfsd4_has_session (cstate));if (status == nfs_ok) status =nfs4_check_fh (current_fh, &stp->st_stid);
Greg Kroah-Hartman
maintainerPATCH 40/67 grace: replace BUG_ON by WARN_ONCE in exit_net hook
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
[ Upstream commit b872285751c1af010e12d02bce7069e2061a58ca ]
--- fs/nfs_common/grace.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/nfs_common/grace.c +3 -1
@@ -104,7 +104,9 @@ grace_exit_net(struct net *net) {struct list_head *grace_list =net_generic (net, grace_net_id); -BUG_ON (!list_empty (grace_list)); +WARN_ONCE (!list_empty (grace_list), +"net %x %s: grace_list is not empty\n" , + net->ns.inum, __func__); }static struct pernet_operations grace_net_ops = {
Greg Kroah-Hartman
maintainerPATCH 41/67 nfsd: check for use of the closed special stateid
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Elble <[email protected]>
[ Upstream commit ae254dac721d44c0bfebe2795df87459e2e88219 ]
Prevent the use of the closed (invalid) special stateid by clients.
--- fs/nfsd/nfs4state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/nfsd/nfs4state.c +5 -2
@@ -72,6 +72,7 @@ static u64 current_sessionid = 1;#define ZERO_STATEID (stateid) (!memcmp((stateid), &zero_stateid, sizeof(stateid_t)))#define ONE_STATEID (stateid) (!memcmp((stateid), &one_stateid, sizeof(stateid_t)))#define CURRENT_STATEID (stateid) (!memcmp((stateid), ¤tstateid, sizeof(stateid_t))) +#define CLOSE_STATEID (stateid) (!memcmp((stateid), &close_stateid, sizeof(stateid_t)))/* forward declarations */ static bool check_for_locks (struct nfs4_file *fp,struct nfs4_lockowner *lowner);
@@ -4704,7 +4705,8 @@ static __be32 nfsd4_validate_stateid(strstruct nfs4_stid *s;__be32 status = nfserr_bad_stateid; -if (ZERO_STATEID (stateid) ||ONE_STATEID (stateid)) +if (ZERO_STATEID (stateid) ||ONE_STATEID (stateid) || +CLOSE_STATEID (stateid))return status;/* Client debugging aid. */ if (!same_clid (&stateid->si_opaque.so_clid, &cl->cl_clientid)) {
@@ -4762,7 +4764,8 @@ nfsd4_lookup_stateid(struct nfsd4_compouelse if (typemask &NFS4_DELEG_STID ) typemask |=NFS4_REVOKED_DELEG_STID ; -if (ZERO_STATEID (stateid) ||ONE_STATEID (stateid)) +if (ZERO_STATEID (stateid) ||ONE_STATEID (stateid) || +CLOSE_STATEID (stateid))return nfserr_bad_stateid; status =lookup_clientid (&stateid->si_opaque.so_clid, cstate, nn);if (status == nfserr_stale_clientid) {
Greg Kroah-Hartman
maintainerPATCH 42/67 lockd: fix "list_add double add" caused by legacy signal interface
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vasily Averin <[email protected]>
[ Upstream commit 81833de1a46edce9ca20cfe079872ac1c20ef359 ]
restart_grace() uses hardcoded init_net.
It can cause to "list_add double add" in following scenario:
1) nfsd and lockd was started in several net namespaces
2) nfsd in init_net was stopped (lockd was not stopped because it have users from another net namespaces)
3) lockd got signal, called restart_grace() -> set_grace_period() and enabled lock_manager in hardcoded init_net.
4) nfsd in init_net is started again,
its lockd_up() calls set_grace_period() and tries to add lock_manager into init_net 2nd time.
Jeff Layton suggest:
"Make it safe to call locks_start_grace multiple times on the same lock_manager. If it's already on the global grace_list, then don't try to add it again. (But we don't intentionally add twice, so for now we WARN about that case.)
With this change, we also need to ensure that the nfsd4 lock manager initializes the list before we call locks_start_grace. While we're at it, move the rest of the nfsd_net initialization into nfs4_state_create_net. I see no reason to have it spread over two functions like it is today."
Suggested patch was updated to generate warning in described situation.
--- fs/nfs_common/grace.c | 6 +++++- fs/nfsd/nfs4state.c | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-)
fs/nfs_common/grace.c +5 -1
@@ -30,7 +30,11 @@ locks_start_grace(struct net *net, strucstruct list_head *grace_list =net_generic (net, grace_net_id);spin_lock (&grace_lock); -list_add (&lm->list, grace_list); +if (list_empty (&lm->list)) +list_add (&lm->list, grace_list); +else +WARN (1 ,"double list_add attempt detected in net %x %s\n" , + net->ns.inum, (net == &init_net) ?"(init_net)" :"" );spin_unlock (&grace_lock); }EXPORT_SYMBOL_GPL (locks_start_grace);
fs/nfsd/nfs4state.c +4 -3
@@ -6792,6 +6792,10 @@ static int nfs4_state_create_net(structINIT_LIST_HEAD (&nn->sessionid_hashtbl[i]); nn->conf_name_tree =RB_ROOT ; nn->unconf_name_tree =RB_ROOT ; + nn->boot_time =get_seconds (); + nn->grace_ended = false; + nn->nfsd4_manager.block_opens = true; +INIT_LIST_HEAD (&nn->nfsd4_manager.list);INIT_LIST_HEAD (&nn->client_lru);INIT_LIST_HEAD (&nn->close_lru);INIT_LIST_HEAD (&nn->del_recall_lru);
@@ -6846,9 +6850,6 @@ nfs4_state_start_net(struct net *net) ret =nfs4_state_create_net (net);if (ret)return ret; - nn->boot_time =get_seconds (); - nn->grace_ended = false; - nn->nfsd4_manager.block_opens = true;locks_start_grace (net, &nn->nfsd4_manager);nfsd4_client_tracking_init (net); printk(KERN_INFO "NFSD: starting %ld-second grace period (net %p)\n",
Greg Kroah-Hartman
maintainerPATCH 43/67 hwmon: (pmbus) Use 64bit math for DIRECT format values
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Lippert <[email protected]>
[ Upstream commit bd467e4eababe4c04272c1e646f066db02734c79 ]
Power values in the 100s of watt range can easily blow past 32bit math limits when processing everything in microwatts.
Use 64bit math instead to avoid these issues on common 32bit ARM BMC platforms.
--- drivers/hwmon/pmbus/pmbus_core.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
drivers/hwmon/pmbus/pmbus_core.c +12 -9
@@ -20,6 +20,7 @@*/ #include <linux/kernel.h> +#include <linux/math64.h> #include <linux/module.h> #include <linux/init.h> #include <linux/err.h>
@@ -476,8 +477,8 @@ static long pmbus_reg2data_linear(structstatic long pmbus_reg2data_direct (struct pmbus_data *data,struct pmbus_sensor *sensor) { -long val = (s16 ) sensor->data; -long m, b,R ; +s64 b, val = (s16 )sensor->data; +s32 m,R ; m = data->info->m[sensor->class]; b = data->info->b[sensor->class];
@@ -505,11 +506,12 @@ static long pmbus_reg2data_direct(structR --; }while (R <0 ) { - val =DIV_ROUND_CLOSEST (val,10 ); + val =div_s64 (val +5LL ,10L );/* round closest */ R ++; } -return (val - b) / m; + val =div_s64 (val - b, m); +return clamp_val (val,LONG_MIN ,LONG_MAX ); }/*
@@ -629,7 +631,8 @@ static u16 pmbus_data2reg_linear(structstatic u16 pmbus_data2reg_direct (struct pmbus_data *data,struct pmbus_sensor *sensor,long val) { -long m, b,R ; +s64 b, val64 = val; +s32 m,R ; m = data->info->m[sensor->class]; b = data->info->b[sensor->class];
@@ -646,18 +649,18 @@ static u16 pmbus_data2reg_direct(structR -=3 ;/* Adjust R and b for data in milli-units */ b *=1000 ; } - val = val * m + b; + val64 = val64 * m + b;while (R >0 ) { - val *=10 ; + val64 *=10 ;R --; }while (R <0 ) { - val =DIV_ROUND_CLOSEST (val,10 ); + val64 =div_s64 (val64 +5LL ,10L );/* round closest */ R ++; } -return val; +return (u16 )clamp_val (val64,S16_MIN ,S16_MAX ); } static u16 pmbus_data2reg_vid(struct pmbus_data *data,
Greg Kroah-Hartman
maintainerPATCH 44/67 net: ethernet: xilinx: Mark XILINX_LL_TEMAC broken on 64-bit
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 15bfe05c8d6386f1a90e9340d15336e85e32aad6 ]
On 64-bit (e.g. powerpc64/allmodconfig):
drivers/net/ethernet/xilinx/ll_temac_main.c: In function 'temac_start_xmit_done':
drivers/net/ethernet/xilinx/ll_temac_main.c:633:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
dev_kfree_skb_irq((struct sk_buff *)cur_p->app4);
^
cdmac_bd.app4 is u32, so it is too small to hold a kernel pointer.
Note that several other fields in struct cdmac_bd are also too small to hold physical addresses on 64-bit platforms.
--- drivers/net/ethernet/xilinx/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/xilinx/Kconfig +1 -0
@@ -34,6 +34,7 @@ config XILINX_AXI_EMAC config XILINX_LL_TEMAC tristate "Xilinx LL TEMAC (LocalLink Tri-mode Ethernet MAC) driver" depends on (PPC || MICROBLAZE) + depends on !64BIT || BROKEN select PHYLIB ---help--- This driver supports the Xilinx 10/100/1000 LocalLink TEMAC
Greg Kroah-Hartman
maintainerPATCH 45/67 quota: Check for register_shrinker() failure.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tetsuo Handa <[email protected]>
[ Upstream commit 88bc0ede8d35edc969350852894dc864a2dc1859 ]
register_shrinker() might return -ENOMEM error since Linux 3.12. Call panic() as with other failure checks in this function if register_shrinker() failed.
--- fs/quota/dquot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/quota/dquot.c +2 -1
@@ -2919,7 +2919,8 @@ static int __init dquot_init(void)pr_info ("VFS: Dquot-cache hash table entries: %ld (order %ld," " %ld bytes)\n" , nr_hash, order, (PAGE_SIZE << order)); -register_shrinker (&dqcache_shrinker); +if (register_shrinker (&dqcache_shrinker)) +panic ("Cannot register dquot shrinker" );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 46/67 SUNRPC: Allow connect to return EHOSTUNREACH
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Trond Myklebust <[email protected]>
[ Upstream commit 4ba161a793d5f43757c35feff258d9f20a082940 ]
--- net/sunrpc/xprtsock.c | 1 + 1 file changed, 1 insertion(+)
net/sunrpc/xprtsock.c +1 -0
@@ -2360,6 +2360,7 @@ static void xs_tcp_setup_socket(struct wcase -ECONNREFUSED :case -ECONNRESET :case -ENETUNREACH : +case -EHOSTUNREACH :case -EADDRINUSE :case -ENOBUFS :/* retry with existing socket, after a delay */
Greg Kroah-Hartman
maintainerPATCH 47/67 kmemleak: add scheduling point to kmemleak_scan()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yisheng Xie <[email protected]>
[ Upstream commit bde5f6bc68db51128f875a756e9082a6c6ff7b4c ]
kmemleak_scan() will scan struct page for each node and it can be really large and resulting in a soft lockup. We have seen a soft lockup when do scan while compile kernel:
watchdog: BUG: soft lockup - CPU#53 stuck for 22s! [bash:10287] [...] Call Trace: kmemleak_scan+0x21a/0x4c0 kmemleak_write+0x312/0x350 full_proxy_write+0x5a/0xa0 __vfs_write+0x33/0x150 vfs_write+0xad/0x1a0 SyS_write+0x52/0xc0 do_syscall_64+0x61/0x1a0 entry_SYSCALL64_slow_path+0x25/0x25
Fix this by adding cond_resched every MAX_SCAN_SIZE.
--- mm/kmemleak.c | 2 ++ 1 file changed, 2 insertions(+)
mm/kmemleak.c +2 -0
@@ -1394,6 +1394,8 @@ static void kmemleak_scan(void)if (page_count (page) ==0 )continue ;scan_block (page, page +1 ,NULL ); +if (!(pfn % (MAX_SCAN_SIZE /sizeof (*page)))) +cond_resched (); } }put_online_mems ();
Greg Kroah-Hartman
maintainerPATCH 48/67 drm/omap: Fix error handling path in omap_dmm_probe()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 8677b1ac2db021ab30bb1fa34f1e56ebe0051ec3 ]
If we don't find a matching device node, we must free the memory allocated in 'omap_dmm' a few lines above.
--- drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/omapdrm/omap_dmm_tiler.c +2 -1
@@ -611,7 +611,8 @@ static int omap_dmm_probe(struct platfor match =of_match_node (dmm_of_match, dev->dev.of_node);if (!match) {dev_err (&dev->dev,"failed to find matching device node\n" ); -return -ENODEV ; + ret = -ENODEV ; + goto fail; } omap_dmm->plat_data = match->data;
Greg Kroah-Hartman
maintainerPATCH 49/67 xfs: ubsan fixes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Darrick J. Wong" <[email protected]>
[ Upstream commit 22a6c83777ac7c17d6c63891beeeac24cf5da450 ]
Fix some complaints from the UBSAN about signed integer addition overflows.
--- fs/xfs/xfs_aops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/xfs/xfs_aops.c +3 -3
@@ -310,7 +310,7 @@ xfs_map_blocks( (ip->i_df.if_flags & XFS_IFEXTENTS));ASSERT (offset <= mp->m_super->s_maxbytes); -if (offset + count > mp->m_super->s_maxbytes) +if ((xfs_ufsize_t )offset + count > mp->m_super->s_maxbytes) count = mp->m_super->s_maxbytes - offset; end_fsb =XFS_B_TO_FSB (mp, (xfs_ufsize_t )offset + count); offset_fsb =XFS_B_TO_FSBT (mp, offset);
@@ -1360,7 +1360,7 @@ xfs_map_trim_size(if (mapping_size > size) mapping_size = size;if (offset <i_size_read (inode) && - offset + mapping_size >=i_size_read (inode)) { + (xfs_ufsize_t )offset + mapping_size >=i_size_read (inode)) {/* limit mapping to block that spans EOF */ mapping_size =roundup_64 (i_size_read (inode) - offset,i_blocksize (inode));
@@ -1416,7 +1416,7 @@ __xfs_get_blocks( }ASSERT (offset <= mp->m_super->s_maxbytes); -if (offset + size > mp->m_super->s_maxbytes) +if ((xfs_ufsize_t )offset + size > mp->m_super->s_maxbytes) size = mp->m_super->s_maxbytes - offset; end_fsb =XFS_B_TO_FSB (mp, (xfs_ufsize_t )offset + size); offset_fsb =XFS_B_TO_FSBT (mp, offset);
Greg Kroah-Hartman
maintainerPATCH 50/67 scsi: aacraid: Prevent crash in case of free interrupt during scsi EH path
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Guilherme G. Piccoli" <[email protected]>
[ Upstream commit e4717292ddebcfe231651b5aff9fa19ca158d178 ]
As part of the scsi EH path, aacraid performs a reinitialization of the adapter, which encompass freeing resources and IRQs, NULLifying lots of pointers, and then initialize it all over again. We've identified a problem during the free IRQ portion of this path if CONFIG_DEBUG_SHIRQ is enabled on kernel config file.
Happens that, in case this flag was set, right after free_irq() effectively clears the interrupt, it checks if it was requested as IRQF_SHARED. In positive case, it performs another call to the IRQ handler on driver. Problem is: since aacraid currently free some resources *before* freeing the IRQ, once free_irq() path calls the handler again (due to CONFIG_DEBUG_SHIRQ), aacraid crashes due to NULL pointer dereference with the following trace:
aac_src_intr_message+0xf8/0x740 [aacraid] __free_irq+0x33c/0x4a0 free_irq+0x78/0xb0 aac_free_irq+0x13c/0x150 [aacraid] aac_reset_adapter+0x2e8/0x970 [aacraid] aac_eh_reset+0x3a8/0x5d0 [aacraid] scsi_try_host_reset+0x74/0x180 scsi_eh_ready_devs+0xc70/0x1510 scsi_error_handler+0x624/0xa20
This patch prevents the crash by changing the order of the deinitialization in this path of aacraid: first we clear the IRQ, then we free other resources. No functional change intended.
--- drivers/scsi/aacraid/commsup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/aacraid/commsup.c +1 -1
@@ -1363,13 +1363,13 @@ static int _aac_reset_adapter(struct aac* will ensure that i/o is queisced and the card is flushed in that * case. */ +aac_free_irq (aac);aac_fib_map_free (aac);pci_free_consistent (aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); aac->comm_addr =NULL ; aac->comm_phys =0 ;kfree (aac->queues); aac->queues =NULL ; -aac_free_irq (aac);kfree (aac->fsa_dev); aac->fsa_dev =NULL ; quirks =aac_get_driver_ident (index)->quirks;
Greg Kroah-Hartman
maintainerPATCH 51/67 scsi: ufs: ufshcd: fix potential NULL pointer dereference in ufshcd_config_vreg
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Gustavo A. R. Silva" <[email protected]>
[ Upstream commit 727535903bea924c4f73abb202c4b3e85fff0ca4 ]
_vreg_ is being dereferenced before it is null checked, hence there is a potential null pointer dereference.
Fix this by moving the pointer dereference after _vreg_ has been null checked.
This issue was detected with the help of Coccinelle.
--- drivers/scsi/ufs/ufshcd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +5 -2
@@ -4392,12 +4392,15 @@ static int ufshcd_config_vreg(struct dev struct ufs_vreg *vreg, bool on) { int ret = 0; -struct regulator *reg = vreg->reg; -const char *name = vreg->name; +struct regulator *reg; +const char *name;int min_uV, uA_load;BUG_ON (!vreg); + reg = vreg->reg; + name = vreg->name; +if (regulator_count_voltages (reg) >0 ) { min_uV = on ? vreg->min_uV :0 ; ret =regulator_set_voltage (reg, min_uV, vreg->max_uV);
Greg Kroah-Hartman
maintainerPATCH 52/67 media: usbtv: add a new usbid
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Icenowy Zheng <[email protected]>
[ Upstream commit 04226916d2360f56d57ad00bc48d2d1854d1e0b0 ]
A new usbid of UTV007 is found in a newly bought device.
The usbid is 1f71:3301.
The ID on the chip is:
UTV007
A89029.1
1520L18K1
Both video and audio is tested with the modified usbtv driver.
--- drivers/media/usb/usbtv/usbtv-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/media/usb/usbtv/usbtv-core.c +1 -0
@@ -127,6 +127,7 @@ static void usbtv_disconnect(struct usb_static struct usb_device_id usbtv_id_table[] = { {USB_DEVICE (0x1b71 ,0x3002 ) }, + {USB_DEVICE (0x1f71 ,0x3301 ) }, {} };MODULE_DEVICE_TABLE (usb, usbtv_id_table);
Greg Kroah-Hartman
maintainerPATCH 53/67 usb: gadget: dont dereference g until after it has been null checked
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit b2fc059fa549fe6881d4c1f8d698b0f50bcd16ec ]
Avoid dereferencing pointer g until after g has been sanity null checked; move the assignment of cdev much later when it is required into a more local scope.
Detected by CoverityScan, CID#1222135 ("Dereference before null check")
--- drivers/usb/gadget/composite.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/gadget/composite.c +5 -2
@@ -104,7 +104,6 @@ int config_ep_by_speed(struct usb_gadgetstruct usb_function *f, struct usb_ep *_ep) { - struct usb_composite_dev *cdev = get_gadget_data(g); struct usb_endpoint_descriptor *chosen_desc = NULL;struct usb_descriptor_header **speed_desc =NULL ;
@@ -176,8 +175,12 @@ ep_found: _ep->maxburst = comp_desc->bMaxBurst +1 ;break ;default : -if (comp_desc->bMaxBurst !=0 ) +if (comp_desc->bMaxBurst !=0 ) { +struct usb_composite_dev *cdev; + + cdev =get_gadget_data (g);ERROR (cdev,"ep0 bMaxBurst must be 0\n" ); + } _ep->maxburst =1 ;break ; }
Greg Kroah-Hartman
maintainerPATCH 54/67 staging: rtl8188eu: Fix incorrect response to SIOCGIWESSID
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
[ Upstream commit b77992d2df9e47144354d1b25328b180afa33442 ]
When not associated with an AP, wifi device drivers should respond to the SIOCGIWESSID ioctl with a zero-length string for the SSID, which is the behavior expected by dhcpcd.
Currently, this driver returns an error code (-1) from the ioctl call, which causes dhcpcd to assume that the device is not a wireless interface and therefore it fails to work correctly with it thereafter.
This problem was reported and tested at
https://github.com/lwfinger/rtl8188eu/issues/234.
--- drivers/staging/rtl8188eu/os_dep/ioctl_linux.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c +4 -10
@@ -1399,19 +1399,13 @@ static int rtw_wx_get_essid(struct net_dif ((check_fwstate (pmlmepriv, _FW_LINKED)) || (check_fwstate (pmlmepriv,WIFI_ADHOC_MASTER_STATE ))) { len = pcur_bss->Ssid.SsidLength; - - wrqu->essid.length = len; -memcpy (extra, pcur_bss->Ssid.Ssid, len); - - wrqu->essid.flags =1 ; }else { - ret =-1 ; - goto exit; + len =0 ; + *extra =0 ; } - -exit: - + wrqu->essid.length = len; + wrqu->essid.flags =1 ;return ret; }
Greg Kroah-Hartman
maintainerPATCH 55/67 usb: option: Add support for FS040U modem
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: OKAMOTO Yoshiaki <[email protected]>
commit 69341bd15018da0a662847e210f9b2380c71e623 upstream.
FS040U modem is manufactured by omega, and sold by Fujisoft. This patch adds ID of the modem to use option1 driver. Interface 3 is used as qmi_wwan, so the interface is ignored.
--- drivers/usb/serial/option.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/serial/option.c +5 -0
@@ -383,6 +383,9 @@ static void option_instat_callback(struc#define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603#define FOUR_G_SYSTEMS_PRODUCT_W100 0x9b01 +/* Fujisoft products */ +#define FUJISOFT_PRODUCT_FS040U 0x9b02 +/* iBall 3.5G connect wireless modem */ #define IBALL_3_5G_CONNECT 0x9605
@@ -1897,6 +1900,8 @@ static const struct usb_device_id option { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W100), .driver_info = (kernel_ulong_t)&four_g_w100_blacklist }, + {USB_DEVICE(LONGCHEER_VENDOR_ID, FUJISOFT_PRODUCT_FS040U), + .driver_info = (kernel_ulong_t)&net_intf3_blacklist}, { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, SPEEDUP_PRODUCT_SU9800, 0xff) }, { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, 0x9801, 0xff), .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
Greg Kroah-Hartman
maintainerPATCH 56/67 USB: serial: pl2303: new device id for Chilitag
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit d08dd3f3dd2ae351b793fc5b76abdbf0fd317b12 upstream.
This adds a new device id for Chilitag devices to the pl2303 driver.
--- drivers/usb/serial/pl2303.c | 1 + drivers/usb/serial/pl2303.h | 1 + 2 files changed, 2 insertions(+)
drivers/usb/serial/pl2303.c +1 -0
@@ -39,6 +39,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ2) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_DCU11) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_RSAQ3) }, + { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_CHILITAG) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_PHAROS) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ALDIGA) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MMX) },
drivers/usb/serial/pl2303.h +1 -0
@@ -17,6 +17,7 @@#define PL2303_PRODUCT_ID_DCU11 0x1234#define PL2303_PRODUCT_ID_PHAROS 0xaaa0#define PL2303_PRODUCT_ID_RSAQ3 0xaaa2 +#define PL2303_PRODUCT_ID_CHILITAG 0xaaa8#define PL2303_PRODUCT_ID_ALDIGA 0x0611#define PL2303_PRODUCT_ID_MMX 0x0612#define PL2303_PRODUCT_ID_GPRS 0x0609
Greg Kroah-Hartman
maintainerPATCH 57/67 USB: cdc-acm: Do not log urb submission errors on disconnect
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit f0386c083c2ce85284dc0b419d7b89c8e567c09f upstream.
When disconnected sometimes the cdc-acm driver logs errors like these:
[20278.039417] cdc_acm 2-2:2.1: urb 9 failed submission with -19 [20278.042924] cdc_acm 2-2:2.1: urb 10 failed submission with -19 [20278.046449] cdc_acm 2-2:2.1: urb 11 failed submission with -19 [20278.049920] cdc_acm 2-2:2.1: urb 12 failed submission with -19 [20278.053442] cdc_acm 2-2:2.1: urb 13 failed submission with -19 [20278.056915] cdc_acm 2-2:2.1: urb 14 failed submission with -19 [20278.060418] cdc_acm 2-2:2.1: urb 15 failed submission with -19
Silence these by not logging errors when the result is -ENODEV.
--- drivers/usb/class/cdc-acm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-acm.c +1 -1
@@ -377,7 +377,7 @@ static int acm_submit_read_urb(struct ac res =usb_submit_urb (acm->read_urbs[index], mem_flags);if (res) { -if (res != -EPERM ) { +if (res != -EPERM && res != -ENODEV ) {dev_err (&acm->data->dev,"%s - usb_submit_urb failed: %d\n" , __func__, res);
Greg Kroah-Hartman
maintainerPATCH 58/67 CDC-ACM: apply quirk for card reader
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit df1cc78a52491f71d8170d513d0f6f114faa1bda upstream.
This devices drops random bytes from messages if you talk to it too fast.
--- drivers/usb/class/cdc-acm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/class/cdc-acm.c +3 -0
@@ -1695,6 +1695,9 @@ static const struct usb_device_id acm_id { USB_DEVICE(0x0ace, 0x1611), /* ZyDAS 56K USB MODEM - new version */ .driver_info =SINGLE_RX_URB ,/* firmware bug */ }, + { USB_DEVICE(0x11ca, 0x0201), /* VeriFone Mx870 Gadget Serial */ + .driver_info = SINGLE_RX_URB, + }, { USB_DEVICE(0x22b8, 0x7000), /* Motorola Q Phone */ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ },
Greg Kroah-Hartman
maintainerPATCH 59/67 USB: serial: io_edgeport: fix possible sleep-in-atomic
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jia-Ju Bai <[email protected]>
commit c7b8f77872c73f69a16528a9eb87afefcccdc18b upstream.
According to drivers/usb/serial/io_edgeport.c, the driver may sleep under a spinlock.
The function call path is:edge_bulk_in_callback (acquire the spinlock)
process_rcvd_data
process_rcvd_status
change_port_settings
send_iosp_ext_cmd
write_cmd_usb
usb_kill_urb --> may sleepTo fix it, the redundant usb_kill_urb() is removed from the error path after usb_submit_urb() fails.
This possible bug is found by my static analysis tool (DSAC) and checked by my code review.
--- drivers/usb/serial/io_edgeport.c | 1 - 1 file changed, 1 deletion(-)
drivers/usb/serial/io_edgeport.c +0 -1
@@ -2219,7 +2219,6 @@ static int write_cmd_usb(struct edgeport/* something went wrong */ dev_err (dev,"%s - usb_submit_urb(write command) failed, status = %d\n" , __func__, status); -usb_kill_urb (urb);usb_free_urb (urb);atomic_dec (&CmdUrbs);return status;
Greg Kroah-Hartman
maintainerPATCH 60/67 usbip: prevent bind loops on devices attached to vhci_hcd
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit ef54cf0c600fb8f5737fb001a9e357edda1a1de8 upstream.
usbip host binds to devices attached to vhci_hcd on the same server when user does attach over localhost or specifies the server as the remote.
usbip attach -r localhost -b busid
or
usbip attach -r servername (or server IP)
Unbind followed by bind works, however device is left in a bad state with accesses via the attached busid result in errors and system hangs during shutdown.
Fix it to check and bail out if the device is already attached to vhci_hcd.
--- tools/usb/usbip/src/usbip_bind.c | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/usb/usbip/src/usbip_bind.c +9 -0
@@ -144,6 +144,7 @@ static int bind_device(char *busid)int rc;struct udev *udev;struct udev_device *dev; +const char *devpath;/* Check whether the device with this bus ID exists. */ udev =udev_new ();
@@ -152,8 +153,16 @@ static int bind_device(char *busid)err ("device with the specified bus ID does not exist" );return -1 ; } + devpath =udev_device_get_devpath (dev);udev_unref (udev); +/* If the device is already attached to vhci_hcd - bail out */ +if (strstr (devpath,USBIP_VHCI_DRV_NAME )) { +err ("bind loop detected: device: %s is attached to %s\n" , + devpath,USBIP_VHCI_DRV_NAME ); +return -1 ; + } + rc =unbind_other (busid);if (rc ==UNBIND_ST_FAILED ) {err ("could not unbind driver from device on busid %s" , busid);
Greg Kroah-Hartman
maintainerPATCH 61/67 usbip: list: dont list devices attached to vhci_hcd
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shuah Khan <[email protected]>
commit ef824501f50846589f02173d73ce3fe6021a9d2a upstream.
usbip host lists devices attached to vhci_hcd on the same server when user does attach over localhost or specifies the server as the remote.
usbip attach -r localhost -b busid
or
usbip attach -r servername (or server IP)
Fix it to check and not list devices that are attached to vhci_hcd.
--- tools/usb/usbip/src/usbip_list.c | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/usb/usbip/src/usbip_list.c +9 -0
@@ -180,6 +180,7 @@ static int list_devices(bool parsable)const char *busid;char product_name[128 ];int ret =-1 ; +const char *devpath;/* Create libudev context. */ udev =udev_new ();
@@ -202,6 +203,14 @@ static int list_devices(bool parsable) path =udev_list_entry_get_name (dev_list_entry); dev =udev_device_new_from_syspath (udev, path); +/* Ignore devices attached to vhci_hcd */ + devpath =udev_device_get_devpath (dev); +if (strstr (devpath,USBIP_VHCI_DRV_NAME )) { +dbg ("Skip the device %s already attached to %s\n" , + devpath,USBIP_VHCI_DRV_NAME ); +continue ; + } +/* Get device information. */ idVendor =udev_device_get_sysattr_value (dev,"idVendor" ); idProduct =udev_device_get_sysattr_value (dev,"idProduct" );
Greg Kroah-Hartman
maintainerPATCH 62/67 USB: serial: simple: add Motorola Tetra driver
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 46fe895e22ab3845515ec06b01eaf1282b342e29 upstream.
Add new Motorola Tetra (simple) driver for Motorola Solutions TETRA PEI devices.
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=0cad ProdID=9011 Rev=24.16 S: Manufacturer=Motorola Solutions Inc. S: Product=Motorola Solutions TETRA PEI interface C: #Ifs= 2 Cfg#= 1 Atr=80 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none) I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
Note that these devices do not support the CDC SET_CONTROL_LINE_STATE request (for any interface).
--- drivers/usb/serial/Kconfig | 1 + drivers/usb/serial/usb-serial-simple.c | 7 +++++++ 2 files changed, 8 insertions(+)
drivers/usb/serial/Kconfig +1 -0
@@ -63,6 +63,7 @@ config USB_SERIAL_SIMPLE - Google USB serial devices - HP4x calculators - a number of Motorola phones + - Motorola Tetra devices - Novatel Wireless GPS receivers - Siemens USB/MPI adapter. - ViVOtech ViVOpay USB device.
drivers/usb/serial/usb-serial-simple.c +7 -0
@@ -80,6 +80,11 @@ DEVICE(vivopay, VIVOPAY_IDS); { USB_DEVICE(0x22b8, 0x2c64) } /* Motorola V950 phone */DEVICE (moto_modem,MOTO_IDS ); +/* Motorola Tetra driver */ +#define MOTOROLA_TETRA_IDS () \ + { USB_DEVICE(0x0cad, 0x9011) }/* Motorola Solutions TETRA PEI */ +DEVICE (motorola_tetra,MOTOROLA_TETRA_IDS ); +/* Novatel Wireless GPS driver */ #define NOVATEL_IDS () \ { USB_DEVICE(0x09d7, 0x0100) }/* NovAtel FlexPack GPS */
@@ -110,6 +115,7 @@ static struct usb_serial_driver * const &google_device, &vivopay_device, &moto_modem_device, + &motorola_tetra_device, &novatel_gps_device, &hp4x_device, &suunto_device,
@@ -125,6 +131,7 @@ static const struct usb_device_id id_tabGOOGLE_IDS (),VIVOPAY_IDS (),MOTO_IDS (), +MOTOROLA_TETRA_IDS (),NOVATEL_IDS (),HP4X_IDS (), SUUNTO_IDS(),
Greg Kroah-Hartman
maintainerPATCH 63/67 usb: f_fs: Prevent gadget unbind if it is already unbound
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hemant Kumar <[email protected]>
commit ce5bf9a50daf2d9078b505aca1cea22e88ecb94a upstream.
Upon usb composition switch there is possibility of ep0 file release happening after gadget driver bind. In case of composition switch from adb to a non-adb composition gadget will never gets bound again resulting into failure of usb device enumeration. Fix this issue by checking FFS_FL_BOUND flag and avoid extra gadget driver unbind if it is already done as part of composition switch.
This fixes adb reconnection error reported on Android running v4.4 and above kernel versions. Verified on Hikey running vanilla v4.15-rc7 + few out of tree Mali patches.
Reviewed-at: https://android-review.googlesource.com/#/c/582632/
--- drivers/usb/gadget/function/f_fs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/gadget/function/f_fs.c +2 -1
@@ -3490,7 +3490,8 @@ static void ffs_closed(struct ffs_data * ci = opts->func_inst.group.cg_item.ci_parent->ci_parent;ffs_dev_unlock (); -unregister_gadget_item (ci); +if (test_bit (FFS_FL_BOUND , &ffs->flags)) +unregister_gadget_item (ci);return ; done:ffs_dev_unlock ();
Greg Kroah-Hartman
maintainerPATCH 64/67 usb: uas: unconditionally bring back host after reset
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit cbeef22fd611c4f47c494b821b2b105b8af970bb upstream.
Quoting Hans:
If we return 1 from our post_reset handler, then our disconnect handler will be called immediately afterwards. Since pre_reset blocks all scsi requests our disconnect handler will then hang in the scsi_remove_host call.
This is esp. bad because our disconnect handler hanging for ever also stops the USB subsys from enumerating any new USB devices, causes commands like lsusb to hang, etc.
In practice this happens when unplugging some uas devices because the hub code may see the device as needing a warm-reset and calls usb_reset_device before seeing the disconnect. In this case uas_configure_endpoints fails with -ENODEV. We do not want to print an error for this, so this commit also silences the shost_printk for -ENODEV.
ENDQUOTE
However, if we do that we better drop any unconditional execution and report to the SCSI subsystem that we have undergone a reset but we are not operational now.
--- drivers/usb/storage/uas.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/usb/storage/uas.c +3 -4
@@ -1052,20 +1052,19 @@ static int uas_post_reset(struct usb_intreturn 0 ; err =uas_configure_endpoints (devinfo); -if (err) { +if (err && err !=ENODEV )shost_printk (KERN_ERR , shost,"%s: alloc streams error %d after reset" , __func__, err); -return 1 ; - } +/* we must unblock the host in every case lest we deadlock */ spin_lock_irqsave (shost->host_lock, flags);scsi_report_bus_reset (shost,0 );spin_unlock_irqrestore (shost->host_lock, flags);scsi_unblock_requests (shost); -return 0 ; +return err ?1 :0 ; }static int uas_suspend (struct usb_interface *intf,pm_message_t message)
Re: [PATCH 4.4 64/67] usb: uas: unconditionally bring back host after reset
Quoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit
cbeef22fd611c4f47c494b821b2b105b8af970bbupstream.
[...]
Quoted 11 lines
drivers/usb/storage/uas.c +0
-0@@ -1052,20 +1052,19 @@ static int uas_post_reset(struct usb_int return 0;
err =uas_configure_endpoints(devinfo);drivers/usb/storage/uas.c +1
-1-if (err) { +if (err && err !=ENODEV )shost_printk(KERN_ERR, shost,
"%s: alloc streams error %d after reset",__func__, err);
[...]
This should be checking for -ENODEV, shouldn't it?
Ben.
Signature · 2 lines
Ben Hutchings Software Developer, Codethink Ltd.
Re: [PATCH 4.4 64/67] usb: uas: unconditionally bring back host after reset
Hi,
Quoted 22 lines · Ben Hutchings
Quoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oliver Neukum <[email protected]>
commit
cbeef22fd611c4f47c494b821b2b105b8af970bbupstream.[...]
Quoted 11 lines
drivers/usb/storage/uas.c +1
-1@@ -1052,20 +1052,19 @@ static int uas_post_reset(struct usb_int return 0; err = uas_configure_endpoints(devinfo); -if (err) { +if (err && err !=ENODEV ) shost_printk(KERN_ERR, shost, "%s: alloc streams error %d after reset", __func__, err);[...]
Quoted 1 line
This should be checking for
-ENODEV, shouldn't it?
Yes you're right, the check should be != -ENODEV.
Oliver can you do a follow-up patch fixing this please?
Regards,
Hans
Greg Kroah-Hartman
maintainerPATCH 65/67 selinux: general protection fault in sock_has_perm
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Salyzyn <[email protected]>
In the absence of commit a4298e4522d6 ("net: add SOCK_RCU_FREE socket flag") and all the associated infrastructure changes to take advantage of a RCU grace period before freeing, there is a heightened possibility that a security check is performed while an ill-timed setsockopt call races in from user space. It then is prudent to null check sk_security, and if the case, reject the permissions.
Because of the nature of this problem, hard to duplicate, no clear path, this patch is a simplified band-aid for stable trees lacking the infrastructure for the series of commits leading up to providing a suitable RCU grace period. This adjustment is orthogonal to infrastructure improvements that may nullify the needed check, but could be added as good code hygiene in all trees.
general protection fault: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 14233 Comm: syz-executor2 Not tainted 4.4.112-g5f6325b #28 task: ffff8801d1095f00 task.stack: ffff8800b5950000 RIP: 0010:[<ffffffff81b69b7e>] [<ffffffff81b69b7e>] sock_has_perm+0x1fe/0x3e0 security/selinux/hooks.c:4069 RSP: 0018:ffff8800b5957ce0 EFLAGS: 00010202 RAX: dffffc0000000000 RBX: 1ffff10016b2af9f RCX: ffffffff81b69b51 RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000010 RBP: ffff8800b5957de0 R08: 0000000000000001 R09: 0000000000000001 R10: 0000000000000000 R11: 1ffff10016b2af68 R12: ffff8800b5957db8 R13: 0000000000000000 R14: ffff8800b7259f40 R15: 00000000000000d7 FS: 00007f72f5ae2700(0000) GS:ffff8801db300000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000a2fa38 CR3: 00000001d7980000 CR4: 0000000000160670 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: ffffffff81b69a1f ffff8800b5957d58 00008000b5957d30 0000000041b58ab3 ffffffff83fc82f2 ffffffff81b69980 0000000000000246 ffff8801d1096770 ffff8801d3165668 ffffffff8157844b ffff8801d1095f00 ffff880000000001 Call Trace: [<ffffffff81b6a19d>] selinux_socket_setsockopt+0x4d/0x80 security/selinux/hooks.c:4338 [<ffffffff81b4873d>] security_socket_setsockopt+0x7d/0xb0 security/security.c:1257 [<ffffffff82df1ac8>] SYSC_setsockopt net/socket.c:1757 [inline] [<ffffffff82df1ac8>] SyS_setsockopt+0xe8/0x250 net/socket.c:1746 [<ffffffff83776499>] entry_SYSCALL_64_fastpath+0x16/0x92 Code: c2 42 9b b6 81 be 01 00 00 00 48 c7 c7 a0 cb 2b 84 e8
f7 2f 6d ff 49 8d 7d 10 48 b8 00 00 00 00 00 fc ff df 48 89
fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e 83 01 00
00 41 8b 75 10 31
RIP [<ffffffff81b69b7e>] sock_has_perm+0x1fe/0x3e0 security/selinux/hooks.c:4069 RSP <ffff8800b5957ce0>
---[ end trace 7b5aaf788fef6174 ]---
--- security/selinux/hooks.c | 2 ++ 1 file changed, 2 insertions(+)
security/selinux/hooks.c +2 -0
@@ -4032,6 +4032,8 @@ static int sock_has_perm(struct task_strstruct lsm_network_audit net = {0 ,};u32 tsid =task_sid (task); +if (!sksec) +return -EFAULT ;if (sksec->sid ==SECINITSID_KERNEL )return 0 ;
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman
maintainerPATCH 66/67 serial: imx: Only wakeup via RTSDEN bit if the system has RTS/CTS
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
commit 38b1f0fb42f772b8c9aac53593883a18ff5eb9d7 upstream.
The wakeup mechanism via RTSDEN bit relies on the system using the RTS/CTS lines, so only allow such wakeup method when the system actually has RTS/CTS support.
--- drivers/tty/serial/imx.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/tty/serial/imx.c +8 -6
@@ -2057,12 +2057,14 @@ static void serial_imx_enable_wakeup(str val &= ~UCR3_AWAKEN ;writel (val, sport->port.membase +UCR3 ); - val =readl (sport->port.membase +UCR1 ); -if (on) - val |=UCR1_RTSDEN ; -else - val &= ~UCR1_RTSDEN ; -writel (val, sport->port.membase +UCR1 ); +if (sport->have_rtscts) { + val =readl (sport->port.membase +UCR1 ); +if (on) + val |=UCR1_RTSDEN ; +else + val &= ~UCR1_RTSDEN ; +writel (val, sport->port.membase +UCR1 ); + } }static int imx_serial_port_suspend_noirq (struct device *dev)
Greg Kroah-Hartman
maintainerPATCH 67/67 spi: imx: do not access registers while clocks disabled
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Agner <[email protected]>
commit d593574aff0ab846136190b1729c151c736727ec upstream.
Since clocks are disabled except during message transfer clocks are also disabled when spi_imx_remove gets called. Accessing registers leads to a freeeze at least on a i.MX 6ULL. Enable clocks before disabling accessing the MXC_CSPICTRL register.
--- drivers/spi/spi-imx.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/spi/spi-imx.c +13 -2
@@ -1228,12 +1228,23 @@ static int spi_imx_remove(struct platfor {struct spi_master *master =platform_get_drvdata (pdev);struct spi_imx_data *spi_imx =spi_master_get_devdata (master); +int ret;spi_bitbang_stop (&spi_imx->bitbang); + ret =clk_enable (spi_imx->clk_per); +if (ret) +return ret; + + ret =clk_enable (spi_imx->clk_ipg); +if (ret) { +clk_disable (spi_imx->clk_per); +return ret; + } +writel (0 , spi_imx->base +MXC_CSPICTRL ); -clk_unprepare (spi_imx->clk_ipg); -clk_unprepare (spi_imx->clk_per); +clk_disable_unprepare (spi_imx->clk_ipg); +clk_disable_unprepare (spi_imx->clk_per);spi_imx_sdma_exit (spi_imx);spi_master_put (master);
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.115 release. There are 67 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 Sun Feb 4 14:07:31 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.115-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Merged, compiled, and flashed onto my Pixel 2 XL.
One minor conflict in drivers/usb/gadget/function/f_fs.c since commit d567071acc75 ("usb: f_fs: Prevent gadget unbind if it is already unbound") is already present in a different form.
No initial issues noticed in general usage or dmesg.
Reference trees for other Android users:
https://github.com/android-linux-stable
Thanks!
Nathan
Greg Kroah-Hartman
maintainerQuoted 22 lines · Nathan Chancellor
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.115 release. There are 67 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 Sun Feb 4 14:07:31 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.115-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Merged, compiled, and flashed onto my Pixel 2 XL.
Quoted 8 lines
One minor conflict in
drivers/usb/gadget/function/f_fs.csince commitd567071acc75("usb:f_fs: Prevent gadget unbind if it is already unbound") is already present in a different form.No initial issues noticed in general usage or dmesg.
Reference trees for other Android users:
https://github.com/android-linux-stable
Great, thanks for testing and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.115 release. There are 67 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 Sun Feb 4 14:07:31 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.115-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.115 release. There are 67 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 8 lines
Responses should be made by Sun Feb 4 14:07:31 UTC 2018. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.115-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.
Results from Linaro’s test farm.
No regressions on arm64, arm and x86_64.
Regarding bpf, I ran the bpf kselftests manually on arm64 and arm32 and they both passed, but there are only two in 4.4:
- net/test_bpf.sh
- seccomp/seccomp_bpf
Summary
------------------------------------------------------------------------
kernel: 4.4.115-rc1
git repo:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.4.y
git commit: 4b03f2681e21018655a0b84a348f4f152dfaa74e git describe: v4.4.114-68-g4b03f2681e21
Test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.4-oe/build/v4.4.114-68-g4b03f2681e21
No regressions (compared to build v4.4.114-55-g36818c5413e0)
Boards, architectures and test suites:
-------------------------------------
juno-r2 - arm64
* boot - pass: 20,
* kselftest - pass: 33, skip: 28,
* libhugetlbfs - pass: 90, skip: 1,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 10,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 984, skip: 124,
* ltp-timers-tests - pass: 12,
x15 - arm
* boot - pass: 20,
* kselftest - pass: 32, skip: 28,
* libhugetlbfs - pass: 87, skip: 1,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 20, skip: 2,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 13, skip: 1,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1037, skip: 67,
* ltp-timers-tests - pass: 12,
x86_64
* boot - pass: 20,
* kselftest - pass: 45, skip: 31,
* libhugetlbfs - pass: 90, skip: 1,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 64,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 61, skip: 1,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 22,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 9, skip: 1,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 1015, skip: 117,
* ltp-timers-tests - pass: 12,
Summary
------------------------------------------------------------------------
kernel: 4.4.115-rc1
git repo: https://git.linaro.org/lkft/arm64-stable-rc.git
git tag: 4.4.115-rc1-hikey-20180202-124
git commit: c7f481905806190d02c71cd5fb46503dda795498 git describe: 4.4.115-rc1-hikey-20180202-124 Test details:
https://qa-reports.linaro.org/lkft/linaro-hikey-stable-rc-4.4-oe/build/4.4.115-rc1-hikey-20180202-124
No regressions (compared to build 4.4.115-rc1-hikey-20180201-123)
Boards, architectures and test suites:
-------------------------------------
hi6220-hikey - arm64
* boot - pass: 20,
* kselftest - pass: 30, skip: 31,
* libhugetlbfs - pass: 90, skip: 1,
* ltp-cap_bounds-tests - pass: 2,
* ltp-containers-tests - pass: 28, skip: 36,
* ltp-fcntl-locktests-tests - pass: 2,
* ltp-filecaps-tests - pass: 2,
* ltp-fs-tests - pass: 60,
* ltp-fs_bind-tests - pass: 2,
* ltp-fs_perms_simple-tests - pass: 19,
* ltp-fsx-tests - pass: 2,
* ltp-hugetlb-tests - pass: 21, skip: 1,
* ltp-io-tests - pass: 3,
* ltp-ipc-tests - pass: 9,
* ltp-math-tests - pass: 11,
* ltp-nptl-tests - pass: 2,
* ltp-pty-tests - pass: 4,
* ltp-sched-tests - pass: 10,
* ltp-securebits-tests - pass: 4,
* ltp-syscalls-tests - pass: 981, skip: 124,
* ltp-timers-tests - pass: 12,
--
Linaro QA (beta)
https://qa-reports.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.115 release. There are 67 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 Sun Feb 4 14:07:31 UTC 2018. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 118 pass: 118 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 6 lines · Guenter Roeck
Quoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.115 release. There are 67 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 6 lines
Quoted 3 lines
Responses should be made by Sun Feb 4 14:07:31 UTC 2018. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0
Really? 0-day is saying there's an issue with i386, but that must just be a build warning, so I'll not worry about it :)
Thanks for testing all of these and letting me know.
greg k-h