Linux 4.4.114
Greg KH
maintainerI'm announcing the release of the 4.4.114 kernel.
All users of the 4.4 kernel series must upgrade.
The updated 4.4.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.4.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/um/Makefile | 2 arch/x86/entry/vsyscall/vsyscall_64.c | 7 +- arch/x86/include/asm/cpufeature.h | 1 arch/x86/include/asm/intel-family.h | 68 ++++++++++++++++++++ arch/x86/include/asm/processor.h | 2 arch/x86/include/asm/switch_to.h | 38 +++++++++++ arch/x86/include/asm/vsyscall.h | 1 arch/x86/kernel/apic/io_apic.c | 2 arch/x86/kernel/cpu/bugs.c | 36 ++++++++++ arch/x86/kernel/cpu/intel_cacheinfo.c | 2 arch/x86/kernel/cpu/microcode/intel.c | 21 +++++- arch/x86/lib/delay.c | 7 ++ arch/x86/mm/kaiser.c | 2 drivers/acpi/acpi_processor.c | 9 -- drivers/acpi/acpica/nsutils.c | 23 ++---- drivers/acpi/glue.c | 12 +-- drivers/acpi/processor_throttling.c | 9 ++ drivers/base/cacheinfo.c | 15 +++- drivers/base/power/trace.c | 4 - drivers/input/mouse/trackpoint.c | 3 drivers/mmc/host/sdhci-of-esdhc.c | 10 ++ drivers/net/ethernet/realtek/r8169.c | 9 -- drivers/net/ppp/pppoe.c | 11 +-- drivers/net/usb/lan78xx.c | 1 drivers/net/vmxnet3/vmxnet3_drv.c | 2 drivers/pci/host/pci-layerscape.c | 22 ++++-- drivers/scsi/libiscsi.c | 2 drivers/usb/usbip/stub_dev.c | 3 drivers/usb/usbip/stub_rx.c | 46 ++++++++++--- drivers/usb/usbip/usbip_common.c | 15 +--- drivers/usb/usbip/usbip_common.h | 1 drivers/usb/usbip/usbip_event.c | 5 - drivers/usb/usbip/vhci_hcd.c | 90 +++++++++++++++----------- drivers/usb/usbip/vhci_rx.c | 30 +++++--- drivers/usb/usbip/vhci_sysfs.c | 44 +++++++------ drivers/usb/usbip/vhci_tx.c | 14 ++-- fs/ext2/acl.c | 36 ++++++---- fs/fcntl.c | 4 + fs/nfsd/auth.c | 5 - fs/reiserfs/bitmap.c | 14 +++- fs/reiserfs/xattr_acl.c | 12 ++- fs/select.c | 14 +++- include/linux/cacheinfo.h | 1 include/linux/ktime.h | 7 ++ include/linux/netfilter/x_tables.h | 10 ++ include/linux/sched.h | 1 include/linux/tcp.h | 7 +- include/linux/vermagic.h | 8 -- include/net/arp.h | 3 include/net/ipv6.h | 1 include/net/net_namespace.h | 10 ++ include/uapi/linux/eventpoll.h | 13 +++ ipc/msg.c | 5 + kernel/sched/core.c | 2 kernel/sched/deadline.c | 98 +++++++++++++++++++++++++---- kernel/time/hrtimer.c | 5 + kernel/time/timer.c | 9 ++ mm/cma.c | 15 +--- mm/memcontrol.c | 2 mm/memory-failure.c | 7 ++ mm/mmap.c | 6 + mm/page_alloc.c | 6 - net/can/af_can.c | 22 ++---- net/core/dev.c | 19 ++++- net/core/flow_dissector.c | 3 net/core/neighbour.c | 4 - net/dccp/ccids/ccid2.c | 3 net/ipv4/arp.c | 7 +- net/ipv4/igmp.c | 2 net/ipv4/netfilter/arp_tables.c | 57 +++++++++------- net/ipv4/netfilter/ip_tables.c | 51 ++++++++------- net/ipv4/netfilter/nf_reject_ipv4.c | 2 net/ipv4/tcp.c | 3 net/ipv4/tcp_timer.c | 15 ++++ net/ipv6/ip6_output.c | 9 +- net/ipv6/ipv6_sockglue.c | 2 net/ipv6/netfilter/ip6_tables.c | 51 ++++++++------- net/ipv6/netfilter/nf_dup_ipv6.c | 1 net/ipv6/netfilter/nf_reject_ipv6.c | 3 net/netfilter/nf_conntrack_core.c | 7 ++ net/netfilter/nf_conntrack_expect.c | 2 net/netfilter/nf_conntrack_sip.c | 5 + net/netfilter/nfnetlink_cthelper.c | 10 ++ net/netfilter/nfnetlink_queue.c | 6 - net/netfilter/x_tables.c | 50 ++++++++++++++ net/netfilter/xt_osf.c | 7 ++ net/sctp/socket.c | 30 +++----- tools/usb/usbip/libsrc/usbip_common.c | 9 ++ tools/usb/usbip/libsrc/usbip_host_driver.c | 27 ++++++- tools/usb/usbip/libsrc/vhci_driver.c | 8 +- tools/usb/usbip/src/usbip.c | 2 92 files changed, 924 insertions(+), 365 deletions(-)
Aaron Ma (1):
Input: trackpoint - force 3 buttons if 0 button is reported
Alexey Kodanev (1):
dccp: don't restart ccid2_hc_tx_rto_expire() if sk in closed state
Andrew Goodbody (1):
usb: usbip: Fix possible deadlocks reported by lockdep
Andy Lutomirski (1):
x86/asm/32: Make sync_core() handle missing CPUID on all 32-bit kernels
Ben Hutchings (4):
x86/microcode/intel: Fix BDW late-loading revision check
vsyscall: Fix permissions for emulate mode with KAISER/PTI
ipv6: Fix getsockopt() for sockets with default IPV6_AUTOFLOWLABEL
nfsd: auth: Fix gid sorting when rootsquash enabled
Craig Gallek (1):
tcp: __tcp_hdrlen() helper
Dan Streetman (1):
net: tcp: close sock if net namespace is exiting
Daniel Bristot de Oliveira (1):
sched/deadline: Use the revised wakeup rule for suspending constrained dl tasks
Dave Hansen (1):
x86/cpu/intel: Introduce macros for Intel family numbers
David Woodhouse (1):
x86/retpoline: Fill RSB on context switch for affected CPUs
Doug Berger (1):
cma: fix calculation of aligned offset
Eric Biggers (1):
PM / sleep: declare __tracedata symbols as char[] rather than char
Eric Dumazet (3):
ipv6: ip6_make_skb() needs to clear cork.base.dst
net: qdisc_pkt_len_init() should be more robust
flow_dissector: properly cap thoff field
Felix Fietkau (1):
net: igmp: fix source address check for IGMPv3 reports
Florian Westphal (2):
netfilter: x_tables: speed up jump target validation
netfilter: restart search if moved to other chain
Francois Romieu (1):
r8169: fix memory corruption on retrieval of hardware statistics.
Greg KH (1):
eventpoll.h: add missing epoll event masks
Greg Kroah-Hartman (2):
Revert "module: Add retpoline tag to VERMAGIC" Linux 4.4.114
Guillaume Nault (1):
pppoe: take ->needed_headroom of lower device into account on xmit
Hongxu Jia (1):
netfilter: arp_tables: fix invoking 32bit "iptable -P INPUT ACCEPT" failed in 64bit kernel
Jan Kara (2):
ext2: Don't clear SGID when inheriting ACLs
reiserfs: Don't clear SGID when inheriting ACLs
Janakarajan Natarajan (1):
Prevent timer value 0 for MWAITX
Jeff Mahoney (2):
reiserfs: fix race in prealloc discard
reiserfs: don't preallocate blocks for extended attributes
Jia Zhang (1):
x86/microcode/intel: Extend BDW late-loading further with LLC size check
Jim Westfall (2):
net: Allow neigh contructor functions ability to modify the primary_key
ipv4: Make neigh lookup keys for loopback/point-to-point devices be INADDR_ANY
Jiri Slaby (2):
ipc: msg, make msgrcv work with LONG_MIN fs/fcntl: f_setown, avoid undefined behaviour
Johannes Thumshirn (1):
scsi: libiscsi: fix shifting of DID_REQUEUE host byte
Jonathan Dieter (2):
usbip: Fix implicit fallthrough warning
usbip: Fix potential format overflow in userspace tools
Kevin Cernekee (2):
netfilter: nfnetlink_cthelper: Add missing permission checks
netfilter: xt_osf: Add missing permission checks
Liping Zhang (2):
netfilter: nf_ct_expect: remove the redundant slash when policy name is empty
netfilter: nfnetlink_queue: reject verdict request from different portid
Marc Kleine-Budde (2):
can: af_can: can_rcv(): replace WARN_ONCE by pr_warn_once
can: af_can: canfd_rcv(): replace WARN_ONCE by pr_warn_once
Michal Hocko (2):
mm/mmap.c: do not blow on PROT_NONE MAP_FIXED holes in the stack hwpoison, memcg: forcibly uncharge LRU pages
Mike Maloney (1):
ipv6: fix udpv6 sendmsg crash caused by too small MTU
Minghuan Lian (1):
PCI: layerscape: Fix MSG TLP drop setting
Neil Horman (1):
vmxnet3: repair memory leak
Pablo Neira Ayuso (1):
netfilter: fix IS_ERR_VALUE usage
Paolo Abeni (1):
netfilter: nf_dup_ipv6: set again FLOWI_FLAG_KNOWN_NH at flowi6_flags
Pau Espin Pedrol (1):
netfilter: use fwmark_reflect in nf_send_reset
Rafael J. Wysocki (2):
ACPI / processor: Avoid reserving IO regions too early ACPI / scan: Prefer devices without _HID/_CID for _ADR matching
Rui Wang (1):
x86/ioapic: Fix incorrect pointers in ioapic_setup_resources()
Seunghun Han (1):
ACPICA: Namespace: fix operand cache leak
Shuah Khan (4):
usbip: prevent vhci_hcd driver from leaking a socket pointer address
usbip: fix stub_rx: get_pipe() to validate endpoint number
usbip: fix stub_rx: harden CMD_SUBMIT path to handle malicious input
usbip: prevent leaking socket pointer address in messages
Sudeep Holla (2):
drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled
drivers: base: cacheinfo: fix boot error message when acpi is enabled
Thomas Gleixner (2):
timers: Plug locking race vs. timer migration
hrtimer: Reset hrtimer cpu base proper on CPU hotplug
Thomas Meyer (1):
um: link vmlinux with -no-pie
Ulrich Weber (1):
netfilter: nf_conntrack_sip: extend request line validation
Vegard Nossum (1):
time: Avoid undefined behaviour in ktime_add_safe()
Vlastimil Babka (2):
fs/select: add vmalloc fallback for select(2)
mm, page_alloc: fix potential false positive in __zone_watermark_ok
Xin Long (2):
sctp: do not allow the v4 socket to bind a v4mapped v6 address
sctp: return error if the asoc has been peeled off in sctp_wait_for_sndbuf
Yang Shi (1):
PCI: layerscape: Add "fsl,ls2085a-pcie" compatible ID
Yuiko Oshino (1):
lan78xx: Fix failure in USB Full Speed
yangbo lu (1):
mmc: sdhci-of-esdhc: add/remove some quirks according to vendor version
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 4 -SUBLEVEL = 113 +SUBLEVEL = 114 EXTRAVERSION = NAME = Blurry Fish Butt
arch/um/Makefile +1 -1
@@ -117,7 +117,7 @@ archheaders: archprepare: include/generated/user_constants.h LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static -LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib +LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib $(call cc-option, -no-pie) CFLAGS_NO_HARDENING := $(call cc-option, -fno-PIC,) $(call cc-option, -fno-pic,) \ $(call cc-option, -fno-stack-protector,) \
arch/x86/entry/vsyscall/vsyscall_64.c +4 -3
@@ -46,6 +46,7 @@ static enum { EMULATE, NATIVE, NONE } vsyscall_mode =#else EMULATE ;#endif +unsigned long vsyscall_pgprot = __PAGE_KERNEL_VSYSCALL;static int __init vsyscall_setup (char *str) {
@@ -336,11 +337,11 @@ void __init map_vsyscall(void)extern char __vsyscall_page;unsigned long physaddr_vsyscall =__pa_symbol (&__vsyscall_page); +if (vsyscall_mode !=NATIVE ) + vsyscall_pgprot = __PAGE_KERNEL_VVAR;if (vsyscall_mode !=NONE )__set_fixmap (VSYSCALL_PAGE , physaddr_vsyscall, - vsyscall_mode ==NATIVE - ?PAGE_KERNEL_VSYSCALL - :PAGE_KERNEL_VVAR ); +__pgprot (vsyscall_pgprot));BUILD_BUG_ON ((unsigned long )__fix_to_virt (VSYSCALL_PAGE ) != (unsigned long )VSYSCALL_ADDR );
arch/x86/include/asm/cpufeature.h +1 -0
@@ -199,6 +199,7 @@#define X86_FEATURE_HWP_EPP ( 7*32+13)/* Intel HWP_EPP */ #define X86_FEATURE_HWP_PKG_REQ ( 7*32+14)/* Intel HWP_PKG_REQ */ #define X86_FEATURE_INTEL_PT ( 7*32+15)/* Intel Processor Trace */ +#define X86_FEATURE_RSB_CTXSW ( 7*32+19)/* Fill RSB on context switches */ #define X86_FEATURE_RETPOLINE ( 7*32+29)/* Generic Retpoline mitigation for Spectre variant 2 */ #define X86_FEATURE_RETPOLINE_AMD ( 7*32+30)/* AMD Retpoline mitigation for Spectre variant 2 */
arch/x86/include/asm/intel-family.h new file +68 -0
68 lines not on this page · raw message
arch/x86/include/asm/processor.h +1 -1
@@ -574,7 +574,7 @@ static inline void sync_core(void) {int tmp; -#ifdef CONFIG_M486 +#ifdef CONFIG_X86_32 /* * Do a CPUID if available, otherwise do a jump. The jump * can conveniently enough be the jump around CPUID.
arch/x86/include/asm/switch_to.h +38 -0
@@ -1,6 +1,8 @@#ifndef _ASM_X86_SWITCH_TO_H#define _ASM_X86_SWITCH_TO_H +#include <asm/nospec-branch.h> +struct task_struct ;/* one of the stranger aspects of C forward declarations */ __visible struct task_struct *__switch_to(struct task_struct *prev,struct task_struct *next);
@@ -24,6 +26,23 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,#define __switch_canary_iparam#endif /* CC_STACKPROTECTOR */ +#ifdef CONFIG_RETPOLINE +/* +* When switching from a shallower to a deeper call stack +* the RSB may either underflow or use entries populated +* with userspace addresses. On CPUs where those concerns +* exist, overwrite the RSB with entries which capture +* speculative execution to prevent attack. +*/ +#define __retpoline_fill_return_buffer \ + ALTERNATIVE("jmp 910f", \ + __stringify(__FILL_RETURN_BUFFER(%%ebx, RSB_CLEAR_LOOPS, %%esp)),\ + X86_FEATURE_RSB_CTXSW) \ + "910:\n\t" +#else +#define __retpoline_fill_return_buffer +#endif +/* * Saving eflags is important. It switches not only IOPL between tasks, * it also protects other tasks from NT leaking through sysenter etc.
@@ -46,6 +65,7 @@ do { \"movl $1f,%[prev_ip]\n\t" /* save EIP */ \"pushl %[next_ip]\n\t" /* restore EIP */ \ __switch_canary \ + __retpoline_fill_return_buffer \"jmp __switch_to\n" /* regparm call */ \"1:\t" \"popl %%ebp\n\t" /* restore EBP */ \
@@ -100,6 +120,23 @@ do { \#define __switch_canary_iparam#endif /* CC_STACKPROTECTOR */ +#ifdef CONFIG_RETPOLINE +/* +* When switching from a shallower to a deeper call stack +* the RSB may either underflow or use entries populated +* with userspace addresses. On CPUs where those concerns +* exist, overwrite the RSB with entries which capture +* speculative execution to prevent attack. +*/ +#define __retpoline_fill_return_buffer \ + ALTERNATIVE("jmp 910f", \ + __stringify(__FILL_RETURN_BUFFER(%%r12, RSB_CLEAR_LOOPS, %%rsp)),\ + X86_FEATURE_RSB_CTXSW) \ + "910:\n\t" +#else +#define __retpoline_fill_return_buffer +#endif +/* * There is no need to save or restore flags, because flags are always * clean in kernel mode, with the possible exception of IOPL. Kernel IOPL
@@ -112,6 +149,7 @@ do { \"call __switch_to\n\t" \ "movq "__percpu_arg([current_task])",%%rsi\n\t" \ __switch_canary \ + __retpoline_fill_return_buffer \"movq %P[thread_info](%%rsi),%%r8\n\t" \"movq %%rax,%%rdi\n\t" \"testl %[_tif_fork],%P[ti_flags](%%r8)\n\t" \
arch/x86/include/asm/vsyscall.h +1 -0
@@ -13,6 +13,7 @@ extern void map_vsyscall(void);*/ extern bool emulate_vsyscall (struct pt_regs *regs,unsigned long address);extern bool vsyscall_enabled (void ); +extern unsigned long vsyscall_pgprot;#else static inline void map_vsyscall (void ) {}static inline bool emulate_vsyscall (struct pt_regs *regs,unsigned long address)
arch/x86/kernel/apic/io_apic.c +1 -1
@@ -2592,8 +2592,8 @@ static struct resource * __init ioapic_setup_resources(void) res[num].flags =IORESOURCE_MEM |IORESOURCE_BUSY ;snprintf (mem,IOAPIC_RESOURCE_NAME_SIZE ,"IOAPIC %u" , i); mem +=IOAPIC_RESOURCE_NAME_SIZE ; + ioapics[i].iomem_res = &res[num]; num++; - ioapics[i].iomem_res = res; } ioapic_resources = res;
arch/x86/kernel/cpu/bugs.c +36 -0
@@ -22,6 +22,7 @@#include <asm/alternative.h> #include <asm/pgtable.h> #include <asm/cacheflush.h> +#include <asm/intel-family.h> static void __init spectre_v2_select_mitigation (void );
@@ -154,6 +155,23 @@ disable:return SPECTRE_V2_CMD_NONE ; } +/* Check for Skylake-like CPUs (for RSB handling) */ +static bool __init is_skylake_era (void ) +{ +if (boot_cpu_data.x86_vendor ==X86_VENDOR_INTEL && + boot_cpu_data.x86 ==6 ) { +switch (boot_cpu_data.x86_model) { +case INTEL_FAM6_SKYLAKE_MOBILE : +case INTEL_FAM6_SKYLAKE_DESKTOP : +case INTEL_FAM6_SKYLAKE_X : +case INTEL_FAM6_KABYLAKE_MOBILE : +case INTEL_FAM6_KABYLAKE_DESKTOP : +return true; + } + } +return false; +} +static void __init spectre_v2_select_mitigation (void ) {enum spectre_v2_mitigation_cmd cmd =spectre_v2_parse_cmdline ();
@@ -212,6 +230,24 @@ retpoline_auto: spectre_v2_enabled = mode;pr_info ("%s\n" , spectre_v2_strings[mode]); + +/* +* If neither SMEP or KPTI are available, there is a risk of +* hitting userspace addresses in the RSB after a context switch +* from a shallow call stack to a deeper one. To prevent this fill +* the entire RSB, even when using IBRS. +* +* Skylake era CPUs have a separate issue with *underflow* of the +* RSB, when they will predict 'ret' targets from the generic BTB. +* The proper mitigation for this is IBRS. If IBRS is not supported +* or deactivated in favour of retpolines the RSB fill on context +* switch is required. +*/ +if ((!boot_cpu_has (X86_FEATURE_KAISER ) && + !boot_cpu_has (X86_FEATURE_SMEP )) ||is_skylake_era ()) { +setup_force_cpu_cap (X86_FEATURE_RSB_CTXSW ); +pr_info ("Filling RSB on context switch\n" ); + } }#undef pr_fmt
arch/x86/kernel/cpu/intel_cacheinfo.c +2 -0
@@ -934,6 +934,8 @@ static int __populate_cache_leaves(unsigned int cpu)ci_leaf_init (this_leaf++, &id4_regs);__cache_cpumap_setup (cpu, idx, &id4_regs); } + this_cpu_ci->cpu_map_populated = true; +return 0 ; }
arch/x86/kernel/cpu/microcode/intel.c +19 -2
@@ -39,6 +39,9 @@#include <asm/setup.h> #include <asm/msr.h> +/* last level cache size per core */ +static int llc_size_per_core; +static unsigned long mc_saved_in_initrd[MAX_UCODE_COUNT ]; static struct mc_saved_data { unsigned int mc_saved_count;
@@ -996,15 +999,18 @@ static bool is_blacklisted(unsigned int cpu)/* * Late loading on model 79 with microcode revision less than 0x0b000021 -* may result in a system hang. This behavior is documented in item -* BDF90, #334165 (Intel Xeon Processor E7-8800/4800 v4 Product Family). +* and LLC size per core bigger than 2.5MB may result in a system hang. +* This behavior is documented in item BDF90, #334165 (Intel Xeon +* Processor E7-8800/4800 v4 Product Family). */ if (c->x86 ==6 && c->x86_model ==79 && c->x86_mask ==0x01 && + llc_size_per_core >2621440 && c->microcode <0x0b000021 ) {pr_err_once ("Erratum BDF90: late loading with revision < 0x0b000021 (0x%x) disabled.\n" , c->microcode);pr_err_once ("Please consider either early loading through initrd/built-in or a potential BIOS update.\n" ); +return true; }return false;
@@ -1067,6 +1073,15 @@ static struct microcode_ops microcode_intel_ops = { .microcode_fini_cpu = microcode_fini_cpu, }; +static int __init calc_llc_size_per_core (struct cpuinfo_x86 *c) +{ +u64 llc_size = c->x86_cache_size *1024 ; + +do_div (llc_size, c->x86_max_cores); + +return (int )llc_size; +} +struct microcode_ops *__init init_intel_microcode (void ) {struct cpuinfo_x86 *c = &boot_cpu_data;
@@ -1077,6 +1092,8 @@ struct microcode_ops * __init init_intel_microcode(void)return NULL ; } + llc_size_per_core =calc_llc_size_per_core (c); +return µcode_intel_ops; }
arch/x86/lib/delay.c +7 -0
@@ -93,6 +93,13 @@ static void delay_mwaitx(unsigned long __loops) {u64 start, end, delay, loops = __loops; +/* +* Timer value of 0 causes MWAITX to wait indefinitely, unless there +* is a store on the memory monitored by MONITORX. +*/ +if (loops ==0 ) +return ; + start =rdtsc_ordered ();for (;;) {
arch/x86/mm/kaiser.c +1 -1
@@ -345,7 +345,7 @@ void __init kaiser_init(void)if (vsyscall_enabled ())kaiser_add_user_map_early ((void *)VSYSCALL_ADDR ,PAGE_SIZE , - __PAGE_KERNEL_VSYSCALL); + vsyscall_pgprot);for_each_possible_cpu (cpu) { void *percpu_vaddr = __per_cpu_user_mapped_start +
drivers/acpi/acpi_processor.c +0 -9
@@ -331,15 +331,6 @@ static int acpi_processor_get_info(struct acpi_device *device) pr->throttling.duty_width = acpi_gbl_FADT.duty_width; pr->pblk = object.processor.pblk_address; - -/* -* We don't care about error returns - we just try to mark -* these reserved so that nobody else is confused into thinking -* that this region might be unused.. -* -* (In particular, allocating the IO range for Cardbus) -*/ -request_region (pr->throttling.address,6 ,"ACPI CPU throttle" ); }/*
drivers/acpi/acpica/nsutils.c +9 -14
@@ -593,25 +593,20 @@ struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle)void acpi_ns_terminate (void ) {acpi_status status; +union acpi_operand_object *prev; +union acpi_operand_object *next;ACPI_FUNCTION_TRACE (ns_terminate); -#ifdef ACPI_EXEC_APP - { -union acpi_operand_object *prev; -union acpi_operand_object *next; +/* Delete any module-level code blocks */ -/* Delete any module-level code blocks */ - - next = acpi_gbl_module_code_list; -while (next) { - prev = next; - next = next->method.mutex; - prev->method.mutex =NULL ;/* Clear the Mutex (cheated) field */ -acpi_ut_remove_reference (prev); - } + next = acpi_gbl_module_code_list; +while (next) { + prev = next; + next = next->method.mutex; + prev->method.mutex =NULL ;/* Clear the Mutex (cheated) field */ +acpi_ut_remove_reference (prev); } -#endif /* * Free the entire namespace -- all nodes and all objects
drivers/acpi/glue.c +6 -6
@@ -99,13 +99,13 @@ static int find_child_checks(struct acpi_device *adev, bool check_children)return -ENODEV ;/* -* If the device has a _HID (or _CID) returning a valid ACPI/PNP -* device ID, it is better to make it look less attractive here, so that -* the other device with the same _ADR value (that may not have a valid -* device ID) can be matched going forward. [This means a second spec -* violation in a row, so whatever we do here is best effort anyway.] +* If the device has a _HID returning a valid ACPI/PNP device ID, it is +* better to make it look less attractive here, so that the other device +* with the same _ADR value (that may not have a valid device ID) can be +* matched going forward. [This means a second spec violation in a row, +* so whatever we do here is best effort anyway.] */ -return sta_present &&list_empty (&adev->pnp.ids) ? +return sta_present && !adev->pnp.type.platform_id ?FIND_CHILD_MAX_SCORE :FIND_CHILD_MIN_SCORE ; }
drivers/acpi/processor_throttling.c +9 -0
@@ -676,6 +676,15 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr)if (!pr->flags.throttling)return -ENODEV ; +/* +* We don't care about error returns - we just try to mark +* these reserved so that nobody else is confused into thinking +* that this region might be unused.. +* +* (In particular, allocating the IO range for Cardbus) +*/ +request_region (pr->throttling.address,6 ,"ACPI CPU throttle" ); + pr->throttling.state =0 ; duty_mask = pr->throttling.state_count -1 ;
drivers/base/cacheinfo.c +11 -4
@@ -16,6 +16,7 @@* You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include <linux/acpi.h> #include <linux/bitops.h> #include <linux/cacheinfo.h> #include <linux/compiler.h>
@@ -104,9 +105,16 @@ static int cache_shared_cpu_map_setup(unsigned int cpu)struct cpu_cacheinfo *this_cpu_ci =get_cpu_cacheinfo (cpu);struct cacheinfo *this_leaf, *sib_leaf;unsigned int index; -int ret; +int ret =0 ; + +if (this_cpu_ci->cpu_map_populated) +return 0 ; - ret =cache_setup_of_node (cpu); +if (of_have_populated_dt ()) + ret =cache_setup_of_node (cpu); +else if (!acpi_disabled) +/* No cache property/hierarchy support yet in ACPI */ + ret = -ENOTSUPP ;if (ret)return ret;
@@ -203,8 +211,7 @@ static int detect_cache_attributes(unsigned int cpu)*/ ret =cache_shared_cpu_map_setup (cpu);if (ret) { -pr_warn ("Unable to detect cache hierarchy from DT for CPU %d\n" , - cpu); +pr_warn ("Unable to detect cache hierarchy for CPU %d\n" , cpu); goto free_ci; }return 0 ;
drivers/base/power/trace.c +2 -2
@@ -166,14 +166,14 @@ void generate_pm_trace(const void *tracedata, unsigned int user) }EXPORT_SYMBOL (generate_pm_trace); -extern char __tracedata_start, __tracedata_end; +extern char __tracedata_start[], __tracedata_end[];static int show_file_hash (unsigned int value) {int match;char *tracedata; match =0 ; -for (tracedata = &__tracedata_start ; tracedata < &__tracedata_end ; +for (tracedata = __tracedata_start ; tracedata < __tracedata_end ; tracedata +=2 +sizeof (unsigned long )) {unsigned short lineno = *(unsigned short *)tracedata;const char *file = *(const char **)(tracedata +2 );
drivers/input/mouse/trackpoint.c +3 -0
@@ -383,6 +383,9 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)if (trackpoint_read (&psmouse->ps2dev,TP_EXT_BTN , &button_info)) {psmouse_warn (psmouse,"failed to get extended button data, assuming 3 buttons\n" ); button_info =0x33 ; + }else if (!button_info) { +psmouse_warn (psmouse,"got 0 in extended button data, assuming 3 buttons\n" ); + button_info =0x33 ; } psmouse->private =kzalloc (sizeof (struct trackpoint_data ),GFP_KERNEL );
drivers/mmc/host/sdhci-of-esdhc.c +10 -0
@@ -584,6 +584,8 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) {struct sdhci_host *host;struct device_node *np; +struct sdhci_pltfm_host *pltfm_host; +struct sdhci_esdhc *esdhc;int ret; np = pdev->dev.of_node;
@@ -600,6 +602,14 @@ static int sdhci_esdhc_probe(struct platform_device *pdev)sdhci_get_of_property (pdev); + pltfm_host =sdhci_priv (host); + esdhc = pltfm_host->priv; +if (esdhc->vendor_ver ==VENDOR_V_22 ) + host->quirks2 |=SDHCI_QUIRK2_HOST_NO_CMD23 ; + +if (esdhc->vendor_ver >VENDOR_V_22 ) + host->quirks &= ~SDHCI_QUIRK_NO_BUSY_IRQ ; + if (of_device_is_compatible(np, "fsl,p5040-esdhc") || of_device_is_compatible(np, "fsl,p5020-esdhc") || of_device_is_compatible(np, "fsl,p4080-esdhc") ||
drivers/net/ethernet/realtek/r8169.c +2 -7
@@ -2205,19 +2205,14 @@ static bool rtl8169_do_counters(struct net_device *dev, u32 counter_cmd)void __iomem *ioaddr = tp->mmio_addr;dma_addr_t paddr = tp->counters_phys_addr;u32 cmd; -bool ret;RTL_W32 (CounterAddrHigh, (u64 )paddr >>32 ); +RTL_R32 (CounterAddrHigh); cmd = (u64 )paddr &DMA_BIT_MASK (32 );RTL_W32 (CounterAddrLow, cmd);RTL_W32 (CounterAddrLow, cmd | counter_cmd); - ret =rtl_udelay_loop_wait_low (tp, &rtl_counters_cond,10 ,1000 ); - -RTL_W32 (CounterAddrLow,0 ); -RTL_W32 (CounterAddrHigh,0 ); - -return ret; +return rtl_udelay_loop_wait_low (tp, &rtl_counters_cond,10 ,1000 ); }static bool rtl8169_reset_counters (struct net_device *dev)
drivers/net/ppp/pppoe.c +6 -5
@@ -860,6 +860,7 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m,struct pppoe_hdr *ph;struct net_device *dev;char *start; +int hlen;lock_sock (sk);if (sock_flag (sk,SOCK_DEAD ) || !(sk->sk_state &PPPOX_CONNECTED )) {
@@ -878,16 +879,16 @@ static int pppoe_sendmsg(struct socket *sock, struct msghdr *m,if (total_len > (dev->mtu + dev->hard_header_len)) goto end; - - skb =sock_wmalloc (sk, total_len + dev->hard_header_len +32 , -0 ,GFP_KERNEL ); + hlen =LL_RESERVED_SPACE (dev); + skb =sock_wmalloc (sk, hlen +sizeof (*ph) + total_len + + dev->needed_tailroom,0 ,GFP_KERNEL );if (!skb) { error = -ENOMEM ; goto end; }/* Reserve space for headers. */ -skb_reserve (skb, dev->hard_header_len); +skb_reserve (skb, hlen);skb_reset_network_header (skb); skb->dev = dev;
@@ -948,7 +949,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)/* Copy the data if there is no space for the header or if it's * read-only. */ -if (skb_cow_head (skb,sizeof (*ph) + dev->hard_header_len)) +if (skb_cow_head (skb,LL_RESERVED_SPACE (dev) +sizeof (*ph))) goto abort;__skb_push (skb,sizeof (*ph));
drivers/net/usb/lan78xx.c +1 -0
@@ -1859,6 +1859,7 @@ static int lan78xx_reset(struct lan78xx_net *dev) buf =DEFAULT_BURST_CAP_SIZE /FS_USB_PKT_SIZE ; dev->rx_urb_size =DEFAULT_BURST_CAP_SIZE ; dev->rx_qlen =4 ; + dev->tx_qlen =4 ; } ret =lan78xx_write_reg (dev,BURST_CAP , buf);
drivers/net/vmxnet3/vmxnet3_drv.c +1 -1
@@ -1563,7 +1563,6 @@ static void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq, rq->rx_ring[i].basePA); rq->rx_ring[i].base =NULL ; } - rq->buf_info[i] =NULL ; }if (rq->comp_ring.base) {
@@ -1578,6 +1577,7 @@ static void vmxnet3_rq_destroy(struct vmxnet3_rx_queue *rq, (rq->rx_ring[0 ].size + rq->rx_ring[1 ].size);dma_free_coherent (&adapter->pdev->dev, sz, rq->buf_info[0 ], rq->buf_info_pa); + rq->buf_info[0 ] = rq->buf_info[1 ] =NULL ; } }
drivers/pci/host/pci-layerscape.c +14 -8
@@ -77,6 +77,16 @@ static void ls_pcie_fix_class(struct ls_pcie *pcie)iowrite16 (PCI_CLASS_BRIDGE_PCI , pcie->dbi +PCI_CLASS_DEVICE ); } +/* Drop MSG TLP except for Vendor MSG */ +static void ls_pcie_drop_msg_tlp (struct ls_pcie *pcie) +{ +u32 val; + + val =ioread32 (pcie->dbi +PCIE_STRFMR1 ); + val &=0xDFFFFFFF ; +iowrite32 (val, pcie->dbi +PCIE_STRFMR1 ); +} +static int ls1021_pcie_link_up (struct pcie_port *pp) {u32 state;
@@ -97,7 +107,7 @@ static int ls1021_pcie_link_up(struct pcie_port *pp)static void ls1021_pcie_host_init (struct pcie_port *pp) {struct ls_pcie *pcie =to_ls_pcie (pp); -u32 val, index[2 ]; +u32 index[2 ]; pcie->scfg =syscon_regmap_lookup_by_phandle (pp->dev->of_node,"fsl,pcie-scfg" );
@@ -116,13 +126,7 @@ static void ls1021_pcie_host_init(struct pcie_port *pp)dw_pcie_setup_rc (pp); -/* -* LS1021A Workaround for internal TKT228622 -* to fix the INTx hang issue -*/ - val =ioread32 (pcie->dbi +PCIE_STRFMR1 ); - val &=0xffff ; -iowrite32 (val, pcie->dbi +PCIE_STRFMR1 ); +ls_pcie_drop_msg_tlp (pcie); }static int ls_pcie_link_up (struct pcie_port *pp)
@@ -147,6 +151,7 @@ static void ls_pcie_host_init(struct pcie_port *pp)iowrite32 (1 , pcie->dbi +PCIE_DBI_RO_WR_EN );ls_pcie_fix_class (pcie);ls_pcie_clear_multifunction (pcie); +ls_pcie_drop_msg_tlp (pcie);iowrite32 (0 , pcie->dbi +PCIE_DBI_RO_WR_EN ); }
@@ -203,6 +208,7 @@ static const struct of_device_id ls_pcie_of_match[] = { { .compatible = "fsl,ls1021a-pcie", .data = &ls1021_drvdata }, { .compatible = "fsl,ls1043a-pcie", .data = &ls1043_drvdata }, { .compatible = "fsl,ls2080a-pcie", .data = &ls2080_drvdata }, + { .compatible = "fsl,ls2085a-pcie", .data = &ls2080_drvdata }, { }, };MODULE_DEVICE_TABLE (of, ls_pcie_of_match);
drivers/scsi/libiscsi.c +1 -1
@@ -1727,7 +1727,7 @@ int iscsi_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *sc)if (test_bit (ISCSI_SUSPEND_BIT , &conn->suspend_tx)) { reason =FAILURE_SESSION_IN_RECOVERY ; - sc->result =DID_REQUEUE ; + sc->result =DID_REQUEUE <<16 ; goto fault; }
drivers/usb/usbip/stub_dev.c +1 -2
@@ -163,8 +163,7 @@ static void stub_shutdown_connection(struct usbip_device *ud)* step 1? */ if (ud->tcp_socket) { -dev_dbg (&sdev->udev->dev,"shutdown tcp_socket %p\n" , - ud->tcp_socket); +dev_dbg (&sdev->udev->dev,"shutdown sockfd %d\n" , ud->sockfd);kernel_sock_shutdown (ud->tcp_socket,SHUT_RDWR ); }
drivers/usb/usbip/stub_rx.c +37 -9
82 lines not on this page · raw message
drivers/usb/usbip/usbip_common.c +4 -11
@@ -317,18 +317,14 @@ int usbip_recv(struct socket *sock, void *buf, int size)struct msghdr msg;struct kvec iov;int total =0 ; -/* for blocks of if (usbip_dbg_flag_xmit) */ char *bp = buf;int osize = size; -usbip_dbg_xmit ("enter\n" ); - -if (!sock || !buf || !size) { -pr_err ("invalid arg, sock %p buff %p size %d\n" , sock, buf, - size); +if (!sock || !buf || !size)return -EINVAL ; - } + +usbip_dbg_xmit ("enter\n" ); do { sock->sk->sk_allocation = GFP_NOIO;
@@ -341,11 +337,8 @@ int usbip_recv(struct socket *sock, void *buf, int size) msg.msg_flags =MSG_NOSIGNAL ; result =kernel_recvmsg (sock, &msg, &iov,1 , size,MSG_WAITALL ); -if (result <=0 ) { -pr_debug ("receive sock %p buf %p size %u ret %d total %d\n" , - sock, buf, size, result, total); +if (result <=0 ) goto err; - } size -= result; buf += result;
drivers/usb/usbip/usbip_common.h +1 -0
@@ -261,6 +261,7 @@ struct usbip_device {/* lock for status */ spinlock_t lock; +int sockfd;struct socket *tcp_socket;struct task_struct *tcp_rx;
drivers/usb/usbip/usbip_event.c +3 -2
@@ -117,11 +117,12 @@ EXPORT_SYMBOL_GPL(usbip_event_add);int usbip_event_happened (struct usbip_device *ud) {int happened =0 ; +unsigned long flags; -spin_lock (&ud->lock); +spin_lock_irqsave (&ud->lock, flags);if (ud->event !=0 ) happened =1 ; -spin_unlock (&ud->lock); +spin_unlock_irqrestore (&ud->lock, flags);return happened; }
drivers/usb/usbip/vhci_hcd.c +53 -37
325 lines not on this page · raw message
drivers/usb/usbip/vhci_rx.c +17 -13
@@ -71,10 +71,11 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev, {struct usbip_device *ud = &vdev->ud;struct urb *urb; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags); urb =pickup_urb_and_free_priv (vdev, pdu->base.seqnum); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);if (!urb) { pr_err("cannot find a urb of seqnum %u max seqnum %d\n",
@@ -103,9 +104,9 @@ static void vhci_recv_ret_submit(struct vhci_device *vdev,usbip_dbg_vhci_rx ("now giveback urb %u\n" , pdu->base.seqnum); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status);
@@ -116,8 +117,9 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev, struct usbip_header *pdu) {struct vhci_unlink *unlink, *tmp; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags);list_for_each_entry_safe (unlink, tmp, &vdev->unlink_rx, list) {pr_info ("unlink->seqnum %lu\n" , unlink->seqnum);
@@ -126,12 +128,12 @@ static struct vhci_unlink *dequeue_pending_unlink(struct vhci_device *vdev, unlink->seqnum);list_del (&unlink->list); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return unlink; } } -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return NULL ; }
@@ -141,6 +143,7 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, {struct vhci_unlink *unlink;struct urb *urb; +unsigned long flags;usbip_dump_header (pdu);
@@ -151,9 +154,9 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,return ; } -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags); urb =pickup_urb_and_free_priv (vdev, unlink->unlink_seqnum); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);if (!urb) {/*
@@ -170,9 +173,9 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev, urb->status = pdu->u.ret_unlink.status;pr_info ("urb->status %d\n" , urb->status); -spin_lock (&the_controller->lock); +spin_lock_irqsave (&the_controller->lock, flags);usb_hcd_unlink_urb_from_ep (vhci_to_hcd (the_controller), urb); -spin_unlock (&the_controller->lock); +spin_unlock_irqrestore (&the_controller->lock, flags);usb_hcd_giveback_urb (vhci_to_hcd (the_controller), urb, urb->status);
@@ -184,10 +187,11 @@ static void vhci_recv_ret_unlink(struct vhci_device *vdev,static int vhci_priv_tx_empty (struct vhci_device *vdev) {int empty =0 ; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags); empty =list_empty (&vdev->priv_rx); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return empty; }
drivers/usb/usbip/vhci_sysfs.c +26 -18
122 lines not on this page · raw message
drivers/usb/usbip/vhci_tx.c +8 -6
@@ -47,16 +47,17 @@ static void setup_cmd_submit_pdu(struct usbip_header *pdup, struct urb *urb)static struct vhci_priv *dequeue_from_priv_tx (struct vhci_device *vdev) {struct vhci_priv *priv, *tmp; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags);list_for_each_entry_safe (priv, tmp, &vdev->priv_tx, list) {list_move_tail (&priv->list, &vdev->priv_rx); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return priv; } -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return NULL ; }
@@ -137,16 +138,17 @@ static int vhci_send_cmd_submit(struct vhci_device *vdev)static struct vhci_unlink *dequeue_from_unlink_tx (struct vhci_device *vdev) {struct vhci_unlink *unlink, *tmp; +unsigned long flags; -spin_lock (&vdev->priv_lock); +spin_lock_irqsave (&vdev->priv_lock, flags);list_for_each_entry_safe (unlink, tmp, &vdev->unlink_tx, list) {list_move_tail (&unlink->list, &vdev->unlink_rx); -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return unlink; } -spin_unlock (&vdev->priv_lock); +spin_unlock_irqrestore (&vdev->priv_lock, flags);return NULL ; }
fs/ext2/acl.c +22 -14
@@ -178,11 +178,8 @@ ext2_get_acl(struct inode *inode, int type)return acl; } -/* -* inode->i_mutex: down -*/ -int -ext2_set_acl (struct inode *inode,struct posix_acl *acl,int type) +static int +__ext2_set_acl (struct inode *inode,struct posix_acl *acl,int type) {int name_index;void *value =NULL ;
@@ -192,13 +189,6 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)switch (type) {case ACL_TYPE_ACCESS : name_index =EXT2_XATTR_INDEX_POSIX_ACL_ACCESS ; -if (acl) { - error =posix_acl_update_mode (inode, &inode->i_mode, &acl); -if (error) -return error; - inode->i_ctime =CURRENT_TIME_SEC ; -mark_inode_dirty (inode); - }break ;case ACL_TYPE_DEFAULT :
@@ -224,6 +214,24 @@ ext2_set_acl(struct inode *inode, struct posix_acl *acl, int type)return error; } +/* +* inode->i_mutex: down +*/ +int +ext2_set_acl (struct inode *inode,struct posix_acl *acl,int type) +{ +int error; + +if (type ==ACL_TYPE_ACCESS && acl) { + error =posix_acl_update_mode (inode, &inode->i_mode, &acl); +if (error) +return error; + inode->i_ctime =CURRENT_TIME_SEC ; +mark_inode_dirty (inode); + } +return __ext2_set_acl (inode, acl, type); +} +/* * Initialize the ACLs of a new inode. Called from ext2_new_inode. *
@@ -241,12 +249,12 @@ ext2_init_acl(struct inode *inode, struct inode *dir)return error;if (default_acl) { - error =ext2_set_acl (inode, default_acl,ACL_TYPE_DEFAULT ); + error =__ext2_set_acl (inode, default_acl,ACL_TYPE_DEFAULT );posix_acl_release (default_acl); }if (acl) {if (!error) - error =ext2_set_acl (inode, acl,ACL_TYPE_ACCESS ); + error =__ext2_set_acl (inode, acl,ACL_TYPE_ACCESS );posix_acl_release (acl); }return error;
fs/fcntl.c +4 -0
@@ -113,6 +113,10 @@ void f_setown(struct file *filp, unsigned long arg, int force)int who = arg; type =PIDTYPE_PID ;if (who <0 ) { +/* avoid overflow below */ +if (who ==INT_MIN ) +return ; + type =PIDTYPE_PGID ; who = -who; }
fs/nfsd/auth.c +3 -2
@@ -60,9 +60,10 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)else GROUP_AT (gi, i) =GROUP_AT (rqgi, i); -/* Each thread allocates its own gi, no race */ -groups_sort (gi); } + +/* Each thread allocates its own gi, no race */ +groups_sort (gi); }else { gi =get_group_info (rqgi); }
fs/reiserfs/bitmap.c +11 -3
@@ -513,9 +513,17 @@ static void __discard_prealloc(struct reiserfs_transaction_handle *th, "inode has negative prealloc blocks count.");#endif while (ei->i_prealloc_count >0 ) { -reiserfs_free_prealloc_block (th, inode, ei->i_prealloc_block); - ei->i_prealloc_block++; +b_blocknr_t block_to_free; + +/* +* reiserfs_free_prealloc_block can drop the write lock, +* which could allow another caller to free the same block. +* We can protect against it by modifying the prealloc +* state before calling it. +*/ + block_to_free = ei->i_prealloc_block++; ei->i_prealloc_count--; +reiserfs_free_prealloc_block (th, inode, block_to_free); dirty =1 ; }if (dirty)
@@ -1128,7 +1136,7 @@ static int determine_prealloc_size(reiserfs_blocknr_hint_t * hint) hint->prealloc_size =0 ;if (!hint->formatted_node && hint->preallocate) { -if (S_ISREG (hint->inode->i_mode) +if (S_ISREG (hint->inode->i_mode) && !IS_PRIVATE (hint->inode) && hint->inode->i_size >=REISERFS_SB (hint->th->t_super)->s_alloc_options. preallocmin * hint->inode->i_sb->s_blocksize)
fs/reiserfs/xattr_acl.c +7 -5
@@ -37,7 +37,14 @@ reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type) error =journal_begin (&th, inode->i_sb, jcreate_blocks);reiserfs_write_unlock (inode->i_sb);if (error ==0 ) { +if (type ==ACL_TYPE_ACCESS && acl) { + error =posix_acl_update_mode (inode, &inode->i_mode, + &acl); +if (error) + goto unlock; + } error =__reiserfs_set_acl (&th, inode, type, acl); +unlock:reiserfs_write_lock (inode->i_sb); error2 =journal_end (&th);reiserfs_write_unlock (inode->i_sb);
@@ -245,11 +252,6 @@ __reiserfs_set_acl(struct reiserfs_transaction_handle *th, struct inode *inode,switch (type) {case ACL_TYPE_ACCESS : name =POSIX_ACL_XATTR_ACCESS ; -if (acl) { - error =posix_acl_update_mode (inode, &inode->i_mode, &acl); -if (error) -return error; - }break ;case ACL_TYPE_DEFAULT : name =POSIX_ACL_XATTR_DEFAULT ;
fs/select.c +11 -3
@@ -29,6 +29,7 @@#include <linux/sched/rt.h> #include <linux/freezer.h> #include <net/busy_poll.h> +#include <linux/vmalloc.h> #include <asm/uaccess.h>
@@ -550,7 +551,7 @@ int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,fd_set_bits fds;void *bits;int ret, max_fds; -unsigned int size; +size_t size, alloc_size;struct fdtable *fdt;/* Allocate small arguments on the stack to save memory and be faster */ long stack_fds[SELECT_STACK_ALLOC /sizeof (long )];
@@ -577,7 +578,14 @@ int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp,if (size >sizeof (stack_fds) /6 ) {/* Not enough space in on-stack array; must use kmalloc */ ret = -ENOMEM ; - bits =kmalloc (6 * size,GFP_KERNEL ); +if (size > (SIZE_MAX /6 )) + goto out_nofds; + + alloc_size =6 * size; + bits =kmalloc (alloc_size,GFP_KERNEL |__GFP_NOWARN); +if (!bits && alloc_size >PAGE_SIZE ) + bits =vmalloc (alloc_size); +if (!bits) goto out_nofds; }
@@ -614,7 +622,7 @@ int core_sys_select(int n, fd_set __user *inp, fd_set __user *outp, out:if (bits != stack_fds) -kfree (bits); +kvfree (bits); out_nofds:return ret; }
include/linux/cacheinfo.h +1 -0
@@ -71,6 +71,7 @@ struct cpu_cacheinfo {struct cacheinfo *info_list;unsigned int num_levels;unsigned int num_leaves; +bool cpu_map_populated; };/*
include/linux/ktime.h +7 -0
@@ -63,6 +63,13 @@ static inline ktime_t ktime_set(const s64 secs, const unsigned long nsecs)#define ktime_add (lhs, rhs) \ ({ (ktime_t){ .tv64 = (lhs).tv64 + (rhs).tv64 }; }) +/* +* Same as ktime_add(), but avoids undefined behaviour on overflow; however, +* this means that you must check the result for overflow yourself. +*/ +#define ktime_add_unsafe (lhs, rhs) \ + ({ (ktime_t){ .tv64 = (u64) (lhs).tv64 + (rhs).tv64 }; }) +/* * Add a ktime_t variable and a scalar nanosecond value. * res = kt + nsval:
include/linux/netfilter/x_tables.h +7 -3
@@ -243,6 +243,10 @@ int xt_check_entry_offsets(const void *base, const char *elems,unsigned int target_offset, unsigned int next_offset); +unsigned int *xt_alloc_entry_offsets (unsigned int size); +bool xt_find_jump_offset (const unsigned int *offsets, +unsigned int target,unsigned int size); +int xt_check_match (struct xt_mtchk_param *,unsigned int size,u_int8_t proto,bool inv_proto); int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto,
@@ -377,16 +381,16 @@ static inline unsigned long ifname_compare_aligned(const char *_a,* allows us to return 0 for single core systems without forcing * callers to deal with SMP vs. NONSMP issues. */ -static inline u64 xt_percpu_counter_alloc (void ) +static inline unsigned long xt_percpu_counter_alloc (void ) {if (nr_cpu_ids >1 ) {void __percpu *res =__alloc_percpu (sizeof (struct xt_counters ),sizeof (struct xt_counters ));if (res ==NULL ) -return (u64) -ENOMEM ; +return -ENOMEM ; -return (u64 ) (__force unsigned long ) res; +return (__force unsigned long ) res; }return 0 ;
include/linux/sched.h +1 -0
@@ -1313,6 +1313,7 @@ struct sched_dl_entity {u64 dl_deadline;/* relative deadline of each instance */ u64 dl_period;/* separation of two instances (period) */ u64 dl_bw;/* dl_runtime / dl_deadline */ +u64 dl_density;/* dl_runtime / dl_deadline */ /* * Actual scheduling parameters. Initialized with the values above,
include/linux/tcp.h +6 -1
@@ -29,9 +29,14 @@ static inline struct tcphdr *tcp_hdr(const struct sk_buff *skb)return (struct tcphdr *)skb_transport_header (skb); } +static inline unsigned int __tcp_hdrlen (const struct tcphdr *th) +{ +return th->doff *4 ; +} +static inline unsigned int tcp_hdrlen (const struct sk_buff *skb) { -return tcp_hdr (skb)->doff *4 ; +return __tcp_hdrlen (tcp_hdr (skb)); }static inline struct tcphdr *inner_tcp_hdr (const struct sk_buff *skb)
include/linux/vermagic.h +1 -7
@@ -24,16 +24,10 @@#ifndef MODULE_ARCH_VERMAGIC #define MODULE_ARCH_VERMAGIC ""#endif -#ifdef RETPOLINE -#define MODULE_VERMAGIC_RETPOLINE "retpoline " -#else -#define MODULE_VERMAGIC_RETPOLINE "" -#endif #define VERMAGIC_STRING \ UTS_RELEASE " " \ MODULE_VERMAGIC_SMP MODULE_VERMAGIC_PREEMPT \ MODULE_VERMAGIC_MODULE_UNLOAD MODULE_VERMAGIC_MODVERSIONS \ - MODULE_ARCH_VERMAGIC \ - MODULE_VERMAGIC_RETPOLINE + MODULE_ARCH_VERMAGIC
include/net/arp.h +3 -0
@@ -19,6 +19,9 @@ static inline u32 arp_hashfn(const void *pkey, const struct net_device *dev, u32static inline struct neighbour *__ipv4_neigh_lookup_noref (struct net_device *dev,u32 key) { +if (dev->flags & (IFF_LOOPBACK |IFF_POINTOPOINT )) + key =INADDR_ANY ; +return ___neigh_lookup_noref (&arp_tbl, neigh_key_eq32, arp_hashfn, &key, dev); }
include/net/ipv6.h +1 -0
@@ -281,6 +281,7 @@ int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq, int flags);int ip6_flowlabel_init (void );void ip6_flowlabel_cleanup (void ); +bool ip6_autoflowlabel (struct net *net,const struct ipv6_pinfo *np);static inline void fl6_sock_release (struct ip6_flowlabel *fl) {
include/net/net_namespace.h +10 -0
@@ -209,6 +209,11 @@ int net_eq(const struct net *net1, const struct net *net2) return net1 == net2; } +static inline int check_net (const struct net *net) +{ +return atomic_read (&net->count) !=0 ; +} +void net_drop_ns (void *);#else
@@ -233,6 +238,11 @@ int net_eq(const struct net *net1, const struct net *net2) return 1; } +static inline int check_net (const struct net *net) +{ +return 1 ; +} +#define net_drop_ns NULL#endif
include/uapi/linux/eventpoll.h +13 -0
@@ -26,6 +26,19 @@#define EPOLL_CTL_DEL 2#define EPOLL_CTL_MOD 3 +/* Epoll event masks */ +#define EPOLLIN 0x00000001 +#define EPOLLPRI 0x00000002 +#define EPOLLOUT 0x00000004 +#define EPOLLERR 0x00000008 +#define EPOLLHUP 0x00000010 +#define EPOLLRDNORM 0x00000040 +#define EPOLLRDBAND 0x00000080 +#define EPOLLWRNORM 0x00000100 +#define EPOLLWRBAND 0x00000200 +#define EPOLLMSG 0x00000400 +#define EPOLLRDHUP 0x00002000 +/* * Request the handling of system wakeup events so as to prevent system suspends * from happening while those events are being processed.
ipc/msg.c +4 -1
@@ -742,7 +742,10 @@ static inline int convert_mode(long *msgtyp, int msgflg)if (*msgtyp ==0 )return SEARCH_ANY ;if (*msgtyp <0 ) { - *msgtyp = -*msgtyp; +if (*msgtyp ==LONG_MIN )/* -LONG_MIN is undefined */ + *msgtyp =LONG_MAX ; +else + *msgtyp = -*msgtyp;return SEARCH_LESSEQUAL ; }if (msgflg &MSG_EXCEPT )
kernel/sched/core.c +2 -0
@@ -2109,6 +2109,7 @@ void __dl_clear_params(struct task_struct *p) dl_se->dl_period =0 ; dl_se->flags =0 ; dl_se->dl_bw =0 ; + dl_se->dl_density =0 ; dl_se->dl_throttled =0 ; dl_se->dl_new =1 ;
@@ -3647,6 +3648,7 @@ __setparam_dl(struct task_struct *p, const struct sched_attr *attr) dl_se->dl_period = attr->sched_period ?: dl_se->dl_deadline; dl_se->flags = attr->sched_flags; dl_se->dl_bw =to_ratio (dl_se->dl_period, dl_se->dl_runtime); + dl_se->dl_density =to_ratio (dl_se->dl_deadline, dl_se->dl_runtime);/* * Changing the parameters of a task is 'tricky' and we're not doing
kernel/sched/deadline.c +86 -12
123 lines not on this page · raw message
kernel/time/hrtimer.c +4 -1
@@ -312,7 +312,7 @@ EXPORT_SYMBOL_GPL(__ktime_divns);*/ ktime_t ktime_add_safe (const ktime_t lhs,const ktime_t rhs) { -ktime_t res =ktime_add (lhs, rhs); +ktime_t res =ktime_add_unsafe (lhs, rhs);/* * We use KTIME_SEC_MAX here, the maximum timeout which we can
@@ -669,7 +669,9 @@ static void hrtimer_reprogram(struct hrtimer *timer,static inline void hrtimer_init_hres (struct hrtimer_cpu_base *base) { base->expires_next.tv64 =KTIME_MAX ; + base->hang_detected =0 ; base->hres_active =0 ; + base->next_timer =NULL ; }/*
@@ -1615,6 +1617,7 @@ static void init_hrtimers_cpu(int cpu)timerqueue_init_head (&cpu_base->clock_base[i].active); } + cpu_base->active_bases =0 ; cpu_base->cpu = cpu;hrtimer_init_hres (cpu_base); }
kernel/time/timer.c +8 -1
@@ -764,8 +764,15 @@ static struct tvec_base *lock_timer_base(struct timer_list *timer, __acquires(timer->base->lock) {for (;;) { -u32 tf = timer->flags;struct tvec_base *base; +u32 tf; + +/* +* We need to use READ_ONCE() here, otherwise the compiler +* might re-read @tf between the check for TIMER_MIGRATING +* and spin_lock(). +*/ + tf =READ_ONCE (timer->flags);if (!(tf &TIMER_MIGRATING )) { base =per_cpu_ptr (&tvec_bases, tf &TIMER_CPUMASK );
mm/cma.c +6 -9
@@ -54,7 +54,7 @@ unsigned long cma_get_size(const struct cma *cma) }static unsigned long cma_bitmap_aligned_mask (const struct cma *cma, -int align_order) +unsigned int align_order) {if (align_order <= cma->order_per_bit)return 0 ;
@@ -62,17 +62,14 @@ static unsigned long cma_bitmap_aligned_mask(const struct cma *cma, }/* -* Find a PFN aligned to the specified order and return an offset represented in -* order_per_bits. +* Find the offset of the base PFN from the specified align_order. +* The value returned is represented in order_per_bits. */ static unsigned long cma_bitmap_aligned_offset (const struct cma *cma, -int align_order) +unsigned int align_order) { -if (align_order <= cma->order_per_bit) -return 0 ; - -return (ALIGN (cma->base_pfn, (1UL << align_order)) - - cma->base_pfn) >> cma->order_per_bit; +return (cma->base_pfn & ((1UL << align_order) -1 )) + >> cma->order_per_bit; } static unsigned long cma_bitmap_pages_to_bits(const struct cma *cma,
mm/memcontrol.c +1 -1
@@ -5576,7 +5576,7 @@ static void uncharge_list(struct list_head *page_list) next = page->lru.next;VM_BUG_ON_PAGE (PageLRU (page), page); -VM_BUG_ON_PAGE (page_count (page), page); +VM_BUG_ON_PAGE (!PageHWPoison (page) &&page_count (page), page);if (!page->mem_cgroup)continue ;
mm/memory-failure.c +7 -0
@@ -539,6 +539,13 @@ static int delete_from_lru_cache(struct page *p)*/ ClearPageActive (p);ClearPageUnevictable (p); + +/* +* Poisoned page might never drop its ref count to 0 so we have +* to uncharge it manually from its memcg. +*/ +mem_cgroup_uncharge (p); +/* * drop the page count elevated by isolate_lru_page() */
mm/mmap.c +4 -2
@@ -2188,7 +2188,8 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) gap_addr =TASK_SIZE ; next = vma->vm_next; -if (next && next->vm_start < gap_addr) { +if (next && next->vm_start < gap_addr && + (next->vm_flags & (VM_WRITE |VM_READ |VM_EXEC ))) {if (!(next->vm_flags &VM_GROWSUP ))return -ENOMEM ;/* Check that both stack segments have the same anon_vma? */
@@ -2273,7 +2274,8 @@ int expand_downwards(struct vm_area_struct *vma,if (gap_addr > address)return -ENOMEM ; prev = vma->vm_prev; -if (prev && prev->vm_end > gap_addr) { +if (prev && prev->vm_end > gap_addr && + (prev->vm_flags & (VM_WRITE |VM_READ |VM_EXEC ))) {if (!(prev->vm_flags &VM_GROWSDOWN ))return -ENOMEM ;/* Check that both stack segments have the same anon_vma? */
mm/page_alloc.c +3 -3
@@ -2468,9 +2468,6 @@ static bool __zone_watermark_ok(struct zone *z, unsigned int order,if (!area->nr_free)continue ; -if (alloc_harder) -return true; -for (mt =0 ; mt <MIGRATE_PCPTYPES ; mt++) {if (!list_empty (&area->free_list[mt]))return true;
@@ -2482,6 +2479,9 @@ static bool __zone_watermark_ok(struct zone *z, unsigned int order, return true; }#endif +if (alloc_harder && + !list_empty (&area->free_list[MIGRATE_HIGHATOMIC ])) +return true; }return false; }
net/can/af_can.c +10 -12
@@ -722,13 +722,12 @@ static int can_rcv(struct sk_buff *skb, struct net_device *dev,if (unlikely (!net_eq (dev_net (dev), &init_net))) goto drop; -if (WARN_ONCE (dev->type !=ARPHRD_CAN || - skb->len !=CAN_MTU || - cfd->len >CAN_MAX_DLEN , -"PF_CAN: dropped non conform CAN skbuf: " -"dev type %d, len %d, datalen %d\n" , - dev->type, skb->len, cfd->len)) +if (unlikely (dev->type !=ARPHRD_CAN || skb->len !=CAN_MTU || + cfd->len >CAN_MAX_DLEN )) { +pr_warn_once ("PF_CAN: dropped non conform CAN skbuf: dev type %d, len %d, datalen %d\n" , + dev->type, skb->len, cfd->len); goto drop; + }can_receive (skb, dev);return NET_RX_SUCCESS ;
@@ -746,13 +745,12 @@ static int canfd_rcv(struct sk_buff *skb, struct net_device *dev,if (unlikely (!net_eq (dev_net (dev), &init_net))) goto drop; -if (WARN_ONCE (dev->type !=ARPHRD_CAN || - skb->len !=CANFD_MTU || - cfd->len >CANFD_MAX_DLEN , -"PF_CAN: dropped non conform CAN FD skbuf: " -"dev type %d, len %d, datalen %d\n" , - dev->type, skb->len, cfd->len)) +if (unlikely (dev->type !=ARPHRD_CAN || skb->len !=CANFD_MTU || + cfd->len >CANFD_MAX_DLEN )) { +pr_warn_once ("PF_CAN: dropped non conform CAN FD skbuf: dev type %d, len %d, datalen %d\n" , + dev->type, skb->len, cfd->len); goto drop; + }can_receive (skb, dev);return NET_RX_SUCCESS ;
net/core/dev.c +15 -4
@@ -2889,10 +2889,21 @@ static void qdisc_pkt_len_init(struct sk_buff *skb) hdr_len =skb_transport_header (skb) -skb_mac_header (skb);/* + transport layer */ -if (likely (shinfo->gso_type & (SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ))) - hdr_len +=tcp_hdrlen (skb); -else - hdr_len +=sizeof (struct udphdr ); +if (likely (shinfo->gso_type & (SKB_GSO_TCPV4 |SKB_GSO_TCPV6 ))) { +const struct tcphdr *th; +struct tcphdr _tcphdr; + + th =skb_header_pointer (skb,skb_transport_offset (skb), +sizeof (_tcphdr), &_tcphdr); +if (likely (th)) + hdr_len +=__tcp_hdrlen (th); + }else { +struct udphdr _udphdr; + +if (skb_header_pointer (skb,skb_transport_offset (skb), +sizeof (_udphdr), &_udphdr)) + hdr_len +=sizeof (struct udphdr ); + }if (shinfo->gso_type &SKB_GSO_DODGY ) gso_segs = DIV_ROUND_UP(skb->len - hdr_len,
net/core/flow_dissector.c +1 -2
@@ -492,8 +492,8 @@ ip_proto_again: out_good: ret = true; - key_control->thoff = (u16 )nhoff; out: + key_control->thoff =min_t (u16, nhoff, skb ? skb->len : hlen); key_basic->n_proto = proto; key_basic->ip_proto = ip_proto;
@@ -501,7 +501,6 @@ out: out_bad: ret = false; - key_control->thoff =min_t (u16, nhoff, skb ? skb->len : hlen); goto out; }EXPORT_SYMBOL (__skb_flow_dissect);
net/core/neighbour.c +2 -2
@@ -496,7 +496,7 @@ struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey,if (atomic_read (&tbl->entries) > (1 << nht->hash_shift)) nht =neigh_hash_grow (tbl, nht->hash_shift +1 ); - hash_val = tbl->hash (pkey, dev, nht->hash_rnd) >> (32 - nht->hash_shift); + hash_val = tbl->hash (n->primary_key, dev, nht->hash_rnd) >> (32 - nht->hash_shift);if (n->parms->dead) { rc =ERR_PTR (-EINVAL );
@@ -508,7 +508,7 @@ struct neighbour *__neigh_create(struct neigh_table *tbl, const void *pkey, n1 !=NULL ; n1 = rcu_dereference_protected(n1->next, lockdep_is_held(&tbl->lock))) { -if (dev == n1->dev && !memcmp (n1->primary_key, pkey, key_len)) { +if (dev == n1->dev && !memcmp (n1->primary_key, n->primary_key, key_len)) {if (want_ref)neigh_hold (n1); rc = n1;
net/dccp/ccids/ccid2.c +3 -0
@@ -140,6 +140,9 @@ static void ccid2_hc_tx_rto_expire(unsigned long data)ccid2_pr_debug ("RTO_EXPIRE\n" ); +if (sk->sk_state ==DCCP_CLOSED ) + goto out; +/* back-off timer */ hc->tx_rto <<=1 ;if (hc->tx_rto >DCCP_RTO_MAX )
net/ipv4/arp.c +6 -1
@@ -223,11 +223,16 @@ static bool arp_key_eq(const struct neighbour *neigh, const void *pkey)static int arp_constructor (struct neighbour *neigh) { -__be32 addr = *(__be32 *)neigh->primary_key; +__be32 addr;struct net_device *dev = neigh->dev;struct in_device *in_dev;struct neigh_parms *parms; +u32 inaddr_any =INADDR_ANY ; +if (dev->flags & (IFF_LOOPBACK |IFF_POINTOPOINT )) +memcpy (neigh->primary_key, &inaddr_any, arp_tbl.key_len); + + addr = *(__be32 *)neigh->primary_key;rcu_read_lock (); in_dev =__in_dev_get_rcu (dev);if (!in_dev) {
net/ipv4/igmp.c +1 -1
@@ -338,7 +338,7 @@ static __be32 igmpv3_get_srcaddr(struct net_device *dev,return htonl (INADDR_ANY );for_ifa (in_dev) { -if (inet_ifa_match (fl4->saddr, ifa)) +if (fl4->saddr == ifa->ifa_local)return fl4->saddr; }endfor_ifa (in_dev);
net/ipv4/netfilter/arp_tables.c +31 -26
137 lines not on this page · raw message
net/ipv4/netfilter/ip_tables.c +28 -23
123 lines not on this page · raw message
net/ipv4/netfilter/nf_reject_ipv4.c +2 -0
@@ -124,6 +124,8 @@ void nf_send_reset(struct net *net, struct sk_buff *oldskb, int hook)/* ip_route_me_harder expects skb->dst to be set */ skb_dst_set_noref (nskb,skb_dst (oldskb)); + nskb->mark =IP4_REPLY_MARK (net, oldskb->mark); +skb_reserve (nskb,LL_MAX_HEADER ); niph =nf_reject_iphdr_put (nskb, oldskb,IPPROTO_TCP ,ip4_dst_hoplimit (skb_dst (nskb)));
net/ipv4/tcp.c +3 -0
@@ -2176,6 +2176,9 @@ adjudge_to_death:tcp_send_active_reset (sk,GFP_ATOMIC );NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPABORTONMEMORY ); + }else if (!check_net (sock_net (sk))) { +/* Not possible to send reset; just close */ +tcp_set_state (sk,TCP_CLOSE ); } }
net/ipv4/tcp_timer.c +15 -0
@@ -46,11 +46,19 @@ static void tcp_write_err(struct sock *sk)* to prevent DoS attacks. It is called when a retransmission timeout * or zero probe timeout occurs on orphaned socket. * +* Also close if our net namespace is exiting; in that case there is no +* hope of ever communicating again since all netns interfaces are already +* down (or about to be down), and we need to release our dst references, +* which have been moved to the netns loopback interface, so the namespace +* can finish exiting. This condition is only possible if we are a kernel +* socket, as those do not hold references to the namespace. +* * Criteria is still not confirmed experimentally and may change. * We kill the socket, if: * 1. If number of orphaned sockets exceeds an administratively configured * limit. * 2. If we have strong memory pressure. +* 3. If our net namespace is exiting. */ static int tcp_out_of_resources (struct sock *sk,bool do_reset) {
@@ -79,6 +87,13 @@ static int tcp_out_of_resources(struct sock *sk, bool do_reset)NET_INC_STATS_BH (sock_net (sk),LINUX_MIB_TCPABORTONMEMORY );return 1 ; } + +if (!check_net (sock_net (sk))) { +/* Not possible to send reset; just close */ +tcp_done (sk); +return 1 ; + } +return 0 ; }
net/ipv6/ip6_output.c +6 -3
@@ -148,7 +148,7 @@ int ip6_output(struct net *net, struct sock *sk, struct sk_buff *skb) !(IP6CB(skb)->flags & IP6SKB_REROUTED)); } -static bool ip6_autoflowlabel (struct net *net,const struct ipv6_pinfo *np) +bool ip6_autoflowlabel (struct net *net,const struct ipv6_pinfo *np) {if (!np->autoflowlabel_set)return ip6_default_np_autolabel (net);
@@ -1246,14 +1246,16 @@ static int ip6_setup_cork(struct sock *sk, struct inet_cork_full *cork, v6_cork->tclass = tclass;if (rt->dst.flags &DST_XFRM_TUNNEL ) mtu = np->pmtudisc >=IPV6_PMTUDISC_PROBE ? - rt->dst.dev->mtu :dst_mtu (&rt->dst); +READ_ONCE (rt->dst.dev->mtu) :dst_mtu (&rt->dst);else mtu = np->pmtudisc >=IPV6_PMTUDISC_PROBE ? - rt->dst.dev->mtu :dst_mtu (rt->dst.path); +READ_ONCE (rt->dst.dev->mtu) :dst_mtu (rt->dst.path);if (np->frag_size < mtu) {if (np->frag_size) mtu = np->frag_size; } +if (mtu <IPV6_MIN_MTU ) +return -EINVAL ; cork->base.fragsize = mtu;if (dst_allfrag (rt->dst.path)) cork->base.flags |=IPCORK_ALLFRAG ;
@@ -1783,6 +1785,7 @@ struct sk_buff *ip6_make_skb(struct sock *sk, cork.base.flags =0 ; cork.base.addr =0 ; cork.base.opt =NULL ; + cork.base.dst =NULL ; v6_cork.opt =NULL ; err =ip6_setup_cork (sk, &cork, &v6_cork, hlimit, tclass, opt, rt, fl6);if (err) {
net/ipv6/ipv6_sockglue.c +1 -1
@@ -1313,7 +1313,7 @@ static int do_ipv6_getsockopt(struct sock *sk, int level, int optname,break ;case IPV6_AUTOFLOWLABEL : - val = np->autoflowlabel; + val =ip6_autoflowlabel (sock_net (sk), np);break ;default :
net/ipv6/netfilter/ip6_tables.c +28 -23
123 lines not on this page · raw message
net/ipv6/netfilter/nf_dup_ipv6.c +1 -0
@@ -33,6 +33,7 @@ static bool nf_dup_ipv6_route(struct net *net, struct sk_buff *skb, fl6.daddr = *gw; fl6.flowlabel = (__force __be32)(((iph->flow_lbl[0 ] &0xF ) <<16 ) | (iph->flow_lbl[1 ] <<8 ) | iph->flow_lbl[2 ]); + fl6.flowi6_flags =FLOWI_FLAG_KNOWN_NH ; dst =ip6_route_output (net,NULL , &fl6);if (dst->error) {dst_release (dst);
net/ipv6/netfilter/nf_reject_ipv6.c +3 -0
@@ -157,6 +157,7 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook) fl6.daddr = oip6h->saddr; fl6.fl6_sport = otcph->dest; fl6.fl6_dport = otcph->source; + fl6.flowi6_mark =IP6_REPLY_MARK (net, oldskb->mark);security_skb_classify_flow (oldskb,flowi6_to_flowi (&fl6)); dst =ip6_route_output (net,NULL , &fl6);if (dst ==NULL || dst->error) {
@@ -180,6 +181,8 @@ void nf_send_reset6(struct net *net, struct sk_buff *oldskb, int hook)skb_dst_set (nskb, dst); + nskb->mark = fl6.flowi6_mark; +skb_reserve (nskb, hh_len + dst->header_len); ip6h =nf_reject_ip6hdr_put (nskb, oldskb,IPPROTO_TCP ,ip6_dst_hoplimit (dst));
net/netfilter/nf_conntrack_core.c +7 -0
@@ -719,6 +719,7 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,* least once for the stats anyway. */ rcu_read_lock_bh (); + begin:hlist_nulls_for_each_entry_rcu (h, n, &net->ct.hash[hash], hnnode) { ct =nf_ct_tuplehash_to_ctrack (h); if (ct != ignored_conntrack &&
@@ -730,6 +731,12 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple, }NF_CT_STAT_INC (net, searched); } + +if (get_nulls_value (n) != hash) { +NF_CT_STAT_INC (net, search_restart); + goto begin; + } +rcu_read_unlock_bh ();return 0 ;
net/netfilter/nf_conntrack_expect.c +1 -1
@@ -560,7 +560,7 @@ static int exp_seq_show(struct seq_file *s, void *v) helper =rcu_dereference (nfct_help (expect->master)->helper);if (helper) {seq_printf (s,"%s%s" , expect->flags ?" " :"" , helper->name); -if (helper->expect_policy[expect->class].name) +if (helper->expect_policy[expect->class].name[0 ])seq_printf (s,"/%s" , helper->expect_policy[expect->class].name); }
net/netfilter/nf_conntrack_sip.c +4 -1
@@ -1434,9 +1434,12 @@ static int process_sip_request(struct sk_buff *skb, unsigned int protoff, handler = &sip_handlers[i];if (handler->request ==NULL )continue ; -if (*datalen < handler->len || +if (*datalen < handler->len +2 ||strncasecmp (*dptr, handler->method, handler->len))continue ; +if ((*dptr)[handler->len] !=' ' || + !isalpha ((*dptr)[handler->len+1 ])) +continue ;if (ct_sip_get_header (ct, *dptr,0 , *datalen,SIP_HDR_CSEQ , &matchoff, &matchlen) <=0 ) {
net/netfilter/nfnetlink_cthelper.c +10 -0
@@ -17,6 +17,7 @@#include <linux/types.h> #include <linux/list.h> #include <linux/errno.h> +#include <linux/capability.h> #include <net/netlink.h> #include <net/sock.h>
@@ -392,6 +393,9 @@ nfnl_cthelper_new(struct sock *nfnl, struct sk_buff *skb,struct nfnl_cthelper *nlcth;int ret =0 ; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (!tb[NFCTH_NAME ] || !tb[NFCTH_TUPLE ])return -EINVAL ;
@@ -595,6 +599,9 @@ nfnl_cthelper_get(struct sock *nfnl, struct sk_buff *skb,struct nfnl_cthelper *nlcth;bool tuple_set = false; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (nlh->nlmsg_flags &NLM_F_DUMP ) {struct netlink_dump_control c = { .dump = nfnl_cthelper_dump_table,
@@ -661,6 +668,9 @@ nfnl_cthelper_del(struct sock *nfnl, struct sk_buff *skb,struct nfnl_cthelper *nlcth, *n;int j =0 , ret; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (tb[NFCTH_NAME ]) helper_name =nla_data (tb[NFCTH_NAME ]);
net/netfilter/nfnetlink_queue.c +2 -4
@@ -1053,10 +1053,8 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,struct net *net =sock_net (ctnl);struct nfnl_queue_net *q =nfnl_queue_pernet (net); - queue =instance_lookup (q, queue_num); -if (!queue) - queue =verdict_instance_lookup (q, queue_num, -NETLINK_CB (skb).portid); + queue =verdict_instance_lookup (q, queue_num, +NETLINK_CB (skb).portid);if (IS_ERR (queue))return PTR_ERR (queue);
net/netfilter/x_tables.c +50 -0
56 lines not on this page · raw message
net/netfilter/xt_osf.c +7 -0
@@ -19,6 +19,7 @@#include <linux/module.h> #include <linux/kernel.h> +#include <linux/capability.h> #include <linux/if.h> #include <linux/inetdevice.h> #include <linux/ip.h>
@@ -69,6 +70,9 @@ static int xt_osf_add_callback(struct sock *ctnl, struct sk_buff *skb,struct xt_osf_finger *kf =NULL , *sf;int err =0 ; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (!osf_attrs[OSF_ATTR_FINGER ])return -EINVAL ;
@@ -112,6 +116,9 @@ static int xt_osf_remove_callback(struct sock *ctnl, struct sk_buff *skb,struct xt_osf_finger *sf;int err = -ENOENT ; +if (!capable (CAP_NET_ADMIN )) +return -EPERM ; +if (!osf_attrs[OSF_ATTR_FINGER ])return -EINVAL ;
net/sctp/socket.c +12 -18
@@ -83,7 +83,7 @@static int sctp_writeable (struct sock *sk);static void sctp_wfree (struct sk_buff *skb);static int sctp_wait_for_sndbuf (struct sctp_association *asoc,long *timeo_p, -size_t msg_len,struct sock **orig_sk); +size_t msg_len);static int sctp_wait_for_packet (struct sock *sk,int *err,long *timeo_p);static int sctp_wait_for_connect (struct sctp_association *,long *timeo_p);static int sctp_wait_for_accept (struct sock *sk,long timeo);
@@ -332,16 +332,14 @@ static struct sctp_af *sctp_sockaddr_af(struct sctp_sock *opt,if (len <sizeof (struct sockaddr ))return NULL ; +if (!opt->pf->af_supported (addr->sa.sa_family, opt)) +return NULL ; +/* V4 mapped address are really of AF_INET family */ if (addr->sa.sa_family ==AF_INET6 && -ipv6_addr_v4mapped (&addr->v6.sin6_addr)) { -if (!opt->pf->af_supported (AF_INET , opt)) -return NULL ; - }else { -/* Does this PF support this AF? */ -if (!opt->pf->af_supported (addr->sa.sa_family, opt)) -return NULL ; - } +ipv6_addr_v4mapped (&addr->v6.sin6_addr) && + !opt->pf->af_supported (AF_INET , opt)) +return NULL ;/* If we get this far, af is valid. */ af =sctp_get_af_specific (addr->sa.sa_family);
@@ -1954,7 +1952,7 @@ static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) timeo =sock_sndtimeo (sk, msg->msg_flags &MSG_DONTWAIT );if (!sctp_wspace (asoc)) {/* sk can be changed by peel off when waiting for buf. */ - err =sctp_wait_for_sndbuf (asoc, &timeo, msg_len, &sk); + err =sctp_wait_for_sndbuf (asoc, &timeo, msg_len);if (err) {if (err == -ESRCH ) {/* asoc is already dead. */
@@ -6976,12 +6974,12 @@ void sctp_sock_rfree(struct sk_buff *skb)/* Helper function to wait for space in the sndbuf. */ static int sctp_wait_for_sndbuf (struct sctp_association *asoc,long *timeo_p, -size_t msg_len,struct sock **orig_sk) +size_t msg_len) {struct sock *sk = asoc->base.sk; -int err =0 ;long current_timeo = *timeo_p;DEFINE_WAIT (wait); +int err =0 ;pr_debug ("%s: asoc:%p, timeo:%ld, msg_len:%zu\n" , __func__, asoc, *timeo_p, msg_len);
@@ -7010,17 +7008,13 @@ static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p,release_sock (sk); current_timeo =schedule_timeout (current_timeo);lock_sock (sk); -if (sk != asoc->base.sk) { -release_sock (sk); - sk = asoc->base.sk; -lock_sock (sk); - } +if (sk != asoc->base.sk) + goto do_error; *timeo_p = current_timeo; } out: - *orig_sk = sk;finish_wait (&asoc->wait, &wait);/* Release the association's refcnt. */
tools/usb/usbip/libsrc/usbip_common.c +8 -1
@@ -215,9 +215,16 @@ int read_usb_interface(struct usbip_usb_device *udev, int i, struct usbip_usb_interface *uinf) {char busid[SYSFS_BUS_ID_SIZE ]; +int size;struct udev_device *sif; -sprintf (busid,"%s:%d.%d" , udev->busid, udev->bConfigurationValue, i); + size =snprintf (busid,sizeof (busid),"%s:%d.%d" , + udev->busid, udev->bConfigurationValue, i); +if (size <0 || (unsigned int )size >=sizeof (busid)) { +err ("busid length %i >= %lu or < 0" , size, + (unsigned long )sizeof (busid)); +return -1 ; + } sif =udev_device_new_from_subsystem_sysname (udev_context,"usb" , busid);if (!sif) {
tools/usb/usbip/libsrc/usbip_host_driver.c +22 -5
@@ -39,13 +39,19 @@ struct udev *udev_context;static int32_t read_attr_usbip_status (struct usbip_usb_device *udev) {char status_attr_path[SYSFS_PATH_MAX ]; +int size;int fd;int length;char status;int value =0 ; -snprintf (status_attr_path,SYSFS_PATH_MAX ,"%s/usbip_status" , - udev->path); + size =snprintf (status_attr_path,SYSFS_PATH_MAX ,"%s/usbip_status" , + udev->path); +if (size <0 || (unsigned int )size >=sizeof (status_attr_path)) { +err ("usbip_status path length %i >= %lu or < 0" , size, + (unsigned long )sizeof (status_attr_path)); +return -1 ; + } fd =open (status_attr_path,O_RDONLY );if (fd <0 ) {
@@ -225,6 +231,7 @@ int usbip_host_export_device(struct usbip_exported_device *edev, int sockfd) {char attr_name[] ="usbip_sockfd" ;char sockfd_attr_path[SYSFS_PATH_MAX ]; +int size;char sockfd_buff[30 ];int ret;
@@ -244,10 +251,20 @@ int usbip_host_export_device(struct usbip_exported_device *edev, int sockfd) }/* only the first interface is true */ -snprintf (sockfd_attr_path,sizeof (sockfd_attr_path),"%s/%s" , - edev->udev.path, attr_name); + size =snprintf (sockfd_attr_path,sizeof (sockfd_attr_path),"%s/%s" , + edev->udev.path, attr_name); +if (size <0 || (unsigned int )size >=sizeof (sockfd_attr_path)) { +err ("exported device path length %i >= %lu or < 0" , size, + (unsigned long )sizeof (sockfd_attr_path)); +return -1 ; + } -snprintf (sockfd_buff,sizeof (sockfd_buff),"%d\n" , sockfd); + size =snprintf (sockfd_buff,sizeof (sockfd_buff),"%d\n" , sockfd); +if (size <0 || (unsigned int )size >=sizeof (sockfd_buff)) { +err ("socket length %i >= %lu or < 0" , size, + (unsigned long )sizeof (sockfd_buff)); +return -1 ; + } ret =write_sysfs_attribute (sockfd_attr_path, sockfd_buff,strlen (sockfd_buff));
tools/usb/usbip/libsrc/vhci_driver.c +4 -4
@@ -55,12 +55,12 @@ static int parse_status(const char *value)while (*c !='\0' ) {int port, status, speed, devid; -unsigned long socket; +int sockfd;char lbusid[SYSFS_BUS_ID_SIZE ]; - ret =sscanf (c,"%d %d %d %x %lx %31s\n" , + ret =sscanf (c,"%d %d %d %x %u %31s\n" , &port, &status, &speed, - &devid, &socket, lbusid); + &devid, &sockfd, lbusid);if (ret <5 ) {dbg ("sscanf failed: %d" , ret);
@@ -69,7 +69,7 @@ static int parse_status(const char *value)dbg ("port %d status %d speed %d devid %x" , port, status, speed, devid); -dbg ("socket %lx lbusid %s" , socket, lbusid); +dbg ("sockfd %u lbusid %s" , sockfd, lbusid);/* if a device is connected, look at it */
tools/usb/usbip/src/usbip.c +2 -0
@@ -176,6 +176,8 @@ int main(int argc, char *argv[])break ;case '?' :printf ("usbip: invalid option\n" ); +/* Terminate after printing error */ +/* FALLTHRU */ default :usbip_usage (); goto out;