Linux 3.16.58
I'm announcing the release of the 3.16.58 kernel.
All users of the 3.16 kernel series should upgrade.
The updated 3.16.y git tree can be found at:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.16.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git
The diff from 3.16.57 is attached to this message.
Ben.
------------
Makefile | 2 +- arch/Kconfig | 1 + arch/x86/include/asm/intel-family.h | 1 + arch/x86/include/asm/kvm_emulate.h | 6 +- arch/x86/include/uapi/asm/msr-index.h | 1 + arch/x86/kernel/cpu/amd.c | 13 +++ arch/x86/kernel/cpu/bugs.c | 59 ++++---------- arch/x86/kernel/cpu/common.c | 17 ++-- arch/x86/kernel/entry_64.S | 13 +-- arch/x86/kernel/i387.c | 24 ++++++ arch/x86/kernel/paravirt.c | 14 +++- arch/x86/kernel/process.c | 62 +++++++++------ arch/x86/kernel/xsave.c | 24 +----- arch/x86/kvm/emulate.c | 76 ++++++++++-------- arch/x86/kvm/vmx.c | 20 +++-- arch/x86/kvm/x86.c | 91 ++++++++++++++------- arch/x86/kvm/x86.h | 4 +- arch/x86/syscalls/syscall_32.tbl | 1 + arch/x86/syscalls/syscall_64.tbl | 1 + drivers/cdrom/cdrom.c | 2 +- drivers/infiniband/core/ucma.c | 6 +- drivers/scsi/libsas/sas_scsi_host.c | 33 +++----- drivers/scsi/sg.c | 2 +- drivers/scsi/sr_ioctl.c | 21 ++--- drivers/staging/usbip/stub.h | 2 + drivers/staging/usbip/stub_dev.c | 69 +++++++++------- drivers/staging/usbip/stub_main.c | 100 +++++++++++++++++++++-- drivers/usb/misc/yurex.c | 23 ++---- drivers/usb/storage/uas.c | 8 +- drivers/video/fbdev/uvesafb.c | 3 +- fs/btrfs/relocation.c | 23 +++--- fs/ext4/balloc.c | 21 +++-- fs/ext4/ext4.h | 8 -- fs/ext4/ext4_extents.h | 1 + fs/ext4/extents.c | 6 ++ fs/ext4/ialloc.c | 19 ++++- fs/ext4/inline.c | 39 +-------- fs/ext4/inode.c | 3 +- fs/ext4/mballoc.c | 6 +- fs/ext4/super.c | 41 +++++++++- fs/ext4/xattr.c | 49 ++++++------ fs/hfsplus/dir.c | 4 +- fs/inode.c | 6 ++ fs/jbd2/transaction.c | 2 +- fs/jfs/xattr.c | 10 ++- fs/xfs/xfs_attr_leaf.c | 5 +- fs/xfs/xfs_bmap.c | 2 + fs/xfs/xfs_icache.c | 58 ++++++++++++-- include/linux/mm_types.h | 2 +- include/linux/sched.h | 2 +- include/linux/syscalls.h | 2 + include/linux/vmacache.h | 5 -- include/uapi/asm-generic/unistd.h | 4 +- include/uapi/linux/seccomp.h | 4 + kernel/futex.c | 99 +++++++++++++++++++++-- kernel/seccomp.c | 146 ++++++++++++++++++++++++++++------ kernel/sys_ni.c | 3 + mm/vmacache.c | 36 --------- net/bluetooth/hidp/core.c | 4 +- net/core/sock.c | 2 + net/ipv4/ip_vti.c | 1 + sound/core/rawmidi.c | 20 +++-- 62 files changed, 846 insertions(+), 486 deletions(-)
Alexander Potapenko (1):
scsi: sg: allocate with __GFP_ZERO in sg_build_indirect()
Alexey Khoroshilov (1):
usbip: fix error handling in stub_probe()
Andy Lutomirski (1):
x86/entry/64: Remove %ebx handling from error_entry/exit
Ben Hutchings (3):
x86/fpu: Default eagerfpu if FPU and FXSR are enabled Revert "vti4: Don't override MTU passed on link creation via IFLA_MTU" Linux 3.16.58
Borislav Petkov (1):
x86/cpu/AMD: Fix erratum 1076 (CPB bit)
Christoph Paasch (1):
net: Set sk_prot_creator when cloning sockets to the right proto
Cong Wang (1):
infiniband: fix a possible use-after-free bug
Dave Chinner (2):
xfs: catch inode allocation state mismatch corruption
xfs: validate cached inodes are free when allocated
Eric Sandeen (2):
xfs: set format back to extents if xfs_bmap_extents_to_btree
xfs: don't call xfs_da_shrink_inode with NULL bp
Ernesto A. Fernández (1):
hfsplus: fix NULL dereference in hfsplus_lookup()
Ingo Molnar (2):
x86/fpu: Fix the 'nofxsr' boot parameter to also clear X86_FEATURE_FXSR_OPT x86/speculation: Clean up various Spectre related details
Jann Horn (1):
USB: yurex: fix out-of-bounds uaccess in read handler
Jason Yan (1):
scsi: libsas: defer ata device eh commands to libata
Jens Axboe (1):
sr: pass down correctly sized SCSI sense buffer
Jiri Kosina (1):
x86/speculation: Protect against userspace-userspace spectreRSB
Kees Cook (5):
video: uvesafb: Fix integer overflow in allocation
seccomp: create internal mode-setting function
seccomp: extract check/assign mode helpers
seccomp: split mode setting routines
seccomp: add "seccomp" syscall
Kyle Huey (2):
x86/process: Optimize TIF checks in __switch_to_xtra() x86/process: Correct and optimize TIF_BLOCKSTEP switch
Linus Torvalds (2):
Fix up non-directory creation in SGID directories
mm: get rid of vmacache_flush_all() entirely
Mark Salyzyn (1):
Bluetooth: hidp: buffer overflow in hidp_process_report
Mel Gorman (2):
futex: Remove requirement for lock_page() in get_futex_key()
futex: Remove unnecessary warning from get_futex_key
Nadav Amit (1):
KVM: x86: Emulator ignores LDTR/TR extended base on LLDT/LTR
Paolo Bonzini (4):
KVM: x86: introduce linear_{read,write}_system
KVM: x86: pass kvm_vcpu to kvm_read_guest_virt and kvm_write_guest_virt_system
kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access
KVM: x86: introduce num_emulated_msrs
Peter Zijlstra (1):
x86/paravirt: Fix spectre-v2 mitigations for paravirt guests
Piotr Luc (1):
x86/cpu/intel: Add Knights Mill to Intel family
Qu Wenruo (1):
btrfs: relocation: Only remove reloc rb_trees if reloc control has been initialized
Sanjeev Sharma (1):
uas: replace WARN_ON_ONCE() with lockdep_assert_held()
Scott Bauer (1):
cdrom: Fix info leak/OOB read in cdrom_ioctl_drive_status
Shankara Pailoor (1):
jfs: Fix inconsistency between memory allocation and ea_buf->max_size
Shuah Khan (2):
usbip: usbip_host: fix to hold parent lock for device_attach() calls
usbip: usbip_host: refine probe and disconnect debug msgs to be useful
Shuah Khan (Samsung OSG) (4):
usbip: usbip_host: delete device from busid_table after rebind
usbip: usbip_host: run rebind from exit when module is removed
usbip: usbip_host: fix NULL-ptr deref and use-after-free errors
usbip: usbip_host: fix bad unlock balance during stub_probe()
Takashi Iwai (1):
ALSA: rawmidi: Change resized buffers atomically
Theodore Ts'o (14):
ext4: only look at the bg_flags field if it is valid
ext4: fix check to prevent initializing reserved inodes
ext4: verify the depth of extent tree in ext4_find_extent()
ext4: always check block group bounds in ext4_init_block_bitmap()
ext4: don't allow r/w mounts if metadata blocks overlap the superblock
ext4: make sure bitmaps and the inode table don't overlap with bg descriptors
ext4: fix false negatives *and* false positives in ext4_check_descriptors()
ext4: add corruption check in ext4_xattr_set_entry()
ext4: always verify the magic number in xattr blocks
ext4: never move the system.data xattr out of the inode body
ext4: clear i_data in ext4_inode_info when removing inline data
ext4: add more inode number paranoia checks
jbd2: don't mark block as modified if the handle is out of credits
ext4: avoid running out of journal credits when appending to an inline file
Makefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 3 PATCHLEVEL = 16 -SUBLEVEL = 57 +SUBLEVEL = 58 EXTRAVERSION = NAME = Museum of Fishiegoodies
arch/Kconfig +1 -0
@@ -321,6 +321,7 @@ config HAVE_ARCH_SECCOMP_FILTER - secure_computing is called from a ptrace_event()-safe context - secure_computing return value is checked and a return value of -1 results in the system call being skipped immediately. + - seccomp syscall wired up config SECCOMP_FILTER def_bool y
arch/x86/include/asm/intel-family.h +1 -0
@@ -67,5 +67,6 @@/* Xeon Phi */ #define INTEL_FAM6_XEON_PHI_KNL 0x57/* Knights Landing */ +#define INTEL_FAM6_XEON_PHI_KNM 0x85/* Knights Mill */ #endif /* _ASM_X86_INTEL_FAMILY_H */
arch/x86/include/asm/kvm_emulate.h +4 -2
@@ -104,11 +104,12 @@ struct x86_emulate_ops {* @addr: [IN ] Linear address from which to read. * @val: [OUT] Value read from memory, zero-extended to 'u_long'. * @bytes: [IN ] Number of bytes to read from memory. +* @system:[IN ] Whether the access is forced to be at CPL0. */ int (*read_std)(struct x86_emulate_ctxt *ctxt,unsigned long addr,void *val,unsigned int bytes, -struct x86_exception *fault); +struct x86_exception *fault,bool system);/* * write_std: Write bytes of standard (non-emulated/special) memory.
@@ -116,10 +117,11 @@ struct x86_emulate_ops {* @addr: [IN ] Linear address to which to write. * @val: [OUT] Value write to memory, zero-extended to 'u_long'. * @bytes: [IN ] Number of bytes to write to memory. +* @system:[IN ] Whether the access is forced to be at CPL0. */ int (*write_std)(struct x86_emulate_ctxt *ctxt,unsigned long addr,void *val,unsigned int bytes, -struct x86_exception *fault); +struct x86_exception *fault,bool system);/* * fetch: Read bytes of standard (non-emulated/special) memory. * Used for instruction fetch.
arch/x86/include/uapi/asm/msr-index.h +1 -0
@@ -109,6 +109,7 @@/* DEBUGCTLMSR bits (others vary by model): */ #define DEBUGCTLMSR_LBR (1UL << 0)/* last branch recording */ +#define DEBUGCTLMSR_BTF_SHIFT 1#define DEBUGCTLMSR_BTF (1UL << 1)/* single-step on branches */ #define DEBUGCTLMSR_TR (1UL << 6)#define DEBUGCTLMSR_BTS (1UL << 7)
arch/x86/kernel/cpu/amd.c +13 -0
@@ -533,6 +533,16 @@ static void init_amd_ln(struct cpuinfo_x86 *c)msr_set_bit (MSR_AMD64_DE_CFG ,31 ); } +static void init_amd_zn (struct cpuinfo_x86 *c) +{ +/* +* Fix erratum 1076: CPB feature bit not being set in CPUID. It affects +* all up to and including B1. +*/ +if (c->x86_model <=1 && c->x86_mask <=1 ) +set_cpu_cap (c,X86_FEATURE_CPB ); +} +static void init_amd (struct cpuinfo_x86 *c) {u32 dummy;
@@ -611,6 +621,9 @@ static void init_amd(struct cpuinfo_x86 *c)clear_cpu_cap (c,X86_FEATURE_MCE );#endif +if (c->x86 ==0x17 ) +init_amd_zn (c); +/* Enable workaround for FXSAVE leak */ if (c->x86 >=6 )set_cpu_cap (c,X86_FEATURE_FXSAVE_LEAK );
arch/x86/kernel/cpu/bugs.c +15 -44
119 lines not on this page · raw message
arch/x86/kernel/cpu/common.c +9 -8
@@ -199,6 +199,15 @@ static int __init x86_noinvpcid_setup(char *s) }early_param ("noinvpcid" , x86_noinvpcid_setup); +static int __init x86_fxsr_setup (char *s) +{ +setup_clear_cpu_cap (X86_FEATURE_FXSR ); +setup_clear_cpu_cap (X86_FEATURE_FXSR_OPT ); +setup_clear_cpu_cap (X86_FEATURE_XMM ); +return 1 ; +} +__setup ("nofxsr" , x86_fxsr_setup); +#ifdef CONFIG_X86_32 static int cachesize_override =-1 ;static int disable_x86_serial_nr =1 ;
@@ -210,14 +219,6 @@ static int __init cachesize_setup(char *str) }__setup ("cachesize=" , cachesize_setup); -static int __init x86_fxsr_setup (char *s) -{ -setup_clear_cpu_cap (X86_FEATURE_FXSR ); -setup_clear_cpu_cap (X86_FEATURE_XMM ); -return 1 ; -} -__setup ("nofxsr" , x86_fxsr_setup); -static int __init x86_sep_setup (char *s) {setup_clear_cpu_cap (X86_FEATURE_SEP );
arch/x86/kernel/entry_64.S +3 -10
@@ -1135,7 +1135,7 @@ ENTRY(\sym) .if \paranoid jmp paranoid_exit /* %ebx: no swapgs flag */ .else - jmp error_exit /* %ebx: no swapgs flag */ + jmp error_exit .endif CFI_ENDPROC
@@ -1411,7 +1411,6 @@ END(paranoid_exit) /* * Exception entry point. This expects an error code/orig_rax on the stack. - * returns in "no swapgs flag" in %ebx. */ ENTRY(error_entry) XCPT_FRAME
@@ -1440,7 +1439,6 @@ ENTRY(error_entry) * the kernel CR3 here. */ SWITCH_KERNEL_CR3 - xorl %ebx,%ebx testl $3,CS+8(%rsp) je error_kernelspace error_swapgs:
@@ -1456,7 +1454,6 @@ ENTRY(error_entry) * for these here too. */ error_kernelspace: - incl %ebx leaq native_irq_return_iret(%rip),%rcx cmpq %rcx,RIP+8(%rsp) je error_bad_iret
@@ -1477,22 +1474,18 @@ ENTRY(error_entry) mov %rsp,%rdi call fixup_bad_iret mov %rax,%rsp - decl %ebx /* Return to usergs */ jmp error_sti CFI_ENDPROC END(error_entry) - -/* ebx: no swapgs flag (1: don't need swapgs, 0: need it) */ ENTRY(error_exit) DEFAULT_FRAME - movl %ebx,%eax RESTORE_REST DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF GET_THREAD_INFO(%rcx) - testl %eax,%eax - jne retint_kernel + testb $3, CS-ARGOFFSET(%rsp) + jz retint_kernel LOCKDEP_SYS_EXIT_IRQ movl TI_flags(%rcx),%edx movl $_TIF_WORK_MASK,%edi
arch/x86/kernel/i387.c +24 -0
@@ -159,6 +159,19 @@ static void init_thread_xstate(void) xstate_size =sizeof (struct i387_fsave_struct ); } +static enum {AUTO ,ENABLE ,DISABLE } eagerfpu =AUTO ; +static int __init eager_fpu_setup (char *s) +{ +if (!strcmp (s,"on" )) + eagerfpu =ENABLE ; +else if (!strcmp (s,"off" )) + eagerfpu =DISABLE ; +else if (!strcmp (s,"auto" )) + eagerfpu =AUTO ; +return 1 ; +} +__setup ("eagerfpu=" , eager_fpu_setup); +/* * Called at bootup to set up the initial FPU state that is later cloned * into all processes.
@@ -197,6 +210,17 @@ void fpu_init(void)if (xstate_size ==0 )init_thread_xstate (); +/* +* We should always enable eagerfpu, but it doesn't work properly +* here without fpu and fxsr. +*/ +if (eagerfpu ==AUTO ) + eagerfpu = (boot_cpu_has (X86_FEATURE_FPU ) && +boot_cpu_has (X86_FEATURE_FXSR )) ? +ENABLE :DISABLE ; +if (eagerfpu ==ENABLE ) +setup_force_cpu_cap (X86_FEATURE_EAGER_FPU ); +mxcsr_feature_mask_init ();xsave_init ();eager_fpu_init ();
arch/x86/kernel/paravirt.c +10 -4
@@ -97,10 +97,12 @@ unsigned paravirt_patch_call(void *insnbuf,struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 ); -if (tgt_clobbers & ~site_clobbers) -return len;/* target would clobber too much for this site */ -if (len <5 ) +if (len <5 ) { +#ifdef CONFIG_RETPOLINE +WARN_ONCE ("Failing to patch indirect CALL in %ps\n" , (void *)addr); +#endif return len;/* call too long for patch site */ + } b->opcode =0xe8 ;/* call */ b->delta = delta;
@@ -115,8 +117,12 @@ unsigned paravirt_patch_jmp(void *insnbuf, const void *target,struct branch *b = insnbuf;unsigned long delta = (unsigned long )target - (addr+5 ); -if (len <5 ) +if (len <5 ) { +#ifdef CONFIG_RETPOLINE +WARN_ONCE ("Failing to patch indirect JMP in %ps\n" , (void *)addr); +#endif return len;/* call too long for patch site */ + } b->opcode =0xe9 ;/* jmp */ b->delta = delta;
arch/x86/kernel/process.c +36 -26
84 lines not on this page · raw message
arch/x86/kernel/xsave.c +1 -23
@@ -509,19 +509,6 @@ static void __init setup_init_fpu_buf(void)xsave_state (init_xstate_buf,-1 ); } -static enum {AUTO ,ENABLE ,DISABLE } eagerfpu =AUTO ; -static int __init eager_fpu_setup (char *s) -{ -if (!strcmp (s,"on" )) - eagerfpu =ENABLE ; -else if (!strcmp (s,"off" )) - eagerfpu =DISABLE ; -else if (!strcmp (s,"auto" )) - eagerfpu =AUTO ; -return 1 ; -} -__setup ("eagerfpu=" , eager_fpu_setup); -/* * Enable and initialize the xsave feature. */
@@ -560,17 +547,11 @@ static void __init xstate_enable_boot_cpu(void)prepare_fx_sw_frame ();setup_init_fpu_buf (); -/* Auto enable eagerfpu for xsaveopt */ -if (cpu_has_xsaveopt && eagerfpu !=DISABLE ) - eagerfpu =ENABLE ; -if (pcntxt_mask &XSTATE_EAGER ) { -if (eagerfpu ==DISABLE ) { +if (!boot_cpu_has (X86_FEATURE_EAGER_FPU )) {pr_err ("eagerfpu not present, disabling some xstate features: 0x%llx\n" , pcntxt_mask &XSTATE_EAGER ); pcntxt_mask &= ~XSTATE_EAGER ; - }else { - eagerfpu =ENABLE ; } }
@@ -613,9 +594,6 @@ void eager_fpu_init(void)clear_used_math ();current_thread_info ()->status =0 ; -if (eagerfpu ==ENABLE ) -setup_force_cpu_cap (X86_FEATURE_EAGER_FPU ); -if (!cpu_has_eager_fpu) {stts ();return ;
arch/x86/kvm/emulate.c +41 -35
199 lines not on this page · raw message
arch/x86/kvm/vmx.c +9 -11
@@ -6027,8 +6027,7 @@ static int nested_vmx_check_vmptr(struct kvm_vcpu *vcpu, int exit_reason, vmcs_read32(VMX_INSTRUCTION_INFO), &gva))return 1 ; -if (kvm_read_guest_virt (&vcpu->arch.emulate_ctxt, gva, &vmptr, -sizeof (vmptr), &e)) { +if (kvm_read_guest_virt (vcpu, gva, &vmptr,sizeof (vmptr), &e)) {kvm_inject_page_fault (vcpu, &e);return 1 ; }
@@ -6539,8 +6538,8 @@ static int handle_vmread(struct kvm_vcpu *vcpu) vmx_instruction_info, &gva))return 1 ;/* _system ok, as nested_vmx_check_permission verified cpl=0 */ -kvm_write_guest_virt_system (&vcpu->arch.emulate_ctxt, gva, - &field_value, (is_long_mode (vcpu) ?8 :4 ),NULL ); +kvm_write_guest_virt_system (vcpu, gva, &field_value, + (is_long_mode (vcpu) ?8 :4 ),NULL ); }nested_vmx_succeed (vcpu);
@@ -6575,8 +6574,8 @@ static int handle_vmwrite(struct kvm_vcpu *vcpu)if (get_vmx_mem_address (vcpu, exit_qualification, vmx_instruction_info, &gva))return 1 ; -if (kvm_read_guest_virt (&vcpu->arch.emulate_ctxt, gva, - &field_value, (is_long_mode (vcpu) ?8 :4 ), &e)) { +if (kvm_read_guest_virt (vcpu, gva, &field_value, + (is_long_mode (vcpu) ?8 :4 ), &e)) {kvm_inject_page_fault (vcpu, &e);return 1 ; }
@@ -6669,9 +6668,9 @@ static int handle_vmptrst(struct kvm_vcpu *vcpu) vmx_instruction_info, &vmcs_gva))return 1 ;/* ok to use *_system, as nested_vmx_check_permission verified cpl=0 */ -if (kvm_write_guest_virt_system (&vcpu->arch.emulate_ctxt, vmcs_gva, - (void *)&to_vmx (vcpu)->nested.current_vmptr, -sizeof (u64), &e)) { +if (kvm_write_guest_virt_system (vcpu, vmcs_gva, + (void *)&to_vmx (vcpu)->nested.current_vmptr, +sizeof (u64), &e)) {kvm_inject_page_fault (vcpu, &e);return 1 ; }
@@ -6723,8 +6722,7 @@ static int handle_invept(struct kvm_vcpu *vcpu)if (get_vmx_mem_address (vcpu,vmcs_readl (EXIT_QUALIFICATION ), vmx_instruction_info, &gva))return 1 ; -if (kvm_read_guest_virt (&vcpu->arch.emulate_ctxt, gva, &operand, -sizeof (operand), &e)) { +if (kvm_read_guest_virt (vcpu, gva, &operand,sizeof (operand), &e)) {kvm_inject_page_fault (vcpu, &e);return 1 ; }
arch/x86/kvm/x86.c +64 -27
173 lines not on this page · raw message
arch/x86/kvm/x86.h +2 -2
@@ -124,11 +124,11 @@ int kvm_inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq, int inc_eip);void kvm_write_tsc (struct kvm_vcpu *vcpu,struct msr_data *msr); -int kvm_read_guest_virt (struct x86_emulate_ctxt *ctxt, +int kvm_read_guest_virt (struct kvm_vcpu *vcpu,gva_t addr,void *val,unsigned int bytes,struct x86_exception *exception); -int kvm_write_guest_virt_system (struct x86_emulate_ctxt *ctxt, +int kvm_write_guest_virt_system (struct kvm_vcpu *vcpu,gva_t addr,void *val,unsigned int bytes,struct x86_exception *exception);
arch/x86/syscalls/syscall_32.tbl +1 -0
@@ -360,3 +360,4 @@ 351 i386 sched_setattr sys_sched_setattr 352 i386 sched_getattr sys_sched_getattr 353 i386 renameat2 sys_renameat2 +354 i386 seccomp sys_seccomp
arch/x86/syscalls/syscall_64.tbl +1 -0
@@ -323,6 +323,7 @@ 314 common sched_setattr sys_sched_setattr 315 common sched_getattr sys_sched_getattr 316 common renameat2 sys_renameat2 +317 common seccomp sys_seccomp # # x32-specific system call numbers start at 512 to avoid cache impact
drivers/cdrom/cdrom.c +1 -1
@@ -2528,7 +2528,7 @@ static int cdrom_ioctl_drive_status(struct cdrom_device_info *cdi,if (!CDROM_CAN (CDC_SELECT_DISC ) || (arg ==CDSL_CURRENT || arg ==CDSL_NONE ))return cdi->ops->drive_status (cdi,CDSL_CURRENT ); -if (((int )arg >= cdi->capacity)) +if (arg >= cdi->capacity)return -EINVAL ;return cdrom_slot_status (cdi, arg); }
drivers/infiniband/core/ucma.c +5 -1
@@ -180,7 +180,7 @@ static struct ucma_multicast* ucma_alloc_multicast(struct ucma_context *ctx)return NULL ;mutex_lock (&mut); - mc->id =idr_alloc (&multicast_idr, mc,0 ,0 ,GFP_KERNEL ); + mc->id =idr_alloc (&multicast_idr,NULL ,0 ,0 ,GFP_KERNEL );mutex_unlock (&mut);if (mc->id <0 ) goto error;
@@ -1285,6 +1285,10 @@ static ssize_t ucma_process_join(struct ucma_file *file, goto err3; } +mutex_lock (&mut); +idr_replace (&multicast_idr, mc, mc->id); +mutex_unlock (&mut); +mutex_unlock (&file->mut);ucma_put_ctx (ctx);return 0 ;
drivers/scsi/libsas/sas_scsi_host.c +13 -20
@@ -250,6 +250,7 @@ int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)static void sas_eh_finish_cmd (struct scsi_cmnd *cmd) {struct sas_ha_struct *sas_ha =SHOST_TO_SAS_HA (cmd->device->host); +struct domain_device *dev =cmd_to_domain_dev (cmd);struct sas_task *task =TO_SAS_TASK (cmd);/* At this point, we only get called following an actual abort
@@ -258,6 +259,14 @@ static void sas_eh_finish_cmd(struct scsi_cmnd *cmd)*/ sas_end_task (cmd, task); +if (dev_is_sata (dev)) { +/* defer commands to libata so that libata EH can +* handle ata qcs correctly +*/ +list_move_tail (&cmd->eh_entry, &sas_ha->eh_ata_q); +return ; + } +/* now finish the command and move it on to the error * handler done list, this also takes it off the * error handler pending list.
@@ -265,22 +274,6 @@ static void sas_eh_finish_cmd(struct scsi_cmnd *cmd)scsi_eh_finish_cmd (cmd, &sas_ha->eh_done_q); } -static void sas_eh_defer_cmd (struct scsi_cmnd *cmd) -{ -struct domain_device *dev =cmd_to_domain_dev (cmd); -struct sas_ha_struct *ha = dev->port->ha; -struct sas_task *task =TO_SAS_TASK (cmd); - -if (!dev_is_sata (dev)) { -sas_eh_finish_cmd (cmd); -return ; - } - -/* report the timeout to libata */ -sas_end_task (cmd, task); -list_move_tail (&cmd->eh_entry, &ha->eh_ata_q); -} -static void sas_scsi_clear_queue_lu (struct list_head *error_q,struct scsi_cmnd *my_cmd) {struct scsi_cmnd *cmd, *n;
@@ -288,7 +281,7 @@ static void sas_scsi_clear_queue_lu(struct list_head *error_q, struct scsi_cmndlist_for_each_entry_safe (cmd, n, error_q, eh_entry) {if (cmd->device->sdev_target == my_cmd->device->sdev_target && cmd->device->lun == my_cmd->device->lun) -sas_eh_defer_cmd (cmd); +sas_eh_finish_cmd (cmd); } }
@@ -677,12 +670,12 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *case TASK_IS_DONE :SAS_DPRINTK ("%s: task 0x%p is done\n" , __func__, task); -sas_eh_defer_cmd (cmd); +sas_eh_finish_cmd (cmd);continue ;case TASK_IS_ABORTED :SAS_DPRINTK ("%s: task 0x%p is aborted\n" , __func__, task); -sas_eh_defer_cmd (cmd); +sas_eh_finish_cmd (cmd);continue ;case TASK_IS_AT_LU :SAS_DPRINTK ("task 0x%p is at LU: lu recover\n" , task);
@@ -693,7 +686,7 @@ static void sas_eh_handle_sas_errors(struct Scsi_Host *shost, struct list_head *"recovered\n" ,SAS_ADDR (task->dev), cmd->device->lun); -sas_eh_defer_cmd (cmd); +sas_eh_finish_cmd (cmd);sas_scsi_clear_queue_lu (work_q, cmd); goto Again; }
drivers/scsi/sg.c +1 -1
@@ -1825,7 +1825,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) num = (rem_sz > scatter_elem_sz_prev) ? scatter_elem_sz_prev : rem_sz; - schp->pages[k] =alloc_pages (gfp_mask, order); + schp->pages[k] =alloc_pages (gfp_mask | __GFP_ZERO, order);if (!schp->pages[k]) goto out;
drivers/scsi/sr_ioctl.c +7 -14
@@ -188,30 +188,25 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)struct scsi_device *SDev;struct scsi_sense_hdr sshdr;int result, err =0 , retries =0 ; -struct request_sense *sense = cgc->sense; +unsigned char sense_buffer[SCSI_SENSE_BUFFERSIZE ]; SDev = cd->device; -if (!sense) { - sense =kmalloc (SCSI_SENSE_BUFFERSIZE ,GFP_KERNEL ); -if (!sense) { - err = -ENOMEM ; - goto out; - } - } - retry:if (!scsi_block_when_processing_errors (SDev)) { err = -ENODEV ; goto out; } -memset (sense,0 ,sizeof (*sense)); +memset (sense_buffer,0 ,sizeof (sense_buffer)); result =scsi_execute (SDev, cgc->cmd, cgc->data_direction, - cgc->buffer, cgc->buflen, (char *)sense, + cgc->buffer, cgc->buflen, sense_buffer, cgc->timeout,IOCTL_RETRIES ,0 ,NULL ); -scsi_normalize_sense ((char *)sense,sizeof (*sense), &sshdr); +scsi_normalize_sense (sense_buffer,sizeof (sense_buffer), &sshdr); + +if (cgc->sense) +memcpy (cgc->sense, sense_buffer,sizeof (*cgc->sense));/* Minimal error checking. Ignore cases we know about, and report the rest. */ if (driver_byte (result) !=0 ) {
@@ -268,8 +263,6 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)/* Wake up a process waiting for device */ out: -if (!cgc->sense) -kfree (sense); cgc->stat = err;return err; }
drivers/staging/usbip/stub.h +2 -0
@@ -87,6 +87,7 @@ struct bus_id_priv {struct stub_device *sdev;struct usb_device *udev;char shutdown_busid; +spinlock_t busid_lock; };/* stub_priv is allocated from stub_priv_cache */
@@ -97,6 +98,7 @@ extern struct usb_device_driver stub_driver;/* stub_main.c */ struct bus_id_priv *get_busid_priv (const char *busid); +void put_busid_priv (struct bus_id_priv *bid);int del_match_busid (char *busid);void stub_device_cleanup_urbs (struct stub_device *sdev);
drivers/staging/usbip/stub_dev.c +41 -28
139 lines not on this page · raw message
drivers/staging/usbip/stub_main.c +92 -8
197 lines not on this page · raw message
drivers/usb/misc/yurex.c +6 -17
@@ -413,8 +413,7 @@ static int yurex_release(struct inode *inode, struct file *file)static ssize_t yurex_read (struct file *file,char *buffer,size_t count,loff_t *ppos) {struct usb_yurex *dev; -int retval =0 ; -int bytes_read =0 ; +int len =0 ;char in_buffer[20 ];unsigned long flags;
@@ -422,26 +421,16 @@ static ssize_t yurex_read(struct file *file, char *buffer, size_t count, loff_tmutex_lock (&dev->io_mutex);if (!dev->interface) {/* already disconnected */ - retval = -ENODEV ; - goto exit; +mutex_unlock (&dev->io_mutex); +return -ENODEV ; }spin_lock_irqsave (&dev->lock, flags); - bytes_read =snprintf (in_buffer,20 ,"%lld\n" , dev->bbu); + len =snprintf (in_buffer,20 ,"%lld\n" , dev->bbu);spin_unlock_irqrestore (&dev->lock, flags); - -if (*ppos < bytes_read) { -if (copy_to_user (buffer, in_buffer + *ppos, bytes_read - *ppos)) - retval = -EFAULT ; -else { - retval = bytes_read - *ppos; - *ppos += bytes_read; - } - } - -exit:mutex_unlock (&dev->io_mutex); -return retval; + +return simple_read_from_buffer (buffer, count, ppos, in_buffer, len); }static ssize_t yurex_write (struct file *file,const char *user_buffer,size_t count,loff_t *ppos)
drivers/usb/storage/uas.c +4 -4
@@ -158,7 +158,7 @@ static void uas_mark_cmd_dead(struct uas_dev_info *devinfo, struct scsi_cmnd *cmnd = container_of(scp, struct scsi_cmnd, SCp);uas_log_cmd_state (cmnd, caller); -WARN_ON_ONCE (!spin_is_locked (&devinfo->lock)); +lockdep_assert_held (&devinfo->lock);WARN_ON_ONCE (cmdinfo->state &COMMAND_ABORTED ); cmdinfo->state |=COMMAND_ABORTED ; cmdinfo->state &= ~IS_IN_WORK_LIST ;
@@ -185,7 +185,7 @@ static void uas_add_work(struct uas_cmd_info *cmdinfo) struct scsi_cmnd *cmnd = container_of(scp, struct scsi_cmnd, SCp);struct uas_dev_info *devinfo = cmnd->device->hostdata; -WARN_ON_ONCE (!spin_is_locked (&devinfo->lock)); +lockdep_assert_held (&devinfo->lock); cmdinfo->state |=IS_IN_WORK_LIST ;schedule_work (&devinfo->work); }
@@ -287,7 +287,7 @@ static int uas_try_complete(struct scsi_cmnd *cmnd, const char *caller)struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;struct uas_dev_info *devinfo = (void *)cmnd->device->hostdata; -WARN_ON_ONCE (!spin_is_locked (&devinfo->lock)); +lockdep_assert_held (&devinfo->lock); if (cmdinfo->state & (COMMAND_INFLIGHT | DATA_IN_URB_INFLIGHT | DATA_OUT_URB_INFLIGHT |
@@ -626,7 +626,7 @@ static int uas_submit_urbs(struct scsi_cmnd *cmnd,struct urb *urb;int err; -WARN_ON_ONCE (!spin_is_locked (&devinfo->lock)); +lockdep_assert_held (&devinfo->lock);if (cmdinfo->state &SUBMIT_STATUS_URB ) { urb =uas_submit_sense_urb (cmnd, gfp, cmdinfo->stream);if (!urb)
drivers/video/fbdev/uvesafb.c +2 -1
@@ -1059,7 +1059,8 @@ static int uvesafb_setcmap(struct fb_cmap *cmap, struct fb_info *info) info->cmap.len || cmap->start < info->cmap.start)return -EINVAL ; - entries =kmalloc (sizeof (*entries) * cmap->len,GFP_KERNEL ); + entries =kmalloc_array (cmap->len,sizeof (*entries), +GFP_KERNEL );if (!entries)return -ENOMEM ;
fs/btrfs/relocation.c +12 -11
@@ -1311,18 +1311,19 @@ static void __del_reloc_root(struct btrfs_root *root)struct mapping_node *node =NULL ;struct reloc_control *rc = root->fs_info->reloc_ctl; -spin_lock (&rc->reloc_root_tree.lock); - rb_node =tree_search (&rc->reloc_root_tree.rb_root, - root->node->start); -if (rb_node) { - node = rb_entry(rb_node, struct mapping_node, rb_node); -rb_erase (&node->rb_node, &rc->reloc_root_tree.rb_root); +if (rc) { +spin_lock (&rc->reloc_root_tree.lock); + rb_node =tree_search (&rc->reloc_root_tree.rb_root, + root->node->start); +if (rb_node) { + node = rb_entry(rb_node, struct mapping_node, rb_node); +rb_erase (&node->rb_node, &rc->reloc_root_tree.rb_root); + } +spin_unlock (&rc->reloc_root_tree.lock); +if (!node) +return ; +BUG_ON ((struct btrfs_root *)node->data != root); } -spin_unlock (&rc->reloc_root_tree.lock); - -if (!node) -return ; -BUG_ON ((struct btrfs_root *)node->data != root);spin_lock (&root->fs_info->trans_lock);list_del_init (&root->root_list);
fs/ext4/balloc.c +13 -8
@@ -184,7 +184,6 @@ static int ext4_init_block_bitmap(struct super_block *sb,unsigned int bit, bit_max;struct ext4_sb_info *sbi =EXT4_SB (sb);ext4_fsblk_t start, tmp; -int flex_bg =0 ;struct ext4_group_info *grp;J_ASSERT_BH (bh,buffer_locked (bh));
@@ -217,22 +216,19 @@ static int ext4_init_block_bitmap(struct super_block *sb, start =ext4_group_first_block_no (sb, block_group); -if (EXT4_HAS_INCOMPAT_FEATURE (sb,EXT4_FEATURE_INCOMPAT_FLEX_BG )) - flex_bg =1 ; -/* Set bits for block and inode bitmaps, and inode table */ tmp =ext4_block_bitmap (sb, gdp); -if (!flex_bg ||ext4_block_in_group (sb, tmp, block_group)) +if (ext4_block_in_group (sb, tmp, block_group))ext4_set_bit (EXT4_B2C (sbi, tmp - start), bh->b_data); tmp =ext4_inode_bitmap (sb, gdp); -if (!flex_bg ||ext4_block_in_group (sb, tmp, block_group)) +if (ext4_block_in_group (sb, tmp, block_group))ext4_set_bit (EXT4_B2C (sbi, tmp - start), bh->b_data); tmp =ext4_inode_table (sb, gdp);for (; tmp <ext4_inode_table (sb, gdp) + sbi->s_itb_per_group; tmp++) { -if (!flex_bg ||ext4_block_in_group (sb, tmp, block_group)) +if (ext4_block_in_group (sb, tmp, block_group))ext4_set_bit (EXT4_B2C (sbi, tmp - start), bh->b_data); }
@@ -453,9 +449,18 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group) goto verify; }ext4_lock_group (sb, block_group); -if (desc->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (desc->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) {int err; +if (block_group ==0 ) { +ext4_unlock_group (sb, block_group); +unlock_buffer (bh); +ext4_error (sb,"Block bitmap for bg 0 marked " +"uninitialized" ); +put_bh (bh); +return NULL ; + } err =ext4_init_block_bitmap (sb, bh, block_group, desc);set_bitmap_uptodate (bh);set_buffer_uptodate (bh);
fs/ext4/ext4.h +0 -8
@@ -1422,11 +1422,6 @@ static inline struct timespec ext4_current_time(struct inode *inode)static inline int ext4_valid_inum (struct super_block *sb,unsigned long ino) {return ino ==EXT4_ROOT_INO || - ino ==EXT4_USR_QUOTA_INO || - ino ==EXT4_GRP_QUOTA_INO || - ino ==EXT4_BOOT_LOADER_INO || - ino ==EXT4_JOURNAL_INO || - ino ==EXT4_RESIZE_INO || (ino >=EXT4_FIRST_INO (sb) && ino <=le32_to_cpu (EXT4_SB (sb)->s_es->s_inodes_count)); }
@@ -2706,9 +2701,6 @@ extern struct buffer_head *ext4_get_first_inline_block(struct inode *inode,extern int ext4_inline_data_fiemap (struct inode *inode,struct fiemap_extent_info *fieinfo,int *has_inline); -extern int ext4_try_to_evict_inline_data (handle_t *handle, -struct inode *inode, -int needed);extern void ext4_inline_data_truncate (struct inode *inode,int *has_inline);extern int ext4_convert_inline_data (struct inode *inode);
fs/ext4/ext4_extents.h +1 -0
@@ -103,6 +103,7 @@ struct ext4_extent_header { };#define EXT4_EXT_MAGIC cpu_to_le16(0xf30a) +#define EXT4_MAX_EXTENT_DEPTH 5#define EXT4_EXTENT_TAIL_OFFSET (hdr) \ (sizeof(struct ext4_extent_header) + \
fs/ext4/extents.c +6 -0
@@ -851,6 +851,12 @@ ext4_ext_find_extent(struct inode *inode, ext4_lblk_t block, eh =ext_inode_hdr (inode); depth =ext_depth (inode); +if (depth <0 || depth >EXT4_MAX_EXTENT_DEPTH ) { +EXT4_ERROR_INODE (inode,"inode has invalid extent depth: %d" , + depth); + ret = -EIO ; + goto err; + }/* account possible depth increase */ if (!path) {
fs/ext4/ialloc.c +16 -3
@@ -156,7 +156,16 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) }ext4_lock_group (sb, block_group); -if (desc->bg_flags &cpu_to_le16 (EXT4_BG_INODE_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (desc->bg_flags &cpu_to_le16 (EXT4_BG_INODE_UNINIT ))) { +if (block_group ==0 ) { +ext4_unlock_group (sb, block_group); +unlock_buffer (bh); +ext4_error (sb,"Inode bitmap for bg 0 marked " +"uninitialized" ); +put_bh (bh); +return NULL ; + }ext4_init_inode_bitmap (sb, bh, block_group, desc);set_bitmap_uptodate (bh);set_buffer_uptodate (bh);
@@ -910,7 +919,8 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir,/* recheck and clear flag under lock if we still need to */ ext4_lock_group (sb, group); -if (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { gdp->bg_flags &=cpu_to_le16 (~EXT4_BG_BLOCK_UNINIT );ext4_free_group_clusters_set (sb, gdp,ext4_free_clusters_after_init (sb, group, gdp));
@@ -1279,7 +1289,10 @@ int ext4_init_inode_table(struct super_block *sb, ext4_group_t group, ext4_itable_unused_count(sb, gdp)), sbi->s_inodes_per_block); -if ((used_blks <0 ) || (used_blks > sbi->s_itb_per_group)) { +if ((used_blks <0 ) || (used_blks > sbi->s_itb_per_group) || + ((group ==0 ) && ((EXT4_INODES_PER_GROUP (sb) - +ext4_itable_unused_count (sb, gdp)) < +EXT4_FIRST_INO (sb)))) { ext4_error(sb, "Something is wrong with group %u: " "used itable blocks: %d; " "itable unused count: %u",
fs/ext4/inline.c +2 -37
@@ -438,6 +438,7 @@ static int ext4_destroy_inline_data_nolock(handle_t *handle,memset ((void *)ext4_raw_inode (&is.iloc)->i_block,0 ,EXT4_MIN_INLINE_DATA_SIZE ); +memset (ei->i_data,0 ,EXT4_MIN_INLINE_DATA_SIZE );if (EXT4_HAS_INCOMPAT_FEATURE (inode->i_sb,EXT4_FEATURE_INCOMPAT_EXTENTS )) {
@@ -876,11 +877,11 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping, }if (ret == -ENOSPC ) { +ext4_journal_stop (handle); ret =ext4_da_convert_inline_data_to_extent (mapping, inode, flags, fsdata); -ext4_journal_stop (handle);if (ret == -ENOSPC &&ext4_should_retry_alloc (inode->i_sb, &retries)) goto retry_journal;
@@ -1838,42 +1839,6 @@ int ext4_inline_data_fiemap(struct inode *inode,return (error <0 ? error :0 ); } -/* -* Called during xattr set, and if we can sparse space 'needed', -* just create the extent tree evict the data to the outer block. -* -* We use jbd2 instead of page cache to move data to the 1st block -* so that the whole transaction can be committed as a whole and -* the data isn't lost because of the delayed page cache write. -*/ -int ext4_try_to_evict_inline_data (handle_t *handle, -struct inode *inode, -int needed) -{ -int error; -struct ext4_xattr_entry *entry; -struct ext4_inode *raw_inode; -struct ext4_iloc iloc; - - error =ext4_get_inode_loc (inode, &iloc); -if (error) -return error; - - raw_inode =ext4_raw_inode (&iloc); - entry = (struct ext4_xattr_entry *)((void *)raw_inode + -EXT4_I (inode)->i_inline_off); -if (EXT4_XATTR_LEN (entry->e_name_len) + -EXT4_XATTR_SIZE (le32_to_cpu (entry->e_value_size)) < needed) { - error = -ENOSPC ; - goto out; - } - - error =ext4_convert_inline_data_nolock (handle, inode, &iloc); -out: -brelse (iloc.bh); -return error; -} -void ext4_inline_data_truncate (struct inode *inode,int *has_inline) {handle_t *handle;
fs/ext4/inode.c +2 -1
@@ -3957,7 +3957,8 @@ static int __ext4_get_inode_loc(struct inode *inode,int inodes_per_block, inode_offset; iloc->bh =NULL ; -if (!ext4_valid_inum (sb, inode->i_ino)) +if (inode->i_ino <EXT4_ROOT_INO || + inode->i_ino >le32_to_cpu (EXT4_SB (sb)->s_es->s_inodes_count))return -EIO ; iloc->block_group = (inode->i_ino -1 ) /EXT4_INODES_PER_GROUP (sb);
fs/ext4/mballoc.c +4 -2
@@ -2418,7 +2418,8 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,* initialize bb_free to be able to skip * empty groups without initialization */ -if (desc->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (desc->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { meta_group_info[i]->bb_free =ext4_free_clusters_after_init (sb, group, desc); }else {
@@ -2943,7 +2944,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,#endif ext4_set_bits (bitmap_bh->b_data, ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len); -if (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT )) { +if (ext4_has_group_desc_csum (sb) && + (gdp->bg_flags &cpu_to_le16 (EXT4_BG_BLOCK_UNINIT ))) { gdp->bg_flags &=cpu_to_le16 (~EXT4_BG_BLOCK_UNINIT ); ext4_free_group_clusters_set(sb, gdp, ext4_free_clusters_after_init(sb,
fs/ext4/super.c +40 -1
89 lines not on this page · raw message
fs/ext4/xattr.c +23 -26
99 lines not on this page · raw message
fs/hfsplus/dir.c +2 -2
@@ -74,13 +74,13 @@ static struct dentry *hfsplus_lookup(struct inode *dir, struct dentry *dentry,cpu_to_be32 (HFSP_HARDLINK_TYPE ) && entry.file.user_info.fdCreator ==cpu_to_be32 (HFSP_HFSPLUS_CREATOR ) && +HFSPLUS_SB (sb)->hidden_dir && (entry.file.create_date ==HFSPLUS_I (HFSPLUS_SB (sb)->hidden_dir)-> create_date || entry.file.create_date ==HFSPLUS_I (sb->s_root->d_inode)-> - create_date) && - HFSPLUS_SB(sb)->hidden_dir) { + create_date)) { struct qstr str;char name[32 ];
fs/inode.c +6 -0
@@ -1827,8 +1827,14 @@ void inode_init_owner(struct inode *inode, const struct inode *dir, inode->i_uid =current_fsuid ();if (dir && dir->i_mode &S_ISGID ) { inode->i_gid = dir->i_gid; + +/* Directories are special, and always inherit S_ISGID */ if (S_ISDIR (mode)) mode |=S_ISGID ; +else if ((mode & (S_ISGID |S_IXGRP )) == (S_ISGID |S_IXGRP ) && + !in_group_p (inode->i_gid) && + !capable_wrt_inode_uidgid (dir,CAP_FSETID )) + mode &= ~S_ISGID ; }else inode->i_gid =current_fsgid (); inode->i_mode = mode;
fs/jbd2/transaction.c +1 -1
@@ -1288,11 +1288,11 @@ int jbd2_journal_dirty_metadata(handle_t *handle, struct buffer_head *bh)* of the transaction. This needs to be done * once a transaction -bzzz */ - jh->b_modified =1 ;if (handle->h_buffer_credits <=0 ) { ret = -ENOSPC ; goto out_unlock_bh; } + jh->b_modified =1 ; handle->h_buffer_credits--; }
fs/jfs/xattr.c +6 -4
@@ -493,15 +493,17 @@ static int ea_get(struct inode *inode, struct ea_buffer *ea_buf, int min_size)if (size >PSIZE ) {/* * To keep the rest of the code simple. Allocate a -* contiguous buffer to work with +* contiguous buffer to work with. Make the buffer large +* enough to make use of the whole extent. */ - ea_buf->xattr =kmalloc (size,GFP_KERNEL ); + ea_buf->max_size = (size + sb->s_blocksize -1 ) & + ~(sb->s_blocksize -1 ); + + ea_buf->xattr =kmalloc (ea_buf->max_size,GFP_KERNEL );if (ea_buf->xattr ==NULL )return -ENOMEM ; ea_buf->flag =EA_MALLOC ; - ea_buf->max_size = (size + sb->s_blocksize -1 ) & - ~(sb->s_blocksize -1 );if (ea_size ==0 )return 0 ;
fs/xfs/xfs_attr_leaf.c +2 -3
@@ -701,9 +701,8 @@ xfs_attr_shortform_to_leaf(xfs_da_args_t *args)ASSERT (blkno ==0 ); error =xfs_attr3_leaf_create (args, blkno, &bp);if (error) { - error =xfs_da_shrink_inode (args,0 , bp); - bp =NULL ; -if (error) +/* xfs_attr3_leaf_create may not have instantiated a block */ +if (bp && (xfs_da_shrink_inode (args,0 , bp) !=0 )) goto out;xfs_idata_realloc (dp, size,XFS_ATTR_FORK );/* try to put */ memcpy (ifp->if_u1.if_data, tmpbuffer, size);/* it back */
fs/xfs/xfs_bmap.c +2 -0
@@ -822,6 +822,8 @@ xfs_bmap_extents_to_btree( *logflagsp =0 ;if ((error =xfs_alloc_vextent (&args))) {xfs_iroot_realloc (ip,-1 , whichfork); +ASSERT (ifp->if_broot ==NULL ); +XFS_IFORK_FMT_SET (ip, whichfork,XFS_DINODE_FMT_EXTENTS );xfs_btree_del_cursor (cur,XFS_BTREE_ERROR );return error; }
fs/xfs/xfs_icache.c +51 -7
79 lines not on this page · raw message
include/linux/mm_types.h +1 -1
@@ -345,7 +345,7 @@ struct kioctx_table;struct mm_struct {struct vm_area_struct *mmap;/* list of VMAs */ struct rb_root mm_rb; -u32 vmacache_seqnum;/* per-thread vmacache */ +u64 vmacache_seqnum;/* per-thread vmacache */ #ifdef CONFIG_MMU unsigned long (*get_unmapped_area) (struct file *filp, unsigned long addr, unsigned long len,
include/linux/sched.h +1 -1
@@ -1291,7 +1291,7 @@ struct task_struct { unsigned brk_randomized:1;#endif /* per-thread vma caching */ -u32 vmacache_seqnum; +u64 vmacache_seqnum;struct vm_area_struct *vmacache[VMACACHE_SIZE ];#if defined(SPLIT_RSS_COUNTING )struct task_rss_stat rss_stat;
include/linux/syscalls.h +2 -0
@@ -866,4 +866,6 @@ asmlinkage long sys_process_vm_writev(pid_t pid,asmlinkage long sys_kcmp (pid_t pid1,pid_t pid2,int type,unsigned long idx1,unsigned long idx2);asmlinkage long sys_finit_module (int fd,const char __user *uargs,int flags); +asmlinkage long sys_seccomp (unsigned int op,unsigned int flags, +const char __user *uargs);#endif
include/linux/vmacache.h +0 -5
@@ -15,7 +15,6 @@ static inline void vmacache_flush(struct task_struct *tsk)memset (tsk->vmacache,0 ,sizeof (tsk->vmacache)); } -extern void vmacache_flush_all (struct mm_struct *mm);extern void vmacache_update (unsigned long addr,struct vm_area_struct *newvma);extern struct vm_area_struct *vmacache_find (struct mm_struct *mm,unsigned long addr);
@@ -29,10 +28,6 @@ extern struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm,static inline void vmacache_invalidate (struct mm_struct *mm) { mm->vmacache_seqnum++; - -/* deal with overflows */ -if (unlikely (mm->vmacache_seqnum ==0 )) -vmacache_flush_all (mm); }#endif /* __LINUX_VMACACHE_H */
include/uapi/asm-generic/unistd.h +3 -1
@@ -699,9 +699,11 @@ __SYSCALL(__NR_sched_setattr, sys_sched_setattr) __SYSCALL(__NR_sched_getattr, sys_sched_getattr)#define __NR_renameat2 276 __SYSCALL(__NR_renameat2, sys_renameat2) +#define __NR_seccomp 277 +__SYSCALL(__NR_seccomp, sys_seccomp)#undef __NR_syscalls -#define __NR_syscalls 277 +#define __NR_syscalls 278/* * All syscalls below here should go away really,
include/uapi/linux/seccomp.h +4 -0
@@ -10,6 +10,10 @@#define SECCOMP_MODE_STRICT 1/* uses hard-coded filter. */ #define SECCOMP_MODE_FILTER 2/* uses user-supplied filter. */ +/* Valid operations for seccomp syscall. */ +#define SECCOMP_SET_MODE_STRICT 0 +#define SECCOMP_SET_MODE_FILTER 1 +/* * All BPF programs must return a 32-bit value. * The bottom 16-bits are for optional return data.
kernel/futex.c +92 -7
139 lines not on this page · raw message
kernel/seccomp.c +121 -25
188 lines not on this page · raw message
kernel/sys_ni.c +3 -0
@@ -213,3 +213,6 @@ cond_syscall(compat_sys_open_by_handle_at);/* compare kernel pointers */ cond_syscall (sys_kcmp); + +/* operate on Secure Computing state */ +cond_syscall (sys_seccomp);
mm/vmacache.c +0 -36
@@ -5,42 +5,6 @@#include <linux/mm.h> #include <linux/vmacache.h> -/* -* Flush vma caches for threads that share a given mm. -* -* The operation is safe because the caller holds the mmap_sem -* exclusively and other threads accessing the vma cache will -* have mmap_sem held at least for read, so no extra locking -* is required to maintain the vma cache. -*/ -void vmacache_flush_all (struct mm_struct *mm) -{ -struct task_struct *g, *p; - -/* -* Single threaded tasks need not iterate the entire -* list of process. We can avoid the flushing as well -* since the mm's seqnum was increased and don't have -* to worry about other threads' seqnum. Current's -* flush will occur upon the next lookup. -*/ -if (atomic_read (&mm->mm_users) ==1 ) -return ; - -rcu_read_lock (); -for_each_process_thread (g, p) { -/* -* Only flush the vmacache pointers as the -* mm seqnum is already set and curr's will -* be set upon invalidation when the next -* lookup is done. -*/ -if (mm == p->mm) -vmacache_flush (p); - } -rcu_read_unlock (); -} -/* * This task may be accessing a foreign mm via (for example) * get_user_pages()->find_vma(). The vmacache is task-local and this
net/bluetooth/hidp/core.c +2 -2
@@ -429,8 +429,8 @@ static void hidp_del_timer(struct hidp_session *session)del_timer (&session->timer); } -static void hidp_process_report (struct hidp_session *session, -int type,const u8 *data,int len,int intr) +static void hidp_process_report (struct hidp_session *session,int type, +const u8 *data,unsigned int len,int intr) {if (len >HID_MAX_BUFFER_SIZE ) len =HID_MAX_BUFFER_SIZE ;
net/core/sock.c +2 -0
@@ -1512,6 +1512,8 @@ struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority)sock_copy (newsk, sk); + newsk->sk_prot_creator = sk->sk_prot; +/* SANITY */ get_net (sock_net (newsk));sk_node_init (&newsk->sk_node);
net/ipv4/ip_vti.c +1 -0
@@ -359,6 +359,7 @@ static int vti_tunnel_init(struct net_device *dev)memcpy (dev->dev_addr, &iph->saddr,4 );memcpy (dev->broadcast, &iph->daddr,4 ); + dev->mtu =ETH_DATA_LEN ; dev->flags =IFF_NOARP ; dev->iflink =0 ; dev->addr_len =4 ;
sound/core/rawmidi.c +14 -6
@@ -645,7 +645,7 @@ static int snd_rawmidi_info_select_user(struct snd_card *card,int snd_rawmidi_output_params (struct snd_rawmidi_substream *substream,struct snd_rawmidi_params * params) { -char *newbuf; +char *newbuf, *oldbuf;struct snd_rawmidi_runtime *runtime = substream->runtime;if (substream->append && substream->use_count >1 )
@@ -658,13 +658,17 @@ int snd_rawmidi_output_params(struct snd_rawmidi_substream *substream,return -EINVAL ; }if (params->buffer_size != runtime->buffer_size) { - newbuf =krealloc (runtime->buffer, params->buffer_size, -GFP_KERNEL ); + newbuf =kmalloc (params->buffer_size,GFP_KERNEL );if (!newbuf)return -ENOMEM ; +spin_lock_irq (&runtime->lock); + oldbuf = runtime->buffer; runtime->buffer = newbuf; runtime->buffer_size = params->buffer_size; runtime->avail = runtime->buffer_size; + runtime->appl_ptr = runtime->hw_ptr =0 ; +spin_unlock_irq (&runtime->lock); +kfree (oldbuf); } runtime->avail_min = params->avail_min; substream->active_sensing = !params->no_active_sensing;
@@ -675,7 +679,7 @@ EXPORT_SYMBOL(snd_rawmidi_output_params);int snd_rawmidi_input_params (struct snd_rawmidi_substream *substream,struct snd_rawmidi_params * params) { -char *newbuf; +char *newbuf, *oldbuf;struct snd_rawmidi_runtime *runtime = substream->runtime;snd_rawmidi_drain_input (substream);
@@ -686,12 +690,16 @@ int snd_rawmidi_input_params(struct snd_rawmidi_substream *substream,return -EINVAL ; }if (params->buffer_size != runtime->buffer_size) { - newbuf =krealloc (runtime->buffer, params->buffer_size, -GFP_KERNEL ); + newbuf =kmalloc (params->buffer_size,GFP_KERNEL );if (!newbuf)return -ENOMEM ; +spin_lock_irq (&runtime->lock); + oldbuf = runtime->buffer; runtime->buffer = newbuf; runtime->buffer_size = params->buffer_size; + runtime->appl_ptr = runtime->hw_ptr =0 ; +spin_unlock_irq (&runtime->lock); +kfree (oldbuf); } runtime->avail_min = params->avail_min;return 0 ;