Linux 3.18.57
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 3 PATCHLEVEL = 18 -SUBLEVEL = 56 +SUBLEVEL = 57 EXTRAVERSION = NAME = Diseased Newt
arch/arm/kvm/init.S +2 -3
@@ -110,7 +110,6 @@ __do_hyp_init: @ - Write permission implies XN: disabled @ - Instruction cache: enabled @ - Data/Unified cache: enabled - @ - Memory alignment checks: enabled @ - MMU: enabled (this code must be run from an identity mapping) mrc p15, 4, r0, c1, c0, 0 @ HSCR ldr r2, =HSCTLR_MASK
@@ -118,8 +117,8 @@ __do_hyp_init: mrc p15, 0, r1, c1, c0, 0 @ SCTLR ldr r2, =(HSCTLR_EE | HSCTLR_FI | HSCTLR_I | HSCTLR_C) and r1, r1, r2 - ARM( ldr r2, =(HSCTLR_M | HSCTLR_A) ) - THUMB( ldr r2, =(HSCTLR_M | HSCTLR_A | HSCTLR_TE) ) + ARM( ldr r2, =(HSCTLR_M) ) + THUMB( ldr r2, =(HSCTLR_M | HSCTLR_TE) ) orr r1, r1, r2 orr r0, r0, r1 isb
arch/arm64/include/asm/asm-uaccess.h new file +13 -0
@@ -0,0 +1,13 @@ +#ifndef __ASM_ASM_UACCESS_H +#define __ASM_ASM_UACCESS_H + +/* +* Remove the address tag from a virtual address, if present. +*/ + .macro clear_address_tag, dst, addr + tst \addr, #(1 << 55) + bic \dst, \addr, #(0xff << 56) + csel \dst, \dst, \addr, eq + .endm + +#endif
arch/arm64/include/asm/barrier.h +8 -2
@@ -60,15 +60,21 @@ do { \#define smp_store_release (p, v) \ do { \ + union { typeof(*p) __val; char __c[1]; } __u = \ + { .__val = (__force typeof(*p)) (v) }; \ compiletime_assert_atomic_type(*p); \ switch (sizeof(*p)) { \ case 4: \ asm volatile ("stlr %w1, %0" \ - : "=Q" (*p) : "r" (v) : "memory"); \ + : "=Q" (*p) \ + : "r" (*(__u32 *)__u.__c) \ + : "memory"); \ break; \ case 8: \ asm volatile ("stlr %1, %0" \ - : "=Q" (*p) : "r" (v) : "memory"); \ + : "=Q" (*p) \ + : "r" (*(__u64 *)__u.__c) \ + : "memory"); \ break; \ } \ } while (0)
arch/arm64/include/asm/uaccess.h +8 -0
@@ -21,6 +21,7 @@/* * User space memory access functions */ +#include <linux/bitops.h> #include <linux/string.h> #include <linux/thread_info.h>
@@ -100,6 +101,13 @@ static inline void set_fs(mm_segment_t fs) flag; \ }) +/* +* When dealing with data aborts, watchpoints, or instruction traps we may end +* up with a tagged userland pointer. Clear the tag to get a sane pointer to +* pass on to access_ok(), for instance. +*/ +#define untagged_addr (addr) sign_extend64(addr, 55) +#define access_ok (type, addr, size) __range_ok(addr, size)#define user_addr_max get_fs
arch/arm64/kernel/entry.S +4 -2
@@ -28,6 +28,7 @@ #include <asm/errno.h> #include <asm/esr.h> #include <asm/thread_info.h> +#include <asm/asm-uaccess.h> #include <asm/unistd.h> /*
@@ -307,12 +308,13 @@ el1_da: /* * Data abort handling */ - mrs x0, far_el1 + mrs x3, far_el1 enable_dbg // re-enable interrupts if they were enabled in the aborted context tbnz x23, #7, 1f // PSR_I_BIT enable_irq 1: + clear_address_tag x0, x3 mov x2, sp // struct pt_regs bl do_mem_abort
@@ -472,7 +474,7 @@ el0_da: // enable interrupts before calling the main handler enable_dbg_and_irq ct_user_exit - bic x0, x26, #(0xff << 56) + clear_address_tag x0, x26 mov x1, x25 mov x2, sp adr lr, ret_to_user
arch/arm64/kernel/hw_breakpoint.c +2 -1
@@ -35,6 +35,7 @@#include <asm/traps.h> #include <asm/cputype.h> #include <asm/system_misc.h> +#include <asm/uaccess.h> /* Breakpoint currently in use for each BRP. */ static DEFINE_PER_CPU(struct perf_event *, bp_on_reg[ARM_MAX_BRP]);
@@ -688,7 +689,7 @@ static int watchpoint_handler(unsigned long addr, unsigned int esr,/* Check if the watchpoint value matches. */ val =read_wb_reg (AARCH64_DBG_REG_WVR , i); -if (val != (addr & ~alignment_mask)) +if (val != (untagged_addr (addr) & ~alignment_mask)) goto unlock;/* Possible match, check the byte address select to confirm. */
arch/powerpc/include/asm/topology.h +14 -0
@@ -44,8 +44,22 @@ extern void __init dump_numa_cpu_topology(void);extern int sysfs_add_device_to_node (struct device *dev,int nid);extern void sysfs_remove_device_from_node (struct device *dev,int nid); +static inline int early_cpu_to_node (int cpu) +{ +int nid; + + nid = numa_cpu_lookup_table[cpu]; + +/* +* Fall back to node 0 if nid is unset (it should be, except bugs). +* This allows callers to safely do NODE_DATA(early_cpu_to_node(cpu)). +*/ +return (nid <0 ) ?0 : nid; +}#else +static inline int early_cpu_to_node (int cpu) {return 0 ; } +static inline void dump_numa_cpu_topology (void ) {}static inline int sysfs_add_device_to_node (struct device *dev,int nid)
arch/powerpc/kernel/eeh_driver.c +15 -4
@@ -678,7 +678,7 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)*/ #define MAX_WAIT_FOR_RECOVERY 300 -static void eeh_handle_normal_event (struct eeh_pe *pe) +static bool eeh_handle_normal_event (struct eeh_pe *pe) {struct pci_bus *frozen_bus;int rc =0 ;
@@ -688,7 +688,7 @@ static void eeh_handle_normal_event(struct eeh_pe *pe)if (!frozen_bus) {pr_err ("%s: Cannot find PCI bus for PHB#%d-PE#%x\n" , __func__, pe->phb->global_number, pe->addr); -return ; +return false; }eeh_pe_update_time_stamp (pe);
@@ -805,7 +805,7 @@ static void eeh_handle_normal_event(struct eeh_pe *pe)pr_info ("EEH: Notify device driver to resume\n" );eeh_pe_dev_traverse (pe, eeh_report_resume,NULL ); -return ; +return false; excess_failures:/*
@@ -845,7 +845,11 @@ perm_error:pci_lock_rescan_remove ();pcibios_remove_pci_devices (frozen_bus);pci_unlock_rescan_remove (); + +/* The passed PE should no longer be used */ +return true; } +return false; }static void eeh_handle_special_event (void )
@@ -911,7 +915,14 @@ static void eeh_handle_special_event(void)*/ if (rc ==EEH_NEXT_ERR_FROZEN_PE || rc ==EEH_NEXT_ERR_FENCED_PHB ) { -eeh_handle_normal_event (pe); +/* +* eeh_handle_normal_event() can make the PE stale if it +* determines that the PE cannot possibly be recovered. +* Don't modify the PE state if that's the case. +*/ +if (eeh_handle_normal_event (pe)) +continue ; +eeh_pe_state_clear (pe,EEH_PE_RECOVERING ); }else {pci_lock_rescan_remove ();
arch/powerpc/kernel/setup_64.c +2 -2
@@ -754,7 +754,7 @@ void ppc64_boot_msg(unsigned int src, const char *msg)static void *__init pcpu_fc_alloc (unsigned int cpu,size_t size,size_t align) { -return __alloc_bootmem_node (NODE_DATA (cpu_to_node (cpu)), size, align, +return __alloc_bootmem_node (NODE_DATA (early_cpu_to_node (cpu)), size, align,__pa (MAX_DMA_ADDRESS )); }
@@ -765,7 +765,7 @@ static void __init pcpu_fc_free(void *ptr, size_t size)static int pcpu_cpu_distance (unsigned int from,unsigned int to) { -if (cpu_to_node (from) ==cpu_to_node (to)) +if (early_cpu_to_node (from) ==early_cpu_to_node (to))return LOCAL_DISTANCE ;else return REMOTE_DISTANCE ;
arch/x86/kernel/kvm.c +1 -1
@@ -161,8 +161,8 @@ void kvm_async_pf_task_wait(u32 token)*/ rcu_irq_exit ();native_safe_halt (); -rcu_irq_enter ();local_irq_disable (); +rcu_irq_enter (); } }if (!n.halted)
arch/x86/kvm/cpuid.c +11 -9
@@ -691,18 +691,20 @@ out:static int move_to_next_stateful_cpuid_entry (struct kvm_vcpu *vcpu,int i) {struct kvm_cpuid_entry2 *e = &vcpu->arch.cpuid_entries[i]; -int j, nent = vcpu->arch.cpuid_nent; +struct kvm_cpuid_entry2 *ej; +int j = i; +int nent = vcpu->arch.cpuid_nent; e->flags &= ~KVM_CPUID_FLAG_STATE_READ_NEXT ;/* when no next entry is found, the current entry[i] is reselected */ -for (j = i +1 ; ; j = (j +1 ) % nent) { -struct kvm_cpuid_entry2 *ej = &vcpu->arch.cpuid_entries[j]; -if (ej->function == e->function) { - ej->flags |=KVM_CPUID_FLAG_STATE_READ_NEXT ; -return j; - } - } -return 0 ;/* silence gcc, even though control never reaches here */ +do { + j = (j +1 ) % nent; + ej = &vcpu->arch.cpuid_entries[j]; + }while (ej->function != e->function); + + ej->flags |=KVM_CPUID_FLAG_STATE_READ_NEXT ; + +return j; }/* find an entry with matching function, matching index (if needed), and that
crypto/gcm.c +2 -4
@@ -146,10 +146,8 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key, err =crypto_ablkcipher_encrypt (&data->req);if (err == -EINPROGRESS || err == -EBUSY ) { - err =wait_for_completion_interruptible ( - &data->result.completion); -if (!err) - err = data->result.err; +wait_for_completion (&data->result.completion); + err = data->result.err; }if (err)
drivers/char/mem.c +1 -1
@@ -332,7 +332,7 @@ static int mmap_mem(struct file *file, struct vm_area_struct *vma)phys_addr_t offset = (phys_addr_t )vma->vm_pgoff <<PAGE_SHIFT ;/* It's illegal to wrap around the end of the physical address space. */ -if (offset + (phys_addr_t )size < offset) +if (offset + (phys_addr_t )size -1 < offset)return -EINVAL ;if (!valid_mmap_phys_addr_range (vma->vm_pgoff, size))
drivers/char/random.c +25 -1
@@ -1714,13 +1714,15 @@ int random_int_secret_init(void)return 0 ; } +static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash) +__aligned(sizeof(unsigned long)) ; +/* * Get a random word for internal kernel use only. Similar to urandom but * with the goal of minimal entropy pool depletion. As a result, the random * value is not cryptographically secure but for several uses the cost of * depleting entropy is too high */ -static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash);unsigned int get_random_int (void ) {__u32 *hash;
@@ -1741,6 +1743,28 @@ unsigned int get_random_int(void)EXPORT_SYMBOL (get_random_int);/* +* Same as get_random_int(), but returns unsigned long. +*/ +unsigned long get_random_long (void ) +{ +__u32 *hash; +unsigned long ret; + +if (arch_get_random_long (&ret)) +return ret; + + hash =get_cpu_var (get_random_int_hash); + + hash[0 ] += current->pid + jiffies +random_get_entropy (); +md5_transform (hash, random_int_secret); + ret = *(unsigned long *)hash; +put_cpu_var (get_random_int_hash); + +return ret; +} +EXPORT_SYMBOL (get_random_long); + +/* * randomize_range() returns a start address such that * * [...... <range> .....]
drivers/dma/ep93xx_dma.c +2 -0
@@ -325,6 +325,8 @@ static int m2p_hw_setup(struct ep93xx_dma_chan *edmac) | M2P_CONTROL_ENABLE;m2p_set_control (edmac, control); + edmac->buffer =0 ; +return 0 ; }
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c +2 -0
@@ -384,6 +384,8 @@ void *vmw_fifo_reserve(struct vmw_private *dev_priv, uint32_t bytes)return fifo_state->static_buffer; else { fifo_state->dynamic_buffer =vmalloc (bytes); +if (!fifo_state->dynamic_buffer) + goto out_err;return fifo_state->dynamic_buffer; } }
drivers/gpu/drm/vmwgfx/vmwgfx_surface.c +3 -0
@@ -1243,6 +1243,9 @@ int vmw_gb_surface_define_ioctl(struct drm_device *dev, void *data,const struct svga3d_surface_desc *desc;uint32_t backup_handle; +if (req->mip_levels >DRM_VMW_MAX_MIP_LEVELS ) +return -EINVAL ; +if (unlikely (vmw_user_surface_size ==0 )) vmw_user_surface_size =ttm_round_pot (sizeof (*user_srf)) +128 ;
drivers/iio/proximity/as3935.c +2 -2
@@ -40,9 +40,9 @@#define AS3935_AFE_PWR_BIT BIT(0)#define AS3935_INT 0x03 -#define AS3935_INT_MASK 0x07 +#define AS3935_INT_MASK 0x0f#define AS3935_EVENT_INT BIT(3) -#define AS3935_NOISE_INT BIT(1) +#define AS3935_NOISE_INT BIT(0)#define AS3935_DATA 0x07#define AS3935_DATA_MASK 0x3F
drivers/infiniband/hw/mlx5/main.c +1 -1
@@ -30,7 +30,7 @@* SOFTWARE. */ -#include <asm-generic/kmap_types.h> +#include <linux/highmem.h> #include <linux/module.h> #include <linux/init.h> #include <linux/errno.h>
drivers/infiniband/hw/qib/qib_rc.c +3 -1
@@ -2086,8 +2086,10 @@ send_last: ret =qib_get_rwqe (qp,1 );if (ret <0 ) goto nack_op_err; -if (!ret) +if (!ret) { +qib_put_ss (&qp->r_sge); goto rnr_nak; + } wc.ex.imm_data = ohdr->u.rc.imm_data; hdrsize +=4 ; wc.wc_flags =IB_WC_WITH_IMM ;
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -1
@@ -1929,7 +1929,7 @@ u16 bnx2x_select_queue(struct net_device *dev, struct sk_buff *skb, }/* select a non-FCoE queue */ -return fallback (dev, skb) %BNX2X_NUM_ETH_QUEUES (bp); +return fallback (dev, skb) % (BNX2X_NUM_ETH_QUEUES (bp) * bp->max_cos); }void bnx2x_set_num_queues (struct bnx2x *bp)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +4 -0
@@ -4580,10 +4580,14 @@ static int cxgb_up(struct adapter *adap)if (err) goto irq_err; } + +mutex_lock (&uld_mutex);enable_rx (adap);t4_sge_start (adap);t4_intr_enable (adap); adap->flags |=FULL_INIT_DONE ; +mutex_unlock (&uld_mutex); +notify_ulds (adap,CXGB4_STATE_UP );#if IS_ENABLED (CONFIG_IPV6 )update_clip (adap);
drivers/net/ethernet/ethoc.c +2 -1
@@ -706,6 +706,8 @@ static int ethoc_open(struct net_device *dev)if (ret)return ret; +napi_enable (&priv->napi); +ethoc_init_ring (priv, dev->mem_start);ethoc_reset (priv);
@@ -718,7 +720,6 @@ static int ethoc_open(struct net_device *dev) }phy_start (priv->phy); -napi_enable (&priv->napi);if (netif_msg_ifup (priv)) { dev_info(&dev->dev, "I/O: %08lx Memory: %08lx-%08lx\n",
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +1 -1
@@ -30,7 +30,7 @@* SOFTWARE. */ -#include <asm-generic/kmap_types.h> +#include <linux/highmem.h> #include <linux/module.h> #include <linux/errno.h> #include <linux/pci.h>
drivers/net/ethernet/mellanox/mlx5/core/main.c +1 -1
@@ -30,7 +30,7 @@* SOFTWARE. */ -#include <asm-generic/kmap_types.h> +#include <linux/highmem.h> #include <linux/module.h> #include <linux/init.h> #include <linux/errno.h>
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +1 -1
@@ -30,7 +30,7 @@* SOFTWARE. */ -#include <asm-generic/kmap_types.h> +#include <linux/highmem.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/mlx5/driver.h>
drivers/scsi/qla2xxx/qla_os.c +4 -4
@@ -2387,10 +2387,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)if (mem_only) {if (pci_enable_device_mem (pdev)) - goto probe_out; +return ret; }else {if (pci_enable_device (pdev)) - goto probe_out; +return ret; }/* This may fail but that's ok */
@@ -2400,7 +2400,7 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)if (!ha) {ql_log_pci (ql_log_fatal, pdev,0x0009 ,"Unable to allocate memory for ha.\n" ); - goto probe_out; + goto disable_device; }ql_dbg_pci (ql_dbg_init, pdev,0x000a ,"Memory allocated for ha=%p.\n" , ha);
@@ -2998,7 +2998,7 @@ iospace_config_failed:kfree (ha); ha =NULL ; -probe_out: +disable_device:pci_disable_device (pdev);return ret; }
drivers/staging/lustre/lustre/lov/lov_pack.c +0 -9
@@ -420,18 +420,10 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm,struct lov_mds_md *lmmk =NULL ;int rc, lmm_size;int lum_size; -mm_segment_t seg;if (!lsm)return -ENODATA ; -/* -* "Switch to kernel segment" to allow copying from kernel space by -* copy_{to,from}_user(). -*/ - seg =get_fs (); -set_fs (KERNEL_DS ); -/* we only need the header part from user space to get lmm_magic and * lmm_stripe_count, (the header part is common to v1 and v3) */ lum_size =sizeof (struct lov_user_md_v1 );
@@ -507,6 +499,5 @@ int lov_getstripe(struct obd_export *exp, struct lov_stripe_md *lsm,obd_free_diskmd (exp, &lmmk); out_set: -set_fs (seg);return rc; }
drivers/tty/serial/ifx6x60.c +1 -1
@@ -1379,9 +1379,9 @@ static struct spi_driver ifx_spi_driver = { static void __exit ifx_spi_exit(void) {/* unregister */ +spi_unregister_driver ((void *)&ifx_spi_driver);tty_unregister_driver (tty_drv);put_tty_driver (tty_drv); -spi_unregister_driver ((void *)&ifx_spi_driver);unregister_reboot_notifier (&ifx_modem_reboot_notifier_block); }
drivers/tty/serial/sh-sci.c +6 -4
@@ -1734,11 +1734,13 @@ static int sci_startup(struct uart_port *port)dev_dbg (port->dev,"%s(%d)\n" , __func__, port->line); +sci_request_dma (port); + ret =sci_request_irq (s); -if (unlikely (ret <0 )) +if (unlikely (ret <0 )) { +sci_free_dma (port);return ret; - -sci_request_dma (port); + }spin_lock_irqsave (&port->lock, flags);sci_start_tx (port);
@@ -1760,8 +1762,8 @@ static void sci_shutdown(struct uart_port *port)sci_stop_tx (port);spin_unlock_irqrestore (&port->lock, flags); -sci_free_dma (port);sci_free_irq (s); +sci_free_dma (port); } static unsigned int sci_scbrr_calc(struct sci_port *s, unsigned int bps,
drivers/usb/chipidea/debug.c +2 -1
@@ -290,7 +290,8 @@ static int ci_role_show(struct seq_file *s, void *data) {struct ci_hdrc *ci = s->private; -seq_printf (s,"%s\n" ,ci_role (ci)->name); +if (ci->role !=CI_ROLE_END ) +seq_printf (s,"%s\n" ,ci_role (ci)->name);return 0 ; }
drivers/usb/chipidea/udc.c +6 -2
@@ -1892,6 +1892,7 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci)int ci_hdrc_gadget_init (struct ci_hdrc *ci) {struct ci_role_driver *rdrv; +int ret;if (!hw_read (ci,CAP_DCCPARAMS ,DCCPARAMS_DC ))return -ENXIO ;
@@ -1904,7 +1905,10 @@ int ci_hdrc_gadget_init(struct ci_hdrc *ci) rdrv->stop = udc_id_switch_for_host; rdrv->irq = udc_irq; rdrv->name ="gadget" ; - ci->roles[CI_ROLE_GADGET ] = rdrv; -return udc_start (ci); + ret =udc_start (ci); +if (!ret) + ci->roles[CI_ROLE_GADGET ] = rdrv; + +return ret; }
drivers/usb/gadget/function/f_mass_storage.c +11 -2
@@ -400,7 +400,11 @@ static int fsg_set_halt(struct fsg_dev *fsg, struct usb_ep *ep)/* Caller must hold fsg->lock */ static void wakeup_thread (struct fsg_common *common) { -smp_wmb ();/* ensure the write of bh->state is complete */ +/* +* Ensure the reading of thread_wakeup_needed +* and the writing of bh->state are completed +*/ +smp_mb ();/* Tell the main thread that something has happened */ common->thread_wakeup_needed =1 ;if (common->thread_task)
@@ -621,7 +625,12 @@ static int sleep_thread(struct fsg_common *common, bool can_freeze) }__set_current_state (TASK_RUNNING ); common->thread_wakeup_needed =0 ; -smp_rmb ();/* ensure the latest bh->state is visible */ + +/* +* Ensure the writing of thread_wakeup_needed +* and the reading of bh->state are completed +*/ +smp_mb ();return rc; }
fs/btrfs/extent-tree.c +1 -0
@@ -3509,6 +3509,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, info->space_info_kobj,"%s" , alloc_name(found->flags));if (ret) { +percpu_counter_destroy (&found->total_bytes_pinned);kfree (found);return ret; }
fs/btrfs/inode.c +2 -2
@@ -6920,8 +6920,8 @@ bool btrfs_page_exists_in_range(struct inode *inode, loff_t start, loff_t end)int found = false;void **pagep =NULL ;struct page *page =NULL ; -int start_idx; -int end_idx; +unsigned long start_idx; +unsigned long end_idx; start_idx = start >>PAGE_CACHE_SHIFT ;
fs/ext4/file.c +14 -36
81 lines not on this page · raw message
fs/ext4/inode.c +3 -2
@@ -4830,8 +4830,9 @@ static int ext4_expand_extra_isize(struct inode *inode,/* No extended attributes present */ if (!ext4_test_inode_state (inode,EXT4_STATE_XATTR ) || header->h_magic !=cpu_to_le32 (EXT4_XATTR_MAGIC )) { -memset ((void *)raw_inode +EXT4_GOOD_OLD_INODE_SIZE ,0 , - new_extra_isize); +memset ((void *)raw_inode +EXT4_GOOD_OLD_INODE_SIZE + +EXT4_I (inode)->i_extra_isize,0 , + new_extra_isize -EXT4_I (inode)->i_extra_isize);EXT4_I (inode)->i_extra_isize = new_extra_isize;return 0 ; }
fs/nfsd/nfs4proc.c +6 -7
@@ -1405,6 +1405,12 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, opdesc->op_get_currentstateid (cstate, &op->u); op->status = opdesc->op_func (rqstp, cstate, &op->u); +/* Only from SEQUENCE */ +if (cstate->status == nfserr_replay_cache) { +dprintk ("%s NFS4.1 replay from cache\n" , __func__); + status = op->status; + goto out; + }if (!op->status) {if (opdesc->op_set_currentstateid) opdesc->op_set_currentstateid (cstate, &op->u);
@@ -1415,14 +1421,7 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,if (need_wrongsec_check (rqstp)) op->status =check_nfsd_access (current_fh->fh_export, rqstp); } - encode_op: -/* Only from SEQUENCE */ -if (cstate->status == nfserr_replay_cache) { -dprintk ("%s NFS4.1 replay from cache\n" , __func__); - status = op->status; - goto out; - }if (op->status == nfserr_replay_me) { op->replay = &cstate->replay_owner->so_replay;nfsd4_encode_replay (&resp->xdr, op);
include/linux/bitops.h +11 -0
@@ -171,6 +171,17 @@ static inline __s32 sign_extend32(__u32 value, int index)return (__s32)(value << shift) >> shift; } +/** +* sign_extend64 - sign extend a 64-bit value using specified bit as sign-bit +* @value: value to sign extend +* @index: 0 based bit index (0<=index<64) to sign bit +*/ +static inline __s64 sign_extend64 (__u64 value,int index) +{ +__u8 shift =63 - index; +return (__s64)(value << shift) >> shift; +} +static inline unsigned fls_long (unsigned long l) {if (sizeof (l) ==4 )
include/linux/random.h +1 -0
@@ -23,6 +23,7 @@ extern const struct file_operations random_fops, urandom_fops;#endif unsigned int get_random_int (void ); +unsigned long get_random_long (void );unsigned long randomize_range (unsigned long start,unsigned long end,unsigned long len);u32 prandom_u32 (void );
include/net/ipv6.h +1 -0
@@ -898,6 +898,7 @@ int inet6_hash_connect(struct inet_timewait_death_row *death_row,*/ extern const struct proto_ops inet6_stream_ops;extern const struct proto_ops inet6_dgram_ops; +extern const struct proto_ops inet6_sockraw_ops;struct group_source_req ;struct group_filter ;
kernel/events/core.c +21 -0
@@ -5761,6 +5761,21 @@ static void perf_log_throttle(struct perf_event *event, int enable)perf_output_end (&handle); } +static bool sample_is_allowed (struct perf_event *event,struct pt_regs *regs) +{ +/* +* Due to interrupt latency (AKA "skid"), we may enter the +* kernel before taking an overflow, even if the PMU is only +* counting user events. +* To avoid leaking information to userspace, we must always +* reject kernel samples when exclude_kernel is set. +*/ +if (event->attr.exclude_kernel && !user_mode (regs)) +return false; + +return true; +} +/* * Generic event overflow handling, sampling. */
@@ -5808,6 +5823,12 @@ static int __perf_event_overflow(struct perf_event *event, }/* +* For security, drop the skid kernel samples if necessary. +*/ +if (!sample_is_allowed (event, regs)) +return ret; + +/* * XXX event_limit might not quite work as expected on inherited * events */
kernel/fork.c +1 -1
@@ -338,7 +338,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)set_task_stack_end_magic (tsk);#ifdef CONFIG_CC_STACKPROTECTOR - tsk->stack_canary =get_random_int (); + tsk->stack_canary =get_random_long ();#endif /*
lib/test_user_copy.c +18 -2
@@ -58,7 +58,9 @@ static int __init test_user_copy_init(void) usermem = (char __user *)user_addr; bad_usermem = (char *)user_addr; -/* Legitimate usage: none of these should fail. */ +/* +* Legitimate usage: none of these copies should fail. +*/ ret |=test (copy_from_user (kmem, usermem,PAGE_SIZE ),"legitimate copy_from_user failed" ); ret |= test(copy_to_user(usermem, kmem, PAGE_SIZE),
@@ -68,19 +70,33 @@ static int __init test_user_copy_init(void) ret |=test (put_user (value, (unsigned long __user *)usermem),"legitimate put_user failed" ); -/* Invalid usage: none of these should succeed. */ +/* +* Invalid usage: none of these copies should succeed. +*/ + +/* Reject kernel-to-kernel copies through copy_from_user(). */ ret |=test (!copy_from_user (kmem, (char __user *)(kmem +PAGE_SIZE ),PAGE_SIZE ),"illegal all-kernel copy_from_user passed" ); + +#if 0 +/* +* When running with SMAP/PAN/etc, this will Oops the kernel +* due to the zeroing of userspace memory on failure. This needs +* to be tested in LKDTM instead, since this test module does not +* expect to explode. +*/ ret |=test (!copy_from_user (bad_usermem, (char __user *)kmem,PAGE_SIZE ),"illegal reversed copy_from_user passed" ); +#endif ret |=test (!copy_to_user ((char __user *)kmem, kmem +PAGE_SIZE ,PAGE_SIZE ),"illegal all-kernel copy_to_user passed" ); ret |=test (!copy_to_user ((char __user *)kmem, bad_usermem,PAGE_SIZE ),"illegal reversed copy_to_user passed" ); + ret |=test (!get_user (value, (unsigned long __user *)kmem),"illegal get_user passed" ); ret |= test(!put_user(value, (unsigned long __user *)kmem),
net/ipv4/af_inet.c +1 -1
@@ -1016,7 +1016,7 @@ static struct inet_protosw inetsw_array[] = .type = SOCK_DGRAM, .protocol = IPPROTO_ICMP, .prot = &ping_prot, - .ops = &inet_dgram_ops, + .ops = &inet_sockraw_ops, .flags = INET_PROTOSW_REUSE, },
net/ipv4/tcp_cong.c +1 -0
@@ -103,6 +103,7 @@ void tcp_init_congestion_control(struct sock *sk) {const struct inet_connection_sock *icsk =inet_csk (sk); +tcp_sk (sk)->prior_ssthresh =0 ;if (icsk->icsk_ca_ops->init) icsk->icsk_ca_ops->init (sk); }
net/ipv6/ip6_offload.c +3 -1
@@ -121,8 +121,10 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,if (udpfrag) {int err =ip6_find_1stfragopt (skb, &prevhdr); -if (err <0 ) +if (err <0 ) { +kfree_skb_list (segs);return ERR_PTR (err); + } fptr = (struct frag_hdr *)((u8 *)ipv6h + err); fptr->frag_off =htons (offset);if (skb->next !=NULL )
net/ipv6/ping.c +1 -1
@@ -50,7 +50,7 @@ static struct inet_protosw pingv6_protosw = { .type = SOCK_DGRAM, .protocol = IPPROTO_ICMPV6, .prot = &pingv6_prot, - .ops = &inet6_dgram_ops, + .ops = &inet6_sockraw_ops, .flags = INET_PROTOSW_REUSE, };
net/ipv6/raw.c +1 -1
@@ -1296,7 +1296,7 @@ void raw6_proc_exit(void)#endif /* CONFIG_PROC_FS */ /* Same as inet6_dgram_ops, sans udp_poll. */ -static const struct proto_ops inet6_sockraw_ops = { +const struct proto_ops inet6_sockraw_ops = { .family =PF_INET6 , .owner =THIS_MODULE , .release = inet6_release,
net/ipv6/xfrm6_mode_ro.c +2 -0
@@ -47,6 +47,8 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb) iph =ipv6_hdr (skb); hdr_len = x->type->hdr_offset (x, skb, &prevhdr); +if (hdr_len <0 ) +return hdr_len;skb_set_mac_header (skb, (prevhdr - x->props.header_len) - skb->data);skb_set_network_header (skb, -x->props.header_len); skb->transport_header = skb->network_header + hdr_len;
net/ipv6/xfrm6_mode_transport.c +2 -0
@@ -28,6 +28,8 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb) iph =ipv6_hdr (skb); hdr_len = x->type->hdr_offset (x, skb, &prevhdr); +if (hdr_len <0 ) +return hdr_len;skb_set_mac_header (skb, (prevhdr - x->props.header_len) - skb->data);skb_set_network_header (skb, -x->props.header_len); skb->transport_header = skb->network_header + hdr_len;
security/keys/key.c +2 -3
@@ -936,12 +936,11 @@ int key_update(key_ref_t key_ref, const void *payload, size_t plen)/* the key must be writable */ ret =key_permission (key_ref,KEY_NEED_WRITE );if (ret <0 ) - goto error; +return ret;/* attempt to update it if supported */ - ret = -EOPNOTSUPP ;if (!key->type->update) - goto error; +return -EOPNOTSUPP ;memset (&prep,0 ,sizeof (prep)); prep.data = payload;
security/keys/keyctl.c +2 -2
@@ -99,7 +99,7 @@ SYSCALL_DEFINE5(add_key, const char __user *, _type, payload =NULL ; vm = false; -if (_payload) { +if (plen) { ret = -ENOMEM ; payload =kmalloc (plen,GFP_KERNEL | __GFP_NOWARN);if (!payload) {
@@ -333,7 +333,7 @@ long keyctl_update_key(key_serial_t id,/* pull the payload in if one was supplied */ payload =NULL ; -if (_payload) { +if (plen) { ret = -ENOMEM ; payload =kmalloc (plen,GFP_KERNEL );if (!payload)
sound/core/timer.c +5 -0
@@ -1620,6 +1620,7 @@ static int snd_timer_user_tselect(struct file *file,if (err <0 ) goto __err; + tu->qhead = tu->qtail = tu->qused =0 ;kfree (tu->queue); tu->queue =NULL ;kfree (tu->tqueue);
@@ -1948,6 +1949,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, tu = file->private_data; unit = tu->tread ?sizeof (struct snd_timer_tread ) :sizeof (struct snd_timer_read ); +mutex_lock (&tu->ioctl_lock);spin_lock_irq (&tu->qlock);while ((long )count - result >= unit) {while (!tu->qused) {
@@ -1963,7 +1965,9 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,add_wait_queue (&tu->qchange_sleep, &wait);spin_unlock_irq (&tu->qlock); +mutex_unlock (&tu->ioctl_lock);schedule (); +mutex_lock (&tu->ioctl_lock);spin_lock_irq (&tu->qlock);remove_wait_queue (&tu->qchange_sleep, &wait);
@@ -2001,6 +2005,7 @@ static ssize_t snd_timer_user_read(struct file *file, char __user *buffer, } _error:spin_unlock_irq (&tu->qlock); +mutex_unlock (&tu->ioctl_lock);return result >0 ? result : err; }
sound/soc/soc-core.c +3 -2
@@ -1868,6 +1868,9 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)for (i =0 ; i < card->num_aux_devs; i++)soc_remove_aux_dev (card, i); +/* free the ALSA card at first; this syncs with pending operations */ +snd_card_free (card->snd_card); +/* remove and free each DAI */ soc_remove_dai_links (card);
@@ -1879,9 +1882,7 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)snd_soc_dapm_free (&card->dapm); -snd_card_free (card->snd_card);return 0 ; - }/* removes a socdev */
Greg KH
maintainerI'm announcing the release of the 3.18.57 kernel.
All users of the 3.18 kernel series must upgrade.
The updated 3.18.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.18.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/init.S | 5 -- arch/arm64/include/asm/asm-uaccess.h | 13 +++++ arch/arm64/include/asm/barrier.h | 10 +++- arch/arm64/include/asm/uaccess.h | 8 +++ arch/arm64/kernel/entry.S | 6 +- arch/arm64/kernel/hw_breakpoint.c | 3 - arch/powerpc/include/asm/topology.h | 14 +++++ arch/powerpc/kernel/eeh_driver.c | 19 ++++++- arch/powerpc/kernel/setup_64.c | 4 - arch/x86/kernel/kvm.c | 2 arch/x86/kvm/cpuid.c | 20 ++++---- crypto/gcm.c | 6 -- drivers/char/mem.c | 2 drivers/char/random.c | 26 ++++++++++ drivers/dma/ep93xx_dma.c | 2 drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c | 2 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 3 + drivers/iio/proximity/as3935.c | 4 - drivers/infiniband/hw/mlx5/main.c | 2 drivers/infiniband/hw/qib/qib_rc.c | 4 + drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 4 + drivers/net/ethernet/ethoc.c | 3 - drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | 2 drivers/scsi/qla2xxx/qla_os.c | 8 +-- drivers/staging/lustre/lustre/lov/lov_pack.c | 9 --- drivers/tty/serial/ifx6x60.c | 2 drivers/tty/serial/sh-sci.c | 10 ++-- drivers/usb/chipidea/debug.c | 3 - drivers/usb/chipidea/udc.c | 8 ++- drivers/usb/gadget/function/f_mass_storage.c | 13 ++++- fs/btrfs/extent-tree.c | 1 fs/btrfs/inode.c | 4 - fs/ext4/file.c | 50 +++++--------------- fs/ext4/inode.c | 5 +- fs/nfsd/nfs4proc.c | 13 ++--- include/linux/bitops.h | 11 ++++ include/linux/random.h | 1 include/net/ipv6.h | 1 kernel/events/core.c | 21 ++++++++ kernel/fork.c | 2 lib/test_user_copy.c | 20 +++++++- net/ipv4/af_inet.c | 2 net/ipv4/tcp_cong.c | 1 net/ipv6/ip6_offload.c | 4 + net/ipv6/ping.c | 2 net/ipv6/raw.c | 2 net/ipv6/xfrm6_mode_ro.c | 2 net/ipv6/xfrm6_mode_transport.c | 2 security/keys/key.c | 5 -- security/keys/keyctl.c | 4 - sound/core/timer.c | 5 ++ sound/soc/soc-core.c | 5 +- 56 files changed, 264 insertions(+), 124 deletions(-)
Alexander Sverdlin (1):
dmaengine: ep93xx: Always start from BASE0
Ben Hutchings (1):
ipv6: xfrm: Handle errors reported by xfrm6_find_1stfragopt()
Christoph Hellwig (1):
mlx5: stop including <asm-generic/kmap_types.h>
Dan Carpenter (1):
drm/vmwgfx: Handle vmalloc() failure in vmw_local_fifo_reserve()
Daniel Cashman (1):
drivers: char: random: add get_random_long()
Daniel Micay (1):
stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms
David S. Miller (1):
ipv6: Fix leak in ipv6_gso_segment().
David Sterba (1):
btrfs: use correct types for page indices in btrfs_page_exists_in_range
Eric Biggers (3):
KEYS: fix dereferencing NULL payload with nonzero length
KEYS: fix freeing uninitialized memory in key_update()
random: properly align get_random_int_hash
Eric Dumazet (1):
net: ping: do not abuse udp_poll()
Ganesh Goudar (1):
cxgb4: avoid enabling napi twice to the same queue
Gilad Ben-Yossef (1):
crypto: gcm - wait for crypto op not signal safe
Greg Kroah-Hartman (1):
Linux 3.18.57
J. Bruce Fields (1):
nfsd4: fix null dereference on replay
Jan Kara (1):
ext4: fix SEEK_HOLE
Jeff Mahoney (1):
btrfs: fix memory leak in update_space_info failure path
Jin Yao (1):
perf/core: Drop kernel samples even though :u is specified
Jisheng Zhang (1):
usb: chipidea: udc: fix NULL pointer dereference if udc_start failed
Johan Hovold (1):
serial: ifx6x60: fix use-after-free on module unload
Johannes Thumshirn (1):
scsi: qla2xxx: don't disable a not previously enabled PCI device
Julius Werner (1):
drivers: char: mem: Fix wraparound check to allow mappings up to the end
Kees Cook (1):
usercopy: Adjust tests to deal with SMAP/PAN
Konstantin Khlebnikov (1):
ext4: keep existing extra fields when inode expands
Kristina Martsenko (2):
arm64: hw_breakpoint: fix watchpoint matching for tagged pointers
arm64: entry: improve data abort handling of tagged pointers
Marc Zyngier (1):
arm: KVM: Allow unaligned accesses at HYP
Mark Rutland (1):
arm64: ensure extension of smp_store_release value
Matt Ranostay (1):
iio: proximity: as3935: fix AS3935_INT mask
Max Filippov (1):
net: ethoc: enable NAPI before poll may be scheduled
Michael Ellerman (1):
powerpc/numa: Fix percpu allocations to be NUMA aware
Michael Thalmeier (1):
usb: chipidea: debug: check before accessing ci_role
Mike Marciniszyn (1):
RDMA/qib,hfi1: Fix MR reference count leak on write with immediate
Mintz, Yuval (1):
bnx2x: Fix Multi-Cos
Oleg Drokin (1):
staging/lustre/lov: remove set_fs() call from lov_getstripe()
Paolo Bonzini (1):
kvm: async_pf: fix rcu_irq_enter() with irqs enabled
Russell Currey (1):
powerpc/eeh: Avoid use after free in eeh_handle_special_event()
Takashi Iwai (3):
ALSA: timer: Fix missing queue indices reset at SNDRV_TIMER_IOCTL_SELECT
ASoC: Fix use-after-free at card unregistration
ALSA: timer: Fix race between read and ioctl
Takatoshi Akiyama (1):
serial: sh-sci: Fix panic when serial console and DMA are enabled
Thinh Nguyen (1):
usb: gadget: f_mass_storage: Serialize wake and sleep execution
Vladis Dronov (1):
drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl()
Wanpeng Li (1):
KVM: cpuid: Fix read/write out-of-bounds vulnerability in cpuid emulation
Yuchung Cheng (1):
tcp: disallow cwnd undo when switching congestion control