Linux 4.14.41
Greg KH
maintainerI'm announcing the release of the 4.14.41 kernel.
All users of the 4.14 kernel series must upgrade.
The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.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
------------
Documentation/arm64/silicon-errata.txt | 1 Makefile | 2 arch/arm64/Kconfig | 14 ++ arch/arm64/include/asm/assembler.h | 40 ++++++++ arch/arm64/include/asm/cputype.h | 2 arch/arm64/mm/proc.S | 5 + arch/powerpc/kvm/book3s_64_mmu_radix.c | 72 +++++++++----- arch/powerpc/kvm/book3s_hv.c | 17 +-- arch/powerpc/kvm/book3s_hv_rmhandlers.S | 8 + arch/x86/events/core.c | 8 + arch/x86/events/intel/cstate.c | 2 arch/x86/events/msr.c | 9 + arch/x86/kvm/lapic.c | 37 ++++--- crypto/af_alg.c | 8 - drivers/ata/libata-core.c | 3 drivers/atm/zatm.c | 3 drivers/bluetooth/btusb.c | 19 +++ drivers/gpio/gpio-aspeed.c | 2 drivers/gpio/gpiolib.c | 7 - drivers/gpu/drm/drm_atomic.c | 8 + drivers/gpu/drm/i915/intel_lvds.c | 3 drivers/gpu/drm/nouveau/nv50_display.c | 7 - drivers/gpu/drm/vc4/vc4_plane.c | 2 drivers/md/dm-integrity.c | 2 drivers/net/can/spi/hi311x.c | 11 +- drivers/net/can/usb/kvaser_usb.c | 2 drivers/nvme/host/nvme.h | 5 + drivers/nvme/host/pci.c | 12 ++ drivers/pci/pci.c | 37 +++++-- drivers/thermal/samsung/exynos_tmu.c | 14 ++ fs/ceph/file.c | 10 +- fs/cifs/cifsfs.c | 13 ++ fs/fs-writeback.c | 2 include/linux/oom.h | 2 include/linux/wait_bit.h | 17 +++ include/net/inet_timewait_sock.h | 1 include/net/nexthop.h | 2 kernel/compat.c | 1 kernel/events/callchain.c | 10 -- kernel/events/ring_buffer.c | 7 + kernel/sched/autogroup.c | 7 + kernel/sched/cpufreq_schedutil.c | 3 kernel/trace/trace_events_filter.c | 3 kernel/trace/trace_uprobe.c | 2 mm/backing-dev.c | 2 mm/memcontrol.c | 3 mm/mmap.c | 44 +++++---- mm/oom_kill.c | 74 ++++++++------- mm/sparse.c | 2 mm/z3fold.c | 42 ++++++-- net/atm/lec.c | 9 + net/bridge/netfilter/ebtables.c | 11 +- net/core/dev_addr_lists.c | 4 net/core/skbuff.c | 1 net/dccp/ipv4.c | 1 net/dccp/ipv6.c | 1 net/ipv4/inet_timewait_sock.c | 1 net/ipv4/inetpeer.c | 1 net/ipv4/route.c | 11 +- net/ipv4/tcp.c | 2 net/kcm/kcmsock.c | 1 net/netfilter/ipvs/ip_vs_ctl.c | 8 - net/netfilter/ipvs/ip_vs_sync.c | 155 ++++++++++++++++---------------- net/netlink/af_netlink.c | 2 net/rfkill/rfkill-gpio.c | 7 + 65 files changed, 542 insertions(+), 282 deletions(-)
Anthoine Bourgeois (1):
KVM: x86: remove APIC Timer periodic/oneshot spikes
Boris Brezillon (1):
drm/vc4: Fix scaling of uni-planar formats
David Rientjes (1):
mm, oom: fix concurrent munlock and oom reaper unmap, v3
Eric Dumazet (10):
crypto: af_alg - fix possible uninit-value in alg_bind()
netlink: fix uninit-value in netlink_sendmsg
net: fix rtnh_ok()
net: initialize skb->peeked when cloning
net: fix uninit-value in __hw_addr_add_ex()
dccp: initialize ireq->ir_mark
ipv4: fix uninit-value in ip_route_output_key_hash_rcu()
soreuseport: initialise timewait reuseport field
inetpeer: fix uninit-value in inet_getpeer
tcp: fix TCP_REPAIR_QUEUE bound checking
Florent Flament (1):
drm/i915: Fix drm:intel_enable_lvds ERROR message in kernel log
Florian Westphal (1):
netfilter: ebtables: don't attempt to allocate 0-sized compat array
Govert Overgaauw (1):
gpio: fix aspeed_gpio unmask irq
Greg Kroah-Hartman (1):
Linux 4.14.41
Gustavo A. R. Silva (2):
net: atm: Fix potential Spectre v1
atm: zatm: Fix potential Spectre v1
Hans de Goede (4):
libata: Apply NOLPM quirk for SanDisk SD7UB3Q*G1001 SSDs
Revert "Bluetooth: btusb: Fix quirk for Atheros 1525/QCA6174"
Bluetooth: btusb: Add Dell XPS 13 9360 to btusb_needs_reset_resume_table
Bluetooth: btusb: Only check needs_reset_resume DMI table for QCA rome chipsets
Ilya Dryomov (1):
ceph: fix rsize/wsize capping in ceph_direct_read_write()
Jan Kara (1):
bdi: Fix oops in wb_workfn()
Jann Horn (1):
compat: fix 4-byte infoleak via uninitialized struct field
Jens Axboe (1):
nvme: add quirk to force medium priority for SQ creation
Jimmy Assarsson (1):
can: kvaser_usb: Increase correct stats counter in kvaser_usb_rx_can_msg()
Jiri Olsa (1):
perf: Remove superfluous allocation error check
Johan Hovold (1):
rfkill: gpio: fix memory leak in probe error path
Julian Anastasov (1):
ipvs: fix rtnl_lock lockups caused by start_sync_thread
Kai Heng Feng (1):
PCI / PM: Always check PME wakeup capability for runtime wakeup support
Laurent Vivier (1):
KVM: PPC: Book3S HV: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN
Lukas Wunner (2):
can: hi311x: Acquire SPI lock on ->do_get_berr_counter
can: hi311x: Work around TX complete interrupt erratum
Lyude Paul (1):
drm/nouveau: Fix deadlock in nv50_mstm_register_connector()
Marek Szyprowski (2):
thermal: exynos: Reading temperature makes sense only when TMU is turned on
thermal: exynos: Propagate error value from tmu_read()
Masami Hiramatsu (1):
tracing/uprobe_event: Fix strncpy corner case
Michal Hocko (1):
memcg: fix per_node_info cleanup
Mikulas Patocka (1):
dm integrity: use kvfree for kvmalloc'd memory
Paul Mackerras (3):
KVM: PPC: Book3S HV: Fix trap number return from __kvmppc_vcore_entry
KVM: PPC: Book3S HV: Fix VRMA initialization with 2MB or 1GB memory backing
KVM: PPC: Book3S HV: Fix handling of large pages in radix page fault handler
Pavel Tatashin (1):
mm: sections are not offlined during memory hotremove
Peter Zijlstra (6):
sched/autogroup: Fix possible Spectre-v1 indexing for sched_prio_to_weight[] perf/x86: Fix possible Spectre-v1 indexing for hw_perf_event cache_* perf/x86/cstate: Fix possible Spectre-v1 indexing for pkg_msr perf/x86/msr: Fix possible Spectre-v1 indexing in the MSR driver perf/core: Fix possible Spectre-v1 indexing for ->aux_pages[] perf/x86: Fix possible Spectre-v1 indexing for x86_pmu::event_map()
Rafael J. Wysocki (2):
PCI / PM: Check device_may_wakeup() in pci_enable_wake()
cpufreq: schedutil: Avoid using invalid next_freq
Steve French (1):
smb3: directory sync should not return an error
Steven Rostedt (VMware) (1):
tracing: Fix regex_match_front() to not over compare the test string
Suzuki K Poulose (1):
arm64: Add work around for Arm Cortex-A55 Erratum 1024718
Tetsuo Handa (1):
bdi: wake up concurrent wb_shutdown() callers.
Timur Tabi (1):
gpioib: do not free unrequested descriptors
Tom Herbert (1):
kcm: Call strp_stop before strp_done in kcm_attach
Uwe Kleine-König (1):
gpio: fix error path in lineevent_create
Ville Syrjälä (2):
drm/atomic: Clean old_state/new_state in drm_atomic_state_default_clear() drm/atomic: Clean private obj old_state/new_state in drm_atomic_state_default_clear()
Vitaly Wool (1):
z3fold: fix reclaim lock-ups
Greg KH
maintainerDocumentation/arm64/silicon-errata.txt +1 -0
@@ -55,6 +55,7 @@ stable kernels. | ARM | Cortex-A57 | #834220 | ARM64_ERRATUM_834220 | | ARM | Cortex-A72 | #853709 | N/A | | ARM | Cortex-A73 | #858921 | ARM64_ERRATUM_858921 | +| ARM | Cortex-A55 | #1024718 | ARM64_ERRATUM_1024718 | | ARM | MMU-500 | #841119,#826419 | N/A | | | | | | | Cavium | ThunderX ITS | #22375, #24313 | CAVIUM_ERRATUM_22375 |
Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 14 -SUBLEVEL = 40 +SUBLEVEL = 41 EXTRAVERSION = NAME = Petit Gorille
arch/arm64/Kconfig +14 -0
@@ -443,6 +443,20 @@ config ARM64_ERRATUM_843419 If unsure, say Y. +config ARM64_ERRATUM_1024718 + bool "Cortex-A55: 1024718: Update of DBM/AP bits without break before make might result in incorrect update" + default y + help + This option adds work around for Arm Cortex-A55 Erratum 1024718. + + Affected Cortex-A55 cores (r0p0, r0p1, r1p0) could cause incorrect + update of the hardware dirty bit when the DBM/AP bits are updated + without a break-before-make. The work around is to disable the usage + of hardware DBM locally on the affected cores. CPUs not affected by + erratum will continue to use the feature. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y
arch/arm64/include/asm/assembler.h +40 -0
@@ -25,6 +25,7 @@#include <asm/asm-offsets.h> #include <asm/cpufeature.h> +#include <asm/cputype.h> #include <asm/page.h> #include <asm/pgtable-hwdef.h> #include <asm/ptrace.h>
@@ -495,4 +496,43 @@ alternative_endif and \phys, \pte, #(((1 << (48 - PAGE_SHIFT)) - 1) << PAGE_SHIFT) .endm +/* +* Check the MIDR_EL1 of the current CPU for a given model and a range of +* variant/revision. See asm/cputype.h for the macros used below. +* +* model: MIDR_CPU_MODEL of CPU +* rv_min: Minimum of MIDR_CPU_VAR_REV() +* rv_max: Maximum of MIDR_CPU_VAR_REV() +* res: Result register. +* tmp1, tmp2, tmp3: Temporary registers +* +* Corrupts: res, tmp1, tmp2, tmp3 +* Returns: 0, if the CPU id doesn't match. Non-zero otherwise +*/ + .macro cpu_midr_match model, rv_min, rv_max, res, tmp1, tmp2, tmp3 + mrs \res, midr_el1 + mov_q \tmp1, (MIDR_REVISION_MASK | MIDR_VARIANT_MASK) + mov_q \tmp2, MIDR_CPU_MODEL_MASK + and \tmp3, \res, \tmp2 // Extract model + and \tmp1, \res, \tmp1 // rev & variant + mov_q \tmp2, \model + cmp \tmp3, \tmp2 + cset \res, eq + cbz \res, .Ldone\@ // Model matches ? + + .if (\rv_min != 0) // Skip min check if rv_min == 0 + mov_q \tmp3, \rv_min + cmp \tmp1, \tmp3 + cset \res, ge + .endif // \rv_min != 0 + /* Skip rv_max check if rv_min == rv_max && rv_min != 0 */ + .if ((\rv_min != \rv_max) || \rv_min == 0) + mov_q \tmp2, \rv_max + cmp \tmp1, \tmp2 + cset \tmp2, le + and \res, \res, \tmp2 + .endif +.Ldone\@: + .endm + #endif /* __ASM_ASSEMBLER_H */
arch/arm64/include/asm/cputype.h +2 -0
@@ -78,6 +78,7 @@#define ARM_CPU_PART_AEM_V8 0xD0F#define ARM_CPU_PART_FOUNDATION 0xD00 +#define ARM_CPU_PART_CORTEX_A55 0xD05#define ARM_CPU_PART_CORTEX_A57 0xD07#define ARM_CPU_PART_CORTEX_A72 0xD08#define ARM_CPU_PART_CORTEX_A53 0xD03
@@ -98,6 +99,7 @@#define QCOM_CPU_PART_KRYO 0x200#define MIDR_CORTEX_A53 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A53) +#define MIDR_CORTEX_A55 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A55)#define MIDR_CORTEX_A57 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A57)#define MIDR_CORTEX_A72 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A72)#define MIDR_CORTEX_A73 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX_A73)
arch/arm64/mm/proc.S +5 -0
@@ -438,6 +438,11 @@ ENTRY(__cpu_setup) cbz x9, 2f cmp x9, #2 b.lt 1f +#ifdef CONFIG_ARM64_ERRATUM_1024718 + /* Disable hardware DBM on Cortex-A55 r0p0, r0p1 & r1p0 */ + cpu_midr_match MIDR_CORTEX_A55, MIDR_CPU_VAR_REV(0, 0), MIDR_CPU_VAR_REV(1, 0), x1, x2, x3, x4 + cbnz x1, 1f +#endif orr x10, x10, #TCR_HD // hardware Dirty flag update 1: orr x10, x10, #TCR_HA // hardware Access flag update 2:
arch/powerpc/kvm/book3s_64_mmu_radix.c +46 -26
130 lines not on this page · raw message
arch/powerpc/kvm/book3s_hv.c +9 -8
@@ -2847,7 +2847,7 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)*/ trace_hardirqs_on (); -guest_enter (); +guest_enter_irqoff (); srcu_idx =srcu_read_lock (&vc->kvm->srcu);
@@ -2855,8 +2855,6 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)srcu_read_unlock (&vc->kvm->srcu, srcu_idx); -guest_exit (); -trace_hardirqs_off ();set_irq_happened (trap);
@@ -2890,6 +2888,7 @@ static noinline void kvmppc_run_core(struct kvmppc_vcore *vc)kvmppc_set_host_core (pcpu);local_irq_enable (); +guest_exit ();/* Let secondaries go back to the offline loop */ for (i =0 ; i < controlled_threads; ++i) {
@@ -3619,15 +3618,17 @@ static int kvmppc_hv_setup_htab_rma(struct kvm_vcpu *vcpu) goto up_out; psize =vma_kernel_pagesize (vma); - porder =__ilog2 (psize);up_read (¤t->mm->mmap_sem);/* We can handle 4k, 64k or 16M pages in the VRMA */ - err = -EINVAL ; -if (!(psize ==0x1000 || psize ==0x10000 || - psize ==0x1000000 )) - goto out_srcu; +if (psize >=0x1000000 ) + psize =0x1000000 ; +else if (psize >=0x10000 ) + psize =0x10000 ; +else + psize =0x1000 ; + porder =__ilog2 (psize); senc =slb_pgsize_encoding (psize); kvm->arch.vrma_slb_v = senc | SLB_VSID_B_1T |
arch/powerpc/kvm/book3s_hv_rmhandlers.S +5 -3
@@ -308,7 +308,6 @@ kvm_novcpu_exit: stw r12, STACK_SLOT_TRAP(r1) bl kvmhv_commence_exit nop - lwz r12, STACK_SLOT_TRAP(r1) b kvmhv_switch_to_host /*
@@ -1136,6 +1135,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300) secondary_too_late: li r12, 0 + stw r12, STACK_SLOT_TRAP(r1) cmpdi r4, 0 beq 11f stw r12, VCPU_TRAP(r4)
@@ -1445,12 +1445,12 @@ mc_cont: 1: #endif /* CONFIG_KVM_XICS */ + stw r12, STACK_SLOT_TRAP(r1) mr r3, r12 /* Increment exit count, poke other threads to exit */ bl kvmhv_commence_exit nop ld r9, HSTATE_KVM_VCPU(r13) - lwz r12, VCPU_TRAP(r9) /* Stop others sending VCPU interrupts to this physical CPU */ li r0, -1
@@ -1816,6 +1816,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_POWER9_DD1) * POWER7/POWER8 guest -> host partition switch code. * We don't have to lock against tlbies but we do * have to coordinate the hardware threads. + * Here STACK_SLOT_TRAP(r1) contains the trap number. */ kvmhv_switch_to_host: /* Secondary threads wait for primary to do partition switch */
@@ -1868,11 +1869,11 @@ BEGIN_FTR_SECTION END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) /* If HMI, call kvmppc_realmode_hmi_handler() */ + lwz r12, STACK_SLOT_TRAP(r1) cmpwi r12, BOOK3S_INTERRUPT_HMI bne 27f bl kvmppc_realmode_hmi_handler nop - li r12, BOOK3S_INTERRUPT_HMI /* * At this point kvmppc_realmode_hmi_handler would have resync-ed * the TB. Hence it is not required to subtract guest timebase
@@ -1950,6 +1951,7 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_TYPE_RADIX) li r0, KVM_GUEST_MODE_NONE stb r0, HSTATE_IN_GUEST(r13) + lwz r12, STACK_SLOT_TRAP(r1) /* return trap # in r12 */ ld r0, SFS+PPC_LR_STKOFF(r1) addi r1, r1, SFS mtlr r0
arch/x86/events/core.c +7 -1
@@ -27,6 +27,7 @@#include <linux/cpu.h> #include <linux/bitops.h> #include <linux/device.h> +#include <linux/nospec.h> #include <asm/apic.h> #include <asm/stacktrace.h>
@@ -304,17 +305,20 @@ set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event *event) config = attr->config; - cache_type = (config >>0 ) &0xff ; + cache_type = (config >>0 ) &0xff ;if (cache_type >=PERF_COUNT_HW_CACHE_MAX )return -EINVAL ; + cache_type =array_index_nospec (cache_type,PERF_COUNT_HW_CACHE_MAX ); cache_op = (config >>8 ) &0xff ;if (cache_op >=PERF_COUNT_HW_CACHE_OP_MAX )return -EINVAL ; + cache_op =array_index_nospec (cache_op,PERF_COUNT_HW_CACHE_OP_MAX ); cache_result = (config >>16 ) &0xff ;if (cache_result >=PERF_COUNT_HW_CACHE_RESULT_MAX )return -EINVAL ; + cache_result =array_index_nospec (cache_result,PERF_COUNT_HW_CACHE_RESULT_MAX ); val = hw_cache_event_ids[cache_type][cache_op][cache_result];
@@ -421,6 +425,8 @@ int x86_setup_perfctr(struct perf_event *event)if (attr->config >= x86_pmu.max_events)return -EINVAL ; + attr->config =array_index_nospec ((unsigned long )attr->config, x86_pmu.max_events); +/* * The generic map: */
arch/x86/events/intel/cstate.c +2 -0
@@ -91,6 +91,7 @@#include <linux/module.h> #include <linux/slab.h> #include <linux/perf_event.h> +#include <linux/nospec.h> #include <asm/cpu_device_id.h> #include <asm/intel-family.h> #include "../perf_event.h"
@@ -301,6 +302,7 @@ static int cstate_pmu_event_init(struct perf_event *event) }else if (event->pmu == &cstate_pkg_pmu) {if (cfg >=PERF_CSTATE_PKG_EVENT_MAX )return -EINVAL ; + cfg =array_index_nospec ((unsigned long )cfg,PERF_CSTATE_PKG_EVENT_MAX );if (!pkg_msr[cfg].attr)return -EINVAL ; event->hw.event_base = pkg_msr[cfg].msr;
arch/x86/events/msr.c +6 -3
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0 #include <linux/perf_event.h> +#include <linux/nospec.h> #include <asm/intel-family.h> enum perf_msr_id {
@@ -145,9 +146,6 @@ static int msr_event_init(struct perf_event *event)if (event->attr.type != event->pmu->type)return -ENOENT ; -if (cfg >=PERF_MSR_EVENT_MAX ) -return -EINVAL ; -/* unsupported modes and filters */ if (event->attr.exclude_user || event->attr.exclude_kernel ||
@@ -158,6 +156,11 @@ static int msr_event_init(struct perf_event *event) event->attr.sample_period) /* no sampling */return -EINVAL ; +if (cfg >=PERF_MSR_EVENT_MAX ) +return -EINVAL ; + + cfg =array_index_nospec ((unsigned long )cfg,PERF_MSR_EVENT_MAX ); +if (!msr[cfg].attr)return -EINVAL ;
arch/x86/kvm/lapic.c +20 -17
@@ -1418,23 +1418,6 @@ static void start_sw_tscdeadline(struct kvm_lapic *apic)local_irq_restore (flags); } -static void start_sw_period (struct kvm_lapic *apic) -{ -if (!apic->lapic_timer.period) -return ; - -if (apic_lvtt_oneshot (apic) && -ktime_after (ktime_get (), - apic->lapic_timer.target_expiration)) { -apic_timer_expired (apic); -return ; - } - -hrtimer_start (&apic->lapic_timer.timer, - apic->lapic_timer.target_expiration, -HRTIMER_MODE_ABS_PINNED ); -} -static bool set_target_expiration (struct kvm_lapic *apic) {ktime_t now;
@@ -1491,6 +1474,26 @@ static void advance_periodic_target_expiration(struct kvm_lapic *apic) apic->lapic_timer.period); } +static void start_sw_period (struct kvm_lapic *apic) +{ +if (!apic->lapic_timer.period) +return ; + +if (ktime_after (ktime_get (), + apic->lapic_timer.target_expiration)) { +apic_timer_expired (apic); + +if (apic_lvtt_oneshot (apic)) +return ; + +advance_periodic_target_expiration (apic); + } + +hrtimer_start (&apic->lapic_timer.timer, + apic->lapic_timer.target_expiration, +HRTIMER_MODE_ABS_PINNED ); +} +bool kvm_lapic_hv_timer_in_use (struct kvm_vcpu *vcpu) {if (!lapic_in_kernel (vcpu))
crypto/af_alg.c +4 -4
@@ -158,16 +158,16 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)void *private;int err; -/* If caller uses non-allowed flag, return error. */ -if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed)) -return -EINVAL ; -if (sock->state ==SS_CONNECTED )return -EINVAL ;if (addr_len <sizeof (*sa))return -EINVAL ; +/* If caller uses non-allowed flag, return error. */ +if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed)) +return -EINVAL ; + sa->salg_type[sizeof (sa->salg_type) -1 ] =0 ; sa->salg_name[sizeof (sa->salg_name) + addr_len -sizeof (*sa) -1 ] =0 ;
drivers/ata/libata-core.c +3 -0
@@ -4539,6 +4539,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { ATA_HORKAGE_ZERO_AFTER_TRIM | ATA_HORKAGE_NOLPM, }, +/* Sandisk devices which are known to not handle LPM well */ + { "SanDisk SD7UB3Q*G1001", NULL, ATA_HORKAGE_NOLPM, }, + /* devices that don't properly handle queued TRIM commands */ { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, },
drivers/atm/zatm.c +3 -0
@@ -28,6 +28,7 @@#include <asm/io.h> #include <linux/atomic.h> #include <linux/uaccess.h> +#include <linux/nospec.h> #include "uPD98401.h" #include "uPD98402.h"
@@ -1458,6 +1459,8 @@ static int zatm_ioctl(struct atm_dev *dev,unsigned int cmd,void __user *arg)return -EFAULT ;if (pool <0 || pool >ZATM_LAST_POOL )return -EINVAL ; + pool =array_index_nospec (pool, +ZATM_LAST_POOL +1 );spin_lock_irqsave (&zatm_dev->lock, flags); info = zatm_dev->pool_info[pool];if (cmd ==ZATM_GETPOOLZ ) {
drivers/bluetooth/btusb.c +15 -4
@@ -235,6 +235,7 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0930, 0x0227), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0b05, 0x17d0), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x0036), .driver_info = BTUSB_ATH3012 }, + { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x3008), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x311d), .driver_info = BTUSB_ATH3012 }, { USB_DEVICE(0x0cf3, 0x311e), .driver_info = BTUSB_ATH3012 },
@@ -267,7 +268,6 @@ static const struct usb_device_id blacklist_table[] = { { USB_DEVICE(0x0489, 0xe03c), .driver_info = BTUSB_ATH3012 }, /* QCA ROME chipset */ - { USB_DEVICE(0x0cf3, 0x3004), .driver_info = BTUSB_QCA_ROME }, { USB_DEVICE(0x0cf3, 0xe007), .driver_info = BTUSB_QCA_ROME }, { USB_DEVICE(0x0cf3, 0xe009), .driver_info = BTUSB_QCA_ROME }, { USB_DEVICE(0x0cf3, 0xe300), .driver_info = BTUSB_QCA_ROME },
@@ -395,6 +395,13 @@ static const struct dmi_system_id btusb_needs_reset_resume_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 3060"), }, }, + { + /* Dell XPS 9360 (QCA ROME device 0cf3:e300) */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "XPS 13 9360"), + }, + }, {} };
@@ -2895,6 +2902,12 @@ static int btusb_config_oob_wake(struct hci_dev *hdev) }#endif +static void btusb_check_needs_reset_resume (struct usb_interface *intf) +{ +if (dmi_check_system (btusb_needs_reset_resume_table)) +interface_to_usbdev (intf)->quirks |=USB_QUIRK_RESET_RESUME ; +} +static int btusb_probe (struct usb_interface *intf,const struct usb_device_id *id) {
@@ -3030,9 +3043,6 @@ static int btusb_probe(struct usb_interface *intf, hdev->send = btusb_send_frame; hdev->notify = btusb_notify; -if (dmi_check_system (btusb_needs_reset_resume_table)) -interface_to_usbdev (intf)->quirks |=USB_QUIRK_RESET_RESUME ; -#ifdef CONFIG_PM err =btusb_config_oob_wake (hdev);if (err)
@@ -3119,6 +3129,7 @@ static int btusb_probe(struct usb_interface *intf,if (id->driver_info &BTUSB_QCA_ROME ) { data->setup_on_usb = btusb_setup_qca; hdev->set_bdaddr = btusb_set_bdaddr_ath3012; +btusb_check_needs_reset_resume (intf); }#ifdef CONFIG_BT_HCIBTUSB_RTL
drivers/gpio/gpio-aspeed.c +1 -1
@@ -375,7 +375,7 @@ static void aspeed_gpio_irq_set_mask(struct irq_data *d, bool set)if (set) reg |= bit;else - reg &= bit; + reg &= ~bit;iowrite32 (reg, addr);spin_unlock_irqrestore (&gpio->lock, flags);
drivers/gpio/gpiolib.c +4 -3
@@ -443,7 +443,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)struct gpiohandle_request handlereq;struct linehandle_state *lh;struct file *file; -int fd, i, ret; +int fd, i, count =0 , ret;if (copy_from_user (&handlereq, ip,sizeof (handlereq)))return -EFAULT ;
@@ -489,6 +489,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)if (ret) goto out_free_descs; lh->descs[i] = desc; + count = i;if (lflags &GPIOHANDLE_REQUEST_ACTIVE_LOW )set_bit (FLAG_ACTIVE_LOW , &desc->flags);
@@ -555,7 +556,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip) out_put_unused_fd:put_unused_fd (fd); out_free_descs: -for (; i >=0 ; i--) +for (i =0 ; i < count; i++)gpiod_free (lh->descs[i]);kfree (lh->label); out_free_lh:
@@ -812,7 +813,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip) desc = &gdev->descs[offset]; ret =gpiod_request (desc, le->label);if (ret) - goto out_free_desc; + goto out_free_label; le->desc = desc; le->eflags = eflags;
drivers/gpu/drm/drm_atomic.c +8 -0
@@ -151,6 +151,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) state->connectors[i].state); state->connectors[i].ptr =NULL ; state->connectors[i].state =NULL ; + state->connectors[i].old_state =NULL ; + state->connectors[i].new_state =NULL ;drm_connector_put (connector); }
@@ -172,6 +174,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) state->crtcs[i].commit =NULL ; state->crtcs[i].ptr =NULL ; state->crtcs[i].state =NULL ; + state->crtcs[i].old_state =NULL ; + state->crtcs[i].new_state =NULL ; }for (i =0 ; i < config->num_total_plane; i++) {
@@ -184,6 +188,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) state->planes[i].state); state->planes[i].ptr =NULL ; state->planes[i].state =NULL ; + state->planes[i].old_state =NULL ; + state->planes[i].new_state =NULL ; }for (i =0 ; i < state->num_private_objs; i++) {
@@ -196,6 +202,8 @@ void drm_atomic_state_default_clear(struct drm_atomic_state *state) state->private_objs[i].state); state->private_objs[i].ptr =NULL ; state->private_objs[i].state =NULL ; + state->private_objs[i].old_state =NULL ; + state->private_objs[i].new_state =NULL ; } state->num_private_objs =0 ;
drivers/gpu/drm/i915/intel_lvds.c +2 -1
@@ -317,7 +317,8 @@ static void intel_enable_lvds(struct intel_encoder *encoder,I915_WRITE (PP_CONTROL (0 ),I915_READ (PP_CONTROL (0 )) |PANEL_POWER_ON );POSTING_READ (lvds_encoder->reg); -if (intel_wait_for_register (dev_priv,PP_STATUS (0 ),PP_ON ,PP_ON ,1000 )) + +if (intel_wait_for_register (dev_priv,PP_STATUS (0 ),PP_ON ,PP_ON ,5000 ))DRM_ERROR ("timed out waiting for panel to power on\n" );intel_panel_enable_backlight (pipe_config, conn_state);
drivers/gpu/drm/nouveau/nv50_display.c +3 -4
@@ -3216,10 +3216,11 @@ nv50_mstm_destroy_connector(struct drm_dp_mst_topology_mgr *mgr,drm_connector_unregister (&mstc->connector); -drm_modeset_lock_all (drm->dev);drm_fb_helper_remove_one_connector (&drm->fbcon->helper, &mstc->connector); + +drm_modeset_lock (&drm->dev->mode_config.connection_mutex,NULL ); mstc->port =NULL ; -drm_modeset_unlock_all (drm->dev); +drm_modeset_unlock (&drm->dev->mode_config.connection_mutex);drm_connector_unreference (&mstc->connector); }
@@ -3229,9 +3230,7 @@ nv50_mstm_register_connector(struct drm_connector *connector) {struct nouveau_drm *drm =nouveau_drm (connector->dev); -drm_modeset_lock_all (drm->dev);drm_fb_helper_add_one_connector (&drm->fbcon->helper, connector); -drm_modeset_unlock_all (drm->dev);drm_connector_register (connector); }
drivers/gpu/drm/vc4/vc4_plane.c +1 -1
@@ -535,7 +535,7 @@ static int vc4_plane_mode_set(struct drm_plane *plane,* the scl fields here. */ if (num_planes ==1 ) { - scl0 =vc4_get_scl_field (state,1 ); + scl0 =vc4_get_scl_field (state,0 ); scl1 = scl0; }else { scl0 =vc4_get_scl_field (state,1 );
drivers/md/dm-integrity.c +1 -1
@@ -2439,7 +2439,7 @@ static void dm_integrity_free_journal_scatterlist(struct dm_integrity_c *ic, strunsigned i;for (i =0 ; i < ic->journal_sections; i++)kvfree (sl[i]); -kfree (sl); +kvfree (sl); }static struct scatterlist **dm_integrity_alloc_journal_scatterlist (struct dm_integrity_c *ic,struct page_list *pl)
drivers/net/can/spi/hi311x.c +7 -4
@@ -91,6 +91,7 @@#define HI3110_STAT_BUSOFF BIT(2)#define HI3110_STAT_ERRP BIT(3)#define HI3110_STAT_ERRW BIT(4) +#define HI3110_STAT_TXMTY BIT(7)#define HI3110_BTR0_SJW_SHIFT 6#define HI3110_BTR0_BRP_SHIFT 0
@@ -427,8 +428,10 @@ static int hi3110_get_berr_counter(const struct net_device *net,struct hi3110_priv *priv =netdev_priv (net);struct spi_device *spi = priv->spi; +mutex_lock (&priv->hi3110_lock); bec->txerr =hi3110_read (spi,HI3110_READ_TEC ); bec->rxerr =hi3110_read (spi,HI3110_READ_REC ); +mutex_unlock (&priv->hi3110_lock);return 0 ; }
@@ -735,10 +738,7 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) } } -if (intf ==0 ) -break ; - -if (intf &HI3110_INT_TXCPLT ) { +if (priv->tx_len && statf &HI3110_STAT_TXMTY ) { net->stats.tx_packets++; net->stats.tx_bytes += priv->tx_len -1 ;can_led_event (net,CAN_LED_EVENT_TX );
@@ -748,6 +748,9 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) }netif_wake_queue (net); } + +if (intf ==0 ) +break ; }mutex_unlock (&priv->hi3110_lock);return IRQ_HANDLED ;
drivers/net/can/usb/kvaser_usb.c +1 -1
@@ -1179,7 +1179,7 @@ static void kvaser_usb_rx_can_msg(const struct kvaser_usb *dev, skb =alloc_can_skb (priv->netdev, &cf);if (!skb) { - stats->tx_dropped++; + stats->rx_dropped++;return ; }
drivers/nvme/host/nvme.h +5 -0
@@ -80,6 +80,11 @@ enum nvme_quirks {* Supports the LighNVM command set if indicated in vs[1]. */ NVME_QUIRK_LIGHTNVM = (1 <<6 ), + +/* +* Set MEDIUM priority on SQ creation +*/ + NVME_QUIRK_MEDIUM_PRIO_SQ = (1 << 7), };/*
drivers/nvme/host/pci.c +11 -1
@@ -947,9 +947,18 @@ static int adapter_alloc_cq(struct nvme_dev *dev, u16 qid,static int adapter_alloc_sq (struct nvme_dev *dev,u16 qid,struct nvme_queue *nvmeq) { +struct nvme_ctrl *ctrl = &dev->ctrl;struct nvme_command c;int flags =NVME_QUEUE_PHYS_CONTIG ; +/* +* Some drives have a bug that auto-enables WRRU if MEDIUM isn't +* set. Since URGENT priority is zeroes, it makes all queues +* URGENT. +*/ +if (ctrl->quirks &NVME_QUIRK_MEDIUM_PRIO_SQ ) + flags |=NVME_SQ_PRIO_MEDIUM ; +/* * Note: we (ab)use the fact the the prp fields survive if no data * is attached to the request.
@@ -2523,7 +2532,8 @@ static const struct pci_device_id nvme_id_table[] = { .driver_data = NVME_QUIRK_STRIPE_SIZE | NVME_QUIRK_DEALLOCATE_ZEROES, }, { PCI_VDEVICE(INTEL, 0xf1a5), /* Intel 600P/P3100 */ - .driver_data = NVME_QUIRK_NO_DEEPEST_PS }, + .driver_data =NVME_QUIRK_NO_DEEPEST_PS | + NVME_QUIRK_MEDIUM_PRIO_SQ }, { PCI_VDEVICE(INTEL, 0x5845), /* Qemu emulated controller */ .driver_data = NVME_QUIRK_IDENTIFY_CNS, }, { PCI_DEVICE(0x1c58, 0x0003), /* HGST adapter */
drivers/pci/pci.c +27 -10
@@ -1892,7 +1892,7 @@ void pci_pme_active(struct pci_dev *dev, bool enable)EXPORT_SYMBOL (pci_pme_active);/** -* pci_enable_wake - enable PCI device as wakeup event source +* __pci_enable_wake - enable PCI device as wakeup event source * @dev: PCI device affected * @state: PCI state from which device will issue wakeup events * @enable: True to enable event generation; false to disable
@@ -1910,7 +1910,7 @@ EXPORT_SYMBOL(pci_pme_active);* Error code depending on the platform is returned if both the platform and * the native mechanism fail to enable the generation of wake-up events */ -int pci_enable_wake (struct pci_dev *dev,pci_power_t state,bool enable) +static int __pci_enable_wake (struct pci_dev *dev,pci_power_t state,bool enable) {int ret =0 ;
@@ -1951,6 +1951,23 @@ int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable)return ret; } + +/** +* pci_enable_wake - change wakeup settings for a PCI device +* @pci_dev: Target device +* @state: PCI state from which device will issue wakeup events +* @enable: Whether or not to enable event generation +* +* If @enable is set, check device_may_wakeup() for the device before calling +* __pci_enable_wake() for it. +*/ +int pci_enable_wake (struct pci_dev *pci_dev,pci_power_t state,bool enable) +{ +if (enable && !device_may_wakeup (&pci_dev->dev)) +return -EINVAL ; + +return __pci_enable_wake (pci_dev, state, enable); +}EXPORT_SYMBOL (pci_enable_wake);/**
@@ -1963,9 +1980,9 @@ EXPORT_SYMBOL(pci_enable_wake);* should not be called twice in a row to enable wake-up due to PCI PM vs ACPI * ordering constraints. * -* This function only returns error code if the device is not capable of -* generating PME# from both D3_hot and D3_cold, and the platform is unable to -* enable wake-up power for it. +* This function only returns error code if the device is not allowed to wake +* up the system from sleep or it is not capable of generating PME# from both +* D3_hot and D3_cold and the platform is unable to enable wake-up power for it. */ int pci_wake_from_d3 (struct pci_dev *dev,bool enable) {
@@ -2096,7 +2113,7 @@ int pci_finish_runtime_suspend(struct pci_dev *dev) dev->runtime_d3cold = target_state == PCI_D3cold; -pci_enable_wake (dev, target_state,pci_dev_run_wake (dev)); +__pci_enable_wake (dev, target_state,pci_dev_run_wake (dev)); error =pci_set_power_state (dev, target_state);
@@ -2120,16 +2137,16 @@ bool pci_dev_run_wake(struct pci_dev *dev) {struct pci_bus *bus = dev->bus; -if (device_can_wakeup (&dev->dev)) -return true; -if (!dev->pme_support)return false;/* PME-capable in principle, but not from the target power state */ -if (!pci_pme_capable (dev,pci_target_state (dev, false))) +if (!pci_pme_capable (dev,pci_target_state (dev, true)))return false; +if (device_can_wakeup (&dev->dev)) +return true; +while (bus->parent) {struct pci_dev *bridge = bus->self;
drivers/thermal/samsung/exynos_tmu.c +11 -3
@@ -185,6 +185,7 @@* @regulator: pointer to the TMU regulator structure. * @reg_conf: pointer to structure to register with core thermal. * @ntrip: number of supported trip points. +* @enabled: current status of TMU device * @tmu_initialize: SoC specific TMU initialization method * @tmu_control: SoC specific TMU control method * @tmu_read: SoC specific TMU temperature read method
@@ -205,6 +206,7 @@ struct exynos_tmu_data {struct regulator *regulator;struct thermal_zone_device *tzd;unsigned int ntrip; +bool enabled;int (*tmu_initialize)(struct platform_device *pdev);void (*tmu_control)(struct platform_device *pdev,bool on);
@@ -398,6 +400,7 @@ static void exynos_tmu_control(struct platform_device *pdev, bool on)mutex_lock (&data->lock);clk_enable (data->clk); data->tmu_control (pdev, on); + data->enabled = on;clk_disable (data->clk);mutex_unlock (&data->lock); }
@@ -889,19 +892,24 @@ static void exynos7_tmu_control(struct platform_device *pdev, bool on)static int exynos_get_temp (void *p,int *temp) {struct exynos_tmu_data *data = p; +int value, ret =0 ; -if (!data || !data->tmu_read) +if (!data || !data->tmu_read || !data->enabled)return -EINVAL ;mutex_lock (&data->lock);clk_enable (data->clk); - *temp =code_to_temp (data, data->tmu_read (data)) *MCELSIUS ; + value = data->tmu_read (data); +if (value <0 ) + ret = value; +else + *temp =code_to_temp (data, value) *MCELSIUS ;clk_disable (data->clk);mutex_unlock (&data->lock); -return 0 ; +return ret; }#ifdef CONFIG_THERMAL_EMULATION
fs/ceph/file.c +5 -5
@@ -873,6 +873,11 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,size_t start =0 ;ssize_t len; +if (write) + size =min_t (u64, size, fsc->mount_options->wsize); +else + size =min_t (u64, size, fsc->mount_options->rsize); + vino =ceph_vino (inode); req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, vino, pos, &size, 0,
@@ -888,11 +893,6 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,break ; } -if (write) - size =min_t (u64, size, fsc->mount_options->wsize); -else - size =min_t (u64, size, fsc->mount_options->rsize); - len = size; pages =dio_get_pages_alloc (iter, len, &start, &num_pages);if (IS_ERR (pages)) {
fs/cifs/cifsfs.c +13 -0
@@ -1045,6 +1045,18 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,return rc; } +/* +* Directory operations under CIFS/SMB2/SMB3 are synchronous, so fsync() +* is a dummy operation. +*/ +static int cifs_dir_fsync (struct file *file,loff_t start,loff_t end,int datasync) +{ +cifs_dbg (FYI ,"Sync directory - name: %pD datasync: 0x%x\n" , + file, datasync); + +return 0 ; +} +static ssize_t cifs_copy_file_range (struct file *src_file,loff_t off,struct file *dst_file,loff_t destoff,size_t len,unsigned int flags)
@@ -1173,6 +1185,7 @@ const struct file_operations cifs_dir_ops = { .copy_file_range = cifs_copy_file_range, .clone_file_range = cifs_clone_file_range, .llseek = generic_file_llseek, + .fsync = cifs_dir_fsync, }; static void
fs/fs-writeback.c +1 -1
@@ -1940,7 +1940,7 @@ void wb_workfn(struct work_struct *work) }if (!list_empty (&wb->work_list)) -mod_delayed_work (bdi_wq, &wb->dwork,0 ); +wb_wakeup (wb);else if (wb_has_dirty_io (wb) && dirty_writeback_interval)wb_wakeup_delayed (wb);
include/linux/oom.h +2 -0
@@ -95,6 +95,8 @@ static inline int check_stable_address_space(struct mm_struct *mm)return 0 ; } +void __oom_reap_task_mm (struct mm_struct *mm); +extern unsigned long oom_badness (struct task_struct *p,struct mem_cgroup *memcg,const nodemask_t *nodemask,unsigned long totalpages);
include/linux/wait_bit.h +17 -0
@@ -259,4 +259,21 @@ int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode) return out_of_line_wait_on_atomic_t(val, action, mode); } +/** +* clear_and_wake_up_bit - clear a bit and wake up anyone waiting on that bit +* +* @bit: the bit of the word being waited on +* @word: the word being waited on, a kernel virtual address +* +* You can use this helper if bitflags are manipulated atomically rather than +* non-atomically under a lock. +*/ +static inline void clear_and_wake_up_bit (int bit,void *word) +{ +clear_bit_unlock (bit, word); +/* See wake_up_bit() for which memory barrier you need to use. */ +smp_mb__after_atomic (); +wake_up_bit (word, bit); +} +#endif /* _LINUX_WAIT_BIT_H */
include/net/inet_timewait_sock.h +1 -0
@@ -43,6 +43,7 @@ struct inet_timewait_sock {#define tw_family __tw_common.skc_family#define tw_state __tw_common.skc_state#define tw_reuse __tw_common.skc_reuse +#define tw_reuseport __tw_common.skc_reuseport#define tw_ipv6only __tw_common.skc_ipv6only#define tw_bound_dev_if __tw_common.skc_bound_dev_if#define tw_node __tw_common.skc_nulls_node
include/net/nexthop.h +1 -1
@@ -7,7 +7,7 @@static inline int rtnh_ok (const struct rtnexthop *rtnh,int remaining) { -return remaining >=sizeof (*rtnh) && +return remaining >= (int )sizeof (*rtnh) && rtnh->rtnh_len >=sizeof (*rtnh) && rtnh->rtnh_len <= remaining; }
kernel/compat.c +1 -0
@@ -34,6 +34,7 @@ int compat_get_timex(struct timex *txc, const struct compat_timex __user *utp) {struct compat_timex tx32; +memset (txc,0 ,sizeof (struct timex ));if (copy_from_user (&tx32, utp,sizeof (struct compat_timex )))return -EFAULT ;
kernel/events/callchain.c +2 -8
@@ -131,14 +131,8 @@ int get_callchain_buffers(int event_max_stack) goto exit; } -if (count >1 ) { -/* If the allocation failed, give up */ -if (!callchain_cpus_entries) - err = -ENOMEM ; - goto exit; - } - - err =alloc_callchain_buffers (); +if (count ==1 ) + err =alloc_callchain_buffers (); exit:if (err)atomic_dec (&nr_callchain_events);
kernel/events/ring_buffer.c +5 -2
@@ -14,6 +14,7 @@#include <linux/slab.h> #include <linux/circ_buf.h> #include <linux/poll.h> +#include <linux/nospec.h> #include "internal.h"
@@ -863,8 +864,10 @@ perf_mmap_to_page(struct ring_buffer *rb, unsigned long pgoff)return NULL ;/* AUX space */ -if (pgoff >= rb->aux_pgoff) -return virt_to_page (rb->aux_pages[pgoff - rb->aux_pgoff]); +if (pgoff >= rb->aux_pgoff) { +int aux_pgoff =array_index_nospec (pgoff - rb->aux_pgoff, rb->aux_nr_pages); +return virt_to_page (rb->aux_pages[aux_pgoff]); + } }return __perf_mmap_to_page (rb, pgoff);
kernel/sched/autogroup.c +5 -2
@@ -7,6 +7,7 @@#include <linux/utsname.h> #include <linux/security.h> #include <linux/export.h> +#include <linux/nospec.h> unsigned int __read_mostly sysctl_sched_autogroup_enabled =1 ;static struct autogroup autogroup_default;
@@ -213,7 +214,7 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int nice)static unsigned long next =INITIAL_JIFFIES ;struct autogroup *ag;unsigned long shares; -int err; +int err, idx;if (nice <MIN_NICE || nice >MAX_NICE )return -EINVAL ;
@@ -231,7 +232,9 @@ int proc_sched_autogroup_set_nice(struct task_struct *p, int nice) next =HZ /10 + jiffies; ag =autogroup_task_get (p); - shares =scale_load (sched_prio_to_weight[nice +20 ]); + + idx =array_index_nospec (nice +20 ,40 ); + shares =scale_load (sched_prio_to_weight[idx]);down_write (&ag->lock); err =sched_group_set_shares (ag->tg, shares);
kernel/sched/cpufreq_schedutil.c +2 -1
@@ -282,7 +282,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,* Do not reduce the frequency if the CPU has not been idle * recently, as the reduction is likely to be premature then. */ -if (busy && next_f < sg_policy->next_freq) { +if (busy && next_f < sg_policy->next_freq && + sg_policy->next_freq !=UINT_MAX ) { next_f = sg_policy->next_freq;/* Reset cached freq as next_freq has changed */
kernel/trace/trace_events_filter.c +3 -0
@@ -338,6 +338,9 @@ static int regex_match_full(char *str, struct regex *r, int len)static int regex_match_front (char *str,struct regex *r,int len) { +if (len < r->len) +return 0 ; +if (strncmp (str, r->pattern, r->len) ==0 )return 1 ;return 0 ;
kernel/trace/trace_uprobe.c +2 -0
@@ -152,6 +152,8 @@ static void FETCH_FUNC_NAME(memory, string)(struct pt_regs *regs,return ; ret =strncpy_from_user (dst, src, maxlen); +if (ret == maxlen) + dst[--ret] ='\0' ;if (ret <0 ) {/* Failed to fetch string */ ((u8 *)get_rloc_data (dest))[0 ] ='\0' ;
mm/backing-dev.c +1 -1
@@ -381,7 +381,7 @@ static void wb_shutdown(struct bdi_writeback *wb)* the barrier provided by test_and_clear_bit() above. */ smp_wmb (); -clear_bit (WB_shutting_down, &wb->state); +clear_and_wake_up_bit (WB_shutting_down, &wb->state); }static void wb_exit (struct bdi_writeback *wb)
mm/memcontrol.c +3 -0
@@ -4187,6 +4187,9 @@ static void free_mem_cgroup_per_node_info(struct mem_cgroup *memcg, int node) {struct mem_cgroup_per_node *pn = memcg->nodeinfo[node]; +if (!pn) +return ; +free_percpu (pn->lruvec_stat);kfree (pn); }
mm/mmap.c +26 -18
56 lines not on this page · raw message
mm/oom_kill.c +40 -34
111 lines not on this page · raw message
mm/sparse.c +1 -1
@@ -661,7 +661,7 @@ void offline_mem_sections(unsigned long start_pfn, unsigned long end_pfn)unsigned long pfn;for (pfn = start_pfn; pfn < end_pfn; pfn +=PAGES_PER_SECTION ) { -unsigned long section_nr =pfn_to_section_nr (start_pfn); +unsigned long section_nr =pfn_to_section_nr (pfn);struct mem_section *ms;/*
mm/z3fold.c +30 -12
80 lines not on this page · raw message
net/atm/lec.c +7 -2
@@ -41,6 +41,9 @@ static unsigned char bridge_ula_lec[] = { 0x01, 0x80, 0xc2, 0x00, 0x00 };#include <linux/module.h> #include <linux/init.h> +/* Hardening for Spectre-v1 */ +#include <linux/nospec.h> +#include "lec.h" #include "lec_arpc.h" #include "resources.h"
@@ -687,8 +690,10 @@ static int lec_vcc_attach(struct atm_vcc *vcc, void __user *arg) bytes_left =copy_from_user (&ioc_data, arg,sizeof (struct atmlec_ioc ));if (bytes_left !=0 )pr_info ("copy from user failed for %d bytes\n" , bytes_left); -if (ioc_data.dev_num <0 || ioc_data.dev_num >=MAX_LEC_ITF || - !dev_lec[ioc_data.dev_num]) +if (ioc_data.dev_num <0 || ioc_data.dev_num >=MAX_LEC_ITF ) +return -EINVAL ; + ioc_data.dev_num =array_index_nospec (ioc_data.dev_num,MAX_LEC_ITF ); +if (!dev_lec[ioc_data.dev_num])return -EINVAL ; vpriv =kmalloc (sizeof (struct lec_vcc_priv ),GFP_KERNEL );if (!vpriv)
net/bridge/netfilter/ebtables.c +6 -5
@@ -1819,13 +1819,14 @@ static int compat_table_info(const struct ebt_table_info *info, {unsigned int size = info->entries_size;const void *entries = info->entries; -int ret; newinfo->entries_size = size; - - ret =xt_compat_init_offsets (NFPROTO_BRIDGE , info->nentries); -if (ret) -return ret; +if (info->nentries) { +int ret =xt_compat_init_offsets (NFPROTO_BRIDGE , + info->nentries); +if (ret) +return ret; + }return EBT_ENTRY_ITERATE (entries, size, compat_calc_entry, info, entries, newinfo);
net/core/dev_addr_lists.c +2 -2
@@ -57,8 +57,8 @@ static int __hw_addr_add_ex(struct netdev_hw_addr_list *list,return -EINVAL ;list_for_each_entry (ha, &list->list, list) { -if (!memcmp (ha->addr, addr, addr_len) && - ha->type == addr_type) { +if (ha->type == addr_type && + !memcmp (ha->addr, addr, addr_len)) {if (global) {/* check if addr is already used as global */ if (ha->global_use)
net/core/skbuff.c +1 -0
@@ -857,6 +857,7 @@ static struct sk_buff *__skb_clone(struct sk_buff *n, struct sk_buff *skb) n->hdr_len = skb->nohdr ?skb_headroom (skb) : skb->hdr_len; n->cloned =1 ; n->nohdr =0 ; + n->peeked =0 ; n->destructor =NULL ;C (tail);C (end);
net/dccp/ipv4.c +1 -0
@@ -614,6 +614,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb) ireq =inet_rsk (req);sk_rcv_saddr_set (req_to_sk (req),ip_hdr (skb)->daddr);sk_daddr_set (req_to_sk (req),ip_hdr (skb)->saddr); + ireq->ir_mark =inet_request_mark (sk, skb); ireq->ireq_family =AF_INET ; ireq->ir_iif = sk->sk_bound_dev_if;
net/dccp/ipv6.c +1 -0
@@ -351,6 +351,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) ireq->ir_v6_rmt_addr =ipv6_hdr (skb)->saddr; ireq->ir_v6_loc_addr =ipv6_hdr (skb)->daddr; ireq->ireq_family =AF_INET6 ; + ireq->ir_mark =inet_request_mark (sk, skb); if (ipv6_opt_accepted(sk, skb, IP6CB(skb)) || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
net/ipv4/inet_timewait_sock.c +1 -0
@@ -179,6 +179,7 @@ struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, tw->tw_dport = inet->inet_dport; tw->tw_family = sk->sk_family; tw->tw_reuse = sk->sk_reuse; + tw->tw_reuseport = sk->sk_reuseport; tw->tw_hash = sk->sk_hash; tw->tw_ipv6only =0 ; tw->tw_transparent = inet->transparent;
net/ipv4/inetpeer.c +1 -0
@@ -210,6 +210,7 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, p =kmem_cache_alloc (peer_cachep,GFP_ATOMIC );if (p) { p->daddr = *daddr; + p->dtime = (__u32 )jiffies;refcount_set (&p->refcnt,2 );atomic_set (&p->rid,0 ); p->metrics[RTAX_LOCK -1 ] =INETPEER_METRICS_NEW ;
net/ipv4/route.c +6 -5
@@ -2288,13 +2288,14 @@ struct rtable *ip_route_output_key_hash(struct net *net, struct flowi4 *fl4, const struct sk_buff *skb) {__u8 tos =RT_FL_TOS (fl4); -struct fib_result res; +struct fib_result res = { + .type =RTN_UNSPEC , + .fi =NULL , + .table =NULL , + .tclassid =0 , + };struct rtable *rth; - res.tclassid =0 ; - res.fi =NULL ; - res.table =NULL ; - fl4->flowi4_iif =LOOPBACK_IFINDEX ; fl4->flowi4_tos = tos &IPTOS_RT_MASK ; fl4->flowi4_scope = ((tos & RTO_ONLINK) ?
net/ipv4/tcp.c +1 -1
@@ -2601,7 +2601,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,case TCP_REPAIR_QUEUE :if (!tp->repair) err = -EPERM ; -else if (val <TCP_QUEUES_NR ) +else if ((unsigned int )val <TCP_QUEUES_NR ) tp->repair_queue = val;else err = -EINVAL ;
net/kcm/kcmsock.c +1 -0
@@ -1425,6 +1425,7 @@ static int kcm_attach(struct socket *sock, struct socket *csock,*/ if (csk->sk_user_data) {write_unlock_bh (&csk->sk_callback_lock); +strp_stop (&psock->strp);strp_done (&psock->strp);kmem_cache_free (kcm_psockp, psock); err = -EALREADY ;
net/netfilter/ipvs/ip_vs_ctl.c +0 -8
@@ -2387,11 +2387,7 @@ do_ip_vs_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len)strlcpy (cfg.mcast_ifn, dm->mcast_ifn,sizeof (cfg.mcast_ifn)); cfg.syncid = dm->syncid; -rtnl_lock (); -mutex_lock (&ipvs->sync_mutex); ret =start_sync_thread (ipvs, &cfg, dm->state); -mutex_unlock (&ipvs->sync_mutex); -rtnl_unlock (); }else {mutex_lock (&ipvs->sync_mutex); ret =stop_sync_thread (ipvs, dm->state);
@@ -3484,12 +3480,8 @@ static int ip_vs_genl_new_daemon(struct netns_ipvs *ipvs, struct nlattr **attrs)if (ipvs->mixed_address_family_dests >0 )return -EINVAL ; -rtnl_lock (); -mutex_lock (&ipvs->sync_mutex); ret =start_sync_thread (ipvs, &c,nla_get_u32 (attrs[IPVS_DAEMON_ATTR_STATE ])); -mutex_unlock (&ipvs->sync_mutex); -rtnl_unlock ();return ret; }
net/netfilter/ipvs/ip_vs_sync.c +80 -75
361 lines not on this page · raw message
net/netlink/af_netlink.c +2 -0
@@ -1813,6 +1813,8 @@ static int netlink_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)if (msg->msg_namelen) { err = -EINVAL ; +if (msg->msg_namelen <sizeof (struct sockaddr_nl )) + goto out;if (addr->nl_family !=AF_NETLINK ) goto out; dst_portid = addr->nl_pid;
net/rfkill/rfkill-gpio.c +6 -1
@@ -137,13 +137,18 @@ static int rfkill_gpio_probe(struct platform_device *pdev) ret =rfkill_register (rfkill->rfkill_dev);if (ret <0 ) -return ret; + goto err_destroy;platform_set_drvdata (pdev, rfkill);dev_info (&pdev->dev,"%s device registered.\n" , rfkill->name);return 0 ; + +err_destroy: +rfkill_destroy (rfkill->rfkill_dev); + +return ret; }static int rfkill_gpio_remove (struct platform_device *pdev)