Linux 3.14.76
Greg KH
maintainerI'm announcing the release of the 3.14.76 kernel.
All users of the 3.14 kernel series must upgrade.
The updated 3.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-3.14.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/kernel/sys_oabi-compat.c | 8 + arch/mips/kernel/scall64-n32.S | 2 arch/mips/kernel/scall64-o32.S | 2 arch/x86/include/asm/mmu_context.h | 33 +++++++ arch/x86/mm/tlb.c | 25 +++++ block/genhd.c | 1 crypto/gcm.c | 4 crypto/scatterwalk.c | 3 drivers/char/random.c | 13 +-- drivers/infiniband/core/ucm.c | 4 drivers/infiniband/core/ucma.c | 3 drivers/infiniband/core/uverbs_main.c | 5 + drivers/infiniband/hw/ipath/ipath_file_ops.c | 5 + drivers/infiniband/hw/qib/qib_file_ops.c | 5 + drivers/net/bonding/bond_netlink.c | 6 + drivers/net/usb/cdc_ncm.c | 20 +--- drivers/scsi/scsi_lib.c | 116 +++++++-------------------- drivers/usb/core/hub.c | 23 ++++- drivers/usb/core/quirks.c | 8 - fs/ext4/extents.c | 8 + fs/ext4/inode.c | 35 ++++++-- fs/ext4/mballoc.c | 17 --- fs/ext4/super.c | 10 ++ fs/fuse/inode.c | 2 include/linux/console.h | 1 include/rdma/ib.h | 16 +++ ipc/msg.c | 2 ipc/sem.c | 12 +- kernel/panic.c | 3 kernel/printk/printk.c | 35 +++++++- mm/migrate.c | 51 +++++++---- net/ipv4/tcp_input.c | 12 ++ net/ipv4/tcp_output.c | 3 net/irda/af_irda.c | 7 + net/sctp/sm_sideeffect.c | 42 +++++---- security/apparmor/apparmorfs.c | 1 37 files changed, 348 insertions(+), 197 deletions(-)
Alan Stern (1):
USB: fix invalid memory access in hub_activate()
Andy Lutomirski (2):
x86/mm: Add barriers and document switch_mm()-vs-flush synchronization x86/mm: Improve switch_mm() barrier comments
Beniamino Galvani (1):
bonding: set carrier off for devices created through netlink
Bjørn Mork (1):
cdc_ncm: do not call usbnet_link_change from cdc_ncm_bind
Christoph Hellwig (1):
scsi: remove scsi_end_request
Dave Weinstein (1):
arm: oabi compat: add missing access checks
David Howells (1):
KEYS: 64-bit MIPS needs to use compat_sys_keyctl for 32-bit userspace
Eric Dumazet (1):
tcp: make challenge acks less predictable
Fabian Frederick (1):
sysv, ipc: fix security-layer leaking
Greg Kroah-Hartman (2):
USB: fix up incorrect quirk
Linux 3.14.76
Herbert Xu (2):
crypto: gcm - Filter out async ghash if necessary
crypto: scatterwalk - Fix test in scatterwalk_done
Hugh Dickins (1):
mm: migrate dirty page without clear_page_dirty_for_io etc
James Bottomley (1):
scsi_lib: correctly retry failed zero length REQ_TYPE_FS commands
Jan Kara (1):
ext4: fix deadlock during page writeback
Jason Gunthorpe (1):
IB/security: Restrict use of the write() interface
John Johansen (1):
apparmor: fix ref count leak when profile sha1 hash is read
Karl Heiss (1):
sctp: Prevent soft lockup when sctp_accept() is called during a timeout event
Soheil Hassas Yeganeh (1):
tcp: consider recv buf for the initial window scale
Tejun Heo (1):
printk: do cond_resched() between lines while outputting to consoles
Theodore Ts'o (1):
random: strengthen input validation for RNDADDTOENTCNT
Vegard Nossum (6):
block: fix use-after-free in seq file
ext4: check for extents that wrap around
ext4: don't call ext4_should_journal_data() on the journal inode
ext4: short-cut orphan cleanup on error
net/irda: fix NULL pointer dereference on memory allocation failure
ext4: fix reference counting bug on block allocation error
Wei Fang (1):
fuse: fix wrong assignment of ->flags in fuse_send_init()
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 3 PATCHLEVEL = 14 -SUBLEVEL = 75 +SUBLEVEL = 76 EXTRAVERSION = NAME = Remembering Coco
arch/arm/kernel/sys_oabi-compat.c +7 -1
@@ -275,8 +275,12 @@ asmlinkage long sys_oabi_epoll_wait(int epfd,mm_segment_t fs;long ret, err, i; -if (maxevents <=0 || maxevents > (INT_MAX /sizeof (struct epoll_event ))) +if (maxevents <=0 || + maxevents > (INT_MAX /sizeof (*kbuf)) || + maxevents > (INT_MAX /sizeof (*events)))return -EINVAL ; +if (!access_ok (VERIFY_WRITE , events,sizeof (*events) * maxevents)) +return -EFAULT ; kbuf =kmalloc (sizeof (*kbuf) * maxevents,GFP_KERNEL );if (!kbuf)return -ENOMEM ;
@@ -313,6 +317,8 @@ asmlinkage long sys_oabi_semtimedop(int semid,if (nsops <1 || nsops >SEMOPM )return -EINVAL ; +if (!access_ok (VERIFY_READ , tsops,sizeof (*tsops) * nsops)) +return -EFAULT ; sops =kmalloc (sizeof (*sops) * nsops,GFP_KERNEL );if (!sops)return -ENOMEM ;
arch/mips/kernel/scall64-n32.S +1 -1
@@ -350,7 +350,7 @@ EXPORT(sysn32_call_table) PTR sys_ni_syscall /* available, was setaltroot */ PTR sys_add_key PTR sys_request_key - PTR sys_keyctl /* 6245 */ + PTR compat_sys_keyctl /* 6245 */ PTR sys_set_thread_area PTR sys_inotify_init PTR sys_inotify_add_watch
arch/mips/kernel/scall64-o32.S +1 -1
@@ -474,7 +474,7 @@ EXPORT(sys32_call_table) PTR sys_ni_syscall /* available, was setaltroot */ PTR sys_add_key /* 4280 */ PTR sys_request_key - PTR sys_keyctl + PTR compat_sys_keyctl PTR sys_set_thread_area PTR sys_inotify_init PTR sys_inotify_add_watch /* 4285 */
arch/x86/include/asm/mmu_context.h +32 -1
@@ -42,7 +42,34 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,#endif cpumask_set_cpu (cpu,mm_cpumask (next)); -/* Re-load page tables */ +/* +* Re-load page tables. +* +* This logic has an ordering constraint: +* +* CPU 0: Write to a PTE for 'next' +* CPU 0: load bit 1 in mm_cpumask. if nonzero, send IPI. +* CPU 1: set bit 1 in next's mm_cpumask +* CPU 1: load from the PTE that CPU 0 writes (implicit) +* +* We need to prevent an outcome in which CPU 1 observes +* the new PTE value and CPU 0 observes bit 1 clear in +* mm_cpumask. (If that occurs, then the IPI will never +* be sent, and CPU 0's TLB will contain a stale entry.) +* +* The bad outcome can occur if either CPU's load is +* reordered before that CPU's store, so both CPUs must +* execute full barriers to prevent this from happening. +* +* Thus, switch_mm needs a full barrier between the +* store to mm_cpumask and any operation that could load +* from next->pgd. TLB fills are special and can happen +* due to instruction fetches or for no reason at all, +* and neither LOCK nor MFENCE orders them. +* Fortunately, load_cr3() is serializing and gives the +* ordering guarantee we need. +* +*/ load_cr3 (next->pgd);/* Stop flush ipis for the previous mm */
@@ -65,10 +92,14 @@ static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,* schedule, protecting us from simultaneous changes. */ cpumask_set_cpu (cpu,mm_cpumask (next)); +/* * We were in lazy tlb mode and leave_mm disabled * tlb flush IPI delivery. We must reload CR3 * to make sure to use no freed page tables. +* +* As above, load_cr3() is serializing and orders TLB +* fills with respect to the mm_cpumask write. */ load_cr3 (next->pgd);load_LDT_nolock (&next->context);
arch/x86/mm/tlb.c +22 -3
@@ -152,7 +152,10 @@ void flush_tlb_current_task(void)preempt_disable ();count_vm_tlb_event (NR_TLB_LOCAL_FLUSH_ALL ); + +/* This is an implicit full barrier that synchronizes with switch_mm. */ local_flush_tlb (); +if (cpumask_any_but (mm_cpumask (mm),smp_processor_id ()) < nr_cpu_ids)flush_tlb_others (mm_cpumask (mm), mm,0UL ,TLB_FLUSH_ALL );preempt_enable ();
@@ -166,11 +169,19 @@ void flush_tlb_mm_range(struct mm_struct *mm, unsigned long start,unsigned long nr_base_pages;preempt_disable (); -if (current->active_mm != mm) +if (current->active_mm != mm) { +/* Synchronize with switch_mm. */ +smp_mb (); + goto flush_all; + }if (!current->mm) {leave_mm (smp_processor_id ()); + +/* Synchronize with switch_mm. */ +smp_mb (); + goto flush_all; }
@@ -222,10 +233,18 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long start)preempt_disable ();if (current->active_mm == mm) { -if (current->mm) +if (current->mm) { +/* +* Implicit full barrier (INVLPG) that synchronizes +* with switch_mm. +*/ __flush_tlb_one (start); -else + }else {leave_mm (smp_processor_id ()); + +/* Synchronize with switch_mm. */ +smp_mb (); + } }if (cpumask_any_but (mm_cpumask (mm),smp_processor_id ()) < nr_cpu_ids)
block/genhd.c +1 -0
@@ -829,6 +829,7 @@ static void disk_seqf_stop(struct seq_file *seqf, void *v)if (iter) {class_dev_iter_exit (iter);kfree (iter); + seqf->private =NULL ; } }
crypto/gcm.c +3 -1
@@ -716,7 +716,9 @@ static struct crypto_instance *crypto_gcm_alloc_common(struct rtattr **tb, ghash_alg =crypto_find_alg (ghash_name, &crypto_ahash_type,CRYPTO_ALG_TYPE_HASH , -CRYPTO_ALG_TYPE_AHASH_MASK ); +CRYPTO_ALG_TYPE_AHASH_MASK | +crypto_requires_sync (algt->type, + algt->mask));if (IS_ERR (ghash_alg))return ERR_CAST (ghash_alg);
crypto/scatterwalk.c +2 -1
@@ -68,7 +68,8 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,void scatterwalk_done (struct scatter_walk *walk,int out,int more) { -if (!(scatterwalk_pagelen (walk) & (PAGE_SIZE -1 )) || !more) +if (!more || walk->offset >= walk->sg->offset + walk->sg->length || + !(walk->offset & (PAGE_SIZE -1 )))scatterwalk_pagedone (walk, out, more); }EXPORT_SYMBOL_GPL (scatterwalk_done);
drivers/char/random.c +7 -6
@@ -698,15 +698,18 @@ retry: } } -static void credit_entropy_bits_safe (struct entropy_store *r,int nbits) +static int credit_entropy_bits_safe (struct entropy_store *r,int nbits) {const int nbits_max = (int )(~0U >> (ENTROPY_SHIFT +1 )); +if (nbits <0 ) +return -EINVAL ; +/* Cap the value to avoid overflows */ nbits =min (nbits, nbits_max); - nbits =max (nbits, -nbits_max);credit_entropy_bits (r, nbits); +return 0 ; }/*********************************************************************
@@ -1420,8 +1423,7 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg)return -EPERM ;if (get_user (ent_count, p))return -EFAULT ; -credit_entropy_bits_safe (&input_pool, ent_count); -return 0 ; +return credit_entropy_bits_safe (&input_pool, ent_count);case RNDADDENTROPY :if (!capable (CAP_SYS_ADMIN ))return -EPERM ;
@@ -1435,8 +1437,7 @@ static long random_ioctl(struct file *f, unsigned int cmd, unsigned long arg) size);if (retval <0 )return retval; -credit_entropy_bits_safe (&input_pool, ent_count); -return 0 ; +return credit_entropy_bits_safe (&input_pool, ent_count);case RNDZAPENTCNT :case RNDCLEARPOOL :/*
drivers/infiniband/core/ucm.c +4 -0
@@ -48,6 +48,7 @@#include <asm/uaccess.h> +#include <rdma/ib.h> #include <rdma/ib_cm.h> #include <rdma/ib_user_cm.h> #include <rdma/ib_marshall.h>
@@ -1104,6 +1105,9 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf,struct ib_ucm_cmd_hdr hdr;ssize_t result; +if (WARN_ON_ONCE (!ib_safe_file_access (filp))) +return -EACCES ; +if (len <sizeof (hdr))return -EINVAL ;
drivers/infiniband/core/ucma.c +3 -0
@@ -1487,6 +1487,9 @@ static ssize_t ucma_write(struct file *filp, const char __user *buf,struct rdma_ucm_cmd_hdr hdr;ssize_t ret; +if (WARN_ON_ONCE (!ib_safe_file_access (filp))) +return -EACCES ; +if (len <sizeof (hdr))return -EINVAL ;
drivers/infiniband/core/uverbs_main.c +5 -0
@@ -48,6 +48,8 @@#include <asm/uaccess.h> +#include <rdma/ib.h> +#include "uverbs.h" MODULE_AUTHOR ("Roland Dreier" );
@@ -605,6 +607,9 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,struct ib_uverbs_cmd_hdr hdr;__u32 flags; +if (WARN_ON_ONCE (!ib_safe_file_access (filp))) +return -EACCES ; +if (count <sizeof hdr)return -EINVAL ;
drivers/infiniband/hw/ipath/ipath_file_ops.c +5 -0
@@ -45,6 +45,8 @@#include <linux/cpu.h> #include <asm/pgtable.h> +#include "rdma/ib.h" +#include "ipath_kernel.h" #include "ipath_common.h" #include "ipath_user_sdma.h"
@@ -2240,6 +2242,9 @@ static ssize_t ipath_write(struct file *fp, const char __user *data,ssize_t ret =0 ;void *dest; +if (WARN_ON_ONCE (!ib_safe_file_access (fp))) +return -EACCES ; +if (count <sizeof (cmd.type)) { ret = -EINVAL ; goto bail;
drivers/infiniband/hw/qib/qib_file_ops.c +5 -0
@@ -45,6 +45,8 @@#include <linux/delay.h> #include <linux/export.h> +#include <rdma/ib.h> +#include "qib.h" #include "qib_common.h" #include "qib_user_sdma.h"
@@ -2058,6 +2060,9 @@ static ssize_t qib_write(struct file *fp, const char __user *data,ssize_t ret =0 ;void *dest; +if (WARN_ON_ONCE (!ib_safe_file_access (fp))) +return -EACCES ; +if (count <sizeof (cmd.type)) { ret = -EINVAL ; goto bail;
drivers/net/bonding/bond_netlink.c +5 -1
@@ -360,7 +360,11 @@ static int bond_newlink(struct net *src_net, struct net_device *bond_dev,if (err <0 )return err; -return register_netdevice (bond_dev); + err =register_netdevice (bond_dev); + +netif_carrier_off (bond_dev); + +return err; }static size_t bond_get_size (const struct net_device *bond_dev)
drivers/net/usb/cdc_ncm.c +5 -15
@@ -571,24 +571,13 @@ EXPORT_SYMBOL_GPL(cdc_ncm_select_altsetting);static int cdc_ncm_bind (struct usbnet *dev,struct usb_interface *intf) { -int ret; -/* MBIM backwards compatible function? */ cdc_ncm_select_altsetting (dev, intf);if (cdc_ncm_comm_intf_is_mbim (intf->cur_altsetting))return -ENODEV ;/* NCM data altsetting is always 1 */ - ret =cdc_ncm_bind_common (dev, intf,1 ); - -/* -* We should get an event when network connection is "connected" or -* "disconnected". Set network connection in "disconnected" state -* (carrier is OFF) during attach, so the IP network stack does not -* start IPv6 negotiation and more. -*/ -usbnet_link_change (dev,0 ,0 ); -return ret; +return cdc_ncm_bind_common (dev, intf,1 ); }static void cdc_ncm_align_tail (struct sk_buff *skb,size_t modulus,size_t remainder,size_t max)
@@ -1117,7 +1106,8 @@ static int cdc_ncm_check_connect(struct usbnet *dev)static const struct driver_info cdc_ncm_info = { .description ="CDC NCM" , - .flags =FLAG_POINTTOPOINT |FLAG_NO_SETINT |FLAG_MULTI_PACKET , + .flags =FLAG_POINTTOPOINT |FLAG_NO_SETINT |FLAG_MULTI_PACKET + |FLAG_LINK_INTR , .bind = cdc_ncm_bind, .unbind = cdc_ncm_unbind, .check_connect = cdc_ncm_check_connect,
@@ -1131,7 +1121,7 @@ static const struct driver_info cdc_ncm_info = {static const struct driver_info wwan_info = { .description ="Mobile Broadband Network Device" , .flags =FLAG_POINTTOPOINT |FLAG_NO_SETINT |FLAG_MULTI_PACKET - |FLAG_WWAN , + |FLAG_LINK_INTR |FLAG_WWAN , .bind = cdc_ncm_bind, .unbind = cdc_ncm_unbind, .check_connect = cdc_ncm_check_connect,
@@ -1145,7 +1135,7 @@ static const struct driver_info wwan_info = {static const struct driver_info wwan_noarp_info = { .description ="Mobile Broadband Network Device (NO ARP)" , .flags =FLAG_POINTTOPOINT |FLAG_NO_SETINT |FLAG_MULTI_PACKET - |FLAG_WWAN |FLAG_NOARP , + |FLAG_LINK_INTR |FLAG_WWAN |FLAG_NOARP , .bind = cdc_ncm_bind, .unbind = cdc_ncm_unbind, .check_connect = cdc_ncm_check_connect,
drivers/scsi/scsi_lib.c +34 -82
160 lines not on this page · raw message
drivers/usb/core/hub.c +20 -3
@@ -106,6 +106,7 @@ EXPORT_SYMBOL_GPL(ehci_cf_port_reset_rwsem);#define HUB_DEBOUNCE_STEP 25#define HUB_DEBOUNCE_STABLE 100 +static void hub_release (struct kref *kref);static int usb_reset_and_verify_device (struct usb_device *udev);static inline char *portspeed (struct usb_hub *hub,int portstatus)
@@ -1023,10 +1024,20 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)unsigned delay;/* Continue a partial initialization */ -if (type ==HUB_INIT2 ) - goto init2; -if (type ==HUB_INIT3 ) +if (type ==HUB_INIT2 || type ==HUB_INIT3 ) { +device_lock (hub->intfdev); + +/* Was the hub disconnected while we were waiting? */ +if (hub->disconnected) { +device_unlock (hub->intfdev); +kref_put (&hub->kref, hub_release); +return ; + } +if (type ==HUB_INIT2 ) + goto init2; goto init3; + } +kref_get (&hub->kref);/* The superspeed hub except for root hub has to use Hub Depth * value as an offset into the route string to locate the bits
@@ -1220,6 +1231,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)PREPARE_DELAYED_WORK (&hub->init_work, hub_init_func3);schedule_delayed_work (&hub->init_work,msecs_to_jiffies (delay)); +device_unlock (hub->intfdev);return ;/* Continues at init3: below */ }else {msleep (delay);
@@ -1240,6 +1252,11 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)/* Allow autosuspend if it was suppressed */ if (type <=HUB_INIT3 )usb_autopm_put_interface_async (to_usb_interface (hub->intfdev)); + +if (type ==HUB_INIT2 || type ==HUB_INIT3 ) +device_unlock (hub->intfdev); + +kref_put (&hub->kref, hub_release); }/* Implement the continuations for the delays above */
drivers/usb/core/quirks.c +4 -4
@@ -164,6 +164,10 @@ static const struct usb_device_id usb_quirk_list[] = {/* MAYA44USB sound device */ { USB_DEVICE(0x0a92, 0x0091), .driver_info = USB_QUIRK_RESET_RESUME }, + /* ASUS Base Station(T100) */ + { USB_DEVICE(0x0b05, 0x17e0), .driver_info = + USB_QUIRK_IGNORE_REMOTE_WAKEUP }, + /* Action Semiconductor flash disk */ { USB_DEVICE(0x10d6, 0x2200), .driver_info = USB_QUIRK_STRING_FETCH_255 },
@@ -186,10 +190,6 @@ static const struct usb_device_id usb_interface_quirk_list[] = { { USB_VENDOR_AND_INTERFACE_INFO(0x046d, USB_CLASS_VIDEO, 1, 0), .driver_info = USB_QUIRK_RESET_RESUME }, - /* ASUS Base Station(T100) */ - { USB_DEVICE(0x0b05, 0x17e0), .driver_info = - USB_QUIRK_IGNORE_REMOTE_WAKEUP }, - { }/* terminating entry must be last */ };
fs/ext4/extents.c +6 -2
@@ -359,9 +359,13 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)ext4_fsblk_t block =ext4_ext_pblock (ext);int len =ext4_ext_get_actual_len (ext);ext4_lblk_t lblock =le32_to_cpu (ext->ee_block); -ext4_lblk_t last = lblock + len -1 ; -if (len ==0 || lblock > last) +/* +* We allow neither: +* - zero length +* - overflow/wrap-around +*/ +if (lblock + len <= lblock)return 0 ;return ext4_data_block_valid (EXT4_SB (inode->i_sb), block, len); }
fs/ext4/inode.c +29 -6
@@ -204,9 +204,9 @@ void ext4_evict_inode(struct inode *inode)* Note that directories do not have this problem because they * don't use page cache. */ -if (ext4_should_journal_data (inode) && - (S_ISLNK (inode->i_mode) ||S_ISREG (inode->i_mode)) && - inode->i_ino !=EXT4_JOURNAL_INO ) { +if (inode->i_ino !=EXT4_JOURNAL_INO && +ext4_should_journal_data (inode) && + (S_ISLNK (inode->i_mode) ||S_ISREG (inode->i_mode))) {journal_t *journal =EXT4_SB (inode->i_sb)->s_journal;tid_t commit_tid =EXT4_I (inode)->i_datasync_tid;
@@ -2579,13 +2579,36 @@ retry: done = true; } } -ext4_journal_stop (handle); +/* +* Caution: If the handle is synchronous, +* ext4_journal_stop() can wait for transaction commit +* to finish which may depend on writeback of pages to +* complete or on page lock to be released. In that +* case, we have to wait until after after we have +* submitted all the IO, released page locks we hold, +* and dropped io_end reference (for extent conversion +* to be able to complete) before stopping the handle. +*/ +if (!ext4_handle_valid (handle) || handle->h_sync ==0 ) { +ext4_journal_stop (handle); + handle =NULL ; + }/* Submit prepared bio */ ext4_io_submit (&mpd.io_submit);/* Unlock pages we didn't use */ mpage_release_unused_pages (&mpd, give_up_on_write); -/* Drop our io_end reference we got from init */ -ext4_put_io_end (mpd.io_submit.io_end); +/* +* Drop our io_end reference we got from init. We have +* to be careful and use deferred io_end finishing if +* we are still holding the transaction as we can +* release the last reference to io_end which may end +* up doing unwritten extent conversion. +*/ +if (handle) { +ext4_put_io_end_defer (mpd.io_submit.io_end); +ext4_journal_stop (handle); + }else +ext4_put_io_end (mpd.io_submit.io_end);if (ret == -ENOSPC && sbi->s_journal) {/*
fs/ext4/mballoc.c +3 -14
@@ -2897,7 +2897,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,ext4_error (sb,"Allocating blocks %llu-%llu which overlap " "fs metadata" , block, block+len);/* File system mounted not to panic on error -* Fix the bitmap and repeat the block allocation +* Fix the bitmap and return EUCLEAN * We leak some of the blocks here. */ ext4_lock_group (sb, ac->ac_b_ex.fe_group);
@@ -2906,7 +2906,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,ext4_unlock_group (sb, ac->ac_b_ex.fe_group); err =ext4_handle_dirty_metadata (handle,NULL , bitmap_bh);if (!err) - err = -EAGAIN ; + err = -EUCLEAN ; goto out_err; }
@@ -4476,18 +4476,7 @@ repeat: }if (likely (ac->ac_status ==AC_STATUS_FOUND )) { *errp =ext4_mb_mark_diskspace_used (ac, handle, reserv_clstrs); -if (*errp == -EAGAIN ) { -/* -* drop the reference that we took -* in ext4_mb_use_best_found -*/ -ext4_mb_release_context (ac); - ac->ac_b_ex.fe_group =0 ; - ac->ac_b_ex.fe_start =0 ; - ac->ac_b_ex.fe_len =0 ; - ac->ac_status =AC_STATUS_CONTINUE ; - goto repeat; - }else if (*errp) { +if (*errp) {ext4_discard_allocated_blocks (ac); goto errout; }else {
fs/ext4/super.c +10 -0
@@ -2222,6 +2222,16 @@ static void ext4_orphan_cleanup(struct super_block *sb,while (es->s_last_orphan) {struct inode *inode; +/* +* We may have encountered an error during cleanup; if +* so, skip the rest. +*/ +if (EXT4_SB (sb)->s_mount_state &EXT4_ERROR_FS ) { +jbd_debug (1 ,"Skipping orphan recovery on fs with errors.\n" ); + es->s_last_orphan =0 ; +break ; + } + inode =ext4_orphan_get (sb,le32_to_cpu (es->s_last_orphan));if (IS_ERR (inode)) { es->s_last_orphan =0 ;
fs/fuse/inode.c +1 -1
@@ -911,7 +911,7 @@ static void fuse_send_init(struct fuse_conn *fc, struct fuse_req *req) arg->flags |=FUSE_ASYNC_READ |FUSE_POSIX_LOCKS |FUSE_ATOMIC_O_TRUNC |FUSE_EXPORT_SUPPORT |FUSE_BIG_WRITES |FUSE_DONT_MASK |FUSE_SPLICE_WRITE |FUSE_SPLICE_MOVE |FUSE_SPLICE_READ | -FUSE_FLOCK_LOCKS |FUSE_IOCTL_DIR |FUSE_AUTO_INVAL_DATA | +FUSE_FLOCK_LOCKS |FUSE_HAS_IOCTL_DIR |FUSE_AUTO_INVAL_DATA |FUSE_DO_READDIRPLUS |FUSE_READDIRPLUS_AUTO |FUSE_ASYNC_DIO ; req->in.h.opcode =FUSE_INIT ; req->in.numargs =1 ;
include/linux/console.h +1 -0
@@ -150,6 +150,7 @@ extern int console_trylock(void);extern void console_unlock (void );extern void console_conditional_schedule (void );extern void console_unblank (void ); +extern void console_flush_on_panic (void );extern struct tty_driver *console_device (int *);extern void console_stop (struct console *);extern void console_start (struct console *);
include/rdma/ib.h +16 -0
@@ -34,6 +34,7 @@#define _RDMA_IB_H#include <linux/types.h> +#include <linux/sched.h> struct ib_addr { union {
@@ -86,4 +87,19 @@ struct sockaddr_ib { __u64 sib_scope_id; }; +/* +* The IB interfaces that use write() as bi-directional ioctl() are +* fundamentally unsafe, since there are lots of ways to trigger "write()" +* calls from various contexts with elevated privileges. That includes the +* traditional suid executable error message writes, but also various kernel +* interfaces that can write to file descriptors. +* +* This function provides protection for the legacy API by restricting the +* calling context. +*/ +static inline bool ib_safe_file_access (struct file *filp) +{ +return filp->f_cred ==current_cred () &&segment_eq (get_fs (),USER_DS ); +} +#endif /* _RDMA_IB_H */
ipc/msg.c +1 -1
@@ -745,7 +745,7 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,rcu_read_lock ();ipc_lock_object (&msq->q_perm); -ipc_rcu_putref (msq, ipc_rcu_free); +ipc_rcu_putref (msq, msg_rcu_free);/* raced with RMID? */ if (!ipc_valid_object (&msq->q_perm)) { err = -EIDRM ;
ipc/sem.c +6 -6
@@ -441,7 +441,7 @@ static inline struct sem_array *sem_obtain_object_check(struct ipc_namespace *nsstatic inline void sem_lock_and_putref (struct sem_array *sma) {sem_lock (sma,NULL ,-1 ); -ipc_rcu_putref (sma, ipc_rcu_free); +ipc_rcu_putref (sma, sem_rcu_free); }static inline void sem_rmid (struct ipc_namespace *ns,struct sem_array *s)
@@ -1371,7 +1371,7 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,rcu_read_unlock (); sem_io =ipc_alloc (sizeof (ushort)*nsems);if (sem_io ==NULL ) { -ipc_rcu_putref (sma, ipc_rcu_free); +ipc_rcu_putref (sma, sem_rcu_free);return -ENOMEM ; }
@@ -1405,20 +1405,20 @@ static int semctl_main(struct ipc_namespace *ns, int semid, int semnum,if (nsems >SEMMSL_FAST ) { sem_io =ipc_alloc (sizeof (ushort)*nsems);if (sem_io ==NULL ) { -ipc_rcu_putref (sma, ipc_rcu_free); +ipc_rcu_putref (sma, sem_rcu_free);return -ENOMEM ; } }if (copy_from_user (sem_io, p, nsems*sizeof (ushort))) { -ipc_rcu_putref (sma, ipc_rcu_free); +ipc_rcu_putref (sma, sem_rcu_free); err = -EFAULT ; goto out_free; }for (i =0 ; i < nsems; i++) {if (sem_io[i] >SEMVMX ) { -ipc_rcu_putref (sma, ipc_rcu_free); +ipc_rcu_putref (sma, sem_rcu_free); err = -ERANGE ; goto out_free; }
@@ -1708,7 +1708,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)/* step 2: allocate new undo structure */ new =kzalloc (sizeof (struct sem_undo ) +sizeof (short )*nsems,GFP_KERNEL );if (!new) { -ipc_rcu_putref (sma, ipc_rcu_free); +ipc_rcu_putref (sma, sem_rcu_free);return ERR_PTR (-ENOMEM ); }
kernel/panic.c +3 -0
@@ -23,6 +23,7 @@#include <linux/sysrq.h> #include <linux/init.h> #include <linux/nmi.h> +#include <linux/console.h> #define PANIC_TIMER_STEP 100#define PANIC_BLINK_SPD 18
@@ -133,6 +134,8 @@ void panic(const char *fmt, ...)bust_spinlocks (0 ); +console_flush_on_panic (); +if (!panic_blink) panic_blink = no_blink;
kernel/printk/printk.c +34 -1
@@ -2011,13 +2011,24 @@ void console_unlock(void)static u64 seen_seq;unsigned long flags;bool wake_klogd = false; -bool retry; +bool do_cond_resched, retry;if (console_suspended) {up (&console_sem);return ; } +/* +* Console drivers are called under logbuf_lock, so +* @console_may_schedule should be cleared before; however, we may +* end up dumping a lot of lines, for example, if called from +* console registration path, and should invoke cond_resched() +* between lines if allowable. Not doing so can cause a very long +* scheduling stall on a slow console leading to RCU stall and +* softlockup warnings which exacerbate the issue with more +* messages practically incapacitating the system. +*/ + do_cond_resched = console_may_schedule; console_may_schedule =0 ;/* flush buffered message fragment immediately to console */
@@ -2074,6 +2085,9 @@ skip:call_console_drivers (level, text, len);start_critical_timings ();local_irq_restore (flags); + +if (do_cond_resched) +cond_resched (); } console_locked =0 ;mutex_release (&console_lock_dep_map,1 , _RET_IP_);
@@ -2142,6 +2156,25 @@ void console_unblank(void)console_unlock (); } +/** +* console_flush_on_panic - flush console content on panic +* +* Immediately output all pending messages no matter what. +*/ +void console_flush_on_panic (void ) +{ +/* +* If someone else is holding the console lock, trylock will fail +* and may_schedule may be set. Ignore and proceed to unlock so +* that messages are flushed out. As this can be called from any +* context and we don't want to get preempted while flushing, +* ensure may_schedule is cleared. +*/ +console_trylock (); + console_may_schedule =0 ; +console_unlock (); +} +/* * Return the console tty driver structure and its associated index */
mm/migrate.c +31 -20
94 lines not on this page · raw message
net/ipv4/tcp_input.c +9 -3
@@ -87,7 +87,7 @@ int sysctl_tcp_adv_win_scale __read_mostly = 1;EXPORT_SYMBOL (sysctl_tcp_adv_win_scale);/* rfc5961 challenge ack rate limiting */ -int sysctl_tcp_challenge_ack_limit =100 ; +int sysctl_tcp_challenge_ack_limit =1000 ;int sysctl_tcp_stdurg__read_mostly ;int sysctl_tcp_rfc1337__read_mostly ;
@@ -3293,12 +3293,18 @@ static void tcp_send_challenge_ack(struct sock *sk)static u32 challenge_timestamp;static unsigned int challenge_count;u32 now = jiffies /HZ ; +u32 count;if (now != challenge_timestamp) { +u32 half = (sysctl_tcp_challenge_ack_limit +1 ) >>1 ; + challenge_timestamp = now; - challenge_count =0 ; + challenge_count = half + +prandom_u32_max (sysctl_tcp_challenge_ack_limit); } -if (++challenge_count <= sysctl_tcp_challenge_ack_limit) { + count = challenge_count; +if (count >0 ) { + challenge_count = count -1 ;NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPCHALLENGEACK );tcp_send_ack (sk); }
net/ipv4/tcp_output.c +2 -1
@@ -242,7 +242,8 @@ void tcp_select_initial_window(int __space, __u32 mss,/* Set window scaling on max possible window * See RFC1323 for an explanation of the limit to 14 */ - space =max_t (u32, sysctl_tcp_rmem[2 ], sysctl_rmem_max); + space =max_t (u32, space, sysctl_tcp_rmem[2 ]); + space =max_t (u32, space, sysctl_rmem_max); space =min_t (u32, space, *window_clamp);while (space >65535 && (*rcv_wscale) <14 ) { space >>=1 ;
net/irda/af_irda.c +5 -2
@@ -1037,8 +1037,11 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, }/* Check if we have opened a local TSAP */ -if (!self->tsap) -irda_open_tsap (self,LSAP_ANY , addr->sir_name); +if (!self->tsap) { + err =irda_open_tsap (self,LSAP_ANY , addr->sir_name); +if (err) + goto out; + }/* Move to connecting socket, start sending Connect Requests */ sock->state =SS_CONNECTING ;
net/sctp/sm_sideeffect.c +23 -19
103 lines not on this page · raw message
security/apparmor/apparmorfs.c +1 -0
@@ -331,6 +331,7 @@ static int aa_fs_seq_hash_show(struct seq_file *seq, void *v)seq_printf (seq,"%.2x" , profile->hash[i]);seq_puts (seq,"\n" ); } +aa_put_profile (profile);return 0 ; }