Linux 4.9.88
Greg KH
maintainerI'm announcing the release of the 4.9.88 kernel.
All users of the 4.9 kernel series must upgrade.
The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/arm/mach-omap2/omap-secure.c | 2 arch/mips/ath25/board.c | 2 arch/mips/cavium-octeon/octeon-irq.c | 2 arch/mips/kernel/smp-bmips.c | 8 arch/s390/kvm/kvm-s390.c | 1 arch/x86/Makefile | 5 arch/x86/entry/entry_32.S | 3 arch/x86/entry/entry_64.S | 3 arch/x86/include/asm/apm.h | 6 arch/x86/include/asm/asm-prototypes.h | 3 arch/x86/include/asm/cpufeatures.h | 1 arch/x86/include/asm/efi.h | 17 arch/x86/include/asm/nospec-branch.h | 138 +++++- arch/x86/include/asm/paravirt.h | 16 arch/x86/include/asm/paravirt_types.h | 5 arch/x86/kernel/cpu/bugs.c | 12 arch/x86/kernel/cpu/intel.c | 7 arch/x86/kernel/cpu/mcheck/mce.c | 22 + arch/x86/kernel/head_64.S | 2 arch/x86/kernel/machine_kexec_64.c | 1 arch/x86/kernel/module.c | 14 arch/x86/lib/Makefile | 1 arch/x86/lib/retpoline.S | 56 -- arch/x86/tools/relocs.c | 3 drivers/block/loop.c | 2 drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 3 drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c | 58 +- drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 13 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 30 - drivers/gpu/drm/drm_probe_helper.c | 20 drivers/gpu/drm/i915/i915_drv.c | 2 drivers/gpu/drm/i915/intel_hdmi.c | 14 drivers/gpu/drm/nouveau/nouveau_connector.c | 18 drivers/gpu/drm/radeon/cik.c | 31 - drivers/gpu/drm/radeon/radeon_connectors.c | 74 ++- drivers/infiniband/core/ucma.c | 6 drivers/infiniband/hw/mlx5/cq.c | 7 drivers/infiniband/hw/mlx5/mr.c | 2 drivers/input/keyboard/matrix_keypad.c | 4 drivers/input/keyboard/tca8418_keypad.c | 2 drivers/md/bcache/super.c | 27 + drivers/media/i2c/tc358743.c | 2 drivers/mtd/ubi/vmt.c | 15 drivers/pci/host/pcie-designware.c | 2 drivers/scsi/qla2xxx/qla_init.c | 1 drivers/scsi/qla2xxx/qla_target.c | 2 drivers/staging/android/ashmem.c | 15 drivers/staging/comedi/drivers.c | 3 drivers/tty/serial/8250/8250_pci.c | 11 drivers/tty/serial/atmel_serial.c | 1 drivers/tty/serial/earlycon.c | 3 drivers/tty/serial/serial_core.c | 2 drivers/tty/serial/sh-sci.c | 2 drivers/usb/core/message.c | 4 drivers/usb/core/quirks.c | 3 drivers/usb/gadget/function/f_fs.c | 1 drivers/usb/mon/mon_text.c | 126 +++--- drivers/usb/storage/uas.c | 2 drivers/usb/storage/unusual_devs.h | 7 drivers/usb/usbip/vudc_sysfs.c | 8 drivers/virtio/virtio_ring.c | 2 drivers/watchdog/hpwdt.c | 507 ------------------------- fs/ext4/xattr.c | 3 fs/nfs/direct.c | 2 fs/nfs/write.c | 83 ++-- include/drm/drm_crtc_helper.h | 1 include/linux/compiler-clang.h | 5 include/linux/compiler-gcc.h | 4 include/linux/init.h | 8 include/linux/netfilter/x_tables.h | 38 - include/linux/nospec.h | 23 - include/linux/usb/quirks.h | 3 include/linux/workqueue.h | 1 kernel/workqueue.c | 16 net/bridge/netfilter/ebt_among.c | 21 - net/bridge/netfilter/ebtables.c | 13 net/ipv4/netfilter/arp_tables.c | 20 net/ipv4/netfilter/ip_tables.c | 23 - net/ipv6/netfilter/ip6_tables.c | 21 - net/ipv6/netfilter/nf_nat_l3proto_ipv6.c | 4 net/netfilter/nf_nat_proto_common.c | 7 net/netfilter/x_tables.c | 55 ++ net/netfilter/xt_IDLETIMER.c | 9 net/netfilter/xt_LED.c | 12 scripts/Makefile.lib | 8 sound/core/seq/seq_clientmgr.c | 21 - sound/core/seq/seq_fifo.c | 2 sound/core/seq/seq_memory.c | 14 sound/core/seq/seq_memory.h | 3 sound/pci/hda/patch_conexant.c | 2 sound/pci/hda/patch_realtek.c | 18 sound/soc/codecs/rt5651.c | 1 sound/soc/codecs/sgtl5000.c | 11 tools/perf/util/trigger.h | 9 95 files changed, 875 insertions(+), 950 deletions(-)
Adrian Hunter (1):
perf tools: Fix trigger class trigger_on()
Alex Deucher (2):
drm/radeon: fix KV harvesting
drm/amdgpu: fix KV harvesting
Arnd Bergmann (2):
watchdog: hpwdt: fix unused variable warning
ARM: omap2: hide omap3_save_secure_ram on non-OMAP3 builds
Benjamin Berg (1):
ALSA: hda/realtek: Limit mic boost on T480
Clay McClure (1):
ubi: Fix race condition between ubi volume creation and udev
Colin Ian King (3):
MIPS: ath25: Check for kzalloc allocation failure
MIPS: OCTEON: irq: Check for null return on kzalloc allocation
usbip: vudc: fix null pointer dereference on udc->lock
Dan Williams (2):
nospec: Kill array_index_nospec_mask_check()
nospec: Include <asm/barrier.h> dependency
Danilo Krummrich (1):
usb: quirks: add control message delay for 1b1c:1b20
David Hildenbrand (1):
KVM: s390: fix memory overwrites when not using SCA entries
David Woodhouse (3):
Revert "x86/retpoline: Simplify vmexit_fill_RSB()" x86/speculation: Use IBRS if available before calling into firmware x86/retpoline: Support retpoline builds with Clang
Dennis Wassenberg (3):
ALSA: hda/realtek - Make dock sound work on ThinkPad L570
ALSA: hda: add dock and led support for HP EliteBook 820 G3
ALSA: hda: add dock and led support for HP ProBook 640 G2
Dmitry Torokhov (1):
Input: tca8418_keypad - remove double read of key event register
Eric Dumazet (1):
netfilter: IDLETIMER: be syzkaller friendly
Fabio Estevam (1):
ASoC: sgtl5000: Fix suspend/resume
Florian Westphal (7):
netfilter: add back stackpointer size checks
netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets
netfilter: bridge: ebt_among: add missing match size checks
netfilter: ipv6: fix use-after-free Write in nf_nat_ipv6_manip_pkt
netfilter: x_tables: pass xt_counters struct instead of packet counter
netfilter: x_tables: pass xt_counters struct to counter allocator
netfilter: x_tables: pack percpu counter allocations
Frank Mori Hess (1):
staging: comedi: fix comedi_nsamples_left.
Greentime Hu (1):
earlycon: add reg-offset to physical address before mapping
Greg Kroah-Hartman (1):
Linux 4.9.88
H.J. Lu (1):
x86: Treat R_X86_64_PLT32 as R_X86_64_PC32
Hans de Goede (1):
ASoC: rt5651: Fix regcache sync errors on resume
Ingo Molnar (1):
x86/speculation: Move firmware_restrict_branch_speculation_*() from C to CPP
James Hogan (1):
kbuild: Handle builtin dtb file names containing hyphens
James Zhu (2):
drm/amdgpu:Correct max uvd handles drm/amdgpu:Always save uvd vcpu_bo in VM Mode
Jerry Hoemann (3):
watchdog: hpwdt: SMBIOS check
watchdog: hpwdt: Check source of NMI
watchdog: hpwdt: Remove legacy NMI sourcing.
Joel Fernandes (1):
staging: android: ashmem: Fix lockdep issue during llseek
Jonas Danielsson (1):
tty/serial: atmel: add new version check for usart
Josh Poimboeuf (1):
x86/module: Detect and skip invalid relocations
Justin Chen (1):
MIPS: BMIPS: Do not mask IPIs during suspend
Koen Vandeputte (1):
PCI: dwc: Fix enumeration end when reaching root subordinate
Konrad Rzeszutek Wilk (1):
x86/spectre_v2: Don't check microcode versions when running under hypervisors
Leon Romanovsky (3):
RDMA/ucma: Limit possible option size RDMA/ucma: Check that user doesn't overflow QP state RDMA/mlx5: Fix integer overflow while resizing CQ
Lukas Wunner (5):
workqueue: Allow retrieval of current task's work struct
drm: Allow determining if current task is output poll worker drm/nouveau: Fix deadlock on runtime suspend drm/radeon: Fix deadlock on runtime suspend drm/amdgpu: Fix deadlock on runtime suspend
Maarten Lankhorst (1):
drm/i915: Always call to intel_display_set_init_power() in resume_early.
Michael Lyle (1):
bcache: don't attach backing with duplicate UUID
Nikola Ciprich (1):
serial: 8250_pci: Add Brainboxes UC-260 4 port serial device
Oliver Neukum (1):
uas: fix comparison for error code
Paolo Abeni (2):
netfilter: x_tables: fix missing timer initialization in xt_LED
netfilter: nat: cope with negative port range
Pete Zaitcev (1):
usb: usbmon: Read text within supplied buffer size
Peter Zijlstra (3):
x86/speculation, objtool: Annotate indirect calls/jumps for objtool x86/boot, objtool: Annotate indirect jump in secondary_startup_64() x86/paravirt, objtool: Annotate indirect calls
Philipp Zabel (1):
tc358743: fix register i2c_rd/wr function fix
Quinn Tran (1):
scsi: qla2xxx: Replace fcport alloc with qla2x00_alloc_fcport
Rex Zhu (1):
drm/amdgpu: Notify sbios device ready before send request
Ross Zwisler (1):
loop: Fix lost writes caused by missing flag
Sebastian Andrzej Siewior (1):
serial: core: mark port as initialized in autoconfig
Sergey Gorenko (1):
IB/mlx5: Fix incorrect size of klms in the memory region
Seunghun Han (1):
x86/MCE: Serialize sysfs changes
Stefan Brüns (1):
drm/i915: Try EDID bitbanging on HDMI after failed read
Tahsin Erdogan (1):
ext4: inplace xattr block update fails to deduplicate blocks
Takashi Iwai (3):
ALSA: hda/realtek - Fix dock line-out volume on Dell Precision 7520
ALSA: seq: Don't allow resizing pool in use
ALSA: seq: More protection for concurrent write and ioctl races
Tang Junhui (1):
bcache: fix crashes in duplicate cache device register
Teijo Kinnunen (1):
USB: storage: Add JMicron bridge 152d:2567 to unusual_devs.h
Tiwei Bie (1):
virtio_ring: fix num_free handling in error case
Trond Myklebust (2):
NFS: Fix an incorrect type in struct nfs_direct_req
NFS: Fix unstable write completion
Ulrich Hecht (1):
serial: sh-sci: prevent lockup on full TTY buffers
Xinyong (1):
usb: gadget: f_fs: Fix use-after-free in ffs_fs_kill_sb()
Zhang Bo (1):
Input: matrix_keypad - fix race when disabling interrupts
[email protected] (1):
scsi: qla2xxx: Fix NULL pointer crash due to active timer for ABTS
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 87 +SUBLEVEL = 88 EXTRAVERSION = NAME = Roaring Lionus
arch/arm/mach-omap2/omap-secure.c +2 -0
@@ -73,6 +73,7 @@ phys_addr_t omap_secure_ram_mempool_base(void)return omap_secure_memblock_base; } +#if defined(CONFIG_ARCH_OMAP3 ) && defined(CONFIG_PM )u32 omap3_save_secure_ram (void __iomem *addr,int size) {u32 ret;
@@ -91,6 +92,7 @@ u32 omap3_save_secure_ram(void __iomem *addr, int size) return ret; } +#endif /** * rx51_secure_dispatcher: Routine to dispatch secure PPA API calls
arch/mips/ath25/board.c +2 -0
@@ -135,6 +135,8 @@ int __init ath25_find_config(phys_addr_t base, unsigned long size) } board_data =kzalloc (BOARD_CONFIG_BUFSZ ,GFP_KERNEL ); +if (!board_data) + goto error; ath25_board.config = (struct ath25_boarddata *)board_data;memcpy_fromio (board_data, bcfg,0x100 );if (broken_boarddata) {
arch/mips/cavium-octeon/octeon-irq.c +2 -0
@@ -2277,6 +2277,8 @@ static int __init octeon_irq_init_cib(struct device_node *ciu_node, } host_data =kzalloc (sizeof (*host_data),GFP_KERNEL ); +if (!host_data) +return -ENOMEM ;raw_spin_lock_init (&host_data->lock); addr =of_get_address (ciu_node,0 ,NULL ,NULL );
arch/mips/kernel/smp-bmips.c +4 -4
@@ -166,11 +166,11 @@ static void bmips_prepare_cpus(unsigned int max_cpus)return ; } -if (request_irq (IPI0_IRQ , bmips_ipi_interrupt,IRQF_PERCPU , -"smp_ipi0" ,NULL )) +if (request_irq (IPI0_IRQ , bmips_ipi_interrupt, +IRQF_PERCPU |IRQF_NO_SUSPEND ,"smp_ipi0" ,NULL ))panic ("Can't request IPI0 interrupt" ); -if (request_irq (IPI1_IRQ , bmips_ipi_interrupt,IRQF_PERCPU , -"smp_ipi1" ,NULL )) +if (request_irq (IPI1_IRQ , bmips_ipi_interrupt, +IRQF_PERCPU |IRQF_NO_SUSPEND ,"smp_ipi1" ,NULL ))panic ("Can't request IPI1 interrupt" ); }
arch/s390/kvm/kvm-s390.c +1 -0
@@ -1601,6 +1601,7 @@ static void sca_add_vcpu(struct kvm_vcpu *vcpu)/* we still need the basic sca for the ipte control */ vcpu->arch.sie_block->scaoh = (__u32)(((__u64 )sca) >>32 ); vcpu->arch.sie_block->scaol = (__u32 )(__u64 )sca; +return ; }read_lock (&vcpu->kvm->arch.sca_lock);if (vcpu->kvm->arch.use_esca) {
arch/x86/Makefile +4 -1
@@ -184,7 +184,10 @@ KBUILD_AFLAGS += $(mflags-y) # Avoid indirect branches in kernel to deal with Spectre ifdef CONFIG_RETPOLINE - RETPOLINE_CFLAGS += $(call cc-option,-mindirect-branch=thunk-extern -mindirect-branch-register) + RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern -mindirect-branch-register + RETPOLINE_CFLAGS_CLANG := -mretpoline-external-thunk + + RETPOLINE_CFLAGS += $(call cc-option,$(RETPOLINE_CFLAGS_GCC),$(call cc-option,$(RETPOLINE_CFLAGS_CLANG))) ifneq ($(RETPOLINE_CFLAGS),) KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE endif
arch/x86/entry/entry_32.S +1 -2
@@ -237,8 +237,7 @@ ENTRY(__switch_to_asm) * exist, overwrite the RSB with entries which capture * speculative execution to prevent attack. */ - /* Clobbers %ebx */ - FILL_RETURN_BUFFER RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW + FILL_RETURN_BUFFER %ebx, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW #endif /* restore callee-saved registers */
arch/x86/entry/entry_64.S +1 -2
@@ -331,8 +331,7 @@ ENTRY(__switch_to_asm) * exist, overwrite the RSB with entries which capture * speculative execution to prevent attack. */ - /* Clobbers %rbx */ - FILL_RETURN_BUFFER RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW + FILL_RETURN_BUFFER %r12, RSB_CLEAR_LOOPS, X86_FEATURE_RSB_CTXSW #endif /* restore callee-saved registers */
arch/x86/include/asm/apm.h +6 -0
@@ -6,6 +6,8 @@#ifndef _ASM_X86_MACH_DEFAULT_APM_H#define _ASM_X86_MACH_DEFAULT_APM_H +#include <asm/nospec-branch.h> +#ifdef APM_ZERO_SEGS # define APM_DO_ZERO_SEGS \ "pushl %%ds\n\t" \
@@ -31,6 +33,7 @@ static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in,* N.B. We do NOT need a cld after the BIOS call * because we always save and restore the flags. */ +firmware_restrict_branch_speculation_start (); __asm__ __volatile__(APM_DO_ZERO_SEGS "pushl %%edi\n\t" "pushl %%ebp\n\t"
@@ -43,6 +46,7 @@ static inline void apm_bios_call_asm(u32 func, u32 ebx_in, u32 ecx_in, "=S" (*esi) : "a" (func), "b" (ebx_in), "c" (ecx_in) : "memory", "cc"); +firmware_restrict_branch_speculation_end (); } static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,
@@ -55,6 +59,7 @@ static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in,* N.B. We do NOT need a cld after the BIOS call * because we always save and restore the flags. */ +firmware_restrict_branch_speculation_start (); __asm__ __volatile__(APM_DO_ZERO_SEGS "pushl %%edi\n\t" "pushl %%ebp\n\t"
@@ -67,6 +72,7 @@ static inline bool apm_bios_call_simple_asm(u32 func, u32 ebx_in, "=S" (si) : "a" (func), "b" (ebx_in), "c" (ecx_in) : "memory", "cc"); +firmware_restrict_branch_speculation_end ();return error; }
arch/x86/include/asm/asm-prototypes.h +0 -3
@@ -37,7 +37,4 @@ INDIRECT_THUNK(dx) INDIRECT_THUNK(si) INDIRECT_THUNK(di) INDIRECT_THUNK(bp) -asmlinkage void __fill_rsb(void); -asmlinkage void __clear_rsb(void); -#endif /* CONFIG_RETPOLINE */
arch/x86/include/asm/cpufeatures.h +1 -0
@@ -203,6 +203,7 @@#define X86_FEATURE_KAISER ( 7*32+31)/* CONFIG_PAGE_TABLE_ISOLATION w/o nokaiser */ #define X86_FEATURE_USE_IBPB ( 7*32+21)/* "" Indirect Branch Prediction Barrier enabled */ +#define X86_FEATURE_USE_IBRS_FW ( 7*32+22)/* "" Use IBRS during runtime firmware calls */ /* Virtualization flags: Linux defined, word 8 */ #define X86_FEATURE_TPR_SHADOW ( 8*32+ 0)/* Intel TPR Shadow */
arch/x86/include/asm/efi.h +15 -2
@@ -5,6 +5,7 @@#include <asm/pgtable.h> #include <asm/processor-flags.h> #include <asm/tlb.h> +#include <asm/nospec-branch.h> /* * We map the EFI regions needed for runtime services non-contiguously,
@@ -35,8 +36,18 @@extern unsigned long asmlinkage efi_call_phys (void *, ...); -#define arch_efi_call_virt_setup () kernel_fpu_begin() -#define arch_efi_call_virt_teardown () kernel_fpu_end() +#define arch_efi_call_virt_setup () \ +({ \ + kernel_fpu_begin(); \ + firmware_restrict_branch_speculation_start(); \ +}) + +#define arch_efi_call_virt_teardown () \ +({ \ + firmware_restrict_branch_speculation_end(); \ + kernel_fpu_end(); \ +}) +/* * Wrap all the virtual calls in a way that forces the parameters on the stack.
@@ -72,6 +83,7 @@ struct efi_scratch {efi_sync_low_kernel_mappings (); \preempt_disable (); \__kernel_fpu_begin (); \ +firmware_restrict_branch_speculation_start (); \ \if (efi_scratch.use_pgd) { \ efi_scratch.prev_cr3 =read_cr3 (); \
@@ -90,6 +102,7 @@ struct efi_scratch {__flush_tlb_all (); \ } \ \ +firmware_restrict_branch_speculation_end (); \__kernel_fpu_end (); \preempt_enable (); \ })
arch/x86/include/asm/nospec-branch.h +118 -20
195 lines not on this page · raw message
arch/x86/include/asm/paravirt.h +12 -4
@@ -6,6 +6,7 @@#ifdef CONFIG_PARAVIRT #include <asm/pgtable_types.h> #include <asm/asm.h> +#include <asm/nospec-branch.h> #include <asm/paravirt_types.h>
@@ -869,23 +870,27 @@ extern void default_banner(void);#define INTERRUPT_RETURN \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_iret), CLBR_NONE, \ - jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret)) + ANNOTATE_RETPOLINE_SAFE; \ + jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_iret);)#define DISABLE_INTERRUPTS (clobbers) \ PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_disable), clobbers, \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_disable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#define ENABLE_INTERRUPTS (clobbers) \ PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_irq_enable), clobbers, \ PV_SAVE_REGS(clobbers | CLBR_CALLEE_SAVE); \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_irq_ops+PV_IRQ_irq_enable); \ PV_RESTORE_REGS(clobbers | CLBR_CALLEE_SAVE);)#ifdef CONFIG_X86_32 #define GET_CR0_INTO_EAX \ push %ecx; push %edx; \ + ANNOTATE_RETPOLINE_SAFE; \ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0); \ pop %edx; pop %ecx#else /* !CONFIG_X86_32 */
@@ -907,11 +912,13 @@ extern void default_banner(void);*/ #define SWAPGS \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_swapgs), CLBR_NONE, \ - call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs) \ + ANNOTATE_RETPOLINE_SAFE; \ + call PARA_INDIRECT(pv_cpu_ops+PV_CPU_swapgs); \ )#define GET_CR2_INTO_RAX \ - call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr2) + ANNOTATE_RETPOLINE_SAFE; \ + call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr2);#define PARAVIRT_ADJUST_EXCEPTION_FRAME \ PARA_SITE(PARA_PATCH(pv_irq_ops, PV_IRQ_adjust_exception_frame), \
@@ -921,7 +928,8 @@ extern void default_banner(void);#define USERGS_SYSRET64 \ PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_usergs_sysret64), \ CLBR_NONE, \ - jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64)) + ANNOTATE_RETPOLINE_SAFE; \ + jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret64);)#endif /* CONFIG_X86_32 */ #endif /* __ASSEMBLY__ */
arch/x86/include/asm/paravirt_types.h +4 -1
@@ -42,6 +42,7 @@#include <asm/desc_defs.h> #include <asm/kmap_types.h> #include <asm/pgtable_types.h> +#include <asm/nospec-branch.h> struct page ;struct thread_struct ;
@@ -391,7 +392,9 @@ int paravirt_disable_iospace(void);* offset into the paravirt_patch_template structure, and can therefore be * freely converted back into a structure offset. */ -#define PARAVIRT_CALL "call *%c[paravirt_opptr];" +#define PARAVIRT_CALL \ + ANNOTATE_RETPOLINE_SAFE \ + "call *%c[paravirt_opptr];"/* * These macros are intended to wrap calls through one of the paravirt
arch/x86/kernel/cpu/bugs.c +11 -1
@@ -299,6 +299,15 @@ static void __init spectre_v2_select_mitigation(void)setup_force_cpu_cap (X86_FEATURE_USE_IBPB );pr_info ("Spectre v2 mitigation: Enabling Indirect Branch Prediction Barrier\n" ); } + +/* +* Retpoline means the kernel is safe because it has no indirect +* branches. But firmware isn't, so use IBRS to protect that. +*/ +if (boot_cpu_has (X86_FEATURE_IBRS )) { +setup_force_cpu_cap (X86_FEATURE_USE_IBRS_FW ); +pr_info ("Enabling Restricted Speculation for firmware calls\n" ); + } }#undef pr_fmt
@@ -325,8 +334,9 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, cif (!boot_cpu_has_bug (X86_BUG_SPECTRE_V2 ))return sprintf (buf,"Not affected\n" ); -return sprintf (buf,"%s%s%s\n" , spectre_v2_strings[spectre_v2_enabled], +return sprintf (buf,"%s%s%s%s\n" , spectre_v2_strings[spectre_v2_enabled],boot_cpu_has (X86_FEATURE_USE_IBPB ) ?", IBPB" :"" , +boot_cpu_has (X86_FEATURE_USE_IBRS_FW ) ?", IBRS_FW" :"" , spectre_v2_module_string()); }#endif
arch/x86/kernel/cpu/intel.c +7 -0
@@ -103,6 +103,13 @@ static bool bad_spectre_microcode(struct cpuinfo_x86 *c) {int i; +/* +* We know that the hypervisor lie to us on the microcode version so +* we may as well hope that it is running the correct version. +*/ +if (cpu_has (c,X86_FEATURE_HYPERVISOR )) +return false; +for (i =0 ; i <ARRAY_SIZE (spectre_bad_microcodes); i++) {if (c->x86_model == spectre_bad_microcodes[i].model && c->x86_stepping == spectre_bad_microcodes[i].stepping)
arch/x86/kernel/cpu/mcheck/mce.c +21 -1
@@ -61,6 +61,9 @@ static DEFINE_MUTEX(mce_chrdev_read_mutex);smp_load_acquire (&(p)); \ }) +/* sysfs synchronization */ +static DEFINE_MUTEX (mce_sysfs_mutex); +#define CREATE_TRACE_POINTS #include <trace/events/mce.h>
@@ -2308,6 +2311,7 @@ static ssize_t set_ignore_ce(struct device *s,if (kstrtou64 (buf,0 , &new) <0 )return -EINVAL ; +mutex_lock (&mce_sysfs_mutex);if (mca_cfg.ignore_ce ^ !!new) {if (new) {/* disable ce features */
@@ -2320,6 +2324,8 @@ static ssize_t set_ignore_ce(struct device *s,on_each_cpu (mce_enable_ce, (void *)1 ,1 ); } } +mutex_unlock (&mce_sysfs_mutex); +return size; }
@@ -2332,6 +2338,7 @@ static ssize_t set_cmci_disabled(struct device *s,if (kstrtou64 (buf,0 , &new) <0 )return -EINVAL ; +mutex_lock (&mce_sysfs_mutex);if (mca_cfg.cmci_disabled ^ !!new) {if (new) {/* disable cmci */
@@ -2343,6 +2350,8 @@ static ssize_t set_cmci_disabled(struct device *s,on_each_cpu (mce_enable_ce,NULL ,1 ); } } +mutex_unlock (&mce_sysfs_mutex); +return size; }
@@ -2350,8 +2359,19 @@ static ssize_t store_int_with_restart(struct device *s,struct device_attribute *attr, const char *buf, size_t size) { - ssize_t ret = device_store_int(s, attr, buf, size); + unsigned long old_check_interval = check_interval; +ssize_t ret =device_store_ulong (s, attr, buf, size); + +if (check_interval == old_check_interval) +return ret; + +if (check_interval <1 ) + check_interval =1 ; + +mutex_lock (&mce_sysfs_mutex);mce_restart (); +mutex_unlock (&mce_sysfs_mutex); +return ret; }
arch/x86/kernel/head_64.S +2 -0
@@ -22,6 +22,7 @@ #include <asm/nops.h> #include "../entry/calling.h" #include <asm/export.h> +#include <asm/nospec-branch.h> #ifdef CONFIG_PARAVIRT #include <asm/asm-offsets.h>
@@ -200,6 +201,7 @@ ENTRY(secondary_startup_64) /* Ensure I am executing from virtual addresses */ movq $1f, %rax + ANNOTATE_RETPOLINE_SAFE jmp *%rax 1:
arch/x86/kernel/machine_kexec_64.c +1 -0
@@ -524,6 +524,7 @@ int arch_kexec_apply_relocations_add(const Elf64_Ehdr *ehdr, goto overflow;break ;case R_X86_64_PC32 : +case R_X86_64_PLT32 : value -= (u64 )address; *(u32 *)location = value;break ;
arch/x86/kernel/module.c +14 -0
@@ -171,19 +171,28 @@ int apply_relocate_add(Elf64_Shdr *sechdrs,case R_X86_64_NONE :break ;case R_X86_64_64 : +if (*(u64 *)loc !=0 ) + goto invalid_relocation; *(u64 *)loc = val;break ;case R_X86_64_32 : +if (*(u32 *)loc !=0 ) + goto invalid_relocation; *(u32 *)loc = val;if (val != *(u32 *)loc) goto overflow;break ;case R_X86_64_32S : +if (*(s32 *)loc !=0 ) + goto invalid_relocation; *(s32 *)loc = val;if ((s64 )val != *(s32 *)loc) goto overflow;break ;case R_X86_64_PC32 : +case R_X86_64_PLT32 : +if (*(u32 *)loc !=0 ) + goto invalid_relocation; val -= (u64 )loc; *(u32 *)loc = val;#if 0
@@ -199,6 +208,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, }return 0 ; +invalid_relocation: +pr_err ("x86/modules: Skipping invalid relocation target, existing value is nonzero for type %d, loc %p, val %Lx\n" , + (int )ELF64_R_TYPE (rel[i].r_info), loc, val); +return -ENOEXEC ; + overflow:pr_err ("overflow in relocation type %d val %Lx\n" , (int )ELF64_R_TYPE (rel[i].r_info), val);
arch/x86/lib/Makefile +0 -1
@@ -26,7 +26,6 @@ lib-$(CONFIG_RWSEM_XCHGADD_ALGORITHM) += rwsem.o lib-$(CONFIG_INSTRUCTION_DECODER) += insn.o inat.o lib-$(CONFIG_RANDOMIZE_BASE) += kaslr.o lib-$(CONFIG_RETPOLINE) += retpoline.o -OBJECT_FILES_NON_STANDARD_retpoline.o :=y obj-y += msr.o msr-reg.o msr-reg-export.o hweight.o
arch/x86/lib/retpoline.S +0 -56
65 lines not on this page · raw message
arch/x86/tools/relocs.c +3 -0
@@ -769,9 +769,12 @@ static int do_reloc64(struct section *sec, Elf_Rel *rel, ElfW(Sym) *sym,break ;case R_X86_64_PC32 : +case R_X86_64_PLT32 :/* * PC relative relocations don't need to be adjusted unless * referencing a percpu symbol. +* +* NB: R_X86_64_PLT32 can be treated as R_X86_64_PC32. */ if (is_percpu_sym (sym, symname))add_reloc (&relocs32neg, offset);
drivers/block/loop.c +1 -1
@@ -263,7 +263,7 @@ static int lo_write_bvec(struct file *file, struct bio_vec *bvec, loff_t *ppos)struct iov_iter i;ssize_t bw; -iov_iter_bvec (&i,ITER_BVEC , bvec,1 , bvec->bv_len); +iov_iter_bvec (&i,ITER_BVEC |WRITE , bvec,1 , bvec->bv_len);file_start_write (file); bw =vfs_iter_write (file, &i, ppos);
drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c +3 -0
@@ -540,6 +540,9 @@ int amdgpu_acpi_pcie_performance_request(struct amdgpu_device *adev,size_t size;u32 retry =3 ; +if (amdgpu_acpi_pcie_notify_device_ready (adev)) +return -EINVAL ; +/* Get the device handle */ handle =ACPI_HANDLE (&adev->pdev->dev);if (!handle)
drivers/gpu/drm/amd/amdgpu/amdgpu_connectors.c +38 -20
106 lines not on this page · raw message
drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c +8 -5
@@ -273,12 +273,15 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)if (adev->uvd.vcpu_bo ==NULL )return 0 ; -for (i =0 ; i < adev->uvd.max_handles; ++i) -if (atomic_read (&adev->uvd.handles[i])) -break ; +/* only valid for physical mode */ +if (adev->asic_type <CHIP_POLARIS10 ) { +for (i =0 ; i < adev->uvd.max_handles; ++i) +if (atomic_read (&adev->uvd.handles[i])) +break ; -if (i ==AMDGPU_MAX_UVD_HANDLES ) -return 0 ; +if (i == adev->uvd.max_handles) +return 0 ; + }cancel_delayed_work_sync (&adev->uvd.idle_work);
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +2 -28
@@ -4475,34 +4475,8 @@ static void gfx_v7_0_gpu_early_init(struct amdgpu_device *adev)case CHIP_KAVERI : adev->gfx.config.max_shader_engines =1 ; adev->gfx.config.max_tile_pipes =4 ; -if ((adev->pdev->device ==0x1304 ) || - (adev->pdev->device ==0x1305 ) || - (adev->pdev->device ==0x130C ) || - (adev->pdev->device ==0x130F ) || - (adev->pdev->device ==0x1310 ) || - (adev->pdev->device ==0x1311 ) || - (adev->pdev->device ==0x131C )) { - adev->gfx.config.max_cu_per_sh =8 ; - adev->gfx.config.max_backends_per_se =2 ; - }else if ((adev->pdev->device ==0x1309 ) || - (adev->pdev->device ==0x130A ) || - (adev->pdev->device ==0x130D ) || - (adev->pdev->device ==0x1313 ) || - (adev->pdev->device ==0x131D )) { - adev->gfx.config.max_cu_per_sh =6 ; - adev->gfx.config.max_backends_per_se =2 ; - }else if ((adev->pdev->device ==0x1306 ) || - (adev->pdev->device ==0x1307 ) || - (adev->pdev->device ==0x130B ) || - (adev->pdev->device ==0x130E ) || - (adev->pdev->device ==0x1315 ) || - (adev->pdev->device ==0x131B )) { - adev->gfx.config.max_cu_per_sh =4 ; - adev->gfx.config.max_backends_per_se =1 ; - }else { - adev->gfx.config.max_cu_per_sh =3 ; - adev->gfx.config.max_backends_per_se =1 ; - } + adev->gfx.config.max_cu_per_sh =8 ; + adev->gfx.config.max_backends_per_se =2 ; adev->gfx.config.max_sh_per_se =1 ; adev->gfx.config.max_texture_channel_caches =4 ; adev->gfx.config.max_gprs =256 ;
drivers/gpu/drm/drm_probe_helper.c +20 -0
@@ -460,6 +460,26 @@ static void output_poll_execute(struct work_struct *work)schedule_delayed_work (delayed_work,DRM_OUTPUT_POLL_PERIOD ); } +/** +* drm_kms_helper_is_poll_worker - is %current task an output poll worker? +* +* Determine if %current task is an output poll worker. This can be used +* to select distinct code paths for output polling versus other contexts. +* +* One use case is to avoid a deadlock between the output poll worker and +* the autosuspend worker wherein the latter waits for polling to finish +* upon calling drm_kms_helper_poll_disable(), while the former waits for +* runtime suspend to finish upon calling pm_runtime_get_sync() in a +* connector ->detect hook. +*/ +bool drm_kms_helper_is_poll_worker (void ) +{ +struct work_struct *work =current_work (); + +return work && work->func == output_poll_execute; +} +EXPORT_SYMBOL (drm_kms_helper_is_poll_worker); +/** * drm_kms_helper_poll_disable - disable output polling * @dev: drm_device
drivers/gpu/drm/i915/i915_drv.c +2 -0
@@ -1703,6 +1703,8 @@ static int i915_drm_resume_early(struct drm_device *dev)if (IS_BROXTON (dev_priv) || !(dev_priv->suspended_to_idle && dev_priv->csr.dmc_payload))intel_power_domains_init_hw (dev_priv, true); +else +intel_display_set_init_power (dev_priv, true);enable_rpm_wakeref_asserts (dev_priv);
drivers/gpu/drm/i915/intel_hdmi.c +11 -3
@@ -1452,12 +1452,20 @@ intel_hdmi_set_edid(struct drm_connector *connector)struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector);struct edid *edid;bool connected = false; +struct i2c_adapter *i2c;intel_display_power_get (dev_priv,POWER_DOMAIN_GMBUS ); - edid =drm_get_edid (connector, -intel_gmbus_get_adapter (dev_priv, - intel_hdmi->ddc_bus)); + i2c =intel_gmbus_get_adapter (dev_priv, intel_hdmi->ddc_bus); + + edid =drm_get_edid (connector, i2c); + +if (!edid && !intel_gmbus_is_forced_bit (i2c)) { +DRM_DEBUG_KMS ("HDMI GMBUS EDID read failed, retry using GPIO bit-banging\n" ); +intel_gmbus_force_bit (i2c, true); + edid =drm_get_edid (connector, i2c); +intel_gmbus_force_bit (i2c, false); + }intel_hdmi_dp_dual_mode_detect (connector, edid !=NULL );
drivers/gpu/drm/nouveau/nouveau_connector.c +13 -5
@@ -271,9 +271,15 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) nv_connector->edid =NULL ; } - ret =pm_runtime_get_sync (connector->dev->dev); -if (ret <0 && ret != -EACCES ) -return conn_status; +/* Outputs are only polled while runtime active, so acquiring a +* runtime PM ref here is unnecessary (and would deadlock upon +* runtime suspend because it waits for polling to finish). +*/ +if (!drm_kms_helper_is_poll_worker ()) { + ret =pm_runtime_get_sync (connector->dev->dev); +if (ret <0 && ret != -EACCES ) +return conn_status; + } nv_encoder =nouveau_connector_ddc_detect (connector);if (nv_encoder && (i2c = nv_encoder->i2c) !=NULL ) {
@@ -348,8 +354,10 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) out: -pm_runtime_mark_last_busy (connector->dev->dev); -pm_runtime_put_autosuspend (connector->dev->dev); +if (!drm_kms_helper_is_poll_worker ()) { +pm_runtime_mark_last_busy (connector->dev->dev); +pm_runtime_put_autosuspend (connector->dev->dev); + }return conn_status; }
drivers/gpu/drm/radeon/cik.c +2 -29
@@ -3244,35 +3244,8 @@ static void cik_gpu_init(struct radeon_device *rdev)case CHIP_KAVERI : rdev->config.cik.max_shader_engines =1 ; rdev->config.cik.max_tile_pipes =4 ; -if ((rdev->pdev->device ==0x1304 ) || - (rdev->pdev->device ==0x1305 ) || - (rdev->pdev->device ==0x130C ) || - (rdev->pdev->device ==0x130F ) || - (rdev->pdev->device ==0x1310 ) || - (rdev->pdev->device ==0x1311 ) || - (rdev->pdev->device ==0x131C )) { - rdev->config.cik.max_cu_per_sh =8 ; - rdev->config.cik.max_backends_per_se =2 ; - }else if ((rdev->pdev->device ==0x1309 ) || - (rdev->pdev->device ==0x130A ) || - (rdev->pdev->device ==0x130D ) || - (rdev->pdev->device ==0x1313 ) || - (rdev->pdev->device ==0x131D )) { - rdev->config.cik.max_cu_per_sh =6 ; - rdev->config.cik.max_backends_per_se =2 ; - }else if ((rdev->pdev->device ==0x1306 ) || - (rdev->pdev->device ==0x1307 ) || - (rdev->pdev->device ==0x130B ) || - (rdev->pdev->device ==0x130E ) || - (rdev->pdev->device ==0x1315 ) || - (rdev->pdev->device ==0x1318 ) || - (rdev->pdev->device ==0x131B )) { - rdev->config.cik.max_cu_per_sh =4 ; - rdev->config.cik.max_backends_per_se =1 ; - }else { - rdev->config.cik.max_cu_per_sh =3 ; - rdev->config.cik.max_backends_per_se =1 ; - } + rdev->config.cik.max_cu_per_sh =8 ; + rdev->config.cik.max_backends_per_se =2 ; rdev->config.cik.max_sh_per_se =1 ; rdev->config.cik.max_texture_channel_caches =4 ; rdev->config.cik.max_gprs =256 ;
drivers/gpu/drm/radeon/radeon_connectors.c +49 -25
134 lines not on this page · raw message
drivers/infiniband/core/ucma.c +6 -0
@@ -1139,6 +1139,9 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file,if (copy_from_user (&cmd, inbuf,sizeof (cmd)))return -EFAULT ; +if (cmd.qp_state >IB_QPS_ERR ) +return -EINVAL ; + ctx =ucma_get_ctx (file, cmd.id);if (IS_ERR (ctx))return PTR_ERR (ctx);
@@ -1275,6 +1278,9 @@ static ssize_t ucma_set_option(struct ucma_file *file, const char __user *inbuf,if (IS_ERR (ctx))return PTR_ERR (ctx); +if (unlikely (cmd.optval >KMALLOC_MAX_SIZE )) +return -EINVAL ; + optval =memdup_user ((void __user *) (unsigned long ) cmd.optval, cmd.optlen);if (IS_ERR (optval)) {
drivers/infiniband/hw/mlx5/cq.c +6 -1
@@ -1117,7 +1117,12 @@ static int resize_user(struct mlx5_ib_dev *dev, struct mlx5_ib_cq *cq,if (ucmd.reserved0 || ucmd.reserved1)return -EINVAL ; - umem =ib_umem_get (context, ucmd.buf_addr, entries * ucmd.cqe_size, +/* check multiplication overflow */ +if (ucmd.cqe_size &&SIZE_MAX / ucmd.cqe_size <= entries -1 ) +return -EINVAL ; + + umem =ib_umem_get (context, ucmd.buf_addr, + (size_t )ucmd.cqe_size * entries,IB_ACCESS_LOCAL_WRITE ,1 );if (IS_ERR (umem)) { err =PTR_ERR (umem);
drivers/infiniband/hw/mlx5/mr.c +1 -1
@@ -1821,7 +1821,6 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr, mr->ibmr.iova =sg_dma_address (sg) + sg_offset; mr->ibmr.length =0 ; - mr->ndescs = sg_nents;for_each_sg (sgl, sg, sg_nents, i) {if (unlikely (i >= mr->max_descs))
@@ -1833,6 +1832,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr, sg_offset =0 ; } + mr->ndescs = i;if (sg_offset_p) *sg_offset_p = sg_offset;
drivers/input/keyboard/matrix_keypad.c +3 -1
@@ -216,8 +216,10 @@ static void matrix_keypad_stop(struct input_dev *dev) {struct matrix_keypad *keypad =input_get_drvdata (dev); +spin_lock_irq (&keypad->lock); keypad->stopped = true; -mb (); +spin_unlock_irq (&keypad->lock); +flush_work (&keypad->work.work);/* * matrix_keypad_scan() will leave IRQs enabled;
drivers/input/keyboard/tca8418_keypad.c +0 -2
@@ -189,8 +189,6 @@ static void tca8418_read_keypad(struct tca8418_keypad *keypad_data)input_event (input,EV_MSC ,MSC_SCAN , code);input_report_key (input, keymap[code], state); -/* Read for next loop */ - error =tca8418_read_byte (keypad_data,REG_KEY_EVENT_A , ®); }while (1 );input_sync (input);
drivers/md/bcache/super.c +21 -6
@@ -937,6 +937,7 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)uint32_t rtime =cpu_to_le32 (get_seconds ());struct uuid_entry *u;char buf[BDEVNAME_SIZE ]; +struct cached_dev *exist_dc, *t;bdevname (dc->bdev, buf);
@@ -960,6 +961,16 @@ int bch_cached_dev_attach(struct cached_dev *dc, struct cache_set *c)return -EINVAL ; } +/* Check whether already attached */ +list_for_each_entry_safe (exist_dc, t, &c->cached_devs, list) { +if (!memcmp (dc->sb.uuid, exist_dc->sb.uuid,16 )) { +pr_err ("Tried to attach %s but duplicate UUID already attached" , + buf); + +return -EINVAL ; + } + } + u =uuid_find (c, dc->sb.uuid); if (u &&
@@ -1182,7 +1193,7 @@ static void register_bdev(struct cache_sb *sb, struct page *sb_page,return ; err: -pr_notice ("error opening %s: %s" ,bdevname (bdev, name), err); +pr_notice ("error %s: %s" ,bdevname (bdev, name), err);bcache_device_stop (&dc->disk); }
@@ -1853,6 +1864,8 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page,const char *err =NULL ;/* must be set for any error case */ int ret =0 ; +bdevname (bdev, name); +memcpy (&ca->sb, sb,sizeof (struct cache_sb )); ca->bdev = bdev; ca->bdev->bd_holder = ca;
@@ -1863,11 +1876,12 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page, ca->sb_bio.bi_io_vec[0 ].bv_page = sb_page;get_page (sb_page); -if (blk_queue_discard (bdev_get_queue (ca->bdev))) +if (blk_queue_discard (bdev_get_queue (bdev))) ca->discard =CACHE_DISCARD (&ca->sb); ret =cache_alloc (ca);if (ret !=0 ) { +blkdev_put (bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL );if (ret == -ENOMEM ) err ="cache_alloc(): -ENOMEM" ;else
@@ -1890,14 +1904,14 @@ static int register_cache(struct cache_sb *sb, struct page *sb_page, goto out; } -pr_info ("registered cache device %s" ,bdevname (bdev, name)); +pr_info ("registered cache device %s" , name); out:kobject_put (&ca->kobj); err:if (err) -pr_notice ("error opening %s: %s" ,bdevname (bdev, name), err); +pr_notice ("error %s: %s" , name, err);return ret; }
@@ -1986,6 +2000,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr,if (err) goto err_close; + err ="failed to register device" ;if (SB_IS_BDEV (sb)) {struct cached_dev *dc =kzalloc (sizeof (*dc),GFP_KERNEL );if (!dc)
@@ -2000,7 +2015,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, goto err_close;if (register_cache (sb, sb_page, bdev, ca) !=0 ) - goto err_close; + goto err; } out:if (sb_page)
@@ -2013,7 +2028,7 @@ static ssize_t register_bcache(struct kobject *k, struct kobj_attribute *attr, err_close:blkdev_put (bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL ); err: -pr_info ("error opening %s: %s" , path, err); +pr_info ("error %s: %s" , path, err); ret = -EINVAL ; goto out; }
drivers/media/i2c/tc358743.c +1 -1
@@ -222,7 +222,7 @@ static void i2c_wr8(struct v4l2_subdev *sd, u16 reg, u8 val)static void i2c_wr8_and_or (struct v4l2_subdev *sd,u16 reg,u8 mask,u8 val) { -i2c_wrreg (sd, reg, (i2c_rdreg (sd, reg,2 ) & mask) | val,2 ); +i2c_wrreg (sd, reg, (i2c_rdreg (sd, reg,1 ) & mask) | val,1 ); }static u16 i2c_rd16 (struct v4l2_subdev *sd,u16 reg)
drivers/mtd/ubi/vmt.c +10 -5
@@ -265,6 +265,12 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req) vol->last_eb_bytes = vol->usable_leb_size; } +/* Make volume "available" before it becomes accessible via sysfs */ +spin_lock (&ubi->volumes_lock); + ubi->volumes[vol_id] = vol; + ubi->vol_count +=1 ; +spin_unlock (&ubi->volumes_lock); +/* Register character device for the volume */ cdev_init (&vol->cdev, &ubi_vol_cdev_operations); vol->cdev.owner =THIS_MODULE ;
@@ -304,11 +310,6 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)if (err) goto out_sysfs; -spin_lock (&ubi->volumes_lock); - ubi->volumes[vol_id] = vol; - ubi->vol_count +=1 ; -spin_unlock (&ubi->volumes_lock); -ubi_volume_notify (ubi, vol,UBI_VOLUME_ADDED );self_check_volumes (ubi);return err;
@@ -328,6 +329,10 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req) out_cdev:cdev_del (&vol->cdev); out_mapping: +spin_lock (&ubi->volumes_lock); + ubi->volumes[vol_id] =NULL ; + ubi->vol_count -=1 ; +spin_unlock (&ubi->volumes_lock);if (do_free)ubi_eba_destroy_table (eba_tbl); out_acc:
drivers/pci/host/pcie-designware.c +1 -1
@@ -861,7 +861,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp)/* setup bus numbers */ val =dw_pcie_readl_rc (pp,PCI_PRIMARY_BUS ); val &=0xff000000 ; - val |=0x00010100 ; + val |=0x00ff0100 ;dw_pcie_writel_rc (pp,PCI_PRIMARY_BUS , val);/* setup command register */
drivers/scsi/qla2xxx/qla_init.c +1 -0
@@ -369,6 +369,7 @@ qla24xx_abort_sp_done(void *data, void *ptr, int res)srb_t *sp = (srb_t *)ptr;struct srb_iocb *abt = &sp->u.iocb_cmd; +del_timer (&sp->u.iocb_cmd.timer);complete (&abt->u.abt.comp); }
drivers/scsi/qla2xxx/qla_target.c +1 -1
@@ -5789,7 +5789,7 @@ static fc_port_t *qlt_get_port_database(struct scsi_qla_host *vha,fc_port_t *fcport;int rc; - fcport =kzalloc (sizeof (*fcport),GFP_KERNEL ); + fcport =qla2x00_alloc_fcport (vha,GFP_KERNEL );if (!fcport) { ql_dbg(ql_dbg_tgt_mgt, vha, 0xf06f, "qla_target(%d): Allocation of tmp FC port failed",
drivers/staging/android/ashmem.c +7 -8
@@ -343,24 +343,23 @@ static loff_t ashmem_llseek(struct file *file, loff_t offset, int origin)mutex_lock (&ashmem_mutex);if (asma->size ==0 ) { - ret = -EINVAL ; - goto out; +mutex_unlock (&ashmem_mutex); +return -EINVAL ; }if (!asma->file) { - ret = -EBADF ; - goto out; +mutex_unlock (&ashmem_mutex); +return -EBADF ; } +mutex_unlock (&ashmem_mutex); + ret =vfs_llseek (asma->file, offset, origin);if (ret <0 ) - goto out; +return ret;/** Copy f_pos from backing file, since f_ops->llseek() sets it */ file->f_pos = asma->file->f_pos; - -out: -mutex_unlock (&ashmem_mutex);return ret; }
drivers/staging/comedi/drivers.c +1 -2
@@ -484,8 +484,7 @@ unsigned int comedi_nsamples_left(struct comedi_subdevice *s,struct comedi_cmd *cmd = &async->cmd;if (cmd->stop_src ==TRIG_COUNT ) { -unsigned int nscans = nsamples / cmd->scan_end_arg; -unsigned int scans_left =__comedi_nscans_left (s, nscans); +unsigned int scans_left =__comedi_nscans_left (s, cmd->stop_arg);unsigned int scan_pos =comedi_bytes_to_samples (s, async->scan_progress);unsigned long long samples_left =0 ;
drivers/tty/serial/8250/8250_pci.c +11 -0
@@ -5099,6 +5099,17 @@ static struct pci_device_id serial_pci_tbl[] = { {PCI_VENDOR_ID_INTASHIELD ,PCI_DEVICE_ID_INTASHIELD_IS400 ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,/* 135a.0dc0 */ pbn_b2_4_115200 }, +/* +* BrainBoxes UC-260 +*/ + { PCI_VENDOR_ID_INTASHIELD, 0x0D21, +PCI_ANY_ID ,PCI_ANY_ID , +PCI_CLASS_COMMUNICATION_MULTISERIAL <<8 ,0xffff00 , + pbn_b2_4_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x0E34, +PCI_ANY_ID ,PCI_ANY_ID , +PCI_CLASS_COMMUNICATION_MULTISERIAL <<8 ,0xffff00 , + pbn_b2_4_115200 },/* * Perle PCI-RAS cards */
drivers/tty/serial/atmel_serial.c +1 -0
@@ -1780,6 +1780,7 @@ static void atmel_get_ip_name(struct uart_port *port)switch (version) {case 0x302 :case 0x10213 : +case 0x10302 :dev_dbg (port->dev,"This version is usart\n" ); atmel_port->has_frac_baudrate = true; atmel_port->has_hw_timer = true;
drivers/tty/serial/earlycon.c +2 -1
@@ -253,11 +253,12 @@ int __init of_setup_earlycon(const struct earlycon_id *match, } port->mapbase = addr; port->uartclk =BASE_BAUD *16 ; - port->membase =earlycon_map (port->mapbase,SZ_4K ); val =of_get_flat_dt_prop (node,"reg-offset" ,NULL );if (val) port->mapbase +=be32_to_cpu (*val); + port->membase =earlycon_map (port->mapbase,SZ_4K ); + val =of_get_flat_dt_prop (node,"reg-shift" ,NULL );if (val) port->regshift =be32_to_cpu (*val);
drivers/tty/serial/serial_core.c +2 -0
@@ -1135,6 +1135,8 @@ static int uart_do_autoconfig(struct tty_struct *tty,struct uart_state *state) uport->ops->config_port (uport, flags); ret =uart_startup (tty, state,1 ); +if (ret ==0 ) +tty_port_set_initialized (port, true);if (ret >0 ) ret =0 ; }
drivers/tty/serial/sh-sci.c +2 -0
@@ -935,6 +935,8 @@ static void sci_receive_chars(struct uart_port *port)/* Tell the rest of the system the news. New characters! */ tty_flip_buffer_push (tport); }else { +/* TTY buffers full; read from RX reg to prevent lockup */ +serial_port_in (port, SCxRDR);serial_port_in (port, SCxSR);/* dummy read */ sci_clear_SCxSR (port,SCxSR_RDxF_CLEAR (port)); }
drivers/usb/core/message.c +4 -0
@@ -148,6 +148,10 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, ret =usb_internal_control_msg (dev, pipe, dr, data, size, timeout); +/* Linger a bit, prior to the next control message. */ +if (dev->quirks &USB_QUIRK_DELAY_CTRL_MSG ) +msleep (200 ); +kfree (dr);return ret;
drivers/usb/core/quirks.c +2 -1
@@ -229,7 +229,8 @@ static const struct usb_device_id usb_quirk_list[] = { { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT }, /* Corsair Strafe RGB */ - { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT }, + { USB_DEVICE(0x1b1c, 0x1b20), .driver_info = USB_QUIRK_DELAY_INIT | + USB_QUIRK_DELAY_CTRL_MSG }, /* Corsair K70 LUX */ { USB_DEVICE(0x1b1c, 0x1b36), .driver_info = USB_QUIRK_DELAY_INIT },
drivers/usb/gadget/function/f_fs.c +0 -1
@@ -1522,7 +1522,6 @@ ffs_fs_kill_sb(struct super_block *sb)if (sb->s_fs_info) {ffs_release_dev (sb->s_fs_info);ffs_data_closed (sb->s_fs_info); -ffs_data_put (sb->s_fs_info); } }
drivers/usb/mon/mon_text.c +78 -48
159 lines not on this page · raw message
drivers/usb/storage/uas.c +1 -1
@@ -1076,7 +1076,7 @@ static int uas_post_reset(struct usb_interface *intf)return 0 ; err =uas_configure_endpoints (devinfo); -if (err && err !=ENODEV ) +if (err && err != -ENODEV )shost_printk (KERN_ERR , shost,"%s: alloc streams error %d after reset" , __func__, err);
drivers/usb/storage/unusual_devs.h +7 -0
@@ -2137,6 +2137,13 @@ UNUSUAL_DEV( 0x152d, 0x2566, 0x0114, 0x0114, USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_BROKEN_FUA ), +/* Reported by Teijo Kinnunen <[email protected]> */ +UNUSUAL_DEV (0x152d ,0x2567 ,0x0117 ,0x0117 , +"JMicron" , +"USB to ATA/ATAPI Bridge" , +USB_SC_DEVICE ,USB_PR_DEVICE ,NULL , +US_FL_BROKEN_FUA ), +/* Reported-by George Cherian <[email protected]> */ UNUSUAL_DEV(0x152d, 0x9561, 0x0000, 0x9999, "JMicron",
drivers/usb/usbip/vudc_sysfs.c +6 -2
@@ -117,10 +117,14 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr,if (rv !=0 )return -EINVAL ; +if (!udc) { +dev_err (dev,"no device" ); +return -ENODEV ; + }spin_lock_irqsave (&udc->lock, flags);/* Don't export what we don't have */ -if (!udc || !udc->driver || !udc->pullup) { -dev_err (dev,"no device or gadget not bound" ); +if (!udc->driver || !udc->pullup) { +dev_err (dev,"gadget not bound" ); ret = -ENODEV ; goto unlock; }
drivers/virtio/virtio_ring.c +0 -2
@@ -423,8 +423,6 @@ static inline int virtqueue_add(struct virtqueue *_vq, i = vq->vring.desc[i].next; } - vq->vq.num_free += total_sg; -if (indirect)kfree (desc);
drivers/watchdog/hpwdt.c +17 -490
588 lines not on this page · raw message
fs/ext4/xattr.c +1 -2
@@ -837,8 +837,6 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode,if (!IS_LAST_ENTRY (s->first))ext4_xattr_rehash (header (s->base), s->here); -ext4_xattr_cache_insert (ext4_mb_cache, - bs->bh); }ext4_xattr_block_csum_set (inode, bs->bh);unlock_buffer (bs->bh);
@@ -959,6 +957,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *inode, }else if (bs->bh && s->base == bs->bh->b_data) {/* We were modifying this block in-place. */ ea_bdebug (bs->bh,"keeping this block" ); +ext4_xattr_cache_insert (ext4_mb_cache, bs->bh); new_bh = bs->bh;get_bh (new_bh); }else {
fs/nfs/direct.c +1 -1
@@ -86,10 +86,10 @@ struct nfs_direct_req {struct nfs_direct_mirror mirrors[NFS_PAGEIO_DESCRIPTOR_MIRROR_MAX ];int mirror_count; +loff_t io_start;/* Start offset for I/O */ ssize_t count,/* bytes actually processed */ max_count,/* max expected count */ bytes_left,/* bytes left to be sent */ - io_start,/* start of IO */ error;/* any reported error */ struct completion completion;/* wait for i/o completion */
fs/nfs/write.c +43 -40
110 lines not on this page · raw message
include/drm/drm_crtc_helper.h +1 -0
@@ -74,5 +74,6 @@ extern void drm_kms_helper_hotplug_event(struct drm_device *dev);extern void drm_kms_helper_poll_disable (struct drm_device *dev);extern void drm_kms_helper_poll_enable (struct drm_device *dev);extern void drm_kms_helper_poll_enable_locked (struct drm_device *dev); +extern bool drm_kms_helper_is_poll_worker (void );#endif
include/linux/compiler-clang.h +5 -0
@@ -15,3 +15,8 @@* with any version that can compile the kernel */ #define __UNIQUE_ID (prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) + +/* Clang doesn't have a way to turn it off per-function, yet. */ +#ifdef __noretpoline +#undef __noretpoline +#endif
include/linux/compiler-gcc.h +4 -0
@@ -88,6 +88,10 @@#define __weak __attribute__((weak))#define __alias (symbol) __attribute__((alias(#symbol))) +#ifdef RETPOLINE +#define __noretpoline __attribute__((indirect_branch("keep"))) +#endif +/* * it doesn't make sense on ARM (currently the only user of __naked) * to trace naked functions because then mcount is called without
include/linux/init.h +4 -4
@@ -5,10 +5,10 @@#include <linux/types.h> /* Built-in __init functions needn't be compiled with retpoline */ -#if defined(RETPOLINE ) && !defined(MODULE ) -#define __noretpoline __attribute__((indirect_branch("keep"))) +#if defined(__noretpoline) && !defined(MODULE ) +#define __noinitretpoline __noretpoline#else -#define __noretpoline +#define __noinitretpoline#endif /* These macros are used to mark some functions or
@@ -46,7 +46,7 @@/* These are for everybody (although not all archs will actually discard it in modules) */ -#define __init __section(.init.text) __cold notrace __latent_entropy __noretpoline +#define __init __section(.init.text) __cold notrace __latent_entropy __noinitretpoline#define __initdata __section(.init.data)#define __initconst __section(.init.rodata)#define __exitdata __section(.exit.data)
include/linux/netfilter/x_tables.h +7 -31
@@ -375,38 +375,14 @@ static inline unsigned long ifname_compare_aligned(const char *_a,return ret; } +struct xt_percpu_counter_alloc_state { +unsigned int off; +const char __percpu *mem; +}; -/* On SMP, ip(6)t_entry->counters.pcnt holds address of the -* real (percpu) counter. On !SMP, its just the packet count, -* so nothing needs to be done there. -* -* xt_percpu_counter_alloc returns the address of the percpu -* counter, or 0 on !SMP. We force an alignment of 16 bytes -* so that bytes/packets share a common cache line. -* -* Hence caller must use IS_ERR_VALUE to check for error, this -* allows us to return 0 for single core systems without forcing -* callers to deal with SMP vs. NONSMP issues. -*/ -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 -ENOMEM ; - -return (__force unsigned long ) res; - } - -return 0 ; -} -static inline void xt_percpu_counter_free (u64 pcnt) -{ -if (nr_cpu_ids >1 ) -free_percpu ((void __percpu *) (unsigned long ) pcnt); -} +bool xt_percpu_counter_alloc (struct xt_percpu_counter_alloc_state *state, +struct xt_counters *counter); +void xt_percpu_counter_free (struct xt_counters *cnt);static inline struct xt_counters *xt_get_this_cpu_counter (struct xt_counters *cnt)
include/linux/nospec.h +2 -21
@@ -5,6 +5,7 @@#ifndef _LINUX_NOSPEC_H#define _LINUX_NOSPEC_H +#include <asm/barrier.h> /** * array_index_mask_nospec() - generate a ~0 mask when index < size, 0 otherwise
@@ -29,26 +30,6 @@ static inline unsigned long array_index_mask_nospec(unsigned long index, }#endif -/* -* Warn developers about inappropriate array_index_nospec() usage. -* -* Even if the CPU speculates past the WARN_ONCE branch, the -* sign bit of @index is taken into account when generating the -* mask. -* -* This warning is compiled out when the compiler can infer that -* @index and @size are less than LONG_MAX. -*/ -#define array_index_mask_nospec_check (index, size) \ -({ \ - if (WARN_ONCE(index > LONG_MAX || size > LONG_MAX, \ - "array_index_nospec() limited to range of [0, LONG_MAX]\n")) \ - _mask = 0; \ - else \ - _mask = array_index_mask_nospec(index, size); \ - _mask; \ -}) -/* * array_index_nospec - sanitize an array index after a bounds check *
@@ -67,7 +48,7 @@ static inline unsigned long array_index_mask_nospec(unsigned long index, ({ \ typeof(index) _i = (index); \ typeof(size) _s = (size); \ - unsigned long _mask = array_index_mask_nospec_check(_i, _s); \ + unsigned long _mask = array_index_mask_nospec(_i, _s); \ \ BUILD_BUG_ON(sizeof(_i) > sizeof(long)); \ BUILD_BUG_ON(sizeof(_s) > sizeof(long)); \
include/linux/usb/quirks.h +3 -0
@@ -56,4 +56,7 @@*/ #define USB_QUIRK_LINEAR_FRAME_INTR_BINTERVAL BIT(11) +/* Device needs a pause after every control message. */ +#define USB_QUIRK_DELAY_CTRL_MSG BIT(13) +#endif /* __LINUX_USB_QUIRKS_H */
include/linux/workqueue.h +1 -0
@@ -453,6 +453,7 @@ extern bool cancel_delayed_work_sync(struct delayed_work *dwork);extern void workqueue_set_max_active (struct workqueue_struct *wq,int max_active); +extern struct work_struct *current_work (void );extern bool current_is_workqueue_rescuer (void );extern bool workqueue_congested (int cpu,struct workqueue_struct *wq);extern unsigned int work_busy (struct work_struct *work);
kernel/workqueue.c +16 -0
@@ -4129,6 +4129,22 @@ void workqueue_set_max_active(struct workqueue_struct *wq, int max_active) }EXPORT_SYMBOL_GPL (workqueue_set_max_active); +/** +* current_work - retrieve %current task's work struct +* +* Determine if %current task is a workqueue worker and what it's working on. +* Useful to find out the context that the %current task is running in. +* +* Return: work struct if %current task is a workqueue worker, %NULL otherwise. +*/ +struct work_struct *current_work (void ) +{ +struct worker *worker =current_wq_worker (); + +return worker ? worker->current_work :NULL ; +} +EXPORT_SYMBOL (current_work); +/** * current_is_workqueue_rescuer - is %current workqueue rescuer? *
net/bridge/netfilter/ebt_among.c +19 -2
@@ -172,18 +172,35 @@ ebt_among_mt(const struct sk_buff *skb, struct xt_action_param *par)return true; } +static bool poolsize_invalid (const struct ebt_mac_wormhash *w) +{ +return w && w->poolsize >= (INT_MAX /sizeof (struct ebt_mac_wormhash_tuple )); +} +static int ebt_among_mt_check (const struct xt_mtchk_param *par) {const struct ebt_among_info *info = par->matchinfo;const struct ebt_entry_match *em = container_of(par->matchinfo, const struct ebt_entry_match, data); -int expected_length =sizeof (struct ebt_among_info ); +unsigned int expected_length =sizeof (struct ebt_among_info );const struct ebt_mac_wormhash *wh_dst, *wh_src;int err; +if (expected_length > em->match_size) +return -EINVAL ; + wh_dst =ebt_among_wh_dst (info); - wh_src =ebt_among_wh_src (info); +if (poolsize_invalid (wh_dst)) +return -EINVAL ; + expected_length +=ebt_mac_wormhash_size (wh_dst); +if (expected_length > em->match_size) +return -EINVAL ; + + wh_src =ebt_among_wh_src (info); +if (poolsize_invalid (wh_src)) +return -EINVAL ; + expected_length +=ebt_mac_wormhash_size (wh_src);if (em->match_size !=EBT_ALIGN (expected_length)) {
net/bridge/netfilter/ebtables.c +12 -1
@@ -2031,7 +2031,9 @@ static int ebt_size_mwt(struct compat_ebt_entry_mwt *match32,if (match_kern) match_kern->match_size = ret; -WARN_ON (type ==EBT_COMPAT_TARGET && size_left); +if (WARN_ON (type ==EBT_COMPAT_TARGET && size_left)) +return -EINVAL ; + match32 = (struct compat_ebt_entry_mwt *) buf; }
@@ -2087,6 +2089,15 @@ static int size_entry_mwt(struct ebt_entry *entry, const unsigned char *base,* * offsets are relative to beginning of struct ebt_entry (i.e., 0). */ +for (i =0 ; i <4 ; ++i) { +if (offsets[i] >= *total) +return -EINVAL ; +if (i ==0 ) +continue ; +if (offsets[i-1 ] > offsets[i]) +return -EINVAL ; + } +for (i =0 , j =1 ; j <4 ; j++, i++) {struct compat_ebt_entry_mwt *match32;unsigned int size;
net/ipv4/netfilter/arp_tables.c +12 -8
@@ -261,6 +261,10 @@ unsigned int arpt_do_table(struct sk_buff *skb, }if (table_base + v !=arpt_next_entry (e)) { +if (unlikely (stackidx >= private->stacksize)) { + verdict =NF_DROP ; +break ; + } jumpstack[stackidx++] = e; }
@@ -415,17 +419,15 @@ static inline int check_target(struct arpt_entry *e, const char *name) }static inline int -find_check_entry (struct arpt_entry *e,const char *name,unsigned int size) +find_check_entry (struct arpt_entry *e,const char *name,unsigned int size, +struct xt_percpu_counter_alloc_state *alloc_state) {struct xt_entry_target *t;struct xt_target *target; -unsigned long pcnt;int ret; - pcnt =xt_percpu_counter_alloc (); -if (IS_ERR_VALUE (pcnt)) +if (!xt_percpu_counter_alloc (alloc_state, &e->counters))return -ENOMEM ; - e->counters.pcnt = pcnt; t =arpt_get_target (e); target = xt_request_find_target(NFPROTO_ARP, t->u.user.name,
@@ -443,7 +445,7 @@ find_check_entry(struct arpt_entry *e, const char *name, unsigned int size) err:module_put (t->u.kernel.target->me); out: -xt_percpu_counter_free (e->counters.pcnt); +xt_percpu_counter_free (&e->counters);return ret; }
@@ -523,7 +525,7 @@ static inline void cleanup_entry(struct arpt_entry *e)if (par.target->destroy !=NULL ) par.target->destroy (&par);module_put (par.target->me); -xt_percpu_counter_free (e->counters.pcnt); +xt_percpu_counter_free (&e->counters); }/* Checks and translates the user-supplied table segment (held in
@@ -532,6 +534,7 @@ static inline void cleanup_entry(struct arpt_entry *e)static int translate_table (struct xt_table_info *newinfo,void *entry0,const struct arpt_replace *repl) { +struct xt_percpu_counter_alloc_state alloc_state = {0 };struct arpt_entry *iter;unsigned int *offsets;unsigned int i;
@@ -594,7 +597,8 @@ static int translate_table(struct xt_table_info *newinfo, void *entry0,/* Finally, each sanity check must pass */ i =0 ; xt_entry_foreach(iter, entry0, newinfo->size) { - ret =find_check_entry (iter, repl->name, repl->size); + ret =find_check_entry (iter, repl->name, repl->size, + &alloc_state);if (ret !=0 )break ; ++i;
net/ipv4/netfilter/ip_tables.c +14 -9
@@ -345,8 +345,13 @@ ipt_do_table(struct sk_buff *skb,continue ; }if (table_base + v !=ipt_next_entry (e) && - !(e->ip.flags &IPT_F_GOTO )) + !(e->ip.flags &IPT_F_GOTO )) { +if (unlikely (stackidx >= private->stacksize)) { + verdict =NF_DROP ; +break ; + } jumpstack[stackidx++] = e; + } e =get_entry (table_base, v);continue ;
@@ -535,7 +540,8 @@ static int check_target(struct ipt_entry *e, struct net *net, const char *name)static int find_check_entry (struct ipt_entry *e,struct net *net,const char *name, -unsigned int size) +unsigned int size, +struct xt_percpu_counter_alloc_state *alloc_state) {struct xt_entry_target *t;struct xt_target *target;
@@ -543,12 +549,9 @@ find_check_entry(struct ipt_entry *e, struct net *net, const char *name,unsigned int j;struct xt_mtchk_param mtpar;struct xt_entry_match *ematch; -unsigned long pcnt; - pcnt =xt_percpu_counter_alloc (); -if (IS_ERR_VALUE (pcnt)) +if (!xt_percpu_counter_alloc (alloc_state, &e->counters))return -ENOMEM ; - e->counters.pcnt = pcnt; j =0 ; mtpar.net = net;
@@ -586,7 +589,7 @@ find_check_entry(struct ipt_entry *e, struct net *net, const char *name,cleanup_match (ematch, net); } -xt_percpu_counter_free (e->counters.pcnt); +xt_percpu_counter_free (&e->counters);return ret; }
@@ -674,7 +677,7 @@ cleanup_entry(struct ipt_entry *e, struct net *net)if (par.target->destroy !=NULL ) par.target->destroy (&par);module_put (par.target->me); -xt_percpu_counter_free (e->counters.pcnt); +xt_percpu_counter_free (&e->counters); }/* Checks and translates the user-supplied table segment (held in
@@ -683,6 +686,7 @@ static int translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0, const struct ipt_replace *repl) { + struct xt_percpu_counter_alloc_state alloc_state = { 0 };struct ipt_entry *iter;unsigned int *offsets;unsigned int i;
@@ -742,7 +746,8 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,/* Finally, each sanity check must pass */ i =0 ; xt_entry_foreach(iter, entry0, newinfo->size) { - ret =find_check_entry (iter, net, repl->name, repl->size); + ret =find_check_entry (iter, net, repl->name, repl->size, + &alloc_state);if (ret !=0 )break ; ++i;
net/ipv6/netfilter/ip6_tables.c +12 -9
@@ -376,6 +376,10 @@ ip6t_do_table(struct sk_buff *skb, }if (table_base + v !=ip6t_next_entry (e) && !(e->ipv6.flags &IP6T_F_GOTO )) { +if (unlikely (stackidx >= private->stacksize)) { + verdict =NF_DROP ; +break ; + } jumpstack[stackidx++] = e; }
@@ -566,7 +570,8 @@ static int check_target(struct ip6t_entry *e, struct net *net, const char *name)static int find_check_entry (struct ip6t_entry *e,struct net *net,const char *name, -unsigned int size) +unsigned int size, +struct xt_percpu_counter_alloc_state *alloc_state) {struct xt_entry_target *t;struct xt_target *target;
@@ -574,12 +579,9 @@ find_check_entry(struct ip6t_entry *e, struct net *net, const char *name,unsigned int j;struct xt_mtchk_param mtpar;struct xt_entry_match *ematch; -unsigned long pcnt; - pcnt =xt_percpu_counter_alloc (); -if (IS_ERR_VALUE (pcnt)) +if (!xt_percpu_counter_alloc (alloc_state, &e->counters))return -ENOMEM ; - e->counters.pcnt = pcnt; j =0 ; mtpar.net = net;
@@ -616,7 +618,7 @@ find_check_entry(struct ip6t_entry *e, struct net *net, const char *name,cleanup_match (ematch, net); } -xt_percpu_counter_free (e->counters.pcnt); +xt_percpu_counter_free (&e->counters);return ret; }
@@ -703,8 +705,7 @@ static void cleanup_entry(struct ip6t_entry *e, struct net *net)if (par.target->destroy !=NULL ) par.target->destroy (&par);module_put (par.target->me); - -xt_percpu_counter_free (e->counters.pcnt); +xt_percpu_counter_free (&e->counters); }/* Checks and translates the user-supplied table segment (held in
@@ -713,6 +714,7 @@ static int translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0, const struct ip6t_replace *repl) { + struct xt_percpu_counter_alloc_state alloc_state = { 0 };struct ip6t_entry *iter;unsigned int *offsets;unsigned int i;
@@ -772,7 +774,8 @@ translate_table(struct net *net, struct xt_table_info *newinfo, void *entry0,/* Finally, each sanity check must pass */ i =0 ; xt_entry_foreach(iter, entry0, newinfo->size) { - ret =find_check_entry (iter, net, repl->name, repl->size); + ret =find_check_entry (iter, net, repl->name, repl->size, + &alloc_state);if (ret !=0 )break ; ++i;
net/ipv6/netfilter/nf_nat_l3proto_ipv6.c +4 -0
@@ -99,6 +99,10 @@ static bool nf_nat_ipv6_manip_pkt(struct sk_buff *skb, !l4proto->manip_pkt(skb, &nf_nat_l3proto_ipv6, iphdroff, hdroff, target, maniptype))return false; + +/* must reload, offset might have changed */ + ipv6h = (void *)skb->data + iphdroff; + manip_addr:if (maniptype ==NF_NAT_MANIP_SRC ) ipv6h->saddr = target->src.u3.in6;
net/netfilter/nf_nat_proto_common.c +5 -2
@@ -41,7 +41,7 @@ void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,const struct nf_conn *ct, u16 *rover) { - unsigned int range_size, min, i; + unsigned int range_size, min, max, i;__be16 *portptr;u_int16_t off;
@@ -71,7 +71,10 @@ void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto, } }else { min =ntohs (range->min_proto.all); - range_size =ntohs (range->max_proto.all) - min +1 ; + max =ntohs (range->max_proto.all); +if (unlikely (max < min)) +swap (max, min); + range_size = max - min +1 ; }if (range->flags &NF_NAT_RANGE_PROTO_RANDOM ) {
net/netfilter/x_tables.c +55 -0
67 lines not on this page · raw message
net/netfilter/xt_IDLETIMER.c +6 -3
@@ -147,11 +147,11 @@ static int idletimer_tg_create(struct idletimer_tg_info *info) (unsigned long) info->timer); info->timer->refcnt =1 ; +INIT_WORK (&info->timer->work, idletimer_tg_work); +mod_timer (&info->timer->timer,msecs_to_jiffies (info->timeout *1000 ) + jiffies); -INIT_WORK (&info->timer->work, idletimer_tg_work); -return 0 ; out_free_attr:
@@ -192,7 +192,10 @@ static int idletimer_tg_checkentry(const struct xt_tgchk_param *par)pr_debug ("timeout value is zero\n" );return -EINVAL ; } - +if (info->timeout >=INT_MAX /1000 ) { +pr_debug ("timeout value is too big\n" ); +return -EINVAL ; + }if (info->label[0 ] =='\0' ||strnlen (info->label,MAX_IDLETIMER_LABEL_SIZE ) ==MAX_IDLETIMER_LABEL_SIZE ) {
net/netfilter/xt_LED.c +6 -6
@@ -141,10 +141,11 @@ static int led_tg_check(const struct xt_tgchk_param *par) goto exit_alloc; } -/* See if we need to set up a timer */ -if (ledinfo->delay >0 ) -setup_timer (&ledinternal->timer, led_timeout_callback, - (unsigned long )ledinternal); +/* Since the letinternal timer can be shared between multiple targets, +* always set it up, even if the current target does not need it +*/ +setup_timer (&ledinternal->timer, led_timeout_callback, + (unsigned long )ledinternal);list_add_tail (&ledinternal->list, &xt_led_triggers);
@@ -181,8 +182,7 @@ static void led_tg_destroy(const struct xt_tgdtor_param *par)list_del (&ledinternal->list); -if (ledinfo->delay >0 ) -del_timer_sync (&ledinternal->timer); +del_timer_sync (&ledinternal->timer);led_trigger_unregister (&ledinternal->netfilter_led_trigger);
scripts/Makefile.lib +4 -4
@@ -290,11 +290,11 @@ cmd_dt_S_dtb= \ echo '\#include <asm-generic/vmlinux.lds.h>'; \ echo '.section .dtb.init.rodata,"a"'; \ echo '.balign STRUCT_ALIGNMENT'; \ - echo '.global __dtb_$(*F)_begin'; \ - echo '__dtb_$(*F)_begin:'; \ + echo '.global __dtb_$(subst -,_,$(*F))_begin'; \ + echo '__dtb_$(subst -,_,$(*F))_begin:'; \ echo '.incbin "$<" '; \ - echo '__dtb_$(*F)_end:'; \ - echo '.global __dtb_$(*F)_end'; \ + echo '__dtb_$(subst -,_,$(*F))_end:'; \ + echo '.global __dtb_$(subst -,_,$(*F))_end'; \ echo '.balign STRUCT_ALIGNMENT'; \ ) > $@
sound/core/seq/seq_clientmgr.c +14 -7
@@ -906,7 +906,8 @@ int snd_seq_dispatch_event(struct snd_seq_event_cell *cell, int atomic, int hop)static int snd_seq_client_enqueue_event (struct snd_seq_client *client,struct snd_seq_event *event,struct file *file,int blocking, -int atomic,int hop) +int atomic,int hop, +struct mutex *mutexp) {struct snd_seq_event_cell *cell;int err;
@@ -944,7 +945,8 @@ static int snd_seq_client_enqueue_event(struct snd_seq_client *client,return -ENXIO ;/* queue is not allocated */ /* allocate an event cell */ - err =snd_seq_event_dup (client->pool, event, &cell, !blocking || atomic, file); + err =snd_seq_event_dup (client->pool, event, &cell, !blocking || atomic, + file, mutexp);if (err <0 )return err;
@@ -1013,12 +1015,11 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf,return -ENXIO ;/* allocate the pool now if the pool is not allocated yet */ +mutex_lock (&client->ioctl_mutex);if (client->pool->size >0 && !snd_seq_write_pool_allocated (client)) {
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.