Linux 4.4.61
Greg KH
maintainerI'm announcing the release of the 4.4.61 kernel.
All users of the 4.4 kernel series must upgrade.
The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.4.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/arm/kvm/mmu.c | 13 - arch/metag/include/asm/uaccess.h | 15 - arch/metag/lib/usercopy.c | 312 +++++++++++-------------------- arch/mips/Kconfig | 2 arch/mips/include/asm/spinlock.h | 8 arch/mips/lantiq/xway/sysctrl.c | 2 arch/mips/mm/tlbex.c | 25 ++ arch/mips/ralink/rt3883.c | 4 arch/nios2/kernel/prom.c | 7 arch/nios2/kernel/setup.c | 3 arch/powerpc/kernel/align.c | 27 +- arch/powerpc/mm/hash_native_64.c | 7 arch/s390/boot/compressed/misc.c | 35 +-- arch/s390/include/asm/uaccess.h | 2 drivers/gpu/drm/ttm/ttm_object.c | 10 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 79 ++++--- drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c | 4 drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 4 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 31 +-- drivers/iio/gyro/bmg160_core.c | 12 + drivers/staging/android/ashmem.c | 1 fs/cifs/smb2pdu.c | 4 fs/sysfs/file.c | 6 include/drm/ttm/ttm_object.h | 5 kernel/ptrace.c | 14 - kernel/trace/ring_buffer.c | 8 mm/mempolicy.c | 20 - 28 files changed, 344 insertions(+), 318 deletions(-)
Chris Salls (1):
mm/mempolicy.c: fix error handling in set_mempolicy and mbind.
Frederic Barrat (1):
powerpc/mm: Add missing global TLB invalidate if cxl is active
Greg Kroah-Hartman (1):
Linux 4.4.61
Hauke Mehrtens (1):
MIPS: Lantiq: fix missing xbar kernel panic
Heiko Carstens (1):
s390/uaccess: get_user() should zero on failure (again)
Huacai Chen (1):
MIPS: Flush wrong invalid FTLB entry for huge page
James Hogan (8):
metag/usercopy: Drop unused macros metag/usercopy: Fix alignment error checking metag/usercopy: Add early abort to copy_to_user metag/usercopy: Zero rest of buffer from copy_from_user metag/usercopy: Set flags before ADDZ metag/usercopy: Fix src fixup in from user rapf loops metag/usercopy: Add missing fixups
MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels
Jan-Marek Glogowski (1):
Reset TreeId to zero on SMB2 TREE_CONNECT
John Crispin (1):
MIPS: ralink: Fix typos in rt3883 pinctrl
Li Qiang (1):
drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl()
Marc Zyngier (2):
arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm arm/arm64: KVM: Take mmap_sem in kvm_arch_prepare_memory_region
Marcelo Henrique Cerri (1):
s390/decompressor: fix initrd corruption caused by bss clear
Murray McAllister (2):
drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl() drm/vmwgfx: avoid calling vzalloc with a 0 size in vmw_get_cap_3d_ioctl()
NeilBrown (1):
sysfs: be careful of error returns from ops->show()
Paul Burton (1):
MIPS: End spinlocks with .insn
Paul Mackerras (1):
powerpc: Don't try to fix up misaligned load-with-reservation instructions
Quentin Schulz (1):
iio: bmg160: reset chip when probing
Shuxiao Zhang (1):
staging: android: ashmem: lseek failed due to no FMODE_LSEEK.
Thomas Hellstrom (3):
drm/vmwgfx: Type-check lookups of fence objects
drm/ttm, drm/vmwgfx: Relax permission checking when opening surfaces drm/vmwgfx: Remove getparam error message
Tobias Klauser (1):
nios2: reserve boot memory for device tree
Wei Yongjun (1):
ring-buffer: Fix return value check in test_ringbuffer()
[email protected] (1):
ptrace: fix PTRACE_LISTEN race corrupting task->state
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 4 -SUBLEVEL = 60 +SUBLEVEL = 61 EXTRAVERSION = NAME = Blurry Fish Butt
arch/arm/kvm/mmu.c +10 -3
@@ -796,6 +796,7 @@ void stage2_unmap_vm(struct kvm *kvm)int idx; idx =srcu_read_lock (&kvm->srcu); +down_read (¤t->mm->mmap_sem);spin_lock (&kvm->mmu_lock); slots =kvm_memslots (kvm);
@@ -803,6 +804,7 @@ void stage2_unmap_vm(struct kvm *kvm)stage2_unmap_memslot (kvm, memslot);spin_unlock (&kvm->mmu_lock); +up_read (¤t->mm->mmap_sem);srcu_read_unlock (&kvm->srcu, idx); }
@@ -1759,6 +1761,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, (KVM_PHYS_SIZE >> PAGE_SHIFT))return -EFAULT ; +down_read (¤t->mm->mmap_sem);/* * A memory region could potentially cover multiple VMAs, and any holes * between them, so iterate over all of them to find out if we can map
@@ -1802,8 +1805,10 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, pa += vm_start - vma->vm_start;/* IO region dirty page logging not allowed */ -if (memslot->flags &KVM_MEM_LOG_DIRTY_PAGES ) -return -EINVAL ; +if (memslot->flags &KVM_MEM_LOG_DIRTY_PAGES ) { + ret = -EINVAL ; + goto out; + } ret = kvm_phys_addr_ioremap(kvm, gpa, pa, vm_end - vm_start,
@@ -1815,7 +1820,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, }while (hva < reg_end);if (change ==KVM_MR_FLAGS_ONLY ) -return ret; + goto out;spin_lock (&kvm->mmu_lock);if (ret)
@@ -1823,6 +1828,8 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,else stage2_flush_memslot (kvm, memslot);spin_unlock (&kvm->mmu_lock); +out: +up_read (¤t->mm->mmap_sem);return ret; }
arch/metag/include/asm/uaccess.h +8 -7
@@ -197,20 +197,21 @@ extern long __must_check strnlen_user(const char __user *src, long count);#define strlen_user (str) strnlen_user(str, 32767) -extern unsigned long __must_check __copy_user_zeroing (void *to, -const void __user *from, -unsigned long n); +extern unsigned long raw_copy_from_user (void *to,const void __user *from, +unsigned long n);static inline unsigned long copy_from_user (void *to,const void __user *from,unsigned long n) { +unsigned long res = n;if (likely (access_ok (VERIFY_READ , from, n))) -return __copy_user_zeroing (to, from, n); -memset (to,0 , n); -return n; + res =raw_copy_from_user (to, from, n); +if (unlikely (res)) +memset (to + (n - res),0 , res); +return res; } -#define __copy_from_user (to, from, n) __copy_user_zeroing(to, from, n) +#define __copy_from_user (to, from, n) raw_copy_from_user(to, from, n)#define __copy_from_user_inatomic __copy_from_user extern unsigned long __must_check __copy_user(void __user *to,
arch/metag/lib/usercopy.c +120 -192
562 lines not on this page · raw message
arch/mips/Kconfig +1 -1
@@ -1412,7 +1412,7 @@ config CPU_MIPS32_R6 select CPU_SUPPORTS_MSA select GENERIC_CSUM select HAVE_KVM - select MIPS_O32_FP64_SUPPORT + select MIPS_O32_FP64_SUPPORT if 32BIT help Choose this option to build a kernel for release 6 or later of the MIPS32 architecture. New MIPS processors, starting with the Warrior
arch/mips/include/asm/spinlock.h +4 -4
@@ -112,7 +112,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)" andi %[ticket], %[ticket], 0xffff \n" " bne %[ticket], %[my_ticket], 4f \n" " subu %[ticket], %[my_ticket], %[ticket] \n" -"2: \n" +"2: .insn \n" " .subsection 2 \n" "4: andi %[ticket], %[ticket], 0xffff \n" " sll %[ticket], 5 \n"
@@ -187,7 +187,7 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock)" sc %[ticket], %[ticket_ptr] \n" " beqz %[ticket], 1b \n" " li %[ticket], 1 \n" -"2: \n" +"2: .insn \n" " .subsection 2 \n" "3: b 2b \n" " li %[ticket], 0 \n"
@@ -367,7 +367,7 @@ static inline int arch_read_trylock(arch_rwlock_t *rw) " .set reorder \n" __WEAK_LLSC_MB " li %2, 1 \n" - "2: \n" + "2: .insn \n" : "=" GCC_OFF_SMALL_ASM() (rw->lock), "=&r" (tmp), "=&r" (ret) : GCC_OFF_SMALL_ASM() (rw->lock) : "memory");
@@ -407,7 +407,7 @@ static inline int arch_write_trylock(arch_rwlock_t *rw) " lui %1, 0x8000 \n" " sc %1, %0 \n" " li %2, 1 \n" - "2: \n" + "2: .insn \n" : "=" GCC_OFF_SMALL_ASM() (rw->lock), "=&r" (tmp), "=&r" (ret) : GCC_OFF_SMALL_ASM() (rw->lock)
arch/mips/lantiq/xway/sysctrl.c +1 -1
@@ -467,7 +467,7 @@ void __init ltq_soc_init(void)if (!np_xbar)panic ("Failed to load xbar nodes from devicetree" ); -if (of_address_to_resource (np_pmu,0 , &res_xbar)) +if (of_address_to_resource (np_xbar,0 , &res_xbar))panic ("Failed to get xbar resources" );if (request_mem_region (res_xbar.start,resource_size (&res_xbar), res_xbar.name) <0 )
arch/mips/mm/tlbex.c +21 -4
@@ -757,7 +757,8 @@ static void build_huge_update_entries(u32 **p, unsigned int pte,static void build_huge_handler_tail (u32 **p,struct uasm_reloc **r,struct uasm_label **l,unsigned int pte, -unsigned int ptr) +unsigned int ptr, +unsigned int flush) {#ifdef CONFIG_SMP UASM_i_SC (p, pte,0 , ptr);
@@ -766,6 +767,22 @@ static void build_huge_handler_tail(u32 **p, struct uasm_reloc **r,#else UASM_i_SW (p, pte,0 , ptr);#endif +if (cpu_has_ftlb && flush) { +BUG_ON (!cpu_has_tlbinv); + +UASM_i_MFC0 (p, ptr,C0_ENTRYHI ); +uasm_i_ori (p, ptr, ptr,MIPS_ENTRYHI_EHINV ); +UASM_i_MTC0 (p, ptr,C0_ENTRYHI ); +build_tlb_write_entry (p, l, r, tlb_indexed); + +uasm_i_xori (p, ptr, ptr,MIPS_ENTRYHI_EHINV ); +UASM_i_MTC0 (p, ptr,C0_ENTRYHI ); +build_huge_update_entries (p, pte, ptr); +build_huge_tlb_write_entry (p, l, r, pte, tlb_random,0 ); + +return ; + } +build_huge_update_entries (p, pte, ptr);build_huge_tlb_write_entry (p, l, r, pte, tlb_indexed,0 ); }
@@ -2082,7 +2099,7 @@ static void build_r4000_tlb_load_handler(void) uasm_l_tlbl_goaround2(&l, p); }uasm_i_ori (&p, wr.r1, wr.r1, (_PAGE_ACCESSED | _PAGE_VALID)); -build_huge_handler_tail (&p, &r, &l, wr.r1, wr.r2); +build_huge_handler_tail (&p, &r, &l, wr.r1, wr.r2,1 );#endif uasm_l_nopage_tlbl (&l, p);
@@ -2137,7 +2154,7 @@ static void build_r4000_tlb_store_handler(void)build_tlb_probe_entry (&p);uasm_i_ori (&p, wr.r1, wr.r1, _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_VALID | _PAGE_DIRTY); -build_huge_handler_tail (&p, &r, &l, wr.r1, wr.r2); +build_huge_handler_tail (&p, &r, &l, wr.r1, wr.r2,1 );#endif uasm_l_nopage_tlbs (&l, p);
@@ -2193,7 +2210,7 @@ static void build_r4000_tlb_modify_handler(void)build_tlb_probe_entry (&p);uasm_i_ori (&p, wr.r1, wr.r1, _PAGE_ACCESSED | _PAGE_MODIFIED | _PAGE_VALID | _PAGE_DIRTY); -build_huge_handler_tail (&p, &r, &l, wr.r1, wr.r2); +build_huge_handler_tail (&p, &r, &l, wr.r1, wr.r2,0 );#endif uasm_l_nopage_tlbm (&l, p);
arch/mips/ralink/rt3883.c +2 -2
@@ -36,7 +36,7 @@ static struct rt2880_pmx_func uartlite_func[] = { FUNC("uartlite", 0, 15, 2) };static struct rt2880_pmx_func jtag_func[] = {FUNC ("jtag" ,0 ,17 ,5 ) };static struct rt2880_pmx_func mdio_func[] = {FUNC ("mdio" ,0 ,22 ,2 ) };static struct rt2880_pmx_func lna_a_func[] = {FUNC ("lna a" ,0 ,32 ,3 ) }; -static struct rt2880_pmx_func lna_g_func[] = {FUNC ("lna a" ,0 ,35 ,3 ) }; +static struct rt2880_pmx_func lna_g_func[] = {FUNC ("lna g" ,0 ,35 ,3 ) };static struct rt2880_pmx_func pci_func[] = {FUNC ("pci-dev" ,0 ,40 ,32 ),FUNC ("pci-host2" ,1 ,40 ,32 ),
@@ -44,7 +44,7 @@ static struct rt2880_pmx_func pci_func[] = {FUNC ("pci-fnc" ,3 ,40 ,32 ) };static struct rt2880_pmx_func ge1_func[] = {FUNC ("ge1" ,0 ,72 ,12 ) }; -static struct rt2880_pmx_func ge2_func[] = {FUNC ("ge1" ,0 ,84 ,12 ) }; +static struct rt2880_pmx_func ge2_func[] = {FUNC ("ge2" ,0 ,84 ,12 ) };static struct rt2880_pmx_group rt3883_pinmux_data[] = {GRP ("i2c" , i2c_func,1 ,RT3883_GPIO_MODE_I2C ),
arch/nios2/kernel/prom.c +7 -0
@@ -48,6 +48,13 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)return alloc_bootmem_align (size, align); } +int __init early_init_dt_reserve_memory_arch (phys_addr_t base,phys_addr_t size, +bool nomap) +{ +reserve_bootmem (base, size,BOOTMEM_DEFAULT ); +return 0 ; +} +void __init early_init_devtree (void *params) {__be32 *dtb = (u32 *)__dtb_start;
arch/nios2/kernel/setup.c +3 -0
@@ -195,6 +195,9 @@ void __init setup_arch(char **cmdline_p) }#endif /* CONFIG_BLK_DEV_INITRD */ +early_init_fdt_reserve_self (); +early_init_fdt_scan_reserved_mem (); +unflatten_and_copy_device_tree ();setup_cpuinfo ();
arch/powerpc/kernel/align.c +19 -8
@@ -808,14 +808,25 @@ int fix_alignment(struct pt_regs *regs) nb = aligninfo[instr].len; flags = aligninfo[instr].flags; -/* ldbrx/stdbrx overlap lfs/stfs in the DSISR unfortunately */ -if (IS_XFORM (instruction) && ((instruction >>1 ) &0x3ff ) ==532 ) { - nb =8 ; - flags =LD +SW ; - }else if (IS_XFORM (instruction) && - ((instruction >>1 ) &0x3ff ) ==660 ) { - nb =8 ; - flags =ST +SW ; +/* +* Handle some cases which give overlaps in the DSISR values. +*/ +if (IS_XFORM (instruction)) { +switch (get_xop (instruction)) { +case 532 :/* ldbrx */ + nb =8 ; + flags =LD +SW ; +break ; +case 660 :/* stdbrx */ + nb =8 ; + flags =ST +SW ; +break ; +case 20 :/* lwarx */ +case 84 :/* ldarx */ +case 116 :/* lharx */ +case 276 :/* lqarx */ +return 0 ;/* not emulated ever */ + } }/* Byteswap little endian loads and stores */
arch/powerpc/mm/hash_native_64.c +5 -2
@@ -645,6 +645,10 @@ static void native_flush_hash_range(unsigned long number, int local)unsigned long psize = batch->psize;int ssize = batch->ssize;int i; +unsigned int use_local; + + use_local = local &&mmu_has_feature (MMU_FTR_TLBIEL ) && + mmu_psize_defs[psize].tlbiel && !cxl_ctx_in_use ();local_irq_save (flags);
@@ -671,8 +675,7 @@ static void native_flush_hash_range(unsigned long number, int local) }pte_iterate_hashed_end (); } -if (mmu_has_feature (MMU_FTR_TLBIEL ) && - mmu_psize_defs[psize].tlbiel && local) { +if (use_local) { asmvolatile ("ptesync" :::"memory" );for (i =0 ; i < number; i++) { vpn = batch->vpn[i];
arch/s390/boot/compressed/misc.c +19 -16
@@ -141,31 +141,34 @@ static void check_ipl_parmblock(void *start, unsigned long size)unsigned long decompress_kernel (void ) { -unsigned long output_addr; -unsigned char *output; +void *output, *kernel_end; - output_addr = ((unsigned long ) &_end +HEAP_SIZE +4095UL ) &-4096UL ; -check_ipl_parmblock ((void *)0 , output_addr + SZ__bss_start); -memset (&_bss,0 , &_ebss - &_bss); - free_mem_ptr = (unsigned long )&_end; - free_mem_end_ptr = free_mem_ptr +HEAP_SIZE ; - output = (unsigned char *) output_addr; + output = (void *)ALIGN ((unsigned long ) &_end +HEAP_SIZE ,PAGE_SIZE ); + kernel_end = output + SZ__bss_start; +check_ipl_parmblock ((void *)0 , (unsigned long ) kernel_end);#ifdef CONFIG_BLK_DEV_INITRD /* * Move the initrd right behind the end of the decompressed -* kernel image. +* kernel image. This also prevents initrd corruption caused by +* bss clearing since kernel_end will always be located behind the +* current bss section.. */ -if (INITRD_START &&INITRD_SIZE && -INITRD_START < (unsigned long ) output + SZ__bss_start) { -check_ipl_parmblock (output + SZ__bss_start, -INITRD_START +INITRD_SIZE ); -memmove (output + SZ__bss_start, - (void *)INITRD_START ,INITRD_SIZE ); -INITRD_START = (unsigned long ) output + SZ__bss_start; +if (INITRD_START &&INITRD_SIZE && kernel_end > (void *)INITRD_START ) { +check_ipl_parmblock (kernel_end,INITRD_SIZE ); +memmove (kernel_end, (void *)INITRD_START ,INITRD_SIZE ); +INITRD_START = (unsigned long ) kernel_end; }#endif +/* +* Clear bss section. free_mem_ptr and free_mem_end_ptr need to be +* initialized afterwards since they reside in bss. +*/ +memset (&_bss,0 , &_ebss - &_bss); + free_mem_ptr = (unsigned long ) &_end; + free_mem_end_ptr = free_mem_ptr +HEAP_SIZE ; +puts ("Uncompressing Linux... " );__decompress (input_data, input_len,NULL ,NULL , output,0 ,NULL , error);puts ("Ok, booting the kernel.\n" );
arch/s390/include/asm/uaccess.h +1 -1
@@ -150,7 +150,7 @@ unsigned long __must_check __copy_to_user(void __user *to, const void *from," jg 2b\n" \".popsection\n" \ EX_TABLE(0b,3b) EX_TABLE(1b,3b) \ - : "=d" (__rc), "=Q" (*(to)) \ + : "=d" (__rc), "+Q" (*(to)) \: " d" (size), " Q " (*(from)), \ " d" (__reg0), " K " (-EFAULT) \ : " cc"); \
drivers/gpu/drm/ttm/ttm_object.c +7 -3
@@ -179,7 +179,7 @@ int ttm_base_object_init(struct ttm_object_file *tfile,if (unlikely (ret !=0 )) goto out_err0; - ret =ttm_ref_object_add (tfile, base,TTM_REF_USAGE ,NULL ); + ret =ttm_ref_object_add (tfile, base,TTM_REF_USAGE ,NULL , false);if (unlikely (ret !=0 )) goto out_err1;
@@ -318,7 +318,8 @@ EXPORT_SYMBOL(ttm_ref_object_exists);int ttm_ref_object_add (struct ttm_object_file *tfile,struct ttm_base_object *base, -enum ttm_ref_type ref_type,bool *existed) +enum ttm_ref_type ref_type,bool *existed, +bool require_existed) {struct drm_open_hash *ht = &tfile->ref_hash[ref_type];struct ttm_ref_object *ref;
@@ -345,6 +346,9 @@ int ttm_ref_object_add(struct ttm_object_file *tfile, }rcu_read_unlock (); +if (require_existed) +return -EPERM ; + ret =ttm_mem_global_alloc (mem_glob,sizeof (*ref), false, false);if (unlikely (ret !=0 ))
@@ -635,7 +639,7 @@ int ttm_prime_fd_to_handle(struct ttm_object_file *tfile, prime = (struct ttm_prime_object *) dma_buf->priv; base = &prime->base; *handle = base->hash.key; - ret =ttm_ref_object_add (tfile, base,TTM_REF_USAGE ,NULL ); + ret =ttm_ref_object_add (tfile, base,TTM_REF_USAGE ,NULL , false);dma_buf_put (dma_buf);
drivers/gpu/drm/vmwgfx/vmwgfx_fence.c +50 -29
127 lines not on this page · raw message
drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +1 -3
@@ -114,8 +114,6 @@ int vmw_getparam_ioctl(struct drm_device *dev, void *data, param->value = dev_priv->has_dx;break ;default : -DRM_ERROR ("Illegal vmwgfx get param request: %d\n" , - param->param);return -EINVAL ; }
@@ -186,7 +184,7 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data,bool gb_objects = !!(dev_priv->capabilities &SVGA_CAP_GBOBJECTS );struct vmw_fpriv *vmw_fp =vmw_fpriv (file_priv); -if (unlikely (arg->pad64 !=0 )) { +if (unlikely (arg->pad64 !=0 || arg->max_size ==0 )) {DRM_ERROR ("Illegal GET_3D_CAP argument.\n" );return -EINVAL ; }
drivers/gpu/drm/vmwgfx/vmwgfx_resource.c +2 -2
@@ -591,7 +591,7 @@ static int vmw_user_dmabuf_synccpu_grab(struct vmw_user_dma_buffer *user_bo,return ret; ret =ttm_ref_object_add (tfile, &user_bo->prime.base, -TTM_REF_SYNCCPU_WRITE , &existed); +TTM_REF_SYNCCPU_WRITE , &existed, false);if (ret !=0 || existed)ttm_bo_synccpu_write_release (&user_bo->dma.base);
@@ -775,7 +775,7 @@ int vmw_user_dmabuf_reference(struct ttm_object_file *tfile, *handle = user_bo->prime.base.hash.key;return ttm_ref_object_add (tfile, &user_bo->prime.base, -TTM_REF_USAGE ,NULL ); +TTM_REF_USAGE ,NULL , false); }/*
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +15 -16
@@ -715,11 +715,14 @@ int vmw_surface_define_ioctl(struct drm_device *dev, void *data,128 ; num_sizes =0 ; -for (i =0 ; i <DRM_VMW_MAX_SURFACE_FACES ; ++i) +for (i =0 ; i <DRM_VMW_MAX_SURFACE_FACES ; ++i) { +if (req->mip_levels[i] >DRM_VMW_MAX_MIP_LEVELS ) +return -EINVAL ; num_sizes += req->mip_levels[i]; + } -if (num_sizes >DRM_VMW_MAX_SURFACE_FACES * -DRM_VMW_MAX_MIP_LEVELS ) +if (num_sizes >DRM_VMW_MAX_SURFACE_FACES *DRM_VMW_MAX_MIP_LEVELS || + num_sizes ==0 )return -EINVAL ; size = vmw_user_surface_size + 128 +
@@ -904,17 +907,16 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,uint32_t handle;struct ttm_base_object *base;int ret; +bool require_exist = false;if (handle_type ==DRM_VMW_HANDLE_PRIME ) { ret =ttm_prime_fd_to_handle (tfile, u_handle, &handle);if (unlikely (ret !=0 ))return ret; }else { -if (unlikely (drm_is_render_client (file_priv))) { -DRM_ERROR ("Render client refused legacy " -"surface reference.\n" ); -return -EACCES ; - } +if (unlikely (drm_is_render_client (file_priv))) + require_exist = true; +if (ACCESS_ONCE (vmw_fpriv (file_priv)->locked_master)) {DRM_ERROR ("Locked master refused legacy " "surface reference.\n" );
@@ -942,17 +944,14 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,/* * Make sure the surface creator has the same -* authenticating master. +* authenticating master, or is already registered with us. */ if (drm_is_primary_client (file_priv) && - user_srf->master != file_priv->master) { -DRM_ERROR ("Trying to reference surface outside of" -" master domain.\n" ); - ret = -EACCES ; - goto out_bad_resource; - } + user_srf->master != file_priv->master) + require_exist = true; - ret =ttm_ref_object_add (tfile, base,TTM_REF_USAGE ,NULL ); + ret =ttm_ref_object_add (tfile, base,TTM_REF_USAGE ,NULL , + require_exist);if (unlikely (ret !=0 )) {DRM_ERROR ("Could not add a reference to a surface.\n" ); goto out_bad_resource;
drivers/iio/gyro/bmg160_core.c +12 -0
@@ -28,6 +28,7 @@#include <linux/iio/trigger_consumer.h> #include <linux/iio/triggered_buffer.h> #include <linux/regmap.h> +#include <linux/delay.h> #include "bmg160.h" #define BMG160_IRQ_NAME "bmg160_event"
@@ -53,6 +54,9 @@#define BMG160_NO_FILTER 0#define BMG160_DEF_BW 100 +#define BMG160_GYRO_REG_RESET 0x14 +#define BMG160_GYRO_RESET_VAL 0xb6 +#define BMG160_REG_INT_MAP_0 0x17#define BMG160_INT_MAP_0_BIT_ANY BIT(1)
@@ -186,6 +190,14 @@ static int bmg160_chip_init(struct bmg160_data *data)int ret;unsigned int val; +/* +* Reset chip to get it in a known good state. A delay of 30ms after +* reset is required according to the datasheet. +*/ +regmap_write (data->regmap,BMG160_GYRO_REG_RESET , +BMG160_GYRO_RESET_VAL ); +usleep_range (30000 ,30700 ); + ret =regmap_read (data->regmap,BMG160_REG_CHIP_ID , &val);if (ret <0 ) {dev_err (data->dev,"Error reading reg_chip_id\n" );
drivers/staging/android/ashmem.c +1 -0
@@ -392,6 +392,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma) ret =PTR_ERR (vmfile); goto out; } + vmfile->f_mode |=FMODE_LSEEK ; asma->file = vmfile; }get_file (asma->file);
fs/cifs/smb2pdu.c +4 -0
@@ -952,6 +952,10 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,return -EINVAL ; } +/* SMB2 TREE_CONNECT request must be called with TreeId == 0 */ +if (tcon) + tcon->tid =0 ; + rc =small_smb2_init (SMB2_TREE_CONNECT , tcon, (void **) &req);if (rc) {kfree (unc_path);
fs/sysfs/file.c +4 -2
@@ -108,7 +108,7 @@ static ssize_t sysfs_kf_read(struct kernfs_open_file *of, char *buf, {const struct sysfs_ops *ops =sysfs_file_ops (of->kn);struct kobject *kobj = of->kn->parent->priv; -size_t len; +ssize_t len;/* * If buf != of->prealloc_buf, we don't know how
@@ -117,13 +117,15 @@ static ssize_t sysfs_kf_read(struct kernfs_open_file *of, char *buf,if (WARN_ON_ONCE (buf != of->prealloc_buf))return 0 ; len = ops->show (kobj, of->kn->priv, buf); +if (len <0 ) +return len;if (pos) {if (len <= pos)return 0 ; len -= pos;memmove (buf, buf + pos, len); } -return min (count, len); +return min_t (ssize_t, count, len); }/* kernfs write callback for regular sysfs files */
include/drm/ttm/ttm_object.h +4 -1
@@ -229,6 +229,8 @@ extern void ttm_base_object_unref(struct ttm_base_object **p_base);* @ref_type: The type of reference. * @existed: Upon completion, indicates that an identical reference object * already existed, and the refcount was upped on that object instead. +* @require_existed: Fail with -EPERM if an identical ref object didn't +* already exist. * * Checks that the base object is shareable and adds a ref object to it. *
@@ -243,7 +245,8 @@ extern void ttm_base_object_unref(struct ttm_base_object **p_base);*/ extern int ttm_ref_object_add (struct ttm_object_file *tfile,struct ttm_base_object *base, -enum ttm_ref_type ref_type,bool *existed); +enum ttm_ref_type ref_type,bool *existed, +bool require_existed);extern bool ttm_ref_object_exists (struct ttm_object_file *tfile,struct ttm_base_object *base);
kernel/ptrace.c +10 -4
@@ -151,11 +151,17 @@ static void ptrace_unfreeze_traced(struct task_struct *task)WARN_ON (!task->ptrace || task->parent != current); +/* +* PTRACE_LISTEN can allow ptrace_trap_notify to wake us up remotely. +* Recheck state under the lock to close this race. +*/ spin_lock_irq (&task->sighand->siglock); -if (__fatal_signal_pending (task)) -wake_up_state (task, __TASK_TRACED); -else - task->state =TASK_TRACED ; +if (task->state == __TASK_TRACED) { +if (__fatal_signal_pending (task)) +wake_up_state (task, __TASK_TRACED); +else + task->state =TASK_TRACED ; + }spin_unlock_irq (&task->sighand->siglock); }
kernel/trace/ring_buffer.c +4 -4
@@ -4875,9 +4875,9 @@ static __init int test_ringbuffer(void) rb_data[cpu].cnt = cpu; rb_threads[cpu] =kthread_create (rb_test, &rb_data[cpu],"rbtester/%d" , cpu); -if (WARN_ON (!rb_threads[cpu])) { +if (WARN_ON (IS_ERR (rb_threads[cpu]))) {pr_cont ("FAILED\n" ); - ret =-1 ; + ret =PTR_ERR (rb_threads[cpu]); goto out_free; }
@@ -4887,9 +4887,9 @@ static __init int test_ringbuffer(void)/* Now create the rb hammer! */ rb_hammer =kthread_run (rb_hammer_test,NULL ,"rbhammer" ); -if (WARN_ON (!rb_hammer)) { +if (WARN_ON (IS_ERR (rb_hammer))) {pr_cont ("FAILED\n" ); - ret =-1 ; + ret =PTR_ERR (rb_hammer); goto out_free; }
mm/mempolicy.c +8 -12
@@ -1492,7 +1492,6 @@ COMPAT_SYSCALL_DEFINE5(get_mempolicy, int __user *, policy, COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode, compat_ulong_t __user *, nmask, compat_ulong_t, maxnode) { -long err =0 ;unsigned long __user *nm =NULL ;unsigned long nr_bits, alloc_size;DECLARE_BITMAP (bm,MAX_NUMNODES );
@@ -1501,14 +1500,13 @@ COMPAT_SYSCALL_DEFINE3(set_mempolicy, int, mode, compat_ulong_t __user *, nmask, alloc_size =ALIGN (nr_bits,BITS_PER_LONG ) /8 ;if (nmask) { - err =compat_get_bitmap (bm, nmask, nr_bits); +if (compat_get_bitmap (bm, nmask, nr_bits)) +return -EFAULT ; nm =compat_alloc_user_space (alloc_size); - err |=copy_to_user (nm, bm, alloc_size); +if (copy_to_user (nm, bm, alloc_size)) +return -EFAULT ; } -if (err) -return -EFAULT ; -return sys_set_mempolicy (mode, nm, nr_bits+1 ); }
@@ -1516,7 +1514,6 @@ COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len, compat_ulong_t, mode, compat_ulong_t __user *, nmask, compat_ulong_t, maxnode, compat_ulong_t, flags) { -long err =0 ;unsigned long __user *nm =NULL ;unsigned long nr_bits, alloc_size;nodemask_t bm;
@@ -1525,14 +1522,13 @@ COMPAT_SYSCALL_DEFINE6(mbind, compat_ulong_t, start, compat_ulong_t, len, alloc_size =ALIGN (nr_bits,BITS_PER_LONG ) /8 ;if (nmask) { - err =compat_get_bitmap (nodes_addr (bm), nmask, nr_bits); +if (compat_get_bitmap (nodes_addr (bm), nmask, nr_bits)) +return -EFAULT ; nm =compat_alloc_user_space (alloc_size); - err |=copy_to_user (nm,nodes_addr (bm), alloc_size); +if (copy_to_user (nm,nodes_addr (bm), alloc_size)) +return -EFAULT ; } -if (err) -return -EFAULT ; -return sys_mbind (start, len, mode, nm, nr_bits+1 , flags); }