Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge 4.19-rc7 into char-misc-next

We want the fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+2768 -1798
+5
Documentation/driver-api/fpga/fpga-mgr.rst
··· 184 184 API for programming an FPGA 185 185 --------------------------- 186 186 187 + FPGA Manager flags 188 + 189 + .. kernel-doc:: include/linux/fpga/fpga-mgr.h 190 + :doc: FPGA Manager flags 191 + 187 192 .. kernel-doc:: include/linux/fpga/fpga-mgr.h 188 193 :functions: fpga_image_info 189 194
+3 -2
Documentation/fb/uvesafb.txt
··· 15 15 arches. 16 16 17 17 v86d source code can be downloaded from the following website: 18 - http://dev.gentoo.org/~spock/projects/uvesafb 18 + 19 + https://github.com/mjanusz/v86d 19 20 20 21 Please refer to the v86d documentation for detailed configuration and 21 22 installation instructions. ··· 178 177 179 178 -- 180 179 Michal Januszewski <spock@gentoo.org> 181 - Last updated: 2009-03-30 180 + Last updated: 2017-10-10 182 181 183 182 Documentation of the uvesafb options is loosely based on vesafb.txt. 184 183
+1 -1
Documentation/networking/ip-sysctl.txt
··· 425 425 1 - Disabled by default, enabled when an ICMP black hole detected 426 426 2 - Always enabled, use initial MSS of tcp_base_mss. 427 427 428 - tcp_probe_interval - INTEGER 428 + tcp_probe_interval - UNSIGNED INTEGER 429 429 Controls how often to start TCP Packetization-Layer Path MTU 430 430 Discovery reprobe. The default is reprobing every 10 minutes as 431 431 per RFC4821.
+6 -8
MAINTAINERS
··· 324 324 F: Documentation/ABI/testing/configfs-acpi 325 325 F: drivers/pci/*acpi* 326 326 F: drivers/pci/*/*acpi* 327 - F: drivers/pci/*/*/*acpi* 328 327 F: tools/power/acpi/ 329 328 330 329 ACPI APEI ··· 1250 1251 1251 1252 ARM/Annapurna Labs ALPINE ARCHITECTURE 1252 1253 M: Tsahee Zidenberg <tsahee@annapurnalabs.com> 1253 - M: Antoine Tenart <antoine.tenart@free-electrons.com> 1254 + M: Antoine Tenart <antoine.tenart@bootlin.com> 1254 1255 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1255 1256 S: Maintained 1256 1257 F: arch/arm/mach-alpine/ ··· 2955 2956 2956 2957 BROADCOM BNX2 GIGABIT ETHERNET DRIVER 2957 2958 M: Rasesh Mody <rasesh.mody@cavium.com> 2958 - M: Harish Patil <harish.patil@cavium.com> 2959 2959 M: Dept-GELinuxNICDev@cavium.com 2960 2960 L: netdev@vger.kernel.org 2961 2961 S: Supported ··· 2975 2977 2976 2978 BROADCOM BNX2X 10 GIGABIT ETHERNET DRIVER 2977 2979 M: Ariel Elior <ariel.elior@cavium.com> 2980 + M: Sudarsana Kalluru <sudarsana.kalluru@cavium.com> 2978 2981 M: everest-linux-l2@cavium.com 2979 2982 L: netdev@vger.kernel.org 2980 2983 S: Supported ··· 5469 5470 F: drivers/net/ethernet/agere/ 5470 5471 5471 5472 ETHERNET BRIDGE 5472 - M: Stephen Hemminger <stephen@networkplumber.org> 5473 + M: Roopa Prabhu <roopa@cumulusnetworks.com> 5474 + M: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> 5473 5475 L: bridge@lists.linux-foundation.org (moderated for non-subscribers) 5474 5476 L: netdev@vger.kernel.org 5475 5477 W: http://www.linuxfoundation.org/en/Net:Bridge ··· 8598 8598 F: arch/*/include/asm/spinlock*.h 8599 8599 F: include/linux/rwlock*.h 8600 8600 F: include/linux/mutex*.h 8601 - F: arch/*/include/asm/mutex*.h 8602 8601 F: include/linux/rwsem*.h 8603 8602 F: arch/*/include/asm/rwsem.h 8604 8603 F: include/linux/seqlock.h ··· 11978 11979 F: drivers/scsi/qla4xxx/ 11979 11980 11980 11981 QLOGIC QLCNIC (1/10)Gb ETHERNET DRIVER 11981 - M: Harish Patil <harish.patil@cavium.com> 11982 + M: Shahed Shaikh <Shahed.Shaikh@cavium.com> 11982 11983 M: Manish Chopra <manish.chopra@cavium.com> 11983 11984 M: Dept-GELinuxNICDev@cavium.com 11984 11985 L: netdev@vger.kernel.org ··· 11986 11987 F: drivers/net/ethernet/qlogic/qlcnic/ 11987 11988 11988 11989 QLOGIC QLGE 10Gb ETHERNET DRIVER 11989 - M: Harish Patil <harish.patil@cavium.com> 11990 11990 M: Manish Chopra <manish.chopra@cavium.com> 11991 11991 M: Dept-GELinuxNICDev@cavium.com 11992 11992 L: netdev@vger.kernel.org ··· 15393 15395 UVESAFB DRIVER 15394 15396 M: Michal Januszewski <spock@gentoo.org> 15395 15397 L: linux-fbdev@vger.kernel.org 15396 - W: http://dev.gentoo.org/~spock/projects/uvesafb/ 15398 + W: https://github.com/mjanusz/v86d 15397 15399 S: Maintained 15398 15400 F: Documentation/fb/uvesafb.txt 15399 15401 F: drivers/video/fbdev/uvesafb.*
+1 -1
Makefile
··· 2 2 VERSION = 4 3 3 PATCHLEVEL = 19 4 4 SUBLEVEL = 0 5 - EXTRAVERSION = -rc6 5 + EXTRAVERSION = -rc7 6 6 NAME = Merciless Moray 7 7 8 8 # *DOCUMENTATION*
+2
arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
··· 11 11 #include "sama5d2-pinfunc.h" 12 12 #include <dt-bindings/mfd/atmel-flexcom.h> 13 13 #include <dt-bindings/gpio/gpio.h> 14 + #include <dt-bindings/pinctrl/at91.h> 14 15 15 16 / { 16 17 model = "Atmel SAMA5D2 PTC EK"; ··· 300 299 <PIN_PA30__NWE_NANDWE>, 301 300 <PIN_PB2__NRD_NANDOE>; 302 301 bias-pull-up; 302 + atmel,drive-strength = <ATMEL_PIO_DRVSTR_ME>; 303 303 }; 304 304 305 305 ale_cle_rdy_cs {
+8 -6
arch/arm/boot/dts/bcm63138.dtsi
··· 106 106 global_timer: timer@1e200 { 107 107 compatible = "arm,cortex-a9-global-timer"; 108 108 reg = <0x1e200 0x20>; 109 - interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>; 109 + interrupts = <GIC_PPI 11 IRQ_TYPE_EDGE_RISING>; 110 110 clocks = <&axi_clk>; 111 111 }; 112 112 113 113 local_timer: local-timer@1e600 { 114 114 compatible = "arm,cortex-a9-twd-timer"; 115 115 reg = <0x1e600 0x20>; 116 - interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>; 116 + interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | 117 + IRQ_TYPE_EDGE_RISING)>; 117 118 clocks = <&axi_clk>; 118 119 }; 119 120 120 121 twd_watchdog: watchdog@1e620 { 121 122 compatible = "arm,cortex-a9-twd-wdt"; 122 123 reg = <0x1e620 0x20>; 123 - interrupts = <GIC_PPI 14 IRQ_TYPE_LEVEL_HIGH>; 124 + interrupts = <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | 125 + IRQ_TYPE_LEVEL_HIGH)>; 124 126 }; 125 127 126 128 armpll: armpll { ··· 160 158 serial0: serial@600 { 161 159 compatible = "brcm,bcm6345-uart"; 162 160 reg = <0x600 0x1b>; 163 - interrupts = <GIC_SPI 32 0>; 161 + interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>; 164 162 clocks = <&periph_clk>; 165 163 clock-names = "periph"; 166 164 status = "disabled"; ··· 169 167 serial1: serial@620 { 170 168 compatible = "brcm,bcm6345-uart"; 171 169 reg = <0x620 0x1b>; 172 - interrupts = <GIC_SPI 33 0>; 170 + interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; 173 171 clocks = <&periph_clk>; 174 172 clock-names = "periph"; 175 173 status = "disabled"; ··· 182 180 reg = <0x2000 0x600>, <0xf0 0x10>; 183 181 reg-names = "nand", "nand-int-base"; 184 182 status = "disabled"; 185 - interrupts = <GIC_SPI 38 0>; 183 + interrupts = <GIC_SPI 38 IRQ_TYPE_LEVEL_HIGH>; 186 184 interrupt-names = "nand"; 187 185 }; 188 186
+2 -2
arch/arm/boot/dts/stm32mp157c.dtsi
··· 1078 1078 interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; 1079 1079 clocks = <&rcc SPI6_K>; 1080 1080 resets = <&rcc SPI6_R>; 1081 - dmas = <&mdma1 34 0x0 0x40008 0x0 0x0 0>, 1082 - <&mdma1 35 0x0 0x40002 0x0 0x0 0>; 1081 + dmas = <&mdma1 34 0x0 0x40008 0x0 0x0>, 1082 + <&mdma1 35 0x0 0x40002 0x0 0x0>; 1083 1083 dma-names = "rx", "tx"; 1084 1084 status = "disabled"; 1085 1085 };
+1 -2
arch/arm/boot/dts/sun8i-r40.dtsi
··· 800 800 }; 801 801 802 802 hdmi_phy: hdmi-phy@1ef0000 { 803 - compatible = "allwinner,sun8i-r40-hdmi-phy", 804 - "allwinner,sun50i-a64-hdmi-phy"; 803 + compatible = "allwinner,sun8i-r40-hdmi-phy"; 805 804 reg = <0x01ef0000 0x10000>; 806 805 clocks = <&ccu CLK_BUS_HDMI1>, <&ccu CLK_HDMI_SLOW>, 807 806 <&ccu 7>, <&ccu 16>;
+1 -1
arch/arm/mm/ioremap.c
··· 473 473 474 474 int pci_ioremap_io(unsigned int offset, phys_addr_t phys_addr) 475 475 { 476 - BUG_ON(offset + SZ_64K > IO_SPACE_LIMIT); 476 + BUG_ON(offset + SZ_64K - 1 > IO_SPACE_LIMIT); 477 477 478 478 return ioremap_page_range(PCI_IO_VIRT_BASE + offset, 479 479 PCI_IO_VIRT_BASE + offset + SZ_64K,
+1
arch/arm/tools/syscall.tbl
··· 413 413 396 common pkey_free sys_pkey_free 414 414 397 common statx sys_statx 415 415 398 common rseq sys_rseq 416 + 399 common io_pgetevents sys_io_pgetevents
+54 -1
arch/arm64/kvm/guest.c
··· 57 57 return id & ~(KVM_REG_ARCH_MASK | KVM_REG_SIZE_MASK | KVM_REG_ARM_CORE); 58 58 } 59 59 60 + static int validate_core_offset(const struct kvm_one_reg *reg) 61 + { 62 + u64 off = core_reg_offset_from_id(reg->id); 63 + int size; 64 + 65 + switch (off) { 66 + case KVM_REG_ARM_CORE_REG(regs.regs[0]) ... 67 + KVM_REG_ARM_CORE_REG(regs.regs[30]): 68 + case KVM_REG_ARM_CORE_REG(regs.sp): 69 + case KVM_REG_ARM_CORE_REG(regs.pc): 70 + case KVM_REG_ARM_CORE_REG(regs.pstate): 71 + case KVM_REG_ARM_CORE_REG(sp_el1): 72 + case KVM_REG_ARM_CORE_REG(elr_el1): 73 + case KVM_REG_ARM_CORE_REG(spsr[0]) ... 74 + KVM_REG_ARM_CORE_REG(spsr[KVM_NR_SPSR - 1]): 75 + size = sizeof(__u64); 76 + break; 77 + 78 + case KVM_REG_ARM_CORE_REG(fp_regs.vregs[0]) ... 79 + KVM_REG_ARM_CORE_REG(fp_regs.vregs[31]): 80 + size = sizeof(__uint128_t); 81 + break; 82 + 83 + case KVM_REG_ARM_CORE_REG(fp_regs.fpsr): 84 + case KVM_REG_ARM_CORE_REG(fp_regs.fpcr): 85 + size = sizeof(__u32); 86 + break; 87 + 88 + default: 89 + return -EINVAL; 90 + } 91 + 92 + if (KVM_REG_SIZE(reg->id) == size && 93 + IS_ALIGNED(off, size / sizeof(__u32))) 94 + return 0; 95 + 96 + return -EINVAL; 97 + } 98 + 60 99 static int get_core_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) 61 100 { 62 101 /* ··· 114 75 if (off >= nr_regs || 115 76 (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs) 116 77 return -ENOENT; 78 + 79 + if (validate_core_offset(reg)) 80 + return -EINVAL; 117 81 118 82 if (copy_to_user(uaddr, ((u32 *)regs) + off, KVM_REG_SIZE(reg->id))) 119 83 return -EFAULT; ··· 140 98 (off + (KVM_REG_SIZE(reg->id) / sizeof(__u32))) >= nr_regs) 141 99 return -ENOENT; 142 100 101 + if (validate_core_offset(reg)) 102 + return -EINVAL; 103 + 143 104 if (KVM_REG_SIZE(reg->id) > sizeof(tmp)) 144 105 return -EINVAL; 145 106 ··· 152 107 } 153 108 154 109 if (off == KVM_REG_ARM_CORE_REG(regs.pstate)) { 155 - u32 mode = (*(u32 *)valp) & PSR_AA32_MODE_MASK; 110 + u64 mode = (*(u64 *)valp) & PSR_AA32_MODE_MASK; 156 111 switch (mode) { 157 112 case PSR_AA32_MODE_USR: 113 + if (!system_supports_32bit_el0()) 114 + return -EINVAL; 115 + break; 158 116 case PSR_AA32_MODE_FIQ: 159 117 case PSR_AA32_MODE_IRQ: 160 118 case PSR_AA32_MODE_SVC: 161 119 case PSR_AA32_MODE_ABT: 162 120 case PSR_AA32_MODE_UND: 121 + if (!vcpu_el1_is_32bit(vcpu)) 122 + return -EINVAL; 123 + break; 163 124 case PSR_MODE_EL0t: 164 125 case PSR_MODE_EL1t: 165 126 case PSR_MODE_EL1h: 127 + if (vcpu_el1_is_32bit(vcpu)) 128 + return -EINVAL; 166 129 break; 167 130 default: 168 131 err = -EINVAL;
+44 -8
arch/arm64/mm/hugetlbpage.c
··· 117 117 118 118 /* 119 119 * If HW_AFDBM is enabled, then the HW could turn on 120 - * the dirty bit for any page in the set, so check 121 - * them all. All hugetlb entries are already young. 120 + * the dirty or accessed bit for any page in the set, 121 + * so check them all. 122 122 */ 123 123 if (pte_dirty(pte)) 124 124 orig_pte = pte_mkdirty(orig_pte); 125 + 126 + if (pte_young(pte)) 127 + orig_pte = pte_mkyoung(orig_pte); 125 128 } 126 129 127 130 if (valid) { ··· 323 320 return get_clear_flush(mm, addr, ptep, pgsize, ncontig); 324 321 } 325 322 323 + /* 324 + * huge_ptep_set_access_flags will update access flags (dirty, accesssed) 325 + * and write permission. 326 + * 327 + * For a contiguous huge pte range we need to check whether or not write 328 + * permission has to change only on the first pte in the set. Then for 329 + * all the contiguous ptes we need to check whether or not there is a 330 + * discrepancy between dirty or young. 331 + */ 332 + static int __cont_access_flags_changed(pte_t *ptep, pte_t pte, int ncontig) 333 + { 334 + int i; 335 + 336 + if (pte_write(pte) != pte_write(huge_ptep_get(ptep))) 337 + return 1; 338 + 339 + for (i = 0; i < ncontig; i++) { 340 + pte_t orig_pte = huge_ptep_get(ptep + i); 341 + 342 + if (pte_dirty(pte) != pte_dirty(orig_pte)) 343 + return 1; 344 + 345 + if (pte_young(pte) != pte_young(orig_pte)) 346 + return 1; 347 + } 348 + 349 + return 0; 350 + } 351 + 326 352 int huge_ptep_set_access_flags(struct vm_area_struct *vma, 327 353 unsigned long addr, pte_t *ptep, 328 354 pte_t pte, int dirty) 329 355 { 330 - int ncontig, i, changed = 0; 356 + int ncontig, i; 331 357 size_t pgsize = 0; 332 358 unsigned long pfn = pte_pfn(pte), dpfn; 333 359 pgprot_t hugeprot; ··· 368 336 ncontig = find_num_contig(vma->vm_mm, addr, ptep, &pgsize); 369 337 dpfn = pgsize >> PAGE_SHIFT; 370 338 371 - orig_pte = get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig); 372 - if (!pte_same(orig_pte, pte)) 373 - changed = 1; 339 + if (!__cont_access_flags_changed(ptep, pte, ncontig)) 340 + return 0; 374 341 375 - /* Make sure we don't lose the dirty state */ 342 + orig_pte = get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig); 343 + 344 + /* Make sure we don't lose the dirty or young state */ 376 345 if (pte_dirty(orig_pte)) 377 346 pte = pte_mkdirty(pte); 347 + 348 + if (pte_young(orig_pte)) 349 + pte = pte_mkyoung(pte); 378 350 379 351 hugeprot = pte_pgprot(pte); 380 352 for (i = 0; i < ncontig; i++, ptep++, addr += pgsize, pfn += dpfn) 381 353 set_pte_at(vma->vm_mm, addr, ptep, pfn_pte(pfn, hugeprot)); 382 354 383 - return changed; 355 + return 1; 384 356 } 385 357 386 358 void huge_ptep_set_wrprotect(struct mm_struct *mm,
+10
arch/powerpc/kernel/process.c
··· 1306 1306 1307 1307 pc = regs->nip - (instructions_to_print * 3 / 4 * sizeof(int)); 1308 1308 1309 + /* 1310 + * Make sure the NIP points at userspace, not kernel text/data or 1311 + * elsewhere. 1312 + */ 1313 + if (!__access_ok(pc, instructions_to_print * sizeof(int), USER_DS)) { 1314 + pr_info("%s[%d]: Bad NIP, not dumping instructions.\n", 1315 + current->comm, current->pid); 1316 + return; 1317 + } 1318 + 1309 1319 pr_info("%s[%d]: code: ", current->comm, current->pid); 1310 1320 1311 1321 for (i = 0; i < instructions_to_print; i++) {
+10
arch/powerpc/kvm/book3s_64_mmu_radix.c
··· 646 646 */ 647 647 local_irq_disable(); 648 648 ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift); 649 + /* 650 + * If the PTE disappeared temporarily due to a THP 651 + * collapse, just return and let the guest try again. 652 + */ 653 + if (!ptep) { 654 + local_irq_enable(); 655 + if (page) 656 + put_page(page); 657 + return RESUME_GUEST; 658 + } 649 659 pte = *ptep; 650 660 local_irq_enable(); 651 661
+12 -8
arch/powerpc/lib/code-patching.c
··· 28 28 { 29 29 int err; 30 30 31 - /* Make sure we aren't patching a freed init section */ 32 - if (init_mem_is_free && init_section_contains(exec_addr, 4)) { 33 - pr_debug("Skipping init section patching addr: 0x%px\n", exec_addr); 34 - return 0; 35 - } 36 - 37 31 __put_user_size(instr, patch_addr, 4, err); 38 32 if (err) 39 33 return err; ··· 142 148 return 0; 143 149 } 144 150 145 - int patch_instruction(unsigned int *addr, unsigned int instr) 151 + static int do_patch_instruction(unsigned int *addr, unsigned int instr) 146 152 { 147 153 int err; 148 154 unsigned int *patch_addr = NULL; ··· 182 188 } 183 189 #else /* !CONFIG_STRICT_KERNEL_RWX */ 184 190 185 - int patch_instruction(unsigned int *addr, unsigned int instr) 191 + static int do_patch_instruction(unsigned int *addr, unsigned int instr) 186 192 { 187 193 return raw_patch_instruction(addr, instr); 188 194 } 189 195 190 196 #endif /* CONFIG_STRICT_KERNEL_RWX */ 197 + 198 + int patch_instruction(unsigned int *addr, unsigned int instr) 199 + { 200 + /* Make sure we aren't patching a freed init section */ 201 + if (init_mem_is_free && init_section_contains(addr, 4)) { 202 + pr_debug("Skipping init section patching addr: 0x%px\n", addr); 203 + return 0; 204 + } 205 + return do_patch_instruction(addr, instr); 206 + } 191 207 NOKPROBE_SYMBOL(patch_instruction); 192 208 193 209 int patch_branch(unsigned int *addr, unsigned long target, int flags)
+3 -2
arch/powerpc/mm/numa.c
··· 1217 1217 * Need to ensure that NODE_DATA is initialized for a node from 1218 1218 * available memory (see memblock_alloc_try_nid). If unable to 1219 1219 * init the node, then default to nearest node that has memory 1220 - * installed. 1220 + * installed. Skip onlining a node if the subsystems are not 1221 + * yet initialized. 1221 1222 */ 1222 - if (try_online_node(new_nid)) 1223 + if (!topology_inited || try_online_node(new_nid)) 1223 1224 new_nid = first_online_node; 1224 1225 #else 1225 1226 /*
+1 -1
arch/riscv/kernel/setup.c
··· 186 186 BUG_ON(mem_size == 0); 187 187 188 188 set_max_mapnr(PFN_DOWN(mem_size)); 189 - max_low_pfn = pfn_base + PFN_DOWN(mem_size); 189 + max_low_pfn = memblock_end_of_DRAM(); 190 190 191 191 #ifdef CONFIG_BLK_DEV_INITRD 192 192 setup_initrd();
+14 -2
arch/x86/entry/vdso/Makefile
··· 68 68 CFL := $(PROFILING) -mcmodel=small -fPIC -O2 -fasynchronous-unwind-tables -m64 \ 69 69 $(filter -g%,$(KBUILD_CFLAGS)) $(call cc-option, -fno-stack-protector) \ 70 70 -fno-omit-frame-pointer -foptimize-sibling-calls \ 71 - -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO $(RETPOLINE_VDSO_CFLAGS) 71 + -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO 72 + 73 + ifdef CONFIG_RETPOLINE 74 + ifneq ($(RETPOLINE_VDSO_CFLAGS),) 75 + CFL += $(RETPOLINE_VDSO_CFLAGS) 76 + endif 77 + endif 72 78 73 79 $(vobjs): KBUILD_CFLAGS := $(filter-out $(GCC_PLUGINS_CFLAGS) $(RETPOLINE_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) 74 80 ··· 144 138 KBUILD_CFLAGS_32 += $(call cc-option, -foptimize-sibling-calls) 145 139 KBUILD_CFLAGS_32 += -fno-omit-frame-pointer 146 140 KBUILD_CFLAGS_32 += -DDISABLE_BRANCH_PROFILING 147 - KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS) 141 + 142 + ifdef CONFIG_RETPOLINE 143 + ifneq ($(RETPOLINE_VDSO_CFLAGS),) 144 + KBUILD_CFLAGS_32 += $(RETPOLINE_VDSO_CFLAGS) 145 + endif 146 + endif 147 + 148 148 $(obj)/vdso32.so.dbg: KBUILD_CFLAGS = $(KBUILD_CFLAGS_32) 149 149 150 150 $(obj)/vdso32.so.dbg: FORCE \
+14 -12
arch/x86/entry/vdso/vclock_gettime.c
··· 43 43 notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) 44 44 { 45 45 long ret; 46 - asm("syscall" : "=a" (ret) : 47 - "0" (__NR_clock_gettime), "D" (clock), "S" (ts) : "memory"); 46 + asm ("syscall" : "=a" (ret), "=m" (*ts) : 47 + "0" (__NR_clock_gettime), "D" (clock), "S" (ts) : 48 + "memory", "rcx", "r11"); 48 49 return ret; 49 50 } 50 51 ··· 53 52 { 54 53 long ret; 55 54 56 - asm("syscall" : "=a" (ret) : 57 - "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : "memory"); 55 + asm ("syscall" : "=a" (ret), "=m" (*tv), "=m" (*tz) : 56 + "0" (__NR_gettimeofday), "D" (tv), "S" (tz) : 57 + "memory", "rcx", "r11"); 58 58 return ret; 59 59 } 60 60 ··· 66 64 { 67 65 long ret; 68 66 69 - asm( 67 + asm ( 70 68 "mov %%ebx, %%edx \n" 71 - "mov %2, %%ebx \n" 69 + "mov %[clock], %%ebx \n" 72 70 "call __kernel_vsyscall \n" 73 71 "mov %%edx, %%ebx \n" 74 - : "=a" (ret) 75 - : "0" (__NR_clock_gettime), "g" (clock), "c" (ts) 72 + : "=a" (ret), "=m" (*ts) 73 + : "0" (__NR_clock_gettime), [clock] "g" (clock), "c" (ts) 76 74 : "memory", "edx"); 77 75 return ret; 78 76 } ··· 81 79 { 82 80 long ret; 83 81 84 - asm( 82 + asm ( 85 83 "mov %%ebx, %%edx \n" 86 - "mov %2, %%ebx \n" 84 + "mov %[tv], %%ebx \n" 87 85 "call __kernel_vsyscall \n" 88 86 "mov %%edx, %%ebx \n" 89 - : "=a" (ret) 90 - : "0" (__NR_gettimeofday), "g" (tv), "c" (tz) 87 + : "=a" (ret), "=m" (*tv), "=m" (*tz) 88 + : "0" (__NR_gettimeofday), [tv] "g" (tv), "c" (tz) 91 89 : "memory", "edx"); 92 90 return ret; 93 91 }
+10
arch/x86/events/amd/uncore.c
··· 36 36 37 37 static int num_counters_llc; 38 38 static int num_counters_nb; 39 + static bool l3_mask; 39 40 40 41 static HLIST_HEAD(uncore_unused_list); 41 42 ··· 209 208 /* and we do not enable counter overflow interrupts */ 210 209 hwc->config = event->attr.config & AMD64_RAW_EVENT_MASK_NB; 211 210 hwc->idx = -1; 211 + 212 + /* 213 + * SliceMask and ThreadMask need to be set for certain L3 events in 214 + * Family 17h. For other events, the two fields do not affect the count. 215 + */ 216 + if (l3_mask) 217 + hwc->config |= (AMD64_L3_SLICE_MASK | AMD64_L3_THREAD_MASK); 212 218 213 219 if (event->cpu < 0) 214 220 return -EINVAL; ··· 533 525 amd_llc_pmu.name = "amd_l3"; 534 526 format_attr_event_df.show = &event_show_df; 535 527 format_attr_event_l3.show = &event_show_l3; 528 + l3_mask = true; 536 529 } else { 537 530 num_counters_nb = NUM_COUNTERS_NB; 538 531 num_counters_llc = NUM_COUNTERS_L2; ··· 541 532 amd_llc_pmu.name = "amd_l2"; 542 533 format_attr_event_df = format_attr_event; 543 534 format_attr_event_l3 = format_attr_event; 535 + l3_mask = false; 544 536 } 545 537 546 538 amd_nb_pmu.attr_groups = amd_uncore_attr_groups_df;
+7 -7
arch/x86/events/intel/uncore_snbep.c
··· 3061 3061 3062 3062 void bdx_uncore_cpu_init(void) 3063 3063 { 3064 - int pkg = topology_phys_to_logical_pkg(0); 3064 + int pkg = topology_phys_to_logical_pkg(boot_cpu_data.phys_proc_id); 3065 3065 3066 3066 if (bdx_uncore_cbox.num_boxes > boot_cpu_data.x86_max_cores) 3067 3067 bdx_uncore_cbox.num_boxes = boot_cpu_data.x86_max_cores; ··· 3931 3931 .driver_data = UNCORE_PCI_DEV_FULL_DATA(21, 5, SKX_PCI_UNCORE_M2PCIE, 3), 3932 3932 }, 3933 3933 { /* M3UPI0 Link 0 */ 3934 - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C), 3935 - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 0, SKX_PCI_UNCORE_M3UPI, 0), 3934 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), 3935 + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 0), 3936 3936 }, 3937 3937 { /* M3UPI0 Link 1 */ 3938 - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), 3939 - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 1, SKX_PCI_UNCORE_M3UPI, 1), 3938 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204E), 3939 + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 2, SKX_PCI_UNCORE_M3UPI, 1), 3940 3940 }, 3941 3941 { /* M3UPI1 Link 2 */ 3942 - PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204C), 3943 - .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 4, SKX_PCI_UNCORE_M3UPI, 2), 3942 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x204D), 3943 + .driver_data = UNCORE_PCI_DEV_FULL_DATA(18, 5, SKX_PCI_UNCORE_M3UPI, 2), 3944 3944 }, 3945 3945 { /* end: all zeroes */ } 3946 3946 };
+8
arch/x86/include/asm/perf_event.h
··· 46 46 #define INTEL_ARCH_EVENT_MASK \ 47 47 (ARCH_PERFMON_EVENTSEL_UMASK | ARCH_PERFMON_EVENTSEL_EVENT) 48 48 49 + #define AMD64_L3_SLICE_SHIFT 48 50 + #define AMD64_L3_SLICE_MASK \ 51 + ((0xFULL) << AMD64_L3_SLICE_SHIFT) 52 + 53 + #define AMD64_L3_THREAD_SHIFT 56 54 + #define AMD64_L3_THREAD_MASK \ 55 + ((0xFFULL) << AMD64_L3_THREAD_SHIFT) 56 + 49 57 #define X86_RAW_EVENT_MASK \ 50 58 (ARCH_PERFMON_EVENTSEL_EVENT | \ 51 59 ARCH_PERFMON_EVENTSEL_UMASK | \
+6
arch/x86/include/asm/uv/uv.h
··· 10 10 struct mm_struct; 11 11 12 12 #ifdef CONFIG_X86_UV 13 + #include <linux/efi.h> 13 14 14 15 extern enum uv_system_type get_uv_system_type(void); 16 + static inline bool is_early_uv_system(void) 17 + { 18 + return !((efi.uv_systab == EFI_INVALID_TABLE_ADDR) || !efi.uv_systab); 19 + } 15 20 extern int is_uv_system(void); 16 21 extern int is_uv_hubless(void); 17 22 extern void uv_cpu_init(void); ··· 28 23 #else /* X86_UV */ 29 24 30 25 static inline enum uv_system_type get_uv_system_type(void) { return UV_NONE; } 26 + static inline bool is_early_uv_system(void) { return 0; } 31 27 static inline int is_uv_system(void) { return 0; } 32 28 static inline int is_uv_hubless(void) { return 0; } 33 29 static inline void uv_cpu_init(void) { }
+1 -1
arch/x86/kernel/cpu/amd.c
··· 922 922 static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size) 923 923 { 924 924 /* AMD errata T13 (order #21922) */ 925 - if ((c->x86 == 6)) { 925 + if (c->x86 == 6) { 926 926 /* Duron Rev A0 */ 927 927 if (c->x86_model == 3 && c->x86_stepping == 0) 928 928 size = 64;
+4
arch/x86/kernel/tsc.c
··· 26 26 #include <asm/apic.h> 27 27 #include <asm/intel-family.h> 28 28 #include <asm/i8259.h> 29 + #include <asm/uv/uv.h> 29 30 30 31 unsigned int __read_mostly cpu_khz; /* TSC clocks / usec, not used here */ 31 32 EXPORT_SYMBOL(cpu_khz); ··· 1433 1432 void __init tsc_early_init(void) 1434 1433 { 1435 1434 if (!boot_cpu_has(X86_FEATURE_TSC)) 1435 + return; 1436 + /* Don't change UV TSC multi-chassis synchronization */ 1437 + if (is_early_uv_system()) 1436 1438 return; 1437 1439 if (!determine_cpu_tsc_frequencies(true)) 1438 1440 return;
+20 -4
arch/x86/kvm/mmu.c
··· 249 249 */ 250 250 static const u64 shadow_nonpresent_or_rsvd_mask_len = 5; 251 251 252 + /* 253 + * In some cases, we need to preserve the GFN of a non-present or reserved 254 + * SPTE when we usurp the upper five bits of the physical address space to 255 + * defend against L1TF, e.g. for MMIO SPTEs. To preserve the GFN, we'll 256 + * shift bits of the GFN that overlap with shadow_nonpresent_or_rsvd_mask 257 + * left into the reserved bits, i.e. the GFN in the SPTE will be split into 258 + * high and low parts. This mask covers the lower bits of the GFN. 259 + */ 260 + static u64 __read_mostly shadow_nonpresent_or_rsvd_lower_gfn_mask; 261 + 262 + 252 263 static void mmu_spte_set(u64 *sptep, u64 spte); 253 264 static union kvm_mmu_page_role 254 265 kvm_mmu_calc_root_page_role(struct kvm_vcpu *vcpu); ··· 368 357 369 358 static gfn_t get_mmio_spte_gfn(u64 spte) 370 359 { 371 - u64 mask = generation_mmio_spte_mask(MMIO_GEN_MASK) | shadow_mmio_mask | 372 - shadow_nonpresent_or_rsvd_mask; 373 - u64 gpa = spte & ~mask; 360 + u64 gpa = spte & shadow_nonpresent_or_rsvd_lower_gfn_mask; 374 361 375 362 gpa |= (spte >> shadow_nonpresent_or_rsvd_mask_len) 376 363 & shadow_nonpresent_or_rsvd_mask; ··· 432 423 433 424 static void kvm_mmu_reset_all_pte_masks(void) 434 425 { 426 + u8 low_phys_bits; 427 + 435 428 shadow_user_mask = 0; 436 429 shadow_accessed_mask = 0; 437 430 shadow_dirty_mask = 0; ··· 448 437 * appropriate mask to guard against L1TF attacks. Otherwise, it is 449 438 * assumed that the CPU is not vulnerable to L1TF. 450 439 */ 440 + low_phys_bits = boot_cpu_data.x86_phys_bits; 451 441 if (boot_cpu_data.x86_phys_bits < 452 - 52 - shadow_nonpresent_or_rsvd_mask_len) 442 + 52 - shadow_nonpresent_or_rsvd_mask_len) { 453 443 shadow_nonpresent_or_rsvd_mask = 454 444 rsvd_bits(boot_cpu_data.x86_phys_bits - 455 445 shadow_nonpresent_or_rsvd_mask_len, 456 446 boot_cpu_data.x86_phys_bits - 1); 447 + low_phys_bits -= shadow_nonpresent_or_rsvd_mask_len; 448 + } 449 + shadow_nonpresent_or_rsvd_lower_gfn_mask = 450 + GENMASK_ULL(low_phys_bits - 1, PAGE_SHIFT); 457 451 } 458 452 459 453 static int is_cpuid_PSE36(void)
+75 -60
arch/x86/kvm/vmx.c
··· 121 121 122 122 #define MSR_BITMAP_MODE_X2APIC 1 123 123 #define MSR_BITMAP_MODE_X2APIC_APICV 2 124 - #define MSR_BITMAP_MODE_LM 4 125 124 126 125 #define KVM_VMX_TSC_MULTIPLIER_MAX 0xffffffffffffffffULL 127 126 ··· 856 857 857 858 /* to migrate it to L2 if VM_ENTRY_LOAD_DEBUG_CONTROLS is off */ 858 859 u64 vmcs01_debugctl; 860 + u64 vmcs01_guest_bndcfgs; 859 861 860 862 u16 vpid02; 861 863 u16 last_vpid; ··· 2899 2899 vmx->msr_host_kernel_gs_base = read_msr(MSR_KERNEL_GS_BASE); 2900 2900 } 2901 2901 2902 - if (is_long_mode(&vmx->vcpu)) 2903 - wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); 2902 + wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); 2904 2903 #else 2905 2904 savesegment(fs, fs_sel); 2906 2905 savesegment(gs, gs_sel); ··· 2950 2951 vmx->loaded_cpu_state = NULL; 2951 2952 2952 2953 #ifdef CONFIG_X86_64 2953 - if (is_long_mode(&vmx->vcpu)) 2954 - rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); 2954 + rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); 2955 2955 #endif 2956 2956 if (host_state->ldt_sel || (host_state->gs_sel & 7)) { 2957 2957 kvm_load_ldt(host_state->ldt_sel); ··· 2978 2980 #ifdef CONFIG_X86_64 2979 2981 static u64 vmx_read_guest_kernel_gs_base(struct vcpu_vmx *vmx) 2980 2982 { 2981 - if (is_long_mode(&vmx->vcpu)) { 2982 - preempt_disable(); 2983 - if (vmx->loaded_cpu_state) 2984 - rdmsrl(MSR_KERNEL_GS_BASE, 2985 - vmx->msr_guest_kernel_gs_base); 2986 - preempt_enable(); 2987 - } 2983 + preempt_disable(); 2984 + if (vmx->loaded_cpu_state) 2985 + rdmsrl(MSR_KERNEL_GS_BASE, vmx->msr_guest_kernel_gs_base); 2986 + preempt_enable(); 2988 2987 return vmx->msr_guest_kernel_gs_base; 2989 2988 } 2990 2989 2991 2990 static void vmx_write_guest_kernel_gs_base(struct vcpu_vmx *vmx, u64 data) 2992 2991 { 2993 - if (is_long_mode(&vmx->vcpu)) { 2994 - preempt_disable(); 2995 - if (vmx->loaded_cpu_state) 2996 - wrmsrl(MSR_KERNEL_GS_BASE, data); 2997 - preempt_enable(); 2998 - } 2992 + preempt_disable(); 2993 + if (vmx->loaded_cpu_state) 2994 + wrmsrl(MSR_KERNEL_GS_BASE, data); 2995 + preempt_enable(); 2999 2996 vmx->msr_guest_kernel_gs_base = data; 3000 2997 } 3001 2998 #endif ··· 3526 3533 VM_EXIT_LOAD_IA32_EFER | VM_EXIT_SAVE_IA32_EFER | 3527 3534 VM_EXIT_SAVE_VMX_PREEMPTION_TIMER | VM_EXIT_ACK_INTR_ON_EXIT; 3528 3535 3529 - if (kvm_mpx_supported()) 3530 - msrs->exit_ctls_high |= VM_EXIT_CLEAR_BNDCFGS; 3531 - 3532 3536 /* We support free control of debug control saving. */ 3533 3537 msrs->exit_ctls_low &= ~VM_EXIT_SAVE_DEBUG_CONTROLS; 3534 3538 ··· 3542 3552 VM_ENTRY_LOAD_IA32_PAT; 3543 3553 msrs->entry_ctls_high |= 3544 3554 (VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR | VM_ENTRY_LOAD_IA32_EFER); 3545 - if (kvm_mpx_supported()) 3546 - msrs->entry_ctls_high |= VM_ENTRY_LOAD_BNDCFGS; 3547 3555 3548 3556 /* We support free control of debug control loading. */ 3549 3557 msrs->entry_ctls_low &= ~VM_ENTRY_LOAD_DEBUG_CONTROLS; ··· 3589 3601 msrs->secondary_ctls_high); 3590 3602 msrs->secondary_ctls_low = 0; 3591 3603 msrs->secondary_ctls_high &= 3592 - SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | 3593 3604 SECONDARY_EXEC_DESC | 3594 3605 SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE | 3595 3606 SECONDARY_EXEC_APIC_REGISTER_VIRT | 3596 3607 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY | 3597 3608 SECONDARY_EXEC_WBINVD_EXITING; 3609 + 3598 3610 /* 3599 3611 * We can emulate "VMCS shadowing," even if the hardware 3600 3612 * doesn't support it. ··· 3650 3662 if (enable_unrestricted_guest) 3651 3663 msrs->secondary_ctls_high |= 3652 3664 SECONDARY_EXEC_UNRESTRICTED_GUEST; 3665 + 3666 + if (flexpriority_enabled) 3667 + msrs->secondary_ctls_high |= 3668 + SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; 3653 3669 3654 3670 /* miscellaneous data */ 3655 3671 rdmsr(MSR_IA32_VMX_MISC, ··· 5065 5073 if (!msr) 5066 5074 return; 5067 5075 5068 - /* 5069 - * MSR_KERNEL_GS_BASE is not intercepted when the guest is in 5070 - * 64-bit mode as a 64-bit kernel may frequently access the 5071 - * MSR. This means we need to manually save/restore the MSR 5072 - * when switching between guest and host state, but only if 5073 - * the guest is in 64-bit mode. Sync our cached value if the 5074 - * guest is transitioning to 32-bit mode and the CPU contains 5075 - * guest state, i.e. the cache is stale. 5076 - */ 5077 - #ifdef CONFIG_X86_64 5078 - if (!(efer & EFER_LMA)) 5079 - (void)vmx_read_guest_kernel_gs_base(vmx); 5080 - #endif 5081 5076 vcpu->arch.efer = efer; 5082 5077 if (efer & EFER_LMA) { 5083 5078 vm_entry_controls_setbit(to_vmx(vcpu), VM_ENTRY_IA32E_MODE); ··· 6057 6078 mode |= MSR_BITMAP_MODE_X2APIC_APICV; 6058 6079 } 6059 6080 6060 - if (is_long_mode(vcpu)) 6061 - mode |= MSR_BITMAP_MODE_LM; 6062 - 6063 6081 return mode; 6064 6082 } 6065 6083 ··· 6096 6120 6097 6121 if (!changed) 6098 6122 return; 6099 - 6100 - vmx_set_intercept_for_msr(msr_bitmap, MSR_KERNEL_GS_BASE, MSR_TYPE_RW, 6101 - !(mode & MSR_BITMAP_MODE_LM)); 6102 6123 6103 6124 if (changed & (MSR_BITMAP_MODE_X2APIC | MSR_BITMAP_MODE_X2APIC_APICV)) 6104 6125 vmx_update_msr_bitmap_x2apic(msr_bitmap, mode); ··· 6162 6189 nested_mark_vmcs12_pages_dirty(vcpu); 6163 6190 } 6164 6191 6192 + static u8 vmx_get_rvi(void) 6193 + { 6194 + return vmcs_read16(GUEST_INTR_STATUS) & 0xff; 6195 + } 6196 + 6165 6197 static bool vmx_guest_apic_has_interrupt(struct kvm_vcpu *vcpu) 6166 6198 { 6167 6199 struct vcpu_vmx *vmx = to_vmx(vcpu); ··· 6179 6201 WARN_ON_ONCE(!vmx->nested.virtual_apic_page)) 6180 6202 return false; 6181 6203 6182 - rvi = vmcs_read16(GUEST_INTR_STATUS) & 0xff; 6204 + rvi = vmx_get_rvi(); 6183 6205 6184 6206 vapic_page = kmap(vmx->nested.virtual_apic_page); 6185 6207 vppr = *((u32 *)(vapic_page + APIC_PROCPRI)); ··· 10223 10245 if (!lapic_in_kernel(vcpu)) 10224 10246 return; 10225 10247 10248 + if (!flexpriority_enabled && 10249 + !cpu_has_vmx_virtualize_x2apic_mode()) 10250 + return; 10251 + 10226 10252 /* Postpone execution until vmcs01 is the current VMCS. */ 10227 10253 if (is_guest_mode(vcpu)) { 10228 10254 to_vmx(vcpu)->nested.change_vmcs01_virtual_apic_mode = true; 10229 10255 return; 10230 10256 } 10231 - 10232 - if (!cpu_need_tpr_shadow(vcpu)) 10233 - return; 10234 10257 10235 10258 sec_exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL); 10236 10259 sec_exec_control &= ~(SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | ··· 10352 10373 } 10353 10374 vmx_hwapic_irr_update(vcpu, max_irr); 10354 10375 return max_irr; 10376 + } 10377 + 10378 + static u8 vmx_has_apicv_interrupt(struct kvm_vcpu *vcpu) 10379 + { 10380 + u8 rvi = vmx_get_rvi(); 10381 + u8 vppr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_PROCPRI); 10382 + 10383 + return ((rvi & 0xf0) > (vppr & 0xf0)); 10355 10384 } 10356 10385 10357 10386 static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) ··· 11251 11264 #undef cr4_fixed1_update 11252 11265 } 11253 11266 11267 + static void nested_vmx_entry_exit_ctls_update(struct kvm_vcpu *vcpu) 11268 + { 11269 + struct vcpu_vmx *vmx = to_vmx(vcpu); 11270 + 11271 + if (kvm_mpx_supported()) { 11272 + bool mpx_enabled = guest_cpuid_has(vcpu, X86_FEATURE_MPX); 11273 + 11274 + if (mpx_enabled) { 11275 + vmx->nested.msrs.entry_ctls_high |= VM_ENTRY_LOAD_BNDCFGS; 11276 + vmx->nested.msrs.exit_ctls_high |= VM_EXIT_CLEAR_BNDCFGS; 11277 + } else { 11278 + vmx->nested.msrs.entry_ctls_high &= ~VM_ENTRY_LOAD_BNDCFGS; 11279 + vmx->nested.msrs.exit_ctls_high &= ~VM_EXIT_CLEAR_BNDCFGS; 11280 + } 11281 + } 11282 + } 11283 + 11254 11284 static void vmx_cpuid_update(struct kvm_vcpu *vcpu) 11255 11285 { 11256 11286 struct vcpu_vmx *vmx = to_vmx(vcpu); ··· 11284 11280 to_vmx(vcpu)->msr_ia32_feature_control_valid_bits &= 11285 11281 ~FEATURE_CONTROL_VMXON_ENABLED_OUTSIDE_SMX; 11286 11282 11287 - if (nested_vmx_allowed(vcpu)) 11283 + if (nested_vmx_allowed(vcpu)) { 11288 11284 nested_vmx_cr_fixed1_bits_update(vcpu); 11285 + nested_vmx_entry_exit_ctls_update(vcpu); 11286 + } 11289 11287 } 11290 11288 11291 11289 static void vmx_set_supported_cpuid(u32 func, struct kvm_cpuid_entry2 *entry) ··· 12055 12049 12056 12050 set_cr4_guest_host_mask(vmx); 12057 12051 12058 - if (vmx_mpx_supported()) 12059 - vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs); 12052 + if (kvm_mpx_supported()) { 12053 + if (vmx->nested.nested_run_pending && 12054 + (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS)) 12055 + vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs); 12056 + else 12057 + vmcs_write64(GUEST_BNDCFGS, vmx->nested.vmcs01_guest_bndcfgs); 12058 + } 12060 12059 12061 12060 if (enable_vpid) { 12062 12061 if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02) ··· 12606 12595 struct vmcs12 *vmcs12 = get_vmcs12(vcpu); 12607 12596 bool from_vmentry = !!exit_qual; 12608 12597 u32 dummy_exit_qual; 12609 - u32 vmcs01_cpu_exec_ctrl; 12598 + bool evaluate_pending_interrupts; 12610 12599 int r = 0; 12611 12600 12612 - vmcs01_cpu_exec_ctrl = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); 12601 + evaluate_pending_interrupts = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL) & 12602 + (CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_VIRTUAL_NMI_PENDING); 12603 + if (likely(!evaluate_pending_interrupts) && kvm_vcpu_apicv_active(vcpu)) 12604 + evaluate_pending_interrupts |= vmx_has_apicv_interrupt(vcpu); 12613 12605 12614 12606 enter_guest_mode(vcpu); 12615 12607 12616 12608 if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) 12617 12609 vmx->nested.vmcs01_debugctl = vmcs_read64(GUEST_IA32_DEBUGCTL); 12610 + if (kvm_mpx_supported() && 12611 + !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS)) 12612 + vmx->nested.vmcs01_guest_bndcfgs = vmcs_read64(GUEST_BNDCFGS); 12618 12613 12619 12614 vmx_switch_vmcs(vcpu, &vmx->nested.vmcs02); 12620 12615 vmx_segment_cache_clear(vmx); ··· 12660 12643 * to L1 or delivered directly to L2 (e.g. In case L1 don't 12661 12644 * intercept EXTERNAL_INTERRUPT). 12662 12645 * 12663 - * Usually this would be handled by L0 requesting a 12664 - * IRQ/NMI window by setting VMCS accordingly. However, 12665 - * this setting was done on VMCS01 and now VMCS02 is active 12666 - * instead. Thus, we force L0 to perform pending event 12667 - * evaluation by requesting a KVM_REQ_EVENT. 12646 + * Usually this would be handled by the processor noticing an 12647 + * IRQ/NMI window request, or checking RVI during evaluation of 12648 + * pending virtual interrupts. However, this setting was done 12649 + * on VMCS01 and now VMCS02 is active instead. Thus, we force L0 12650 + * to perform pending event evaluation by requesting a KVM_REQ_EVENT. 12668 12651 */ 12669 - if (vmcs01_cpu_exec_ctrl & 12670 - (CPU_BASED_VIRTUAL_INTR_PENDING | CPU_BASED_VIRTUAL_NMI_PENDING)) { 12652 + if (unlikely(evaluate_pending_interrupts)) 12671 12653 kvm_make_request(KVM_REQ_EVENT, vcpu); 12672 - } 12673 12654 12674 12655 /* 12675 12656 * Note no nested_vmx_succeed or nested_vmx_fail here. At this point
+1 -1
arch/x86/kvm/x86.c
··· 4698 4698 */ 4699 4699 switch (msrs_to_save[i]) { 4700 4700 case MSR_IA32_BNDCFGS: 4701 - if (!kvm_x86_ops->mpx_supported()) 4701 + if (!kvm_mpx_supported()) 4702 4702 continue; 4703 4703 break; 4704 4704 case MSR_TSC_AUX:
+5 -2
drivers/base/firmware_loader/main.c
··· 226 226 } 227 227 228 228 tmp = __allocate_fw_priv(fw_name, fwc, dbuf, size); 229 - if (tmp && !(opt_flags & FW_OPT_NOCACHE)) 230 - list_add(&tmp->list, &fwc->head); 229 + if (tmp) { 230 + INIT_LIST_HEAD(&tmp->list); 231 + if (!(opt_flags & FW_OPT_NOCACHE)) 232 + list_add(&tmp->list, &fwc->head); 233 + } 231 234 spin_unlock(&fwc->lock); 232 235 233 236 *fw_priv = tmp;
+4 -1
drivers/base/power/main.c
··· 1713 1713 1714 1714 dpm_wait_for_subordinate(dev, async); 1715 1715 1716 - if (async_error) 1716 + if (async_error) { 1717 + dev->power.direct_complete = false; 1717 1718 goto Complete; 1719 + } 1718 1720 1719 1721 /* 1720 1722 * If a device configured to wake up the system from sleep states ··· 1728 1726 pm_wakeup_event(dev, 0); 1729 1727 1730 1728 if (pm_wakeup_pending()) { 1729 + dev->power.direct_complete = false; 1731 1730 async_error = -EBUSY; 1732 1731 goto Complete; 1733 1732 }
+4 -4
drivers/crypto/caam/caamalg.c
··· 1553 1553 edesc->src_nents = src_nents; 1554 1554 edesc->dst_nents = dst_nents; 1555 1555 edesc->sec4_sg_bytes = sec4_sg_bytes; 1556 - edesc->sec4_sg = (void *)edesc + sizeof(struct ablkcipher_edesc) + 1557 - desc_bytes; 1556 + edesc->sec4_sg = (struct sec4_sg_entry *)((u8 *)edesc->hw_desc + 1557 + desc_bytes); 1558 1558 edesc->iv_dir = DMA_TO_DEVICE; 1559 1559 1560 1560 /* Make sure IV is located in a DMAable area */ ··· 1757 1757 edesc->src_nents = src_nents; 1758 1758 edesc->dst_nents = dst_nents; 1759 1759 edesc->sec4_sg_bytes = sec4_sg_bytes; 1760 - edesc->sec4_sg = (void *)edesc + sizeof(struct ablkcipher_edesc) + 1761 - desc_bytes; 1760 + edesc->sec4_sg = (struct sec4_sg_entry *)((u8 *)edesc->hw_desc + 1761 + desc_bytes); 1762 1762 edesc->iv_dir = DMA_FROM_DEVICE; 1763 1763 1764 1764 /* Make sure IV is located in a DMAable area */
+22 -10
drivers/crypto/chelsio/chcr_algo.c
··· 367 367 walk->to = (struct phys_sge_pairs *)(dsgl + 1); 368 368 } 369 369 370 - static inline void dsgl_walk_end(struct dsgl_walk *walk, unsigned short qid) 370 + static inline void dsgl_walk_end(struct dsgl_walk *walk, unsigned short qid, 371 + int pci_chan_id) 371 372 { 372 373 struct cpl_rx_phys_dsgl *phys_cpl; 373 374 ··· 386 385 phys_cpl->rss_hdr_int.opcode = CPL_RX_PHYS_ADDR; 387 386 phys_cpl->rss_hdr_int.qid = htons(qid); 388 387 phys_cpl->rss_hdr_int.hash_val = 0; 388 + phys_cpl->rss_hdr_int.channel = pci_chan_id; 389 389 } 390 390 391 391 static inline void dsgl_walk_add_page(struct dsgl_walk *walk, ··· 720 718 FILL_WR_RX_Q_ID(ctx->dev->rx_channel_id, qid, 721 719 !!lcb, ctx->tx_qidx); 722 720 723 - chcr_req->ulptx.cmd_dest = FILL_ULPTX_CMD_DEST(ctx->dev->tx_channel_id, 721 + chcr_req->ulptx.cmd_dest = FILL_ULPTX_CMD_DEST(ctx->tx_chan_id, 724 722 qid); 725 723 chcr_req->ulptx.len = htonl((DIV_ROUND_UP(len16, 16) - 726 724 ((sizeof(chcr_req->wreq)) >> 4))); ··· 1341 1339 adap->vres.ncrypto_fc); 1342 1340 rxq_perchan = u_ctx->lldi.nrxq / u_ctx->lldi.nchan; 1343 1341 txq_perchan = ntxq / u_ctx->lldi.nchan; 1344 - rxq_idx = ctx->dev->tx_channel_id * rxq_perchan; 1345 - rxq_idx += id % rxq_perchan; 1346 - txq_idx = ctx->dev->tx_channel_id * txq_perchan; 1347 - txq_idx += id % txq_perchan; 1348 1342 spin_lock(&ctx->dev->lock_chcr_dev); 1349 - ctx->rx_qidx = rxq_idx; 1350 - ctx->tx_qidx = txq_idx; 1343 + ctx->tx_chan_id = ctx->dev->tx_channel_id; 1351 1344 ctx->dev->tx_channel_id = !ctx->dev->tx_channel_id; 1352 1345 ctx->dev->rx_channel_id = 0; 1353 1346 spin_unlock(&ctx->dev->lock_chcr_dev); 1347 + rxq_idx = ctx->tx_chan_id * rxq_perchan; 1348 + rxq_idx += id % rxq_perchan; 1349 + txq_idx = ctx->tx_chan_id * txq_perchan; 1350 + txq_idx += id % txq_perchan; 1351 + ctx->rx_qidx = rxq_idx; 1352 + ctx->tx_qidx = txq_idx; 1353 + /* Channel Id used by SGE to forward packet to Host. 1354 + * Same value should be used in cpl_fw6_pld RSS_CH field 1355 + * by FW. Driver programs PCI channel ID to be used in fw 1356 + * at the time of queue allocation with value "pi->tx_chan" 1357 + */ 1358 + ctx->pci_chan_id = txq_idx / txq_perchan; 1354 1359 } 1355 1360 out: 1356 1361 return err; ··· 2512 2503 struct crypto_aead *tfm = crypto_aead_reqtfm(req); 2513 2504 struct dsgl_walk dsgl_walk; 2514 2505 unsigned int authsize = crypto_aead_authsize(tfm); 2506 + struct chcr_context *ctx = a_ctx(tfm); 2515 2507 u32 temp; 2516 2508 2517 2509 dsgl_walk_init(&dsgl_walk, phys_cpl); ··· 2522 2512 dsgl_walk_add_page(&dsgl_walk, IV, &reqctx->iv_dma); 2523 2513 temp = req->cryptlen + (reqctx->op ? -authsize : authsize); 2524 2514 dsgl_walk_add_sg(&dsgl_walk, req->dst, temp, req->assoclen); 2525 - dsgl_walk_end(&dsgl_walk, qid); 2515 + dsgl_walk_end(&dsgl_walk, qid, ctx->pci_chan_id); 2526 2516 } 2527 2517 2528 2518 void chcr_add_cipher_src_ent(struct ablkcipher_request *req, ··· 2554 2544 unsigned short qid) 2555 2545 { 2556 2546 struct chcr_blkcipher_req_ctx *reqctx = ablkcipher_request_ctx(req); 2547 + struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(wrparam->req); 2548 + struct chcr_context *ctx = c_ctx(tfm); 2557 2549 struct dsgl_walk dsgl_walk; 2558 2550 2559 2551 dsgl_walk_init(&dsgl_walk, phys_cpl); ··· 2564 2552 reqctx->dstsg = dsgl_walk.last_sg; 2565 2553 reqctx->dst_ofst = dsgl_walk.last_sg_len; 2566 2554 2567 - dsgl_walk_end(&dsgl_walk, qid); 2555 + dsgl_walk_end(&dsgl_walk, qid, ctx->pci_chan_id); 2568 2556 } 2569 2557 2570 2558 void chcr_add_hash_src_ent(struct ahash_request *req,
+2
drivers/crypto/chelsio/chcr_crypto.h
··· 255 255 struct chcr_dev *dev; 256 256 unsigned char tx_qidx; 257 257 unsigned char rx_qidx; 258 + unsigned char tx_chan_id; 259 + unsigned char pci_chan_id; 258 260 struct __crypto_ctx crypto_ctx[0]; 259 261 }; 260 262
+30 -23
drivers/crypto/mxs-dcp.c
··· 63 63 struct dcp_coherent_block *coh; 64 64 65 65 struct completion completion[DCP_MAX_CHANS]; 66 - struct mutex mutex[DCP_MAX_CHANS]; 66 + spinlock_t lock[DCP_MAX_CHANS]; 67 67 struct task_struct *thread[DCP_MAX_CHANS]; 68 68 struct crypto_queue queue[DCP_MAX_CHANS]; 69 69 }; ··· 349 349 350 350 int ret; 351 351 352 - do { 353 - __set_current_state(TASK_INTERRUPTIBLE); 352 + while (!kthread_should_stop()) { 353 + set_current_state(TASK_INTERRUPTIBLE); 354 354 355 - mutex_lock(&sdcp->mutex[chan]); 355 + spin_lock(&sdcp->lock[chan]); 356 356 backlog = crypto_get_backlog(&sdcp->queue[chan]); 357 357 arq = crypto_dequeue_request(&sdcp->queue[chan]); 358 - mutex_unlock(&sdcp->mutex[chan]); 358 + spin_unlock(&sdcp->lock[chan]); 359 + 360 + if (!backlog && !arq) { 361 + schedule(); 362 + continue; 363 + } 364 + 365 + set_current_state(TASK_RUNNING); 359 366 360 367 if (backlog) 361 368 backlog->complete(backlog, -EINPROGRESS); ··· 370 363 if (arq) { 371 364 ret = mxs_dcp_aes_block_crypt(arq); 372 365 arq->complete(arq, ret); 373 - continue; 374 366 } 375 - 376 - schedule(); 377 - } while (!kthread_should_stop()); 367 + } 378 368 379 369 return 0; 380 370 } ··· 413 409 rctx->ecb = ecb; 414 410 actx->chan = DCP_CHAN_CRYPTO; 415 411 416 - mutex_lock(&sdcp->mutex[actx->chan]); 412 + spin_lock(&sdcp->lock[actx->chan]); 417 413 ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base); 418 - mutex_unlock(&sdcp->mutex[actx->chan]); 414 + spin_unlock(&sdcp->lock[actx->chan]); 419 415 420 416 wake_up_process(sdcp->thread[actx->chan]); 421 417 ··· 644 640 struct ahash_request *req; 645 641 int ret, fini; 646 642 647 - do { 648 - __set_current_state(TASK_INTERRUPTIBLE); 643 + while (!kthread_should_stop()) { 644 + set_current_state(TASK_INTERRUPTIBLE); 649 645 650 - mutex_lock(&sdcp->mutex[chan]); 646 + spin_lock(&sdcp->lock[chan]); 651 647 backlog = crypto_get_backlog(&sdcp->queue[chan]); 652 648 arq = crypto_dequeue_request(&sdcp->queue[chan]); 653 - mutex_unlock(&sdcp->mutex[chan]); 649 + spin_unlock(&sdcp->lock[chan]); 650 + 651 + if (!backlog && !arq) { 652 + schedule(); 653 + continue; 654 + } 655 + 656 + set_current_state(TASK_RUNNING); 654 657 655 658 if (backlog) 656 659 backlog->complete(backlog, -EINPROGRESS); ··· 669 658 ret = dcp_sha_req_to_buf(arq); 670 659 fini = rctx->fini; 671 660 arq->complete(arq, ret); 672 - if (!fini) 673 - continue; 674 661 } 675 - 676 - schedule(); 677 - } while (!kthread_should_stop()); 662 + } 678 663 679 664 return 0; 680 665 } ··· 728 721 rctx->init = 1; 729 722 } 730 723 731 - mutex_lock(&sdcp->mutex[actx->chan]); 724 + spin_lock(&sdcp->lock[actx->chan]); 732 725 ret = crypto_enqueue_request(&sdcp->queue[actx->chan], &req->base); 733 - mutex_unlock(&sdcp->mutex[actx->chan]); 726 + spin_unlock(&sdcp->lock[actx->chan]); 734 727 735 728 wake_up_process(sdcp->thread[actx->chan]); 736 729 mutex_unlock(&actx->mutex); ··· 1004 997 platform_set_drvdata(pdev, sdcp); 1005 998 1006 999 for (i = 0; i < DCP_MAX_CHANS; i++) { 1007 - mutex_init(&sdcp->mutex[i]); 1000 + spin_lock_init(&sdcp->lock[i]); 1008 1001 init_completion(&sdcp->completion[i]); 1009 1002 crypto_init_queue(&sdcp->queue[i], 50); 1010 1003 }
+3 -3
drivers/crypto/qat/qat_c3xxx/adf_drv.c
··· 123 123 struct adf_hw_device_data *hw_data; 124 124 char name[ADF_DEVICE_NAME_LENGTH]; 125 125 unsigned int i, bar_nr; 126 - int ret, bar_mask; 126 + unsigned long bar_mask; 127 + int ret; 127 128 128 129 switch (ent->device) { 129 130 case ADF_C3XXX_PCI_DEVICE_ID: ··· 236 235 /* Find and map all the device's BARS */ 237 236 i = 0; 238 237 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); 239 - for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask, 240 - ADF_PCI_MAX_BARS * 2) { 238 + for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) { 241 239 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++]; 242 240 243 241 bar->base_addr = pci_resource_start(pdev, bar_nr);
+3 -3
drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
··· 125 125 struct adf_hw_device_data *hw_data; 126 126 char name[ADF_DEVICE_NAME_LENGTH]; 127 127 unsigned int i, bar_nr; 128 - int ret, bar_mask; 128 + unsigned long bar_mask; 129 + int ret; 129 130 130 131 switch (ent->device) { 131 132 case ADF_C3XXXIOV_PCI_DEVICE_ID: ··· 216 215 /* Find and map all the device's BARS */ 217 216 i = 0; 218 217 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); 219 - for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask, 220 - ADF_PCI_MAX_BARS * 2) { 218 + for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) { 221 219 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++]; 222 220 223 221 bar->base_addr = pci_resource_start(pdev, bar_nr);
+3 -3
drivers/crypto/qat/qat_c62x/adf_drv.c
··· 123 123 struct adf_hw_device_data *hw_data; 124 124 char name[ADF_DEVICE_NAME_LENGTH]; 125 125 unsigned int i, bar_nr; 126 - int ret, bar_mask; 126 + unsigned long bar_mask; 127 + int ret; 127 128 128 129 switch (ent->device) { 129 130 case ADF_C62X_PCI_DEVICE_ID: ··· 236 235 /* Find and map all the device's BARS */ 237 236 i = (hw_data->fuses & ADF_DEVICE_FUSECTL_MASK) ? 1 : 0; 238 237 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); 239 - for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask, 240 - ADF_PCI_MAX_BARS * 2) { 238 + for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) { 241 239 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++]; 242 240 243 241 bar->base_addr = pci_resource_start(pdev, bar_nr);
+3 -3
drivers/crypto/qat/qat_c62xvf/adf_drv.c
··· 125 125 struct adf_hw_device_data *hw_data; 126 126 char name[ADF_DEVICE_NAME_LENGTH]; 127 127 unsigned int i, bar_nr; 128 - int ret, bar_mask; 128 + unsigned long bar_mask; 129 + int ret; 129 130 130 131 switch (ent->device) { 131 132 case ADF_C62XIOV_PCI_DEVICE_ID: ··· 216 215 /* Find and map all the device's BARS */ 217 216 i = 0; 218 217 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); 219 - for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask, 220 - ADF_PCI_MAX_BARS * 2) { 218 + for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) { 221 219 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++]; 222 220 223 221 bar->base_addr = pci_resource_start(pdev, bar_nr);
+3 -3
drivers/crypto/qat/qat_dh895xcc/adf_drv.c
··· 123 123 struct adf_hw_device_data *hw_data; 124 124 char name[ADF_DEVICE_NAME_LENGTH]; 125 125 unsigned int i, bar_nr; 126 - int ret, bar_mask; 126 + unsigned long bar_mask; 127 + int ret; 127 128 128 129 switch (ent->device) { 129 130 case ADF_DH895XCC_PCI_DEVICE_ID: ··· 238 237 /* Find and map all the device's BARS */ 239 238 i = 0; 240 239 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); 241 - for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask, 242 - ADF_PCI_MAX_BARS * 2) { 240 + for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) { 243 241 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++]; 244 242 245 243 bar->base_addr = pci_resource_start(pdev, bar_nr);
+3 -3
drivers/crypto/qat/qat_dh895xccvf/adf_drv.c
··· 125 125 struct adf_hw_device_data *hw_data; 126 126 char name[ADF_DEVICE_NAME_LENGTH]; 127 127 unsigned int i, bar_nr; 128 - int ret, bar_mask; 128 + unsigned long bar_mask; 129 + int ret; 129 130 130 131 switch (ent->device) { 131 132 case ADF_DH895XCCIOV_PCI_DEVICE_ID: ··· 216 215 /* Find and map all the device's BARS */ 217 216 i = 0; 218 217 bar_mask = pci_select_bars(pdev, IORESOURCE_MEM); 219 - for_each_set_bit(bar_nr, (const unsigned long *)&bar_mask, 220 - ADF_PCI_MAX_BARS * 2) { 218 + for_each_set_bit(bar_nr, &bar_mask, ADF_PCI_MAX_BARS * 2) { 221 219 struct adf_bar *bar = &accel_pci_dev->pci_bars[i++]; 222 220 223 221 bar->base_addr = pci_resource_start(pdev, bar_nr);
+3 -1
drivers/fpga/dfl-fme-region.c
··· 14 14 */ 15 15 16 16 #include <linux/module.h> 17 + #include <linux/fpga/fpga-mgr.h> 17 18 #include <linux/fpga/fpga-region.h> 18 19 19 20 #include "dfl-fme-pr.h" ··· 67 66 static int fme_region_remove(struct platform_device *pdev) 68 67 { 69 68 struct fpga_region *region = dev_get_drvdata(&pdev->dev); 69 + struct fpga_manager *mgr = region->mgr; 70 70 71 71 fpga_region_unregister(region); 72 - fpga_mgr_put(region->mgr); 72 + fpga_mgr_put(mgr); 73 73 74 74 return 0; 75 75 }
+1 -1
drivers/fpga/fpga-bridge.c
··· 125 125 * 126 126 * Given a device, get an exclusive reference to a fpga bridge. 127 127 * 128 - * Return: fpga manager struct or IS_ERR() condition containing error code. 128 + * Return: fpga bridge struct or IS_ERR() condition containing error code. 129 129 */ 130 130 struct fpga_bridge *fpga_bridge_get(struct device *dev, 131 131 struct fpga_image_info *info)
+2 -1
drivers/fpga/of-fpga-region.c
··· 437 437 static int of_fpga_region_remove(struct platform_device *pdev) 438 438 { 439 439 struct fpga_region *region = platform_get_drvdata(pdev); 440 + struct fpga_manager *mgr = region->mgr; 440 441 441 442 fpga_region_unregister(region); 442 - fpga_mgr_put(region->mgr); 443 + fpga_mgr_put(mgr); 443 444 444 445 return 0; 445 446 }
+1 -1
drivers/gpio/gpiolib.c
··· 571 571 if (ret) 572 572 goto out_free_descs; 573 573 lh->descs[i] = desc; 574 - count = i; 574 + count = i + 1; 575 575 576 576 if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW) 577 577 set_bit(FLAG_ACTIVE_LOW, &desc->flags);
+29 -8
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
··· 358 358 struct queue *q, 359 359 struct qcm_process_device *qpd) 360 360 { 361 - int retval; 362 361 struct mqd_manager *mqd_mgr; 362 + int retval; 363 363 364 364 mqd_mgr = dqm->ops.get_mqd_manager(dqm, KFD_MQD_TYPE_COMPUTE); 365 365 if (!mqd_mgr) ··· 387 387 if (!q->properties.is_active) 388 388 return 0; 389 389 390 - retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue, 391 - &q->properties, q->process->mm); 390 + if (WARN(q->process->mm != current->mm, 391 + "should only run in user thread")) 392 + retval = -EFAULT; 393 + else 394 + retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue, 395 + &q->properties, current->mm); 392 396 if (retval) 393 397 goto out_uninit_mqd; 394 398 ··· 549 545 retval = map_queues_cpsch(dqm); 550 546 else if (q->properties.is_active && 551 547 (q->properties.type == KFD_QUEUE_TYPE_COMPUTE || 552 - q->properties.type == KFD_QUEUE_TYPE_SDMA)) 553 - retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, q->queue, 554 - &q->properties, q->process->mm); 548 + q->properties.type == KFD_QUEUE_TYPE_SDMA)) { 549 + if (WARN(q->process->mm != current->mm, 550 + "should only run in user thread")) 551 + retval = -EFAULT; 552 + else 553 + retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, 554 + q->pipe, q->queue, 555 + &q->properties, current->mm); 556 + } 555 557 556 558 out_unlock: 557 559 dqm_unlock(dqm); ··· 663 653 static int restore_process_queues_nocpsch(struct device_queue_manager *dqm, 664 654 struct qcm_process_device *qpd) 665 655 { 656 + struct mm_struct *mm = NULL; 666 657 struct queue *q; 667 658 struct mqd_manager *mqd_mgr; 668 659 struct kfd_process_device *pdd; ··· 697 686 kfd_flush_tlb(pdd); 698 687 } 699 688 689 + /* Take a safe reference to the mm_struct, which may otherwise 690 + * disappear even while the kfd_process is still referenced. 691 + */ 692 + mm = get_task_mm(pdd->process->lead_thread); 693 + if (!mm) { 694 + retval = -EFAULT; 695 + goto out; 696 + } 697 + 700 698 /* activate all active queues on the qpd */ 701 699 list_for_each_entry(q, &qpd->queues_list, list) { 702 700 if (!q->properties.is_evicted) ··· 720 700 q->properties.is_evicted = false; 721 701 q->properties.is_active = true; 722 702 retval = mqd_mgr->load_mqd(mqd_mgr, q->mqd, q->pipe, 723 - q->queue, &q->properties, 724 - q->process->mm); 703 + q->queue, &q->properties, mm); 725 704 if (retval) 726 705 goto out; 727 706 dqm->queue_count++; 728 707 } 729 708 qpd->evicted = 0; 730 709 out: 710 + if (mm) 711 + mmput(mm); 731 712 dqm_unlock(dqm); 732 713 return retval; 733 714 }
+8 -2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 4633 4633 } 4634 4634 spin_unlock_irqrestore(&adev->ddev->event_lock, flags); 4635 4635 4636 - /* Signal HW programming completion */ 4637 - drm_atomic_helper_commit_hw_done(state); 4638 4636 4639 4637 if (wait_for_vblank) 4640 4638 drm_atomic_helper_wait_for_flip_done(dev, state); 4639 + 4640 + /* 4641 + * FIXME: 4642 + * Delay hw_done() until flip_done() is signaled. This is to block 4643 + * another commit from freeing the CRTC state while we're still 4644 + * waiting on flip_done. 4645 + */ 4646 + drm_atomic_helper_commit_hw_done(state); 4641 4647 4642 4648 drm_atomic_helper_cleanup_planes(dev, state); 4643 4649
+26 -9
drivers/gpu/drm/drm_client.c
··· 63 63 EXPORT_SYMBOL(drm_client_close); 64 64 65 65 /** 66 - * drm_client_new - Create a DRM client 66 + * drm_client_init - Initialise a DRM client 67 67 * @dev: DRM device 68 68 * @client: DRM client 69 69 * @name: Client name 70 70 * @funcs: DRM client functions (optional) 71 71 * 72 + * This initialises the client and opens a &drm_file. Use drm_client_add() to complete the process. 72 73 * The caller needs to hold a reference on @dev before calling this function. 73 74 * The client is freed when the &drm_device is unregistered. See drm_client_release(). 74 75 * 75 76 * Returns: 76 77 * Zero on success or negative error code on failure. 77 78 */ 78 - int drm_client_new(struct drm_device *dev, struct drm_client_dev *client, 79 - const char *name, const struct drm_client_funcs *funcs) 79 + int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, 80 + const char *name, const struct drm_client_funcs *funcs) 80 81 { 81 82 int ret; 82 83 ··· 96 95 if (ret) 97 96 goto err_put_module; 98 97 99 - mutex_lock(&dev->clientlist_mutex); 100 - list_add(&client->list, &dev->clientlist); 101 - mutex_unlock(&dev->clientlist_mutex); 102 - 103 98 drm_dev_get(dev); 104 99 105 100 return 0; ··· 106 109 107 110 return ret; 108 111 } 109 - EXPORT_SYMBOL(drm_client_new); 112 + EXPORT_SYMBOL(drm_client_init); 113 + 114 + /** 115 + * drm_client_add - Add client to the device list 116 + * @client: DRM client 117 + * 118 + * Add the client to the &drm_device client list to activate its callbacks. 119 + * @client must be initialized by a call to drm_client_init(). After 120 + * drm_client_add() it is no longer permissible to call drm_client_release() 121 + * directly (outside the unregister callback), instead cleanup will happen 122 + * automatically on driver unload. 123 + */ 124 + void drm_client_add(struct drm_client_dev *client) 125 + { 126 + struct drm_device *dev = client->dev; 127 + 128 + mutex_lock(&dev->clientlist_mutex); 129 + list_add(&client->list, &dev->clientlist); 130 + mutex_unlock(&dev->clientlist_mutex); 131 + } 132 + EXPORT_SYMBOL(drm_client_add); 110 133 111 134 /** 112 135 * drm_client_release - Release DRM client resources 113 136 * @client: DRM client 114 137 * 115 - * Releases resources by closing the &drm_file that was opened by drm_client_new(). 138 + * Releases resources by closing the &drm_file that was opened by drm_client_init(). 116 139 * It is called automatically if the &drm_client_funcs.unregister callback is _not_ set. 117 140 * 118 141 * This function should only be called from the unregister callback. An exception
+3 -1
drivers/gpu/drm/drm_fb_cma_helper.c
··· 160 160 161 161 fb_helper = &fbdev_cma->fb_helper; 162 162 163 - ret = drm_client_new(dev, &fb_helper->client, "fbdev", NULL); 163 + ret = drm_client_init(dev, &fb_helper->client, "fbdev", NULL); 164 164 if (ret) 165 165 goto err_free; 166 166 ··· 168 168 preferred_bpp, max_conn_count); 169 169 if (ret) 170 170 goto err_client_put; 171 + 172 + drm_client_add(&fb_helper->client); 171 173 172 174 return fbdev_cma; 173 175
+3 -1
drivers/gpu/drm/drm_fb_helper.c
··· 3218 3218 if (!fb_helper) 3219 3219 return -ENOMEM; 3220 3220 3221 - ret = drm_client_new(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs); 3221 + ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs); 3222 3222 if (ret) { 3223 3223 kfree(fb_helper); 3224 3224 return ret; 3225 3225 } 3226 + 3227 + drm_client_add(&fb_helper->client); 3226 3228 3227 3229 fb_helper->preferred_bpp = preferred_bpp; 3228 3230
+3 -3
drivers/gpu/drm/drm_lease.c
··· 566 566 lessee_priv->is_master = 1; 567 567 lessee_priv->authenticated = 1; 568 568 569 - /* Hook up the fd */ 570 - fd_install(fd, lessee_file); 571 - 572 569 /* Pass fd back to userspace */ 573 570 DRM_DEBUG_LEASE("Returning fd %d id %d\n", fd, lessee->lessee_id); 574 571 cl->fd = fd; 575 572 cl->lessee_id = lessee->lessee_id; 573 + 574 + /* Hook up the fd */ 575 + fd_install(fd, lessee_file); 576 576 577 577 DRM_DEBUG_LEASE("drm_mode_create_lease_ioctl succeeded\n"); 578 578 return 0;
+6 -28
drivers/gpu/drm/exynos/exynos_drm_iommu.h
··· 55 55 static inline int __exynos_iommu_create_mapping(struct exynos_drm_private *priv, 56 56 unsigned long start, unsigned long size) 57 57 { 58 - struct iommu_domain *domain; 59 - int ret; 60 - 61 - domain = iommu_domain_alloc(priv->dma_dev->bus); 62 - if (!domain) 63 - return -ENOMEM; 64 - 65 - ret = iommu_get_dma_cookie(domain); 66 - if (ret) 67 - goto free_domain; 68 - 69 - ret = iommu_dma_init_domain(domain, start, size, NULL); 70 - if (ret) 71 - goto put_cookie; 72 - 73 - priv->mapping = domain; 58 + priv->mapping = iommu_get_domain_for_dev(priv->dma_dev); 74 59 return 0; 75 - 76 - put_cookie: 77 - iommu_put_dma_cookie(domain); 78 - free_domain: 79 - iommu_domain_free(domain); 80 - return ret; 81 60 } 82 61 83 62 static inline void __exynos_iommu_release_mapping(struct exynos_drm_private *priv) 84 63 { 85 - struct iommu_domain *domain = priv->mapping; 86 - 87 - iommu_put_dma_cookie(domain); 88 - iommu_domain_free(domain); 89 64 priv->mapping = NULL; 90 65 } 91 66 ··· 69 94 { 70 95 struct iommu_domain *domain = priv->mapping; 71 96 72 - return iommu_attach_device(domain, dev); 97 + if (dev != priv->dma_dev) 98 + return iommu_attach_device(domain, dev); 99 + return 0; 73 100 } 74 101 75 102 static inline void __exynos_iommu_detach(struct exynos_drm_private *priv, ··· 79 102 { 80 103 struct iommu_domain *domain = priv->mapping; 81 104 82 - iommu_detach_device(domain, dev); 105 + if (dev != priv->dma_dev) 106 + iommu_detach_device(domain, dev); 83 107 } 84 108 #else 85 109 #error Unsupported architecture and IOMMU/DMA-mapping glue code
+3 -2
drivers/gpu/drm/i2c/tda9950.c
··· 191 191 break; 192 192 } 193 193 /* TDA9950 executes all retries for us */ 194 - tx_status |= CEC_TX_STATUS_MAX_RETRIES; 194 + if (tx_status != CEC_TX_STATUS_OK) 195 + tx_status |= CEC_TX_STATUS_MAX_RETRIES; 195 196 cec_transmit_done(priv->adap, tx_status, arb_lost_cnt, 196 197 nack_cnt, 0, err_cnt); 197 198 break; ··· 311 310 /* Wait up to .5s for it to signal non-busy */ 312 311 do { 313 312 csr = tda9950_read(client, REG_CSR); 314 - if (!(csr & CSR_BUSY) || --timeout) 313 + if (!(csr & CSR_BUSY) || !--timeout) 315 314 break; 316 315 msleep(10); 317 316 } while (1);
+63 -25
drivers/gpu/drm/i915/i915_gpu_error.c
··· 232 232 return true; 233 233 } 234 234 235 + static void *compress_next_page(struct drm_i915_error_object *dst) 236 + { 237 + unsigned long page; 238 + 239 + if (dst->page_count >= dst->num_pages) 240 + return ERR_PTR(-ENOSPC); 241 + 242 + page = __get_free_page(GFP_ATOMIC | __GFP_NOWARN); 243 + if (!page) 244 + return ERR_PTR(-ENOMEM); 245 + 246 + return dst->pages[dst->page_count++] = (void *)page; 247 + } 248 + 235 249 static int compress_page(struct compress *c, 236 250 void *src, 237 251 struct drm_i915_error_object *dst) ··· 259 245 260 246 do { 261 247 if (zstream->avail_out == 0) { 262 - unsigned long page; 248 + zstream->next_out = compress_next_page(dst); 249 + if (IS_ERR(zstream->next_out)) 250 + return PTR_ERR(zstream->next_out); 263 251 264 - page = __get_free_page(GFP_ATOMIC | __GFP_NOWARN); 265 - if (!page) 266 - return -ENOMEM; 267 - 268 - dst->pages[dst->page_count++] = (void *)page; 269 - 270 - zstream->next_out = (void *)page; 271 252 zstream->avail_out = PAGE_SIZE; 272 253 } 273 254 274 - if (zlib_deflate(zstream, Z_SYNC_FLUSH) != Z_OK) 255 + if (zlib_deflate(zstream, Z_NO_FLUSH) != Z_OK) 275 256 return -EIO; 276 257 } while (zstream->avail_in); 277 258 ··· 277 268 return 0; 278 269 } 279 270 271 + static int compress_flush(struct compress *c, 272 + struct drm_i915_error_object *dst) 273 + { 274 + struct z_stream_s *zstream = &c->zstream; 275 + 276 + do { 277 + switch (zlib_deflate(zstream, Z_FINISH)) { 278 + case Z_OK: /* more space requested */ 279 + zstream->next_out = compress_next_page(dst); 280 + if (IS_ERR(zstream->next_out)) 281 + return PTR_ERR(zstream->next_out); 282 + 283 + zstream->avail_out = PAGE_SIZE; 284 + break; 285 + 286 + case Z_STREAM_END: 287 + goto end; 288 + 289 + default: /* any error */ 290 + return -EIO; 291 + } 292 + } while (1); 293 + 294 + end: 295 + memset(zstream->next_out, 0, zstream->avail_out); 296 + dst->unused = zstream->avail_out; 297 + return 0; 298 + } 299 + 280 300 static void compress_fini(struct compress *c, 281 301 struct drm_i915_error_object *dst) 282 302 { 283 303 struct z_stream_s *zstream = &c->zstream; 284 304 285 - if (dst) { 286 - zlib_deflate(zstream, Z_FINISH); 287 - dst->unused = zstream->avail_out; 288 - } 289 - 290 305 zlib_deflateEnd(zstream); 291 306 kfree(zstream->workspace); 292 - 293 307 if (c->tmp) 294 308 free_page((unsigned long)c->tmp); 295 309 } ··· 348 316 memcpy(ptr, src, PAGE_SIZE); 349 317 dst->pages[dst->page_count++] = ptr; 350 318 319 + return 0; 320 + } 321 + 322 + static int compress_flush(struct compress *c, 323 + struct drm_i915_error_object *dst) 324 + { 351 325 return 0; 352 326 } 353 327 ··· 955 917 unsigned long num_pages; 956 918 struct sgt_iter iter; 957 919 dma_addr_t dma; 920 + int ret; 958 921 959 922 if (!vma) 960 923 return NULL; ··· 969 930 970 931 dst->gtt_offset = vma->node.start; 971 932 dst->gtt_size = vma->node.size; 933 + dst->num_pages = num_pages; 972 934 dst->page_count = 0; 973 935 dst->unused = 0; 974 936 ··· 978 938 return NULL; 979 939 } 980 940 941 + ret = -EINVAL; 981 942 for_each_sgt_dma(dma, iter, vma->pages) { 982 943 void __iomem *s; 983 - int ret; 984 944 985 945 ggtt->vm.insert_page(&ggtt->vm, dma, slot, I915_CACHE_NONE, 0); 986 946 987 947 s = io_mapping_map_atomic_wc(&ggtt->iomap, slot); 988 948 ret = compress_page(&compress, (void __force *)s, dst); 989 949 io_mapping_unmap_atomic(s); 990 - 991 950 if (ret) 992 - goto unwind; 951 + break; 993 952 } 994 - goto out; 995 953 996 - unwind: 997 - while (dst->page_count--) 998 - free_page((unsigned long)dst->pages[dst->page_count]); 999 - kfree(dst); 1000 - dst = NULL; 954 + if (ret || compress_flush(&compress, dst)) { 955 + while (dst->page_count--) 956 + free_page((unsigned long)dst->pages[dst->page_count]); 957 + kfree(dst); 958 + dst = NULL; 959 + } 1001 960 1002 - out: 1003 961 compress_fini(&compress, dst); 1004 962 ggtt->vm.clear_range(&ggtt->vm, slot, PAGE_SIZE); 1005 963 return dst;
+1
drivers/gpu/drm/i915/i915_gpu_error.h
··· 135 135 struct drm_i915_error_object { 136 136 u64 gtt_offset; 137 137 u64 gtt_size; 138 + int num_pages; 138 139 int page_count; 139 140 int unused; 140 141 u32 *pages[0];
+12 -21
drivers/gpu/drm/i915/i915_irq.c
··· 3091 3091 spin_unlock(&i915->irq_lock); 3092 3092 } 3093 3093 3094 - static void 3095 - gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl, 3096 - u32 *iir) 3094 + static u32 3095 + gen11_gu_misc_irq_ack(struct drm_i915_private *dev_priv, const u32 master_ctl) 3097 3096 { 3098 3097 void __iomem * const regs = dev_priv->regs; 3098 + u32 iir; 3099 3099 3100 3100 if (!(master_ctl & GEN11_GU_MISC_IRQ)) 3101 - return; 3101 + return 0; 3102 3102 3103 - *iir = raw_reg_read(regs, GEN11_GU_MISC_IIR); 3104 - if (likely(*iir)) 3105 - raw_reg_write(regs, GEN11_GU_MISC_IIR, *iir); 3103 + iir = raw_reg_read(regs, GEN11_GU_MISC_IIR); 3104 + if (likely(iir)) 3105 + raw_reg_write(regs, GEN11_GU_MISC_IIR, iir); 3106 + 3107 + return iir; 3106 3108 } 3107 3109 3108 3110 static void 3109 - gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, 3110 - const u32 master_ctl, const u32 iir) 3111 + gen11_gu_misc_irq_handler(struct drm_i915_private *dev_priv, const u32 iir) 3111 3112 { 3112 - if (!(master_ctl & GEN11_GU_MISC_IRQ)) 3113 - return; 3114 - 3115 - if (unlikely(!iir)) { 3116 - DRM_ERROR("GU_MISC iir blank!\n"); 3117 - return; 3118 - } 3119 - 3120 3113 if (iir & GEN11_GU_MISC_GSE) 3121 3114 intel_opregion_asle_intr(dev_priv); 3122 - else 3123 - DRM_ERROR("Unexpected GU_MISC interrupt 0x%x\n", iir); 3124 3115 } 3125 3116 3126 3117 static irqreturn_t gen11_irq_handler(int irq, void *arg) ··· 3148 3157 enable_rpm_wakeref_asserts(i915); 3149 3158 } 3150 3159 3151 - gen11_gu_misc_irq_ack(i915, master_ctl, &gu_misc_iir); 3160 + gu_misc_iir = gen11_gu_misc_irq_ack(i915, master_ctl); 3152 3161 3153 3162 /* Acknowledge and enable interrupts. */ 3154 3163 raw_reg_write(regs, GEN11_GFX_MSTR_IRQ, GEN11_MASTER_IRQ | master_ctl); 3155 3164 3156 - gen11_gu_misc_irq_handler(i915, master_ctl, gu_misc_iir); 3165 + gen11_gu_misc_irq_handler(i915, gu_misc_iir); 3157 3166 3158 3167 return IRQ_HANDLED; 3159 3168 }
-1
drivers/gpu/drm/i915/i915_pci.c
··· 592 592 GEN10_FEATURES, \ 593 593 GEN(11), \ 594 594 .ddb_size = 2048, \ 595 - .has_csr = 0, \ 596 595 .has_logical_ring_elsq = 1 597 596 598 597 static const struct intel_device_info intel_icelake_11_info = {
-1
drivers/hid/hid-ids.h
··· 976 976 #define USB_DEVICE_ID_SIS817_TOUCH 0x0817 977 977 #define USB_DEVICE_ID_SIS_TS 0x1013 978 978 #define USB_DEVICE_ID_SIS1030_TOUCH 0x1030 979 - #define USB_DEVICE_ID_SIS10FB_TOUCH 0x10fb 980 979 981 980 #define USB_VENDOR_ID_SKYCABLE 0x1223 982 981 #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
+10 -17
drivers/hid/i2c-hid/i2c-hid.c
··· 47 47 /* quirks to control the device */ 48 48 #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0) 49 49 #define I2C_HID_QUIRK_NO_IRQ_AFTER_RESET BIT(1) 50 - #define I2C_HID_QUIRK_RESEND_REPORT_DESCR BIT(2) 50 + #define I2C_HID_QUIRK_NO_RUNTIME_PM BIT(2) 51 51 52 52 /* flags */ 53 53 #define I2C_HID_STARTED 0 ··· 169 169 { USB_VENDOR_ID_WEIDA, USB_DEVICE_ID_WEIDA_8755, 170 170 I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV }, 171 171 { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288, 172 - I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, 173 - { USB_VENDOR_ID_SIS_TOUCH, USB_DEVICE_ID_SIS10FB_TOUCH, 174 - I2C_HID_QUIRK_RESEND_REPORT_DESCR }, 172 + I2C_HID_QUIRK_NO_IRQ_AFTER_RESET | 173 + I2C_HID_QUIRK_NO_RUNTIME_PM }, 175 174 { 0, 0 } 176 175 }; 177 176 ··· 1104 1105 goto err_mem_free; 1105 1106 } 1106 1107 1107 - pm_runtime_put(&client->dev); 1108 + if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM)) 1109 + pm_runtime_put(&client->dev); 1110 + 1108 1111 return 0; 1109 1112 1110 1113 err_mem_free: ··· 1131 1130 struct i2c_hid *ihid = i2c_get_clientdata(client); 1132 1131 struct hid_device *hid; 1133 1132 1134 - pm_runtime_get_sync(&client->dev); 1133 + if (!(ihid->quirks & I2C_HID_QUIRK_NO_RUNTIME_PM)) 1134 + pm_runtime_get_sync(&client->dev); 1135 1135 pm_runtime_disable(&client->dev); 1136 1136 pm_runtime_set_suspended(&client->dev); 1137 1137 pm_runtime_put_noidle(&client->dev); ··· 1238 1236 1239 1237 /* Instead of resetting device, simply powers the device on. This 1240 1238 * solves "incomplete reports" on Raydium devices 2386:3118 and 1241 - * 2386:4B33 1239 + * 2386:4B33 and fixes various SIS touchscreens no longer sending 1240 + * data after a suspend/resume. 1242 1241 */ 1243 1242 ret = i2c_hid_set_power(client, I2C_HID_PWR_ON); 1244 1243 if (ret) 1245 1244 return ret; 1246 - 1247 - /* Some devices need to re-send report descr cmd 1248 - * after resume, after this it will be back normal. 1249 - * otherwise it issues too many incomplete reports. 1250 - */ 1251 - if (ihid->quirks & I2C_HID_QUIRK_RESEND_REPORT_DESCR) { 1252 - ret = i2c_hid_command(client, &hid_report_descr_cmd, NULL, 0); 1253 - if (ret) 1254 - return ret; 1255 - } 1256 1245 1257 1246 if (hid->driver && hid->driver->reset_resume) { 1258 1247 ret = hid->driver->reset_resume(hid);
+1
drivers/hid/intel-ish-hid/ipc/hw-ish.h
··· 29 29 #define CNL_Ax_DEVICE_ID 0x9DFC 30 30 #define GLK_Ax_DEVICE_ID 0x31A2 31 31 #define CNL_H_DEVICE_ID 0xA37C 32 + #define ICL_MOBILE_DEVICE_ID 0x34FC 32 33 #define SPT_H_DEVICE_ID 0xA135 33 34 34 35 #define REVISION_ID_CHT_A0 0x6
+1
drivers/hid/intel-ish-hid/ipc/pci-ish.c
··· 38 38 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_Ax_DEVICE_ID)}, 39 39 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, GLK_Ax_DEVICE_ID)}, 40 40 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_H_DEVICE_ID)}, 41 + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, ICL_MOBILE_DEVICE_ID)}, 41 42 {PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_H_DEVICE_ID)}, 42 43 {0, } 43 44 };
+5 -3
drivers/hv/connection.c
··· 76 76 __u32 version) 77 77 { 78 78 int ret = 0; 79 + unsigned int cur_cpu; 79 80 struct vmbus_channel_initiate_contact *msg; 80 81 unsigned long flags; 81 82 ··· 119 118 * the CPU attempting to connect may not be CPU 0. 120 119 */ 121 120 if (version >= VERSION_WIN8_1) { 122 - msg->target_vcpu = 123 - hv_cpu_number_to_vp_number(smp_processor_id()); 124 - vmbus_connection.connect_cpu = smp_processor_id(); 121 + cur_cpu = get_cpu(); 122 + msg->target_vcpu = hv_cpu_number_to_vp_number(cur_cpu); 123 + vmbus_connection.connect_cpu = cur_cpu; 124 + put_cpu(); 125 125 } else { 126 126 msg->target_vcpu = 0; 127 127 vmbus_connection.connect_cpu = 0;
+3 -1
drivers/i2c/busses/i2c-designware-master.c
··· 34 34 35 35 static int i2c_dw_set_timings_master(struct dw_i2c_dev *dev) 36 36 { 37 - u32 ic_clk = i2c_dw_clk_rate(dev); 38 37 const char *mode_str, *fp_str = ""; 39 38 u32 comp_param1; 40 39 u32 sda_falling_time, scl_falling_time; 41 40 struct i2c_timings *t = &dev->timings; 41 + u32 ic_clk; 42 42 int ret; 43 43 44 44 ret = i2c_dw_acquire_lock(dev); ··· 53 53 54 54 /* Calculate SCL timing parameters for standard mode if not set */ 55 55 if (!dev->ss_hcnt || !dev->ss_lcnt) { 56 + ic_clk = i2c_dw_clk_rate(dev); 56 57 dev->ss_hcnt = 57 58 i2c_dw_scl_hcnt(ic_clk, 58 59 4000, /* tHD;STA = tHIGH = 4.0 us */ ··· 90 89 * needed also in high speed mode. 91 90 */ 92 91 if (!dev->fs_hcnt || !dev->fs_lcnt) { 92 + ic_clk = i2c_dw_clk_rate(dev); 93 93 dev->fs_hcnt = 94 94 i2c_dw_scl_hcnt(ic_clk, 95 95 600, /* tHD;STA = tHIGH = 0.6 us */
+1 -1
drivers/i2c/busses/i2c-isch.c
··· 164 164 * run ~75 kHz instead which should do no harm. 165 165 */ 166 166 dev_notice(&sch_adapter.dev, 167 - "Clock divider unitialized. Setting defaults\n"); 167 + "Clock divider uninitialized. Setting defaults\n"); 168 168 outw(backbone_speed / (4 * 100), SMBHSTCLK); 169 169 } 170 170
+18 -4
drivers/i2c/busses/i2c-qcom-geni.c
··· 367 367 dma_addr_t rx_dma; 368 368 enum geni_se_xfer_mode mode; 369 369 unsigned long time_left = XFER_TIMEOUT; 370 + void *dma_buf; 370 371 371 372 gi2c->cur = msg; 372 - mode = msg->len > 32 ? GENI_SE_DMA : GENI_SE_FIFO; 373 + mode = GENI_SE_FIFO; 374 + dma_buf = i2c_get_dma_safe_msg_buf(msg, 32); 375 + if (dma_buf) 376 + mode = GENI_SE_DMA; 377 + 373 378 geni_se_select_mode(&gi2c->se, mode); 374 379 writel_relaxed(msg->len, gi2c->se.base + SE_I2C_RX_TRANS_LEN); 375 380 geni_se_setup_m_cmd(&gi2c->se, I2C_READ, m_param); 376 381 if (mode == GENI_SE_DMA) { 377 382 int ret; 378 383 379 - ret = geni_se_rx_dma_prep(&gi2c->se, msg->buf, msg->len, 384 + ret = geni_se_rx_dma_prep(&gi2c->se, dma_buf, msg->len, 380 385 &rx_dma); 381 386 if (ret) { 382 387 mode = GENI_SE_FIFO; 383 388 geni_se_select_mode(&gi2c->se, mode); 389 + i2c_put_dma_safe_msg_buf(dma_buf, msg, false); 384 390 } 385 391 } 386 392 ··· 399 393 if (gi2c->err) 400 394 geni_i2c_rx_fsm_rst(gi2c); 401 395 geni_se_rx_dma_unprep(&gi2c->se, rx_dma, msg->len); 396 + i2c_put_dma_safe_msg_buf(dma_buf, msg, !gi2c->err); 402 397 } 403 398 return gi2c->err; 404 399 } ··· 410 403 dma_addr_t tx_dma; 411 404 enum geni_se_xfer_mode mode; 412 405 unsigned long time_left; 406 + void *dma_buf; 413 407 414 408 gi2c->cur = msg; 415 - mode = msg->len > 32 ? GENI_SE_DMA : GENI_SE_FIFO; 409 + mode = GENI_SE_FIFO; 410 + dma_buf = i2c_get_dma_safe_msg_buf(msg, 32); 411 + if (dma_buf) 412 + mode = GENI_SE_DMA; 413 + 416 414 geni_se_select_mode(&gi2c->se, mode); 417 415 writel_relaxed(msg->len, gi2c->se.base + SE_I2C_TX_TRANS_LEN); 418 416 geni_se_setup_m_cmd(&gi2c->se, I2C_WRITE, m_param); 419 417 if (mode == GENI_SE_DMA) { 420 418 int ret; 421 419 422 - ret = geni_se_tx_dma_prep(&gi2c->se, msg->buf, msg->len, 420 + ret = geni_se_tx_dma_prep(&gi2c->se, dma_buf, msg->len, 423 421 &tx_dma); 424 422 if (ret) { 425 423 mode = GENI_SE_FIFO; 426 424 geni_se_select_mode(&gi2c->se, mode); 425 + i2c_put_dma_safe_msg_buf(dma_buf, msg, false); 427 426 } 428 427 } 429 428 ··· 445 432 if (gi2c->err) 446 433 geni_i2c_tx_fsm_rst(gi2c); 447 434 geni_se_tx_dma_unprep(&gi2c->se, tx_dma, msg->len); 435 + i2c_put_dma_safe_msg_buf(dma_buf, msg, !gi2c->err); 448 436 } 449 437 return gi2c->err; 450 438 }
+1
drivers/i2c/busses/i2c-scmi.c
··· 152 152 mt_params[3].type = ACPI_TYPE_INTEGER; 153 153 mt_params[3].integer.value = len; 154 154 mt_params[4].type = ACPI_TYPE_BUFFER; 155 + mt_params[4].buffer.length = len; 155 156 mt_params[4].buffer.pointer = data->block + 1; 156 157 } 157 158 break;
+1 -1
drivers/iommu/amd_iommu.c
··· 3069 3069 return 0; 3070 3070 3071 3071 offset_mask = pte_pgsize - 1; 3072 - __pte = *pte & PM_ADDR_MASK; 3072 + __pte = __sme_clr(*pte & PM_ADDR_MASK); 3073 3073 3074 3074 return (__pte & ~offset_mask) | (iova & offset_mask); 3075 3075 }
+2 -2
drivers/md/dm-cache-metadata.c
··· 1455 1455 if (hints_valid) { 1456 1456 r = dm_array_cursor_next(&cmd->hint_cursor); 1457 1457 if (r) { 1458 - DMERR("dm_array_cursor_next for hint failed"); 1459 - goto out; 1458 + dm_array_cursor_end(&cmd->hint_cursor); 1459 + hints_valid = false; 1460 1460 } 1461 1461 } 1462 1462
+7 -2
drivers/md/dm-cache-target.c
··· 3009 3009 3010 3010 static bool can_resize(struct cache *cache, dm_cblock_t new_size) 3011 3011 { 3012 - if (from_cblock(new_size) > from_cblock(cache->cache_size)) 3013 - return true; 3012 + if (from_cblock(new_size) > from_cblock(cache->cache_size)) { 3013 + if (cache->sized) { 3014 + DMERR("%s: unable to extend cache due to missing cache table reload", 3015 + cache_device_name(cache)); 3016 + return false; 3017 + } 3018 + } 3014 3019 3015 3020 /* 3016 3021 * We can't drop a dirty block when shrinking the cache.
+8 -6
drivers/md/dm-mpath.c
··· 806 806 } 807 807 808 808 static int setup_scsi_dh(struct block_device *bdev, struct multipath *m, 809 - const char *attached_handler_name, char **error) 809 + const char **attached_handler_name, char **error) 810 810 { 811 811 struct request_queue *q = bdev_get_queue(bdev); 812 812 int r; 813 813 814 814 if (test_bit(MPATHF_RETAIN_ATTACHED_HW_HANDLER, &m->flags)) { 815 815 retain: 816 - if (attached_handler_name) { 816 + if (*attached_handler_name) { 817 817 /* 818 818 * Clear any hw_handler_params associated with a 819 819 * handler that isn't already attached. 820 820 */ 821 - if (m->hw_handler_name && strcmp(attached_handler_name, m->hw_handler_name)) { 821 + if (m->hw_handler_name && strcmp(*attached_handler_name, m->hw_handler_name)) { 822 822 kfree(m->hw_handler_params); 823 823 m->hw_handler_params = NULL; 824 824 } ··· 830 830 * handler instead of the original table passed in. 831 831 */ 832 832 kfree(m->hw_handler_name); 833 - m->hw_handler_name = attached_handler_name; 833 + m->hw_handler_name = *attached_handler_name; 834 + *attached_handler_name = NULL; 834 835 } 835 836 } 836 837 ··· 868 867 struct pgpath *p; 869 868 struct multipath *m = ti->private; 870 869 struct request_queue *q; 871 - const char *attached_handler_name; 870 + const char *attached_handler_name = NULL; 872 871 873 872 /* we need at least a path arg */ 874 873 if (as->argc < 1) { ··· 891 890 attached_handler_name = scsi_dh_attached_handler_name(q, GFP_KERNEL); 892 891 if (attached_handler_name || m->hw_handler_name) { 893 892 INIT_DELAYED_WORK(&p->activate_path, activate_path_work); 894 - r = setup_scsi_dh(p->path.dev->bdev, m, attached_handler_name, &ti->error); 893 + r = setup_scsi_dh(p->path.dev->bdev, m, &attached_handler_name, &ti->error); 895 894 if (r) { 896 895 dm_put_device(ti, p->path.dev); 897 896 goto bad; ··· 906 905 907 906 return p; 908 907 bad: 908 + kfree(attached_handler_name); 909 909 free_pgpath(p); 910 910 return ERR_PTR(r); 911 911 }
+1 -1
drivers/md/dm-raid.c
··· 3353 3353 }; 3354 3354 3355 3355 /* Return enum sync_state for @mddev derived from @recovery flags */ 3356 - static const enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery) 3356 + static enum sync_state decipher_sync_action(struct mddev *mddev, unsigned long recovery) 3357 3357 { 3358 3358 if (test_bit(MD_RECOVERY_FROZEN, &recovery)) 3359 3359 return st_frozen;
+2 -4
drivers/md/dm-thin-metadata.c
··· 832 832 if (r) { 833 833 DMERR("could not get size of metadata device"); 834 834 pmd->metadata_reserve = max_blocks; 835 - } else { 836 - sector_div(total, 10); 837 - pmd->metadata_reserve = min(max_blocks, total); 838 - } 835 + } else 836 + pmd->metadata_reserve = min(max_blocks, div_u64(total, 10)); 839 837 } 840 838 841 839 struct dm_pool_metadata *dm_pool_metadata_open(struct block_device *bdev,
+20 -18
drivers/media/v4l2-core/v4l2-event.c
··· 115 115 if (sev == NULL) 116 116 return; 117 117 118 - /* 119 - * If the event has been added to the fh->subscribed list, but its 120 - * add op has not completed yet elems will be 0, treat this as 121 - * not being subscribed. 122 - */ 123 - if (!sev->elems) 124 - return; 125 - 126 118 /* Increase event sequence number on fh. */ 127 119 fh->sequence++; 128 120 ··· 200 208 struct v4l2_subscribed_event *sev, *found_ev; 201 209 unsigned long flags; 202 210 unsigned i; 211 + int ret = 0; 203 212 204 213 if (sub->type == V4L2_EVENT_ALL) 205 214 return -EINVAL; ··· 218 225 sev->flags = sub->flags; 219 226 sev->fh = fh; 220 227 sev->ops = ops; 228 + sev->elems = elems; 229 + 230 + mutex_lock(&fh->subscribe_lock); 221 231 222 232 spin_lock_irqsave(&fh->vdev->fh_lock, flags); 223 233 found_ev = v4l2_event_subscribed(fh, sub->type, sub->id); 224 - if (!found_ev) 225 - list_add(&sev->list, &fh->subscribed); 226 234 spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); 227 235 228 236 if (found_ev) { 237 + /* Already listening */ 229 238 kvfree(sev); 230 - return 0; /* Already listening */ 239 + goto out_unlock; 231 240 } 232 241 233 242 if (sev->ops && sev->ops->add) { 234 - int ret = sev->ops->add(sev, elems); 243 + ret = sev->ops->add(sev, elems); 235 244 if (ret) { 236 - sev->ops = NULL; 237 - v4l2_event_unsubscribe(fh, sub); 238 - return ret; 245 + kvfree(sev); 246 + goto out_unlock; 239 247 } 240 248 } 241 249 242 - /* Mark as ready for use */ 243 - sev->elems = elems; 250 + spin_lock_irqsave(&fh->vdev->fh_lock, flags); 251 + list_add(&sev->list, &fh->subscribed); 252 + spin_unlock_irqrestore(&fh->vdev->fh_lock, flags); 244 253 245 - return 0; 254 + out_unlock: 255 + mutex_unlock(&fh->subscribe_lock); 256 + 257 + return ret; 246 258 } 247 259 EXPORT_SYMBOL_GPL(v4l2_event_subscribe); 248 260 ··· 286 288 return 0; 287 289 } 288 290 291 + mutex_lock(&fh->subscribe_lock); 292 + 289 293 spin_lock_irqsave(&fh->vdev->fh_lock, flags); 290 294 291 295 sev = v4l2_event_subscribed(fh, sub->type, sub->id); ··· 304 304 305 305 if (sev && sev->ops && sev->ops->del) 306 306 sev->ops->del(sev); 307 + 308 + mutex_unlock(&fh->subscribe_lock); 307 309 308 310 kvfree(sev); 309 311
+2
drivers/media/v4l2-core/v4l2-fh.c
··· 45 45 INIT_LIST_HEAD(&fh->available); 46 46 INIT_LIST_HEAD(&fh->subscribed); 47 47 fh->sequence = -1; 48 + mutex_init(&fh->subscribe_lock); 48 49 } 49 50 EXPORT_SYMBOL_GPL(v4l2_fh_init); 50 51 ··· 91 90 return; 92 91 v4l_disable_media_source(fh->vdev); 93 92 v4l2_event_unsubscribe_all(fh); 93 + mutex_destroy(&fh->subscribe_lock); 94 94 fh->vdev = NULL; 95 95 } 96 96 EXPORT_SYMBOL_GPL(v4l2_fh_exit);
+1 -1
drivers/mmc/core/host.c
··· 235 235 host->caps |= MMC_CAP_NEEDS_POLL; 236 236 237 237 ret = mmc_gpiod_request_cd(host, "cd", 0, true, 238 - cd_debounce_delay_ms, 238 + cd_debounce_delay_ms * 1000, 239 239 &cd_gpio_invert); 240 240 if (!ret) 241 241 dev_info(host->parent, "Got CD GPIO\n");
+1 -1
drivers/mmc/core/slot-gpio.c
··· 271 271 if (debounce) { 272 272 ret = gpiod_set_debounce(desc, debounce); 273 273 if (ret < 0) 274 - ctx->cd_debounce_delay_ms = debounce; 274 + ctx->cd_debounce_delay_ms = debounce / 1000; 275 275 } 276 276 277 277 if (gpio_invert)
+2 -1
drivers/mmc/host/renesas_sdhi_sys_dmac.c
··· 498 498 499 499 static int renesas_sdhi_sys_dmac_probe(struct platform_device *pdev) 500 500 { 501 - if (of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible && 501 + if ((of_device_get_match_data(&pdev->dev) == &of_rcar_gen3_compatible || 502 + of_device_get_match_data(&pdev->dev) == &of_rcar_r8a7795_compatible) && 502 503 !soc_device_match(gen3_soc_whitelist)) 503 504 return -ENODEV; 504 505
+37 -28
drivers/net/bonding/bond_main.c
··· 210 210 static void bond_slave_arr_handler(struct work_struct *work); 211 211 static bool bond_time_in_interval(struct bonding *bond, unsigned long last_act, 212 212 int mod); 213 + static void bond_netdev_notify_work(struct work_struct *work); 213 214 214 215 /*---------------------------- General routines -----------------------------*/ 215 216 ··· 1171 1170 } 1172 1171 } 1173 1172 1174 - /* don't change skb->dev for link-local packets */ 1175 - if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) 1173 + /* Link-local multicast packets should be passed to the 1174 + * stack on the link they arrive as well as pass them to the 1175 + * bond-master device. These packets are mostly usable when 1176 + * stack receives it with the link on which they arrive 1177 + * (e.g. LLDP) they also must be available on master. Some of 1178 + * the use cases include (but are not limited to): LLDP agents 1179 + * that must be able to operate both on enslaved interfaces as 1180 + * well as on bonds themselves; linux bridges that must be able 1181 + * to process/pass BPDUs from attached bonds when any kind of 1182 + * STP version is enabled on the network. 1183 + */ 1184 + if (is_link_local_ether_addr(eth_hdr(skb)->h_dest)) { 1185 + struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); 1186 + 1187 + if (nskb) { 1188 + nskb->dev = bond->dev; 1189 + nskb->queue_mapping = 0; 1190 + netif_rx(nskb); 1191 + } 1176 1192 return RX_HANDLER_PASS; 1193 + } 1177 1194 if (bond_should_deliver_exact_match(skb, slave, bond)) 1178 1195 return RX_HANDLER_EXACT; 1179 1196 ··· 1288 1269 return NULL; 1289 1270 } 1290 1271 } 1272 + INIT_DELAYED_WORK(&slave->notify_work, bond_netdev_notify_work); 1273 + 1291 1274 return slave; 1292 1275 } 1293 1276 ··· 1297 1276 { 1298 1277 struct bonding *bond = bond_get_bond_by_slave(slave); 1299 1278 1279 + cancel_delayed_work_sync(&slave->notify_work); 1300 1280 if (BOND_MODE(bond) == BOND_MODE_8023AD) 1301 1281 kfree(SLAVE_AD_INFO(slave)); 1302 1282 ··· 1319 1297 info->link_failure_count = slave->link_failure_count; 1320 1298 } 1321 1299 1322 - static void bond_netdev_notify(struct net_device *dev, 1323 - struct netdev_bonding_info *info) 1324 - { 1325 - rtnl_lock(); 1326 - netdev_bonding_info_change(dev, info); 1327 - rtnl_unlock(); 1328 - } 1329 - 1330 1300 static void bond_netdev_notify_work(struct work_struct *_work) 1331 1301 { 1332 - struct netdev_notify_work *w = 1333 - container_of(_work, struct netdev_notify_work, work.work); 1302 + struct slave *slave = container_of(_work, struct slave, 1303 + notify_work.work); 1334 1304 1335 - bond_netdev_notify(w->dev, &w->bonding_info); 1336 - dev_put(w->dev); 1337 - kfree(w); 1305 + if (rtnl_trylock()) { 1306 + struct netdev_bonding_info binfo; 1307 + 1308 + bond_fill_ifslave(slave, &binfo.slave); 1309 + bond_fill_ifbond(slave->bond, &binfo.master); 1310 + netdev_bonding_info_change(slave->dev, &binfo); 1311 + rtnl_unlock(); 1312 + } else { 1313 + queue_delayed_work(slave->bond->wq, &slave->notify_work, 1); 1314 + } 1338 1315 } 1339 1316 1340 1317 void bond_queue_slave_event(struct slave *slave) 1341 1318 { 1342 - struct bonding *bond = slave->bond; 1343 - struct netdev_notify_work *nnw = kzalloc(sizeof(*nnw), GFP_ATOMIC); 1344 - 1345 - if (!nnw) 1346 - return; 1347 - 1348 - dev_hold(slave->dev); 1349 - nnw->dev = slave->dev; 1350 - bond_fill_ifslave(slave, &nnw->bonding_info.slave); 1351 - bond_fill_ifbond(bond, &nnw->bonding_info.master); 1352 - INIT_DELAYED_WORK(&nnw->work, bond_netdev_notify_work); 1353 - 1354 - queue_delayed_work(slave->bond->wq, &nnw->work, 0); 1319 + queue_delayed_work(slave->bond->wq, &slave->notify_work, 0); 1355 1320 } 1356 1321 1357 1322 void bond_lower_state_changed(struct slave *slave)
+2 -2
drivers/net/dsa/b53/b53_common.c
··· 1107 1107 b53_get_vlan_entry(dev, vid, vl); 1108 1108 1109 1109 vl->members |= BIT(port); 1110 - if (untagged) 1110 + if (untagged && !dsa_is_cpu_port(ds, port)) 1111 1111 vl->untag |= BIT(port); 1112 1112 else 1113 1113 vl->untag &= ~BIT(port); ··· 1149 1149 pvid = 0; 1150 1150 } 1151 1151 1152 - if (untagged) 1152 + if (untagged && !dsa_is_cpu_port(ds, port)) 1153 1153 vl->untag &= ~(BIT(port)); 1154 1154 1155 1155 b53_set_vlan_entry(dev, vid, vl);
-22
drivers/net/ethernet/amazon/ena/ena_netdev.c
··· 2185 2185 return NETDEV_TX_OK; 2186 2186 } 2187 2187 2188 - #ifdef CONFIG_NET_POLL_CONTROLLER 2189 - static void ena_netpoll(struct net_device *netdev) 2190 - { 2191 - struct ena_adapter *adapter = netdev_priv(netdev); 2192 - int i; 2193 - 2194 - /* Dont schedule NAPI if the driver is in the middle of reset 2195 - * or netdev is down. 2196 - */ 2197 - 2198 - if (!test_bit(ENA_FLAG_DEV_UP, &adapter->flags) || 2199 - test_bit(ENA_FLAG_TRIGGER_RESET, &adapter->flags)) 2200 - return; 2201 - 2202 - for (i = 0; i < adapter->num_queues; i++) 2203 - napi_schedule(&adapter->ena_napi[i].napi); 2204 - } 2205 - #endif /* CONFIG_NET_POLL_CONTROLLER */ 2206 - 2207 2188 static u16 ena_select_queue(struct net_device *dev, struct sk_buff *skb, 2208 2189 struct net_device *sb_dev, 2209 2190 select_queue_fallback_t fallback) ··· 2350 2369 .ndo_change_mtu = ena_change_mtu, 2351 2370 .ndo_set_mac_address = NULL, 2352 2371 .ndo_validate_addr = eth_validate_addr, 2353 - #ifdef CONFIG_NET_POLL_CONTROLLER 2354 - .ndo_poll_controller = ena_netpoll, 2355 - #endif /* CONFIG_NET_POLL_CONTROLLER */ 2356 2372 }; 2357 2373 2358 2374 static int ena_device_validate_params(struct ena_adapter *adapter,
+6 -4
drivers/net/ethernet/amd/declance.c
··· 1031 1031 int i, ret; 1032 1032 unsigned long esar_base; 1033 1033 unsigned char *esar; 1034 + const char *desc; 1034 1035 1035 1036 if (dec_lance_debug && version_printed++ == 0) 1036 1037 printk(version); ··· 1217 1216 */ 1218 1217 switch (type) { 1219 1218 case ASIC_LANCE: 1220 - printk("%s: IOASIC onboard LANCE", name); 1219 + desc = "IOASIC onboard LANCE"; 1221 1220 break; 1222 1221 case PMAD_LANCE: 1223 - printk("%s: PMAD-AA", name); 1222 + desc = "PMAD-AA"; 1224 1223 break; 1225 1224 case PMAX_LANCE: 1226 - printk("%s: PMAX onboard LANCE", name); 1225 + desc = "PMAX onboard LANCE"; 1227 1226 break; 1228 1227 } 1229 1228 for (i = 0; i < 6; i++) 1230 1229 dev->dev_addr[i] = esar[i * 4]; 1231 1230 1232 - printk(", addr = %pM, irq = %d\n", dev->dev_addr, dev->irq); 1231 + printk("%s: %s, addr = %pM, irq = %d\n", 1232 + name, desc, dev->dev_addr, dev->irq); 1233 1233 1234 1234 dev->netdev_ops = &lance_netdev_ops; 1235 1235 dev->watchdog_timeo = 5*HZ;
+11 -17
drivers/net/ethernet/broadcom/bcmsysport.c
··· 1069 1069 { 1070 1070 u32 reg; 1071 1071 1072 - /* Stop monitoring MPD interrupt */ 1073 - intrl2_0_mask_set(priv, INTRL2_0_MPD | INTRL2_0_BRCM_MATCH_TAG); 1074 - 1075 1072 /* Disable RXCHK, active filters and Broadcom tag matching */ 1076 1073 reg = rxchk_readl(priv, RXCHK_CONTROL); 1077 1074 reg &= ~(RXCHK_BRCM_TAG_MATCH_MASK << ··· 1077 1080 1078 1081 /* Clear the MagicPacket detection logic */ 1079 1082 mpd_enable_set(priv, false); 1083 + 1084 + reg = intrl2_0_readl(priv, INTRL2_CPU_STATUS); 1085 + if (reg & INTRL2_0_MPD) 1086 + netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n"); 1087 + 1088 + if (reg & INTRL2_0_BRCM_MATCH_TAG) { 1089 + reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) & 1090 + RXCHK_BRCM_TAG_MATCH_MASK; 1091 + netdev_info(priv->netdev, 1092 + "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg); 1093 + } 1080 1094 1081 1095 netif_dbg(priv, wol, priv->netdev, "resumed from WOL\n"); 1082 1096 } ··· 1113 1105 struct bcm_sysport_priv *priv = netdev_priv(dev); 1114 1106 struct bcm_sysport_tx_ring *txr; 1115 1107 unsigned int ring, ring_bit; 1116 - u32 reg; 1117 1108 1118 1109 priv->irq0_stat = intrl2_0_readl(priv, INTRL2_CPU_STATUS) & 1119 1110 ~intrl2_0_readl(priv, INTRL2_CPU_MASK_STATUS); ··· 1137 1130 */ 1138 1131 if (priv->irq0_stat & INTRL2_0_TX_RING_FULL) 1139 1132 bcm_sysport_tx_reclaim_all(priv); 1140 - 1141 - if (priv->irq0_stat & INTRL2_0_MPD) 1142 - netdev_info(priv->netdev, "Wake-on-LAN (MPD) interrupt!\n"); 1143 - 1144 - if (priv->irq0_stat & INTRL2_0_BRCM_MATCH_TAG) { 1145 - reg = rxchk_readl(priv, RXCHK_BRCM_TAG_MATCH_STATUS) & 1146 - RXCHK_BRCM_TAG_MATCH_MASK; 1147 - netdev_info(priv->netdev, 1148 - "Wake-on-LAN (filters 0x%02x) interrupt!\n", reg); 1149 - } 1150 1133 1151 1134 if (!priv->is_lite) 1152 1135 goto out; ··· 2637 2640 2638 2641 /* UniMAC receive needs to be turned on */ 2639 2642 umac_enable_set(priv, CMD_RX_EN, 1); 2640 - 2641 - /* Enable the interrupt wake-up source */ 2642 - intrl2_0_mask_clear(priv, INTRL2_0_MPD | INTRL2_0_BRCM_MATCH_TAG); 2643 2643 2644 2644 netif_dbg(priv, wol, ndev, "entered WOL mode\n"); 2645 2645
+18 -9
drivers/net/ethernet/broadcom/bnxt/bnxt.c
··· 1884 1884 if (TX_CMP_TYPE(txcmp) == CMP_TYPE_TX_L2_CMP) { 1885 1885 tx_pkts++; 1886 1886 /* return full budget so NAPI will complete. */ 1887 - if (unlikely(tx_pkts > bp->tx_wake_thresh)) 1887 + if (unlikely(tx_pkts > bp->tx_wake_thresh)) { 1888 1888 rx_pkts = budget; 1889 + raw_cons = NEXT_RAW_CMP(raw_cons); 1890 + break; 1891 + } 1889 1892 } else if ((TX_CMP_TYPE(txcmp) & 0x30) == 0x10) { 1890 1893 if (likely(budget)) 1891 1894 rc = bnxt_rx_pkt(bp, bnapi, &raw_cons, &event); ··· 1916 1913 } 1917 1914 raw_cons = NEXT_RAW_CMP(raw_cons); 1918 1915 1919 - if (rx_pkts == budget) 1916 + if (rx_pkts && rx_pkts == budget) 1920 1917 break; 1921 1918 } 1922 1919 ··· 2030 2027 while (1) { 2031 2028 work_done += bnxt_poll_work(bp, bnapi, budget - work_done); 2032 2029 2033 - if (work_done >= budget) 2030 + if (work_done >= budget) { 2031 + if (!budget) 2032 + BNXT_CP_DB_REARM(cpr->cp_doorbell, 2033 + cpr->cp_raw_cons); 2034 2034 break; 2035 + } 2035 2036 2036 2037 if (!bnxt_has_work(bp, cpr)) { 2037 2038 if (napi_complete_done(napi, work_done)) ··· 3017 3010 { 3018 3011 struct pci_dev *pdev = bp->pdev; 3019 3012 3020 - dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr, 3021 - bp->hwrm_cmd_resp_dma_addr); 3022 - 3023 - bp->hwrm_cmd_resp_addr = NULL; 3013 + if (bp->hwrm_cmd_resp_addr) { 3014 + dma_free_coherent(&pdev->dev, PAGE_SIZE, bp->hwrm_cmd_resp_addr, 3015 + bp->hwrm_cmd_resp_dma_addr); 3016 + bp->hwrm_cmd_resp_addr = NULL; 3017 + } 3024 3018 } 3025 3019 3026 3020 static int bnxt_alloc_hwrm_resources(struct bnxt *bp) ··· 4651 4643 FUNC_CFG_REQ_ENABLES_NUM_STAT_CTXS : 0; 4652 4644 enables |= ring_grps ? 4653 4645 FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS : 0; 4654 - enables |= vnics ? FUNC_VF_CFG_REQ_ENABLES_NUM_VNICS : 0; 4646 + enables |= vnics ? FUNC_CFG_REQ_ENABLES_NUM_VNICS : 0; 4655 4647 4656 4648 req->num_rx_rings = cpu_to_le16(rx_rings); 4657 4649 req->num_hw_ring_grps = cpu_to_le16(ring_grps); ··· 8622 8614 *max_tx = hw_resc->max_tx_rings; 8623 8615 *max_rx = hw_resc->max_rx_rings; 8624 8616 *max_cp = min_t(int, bnxt_get_max_func_cp_rings_for_en(bp), 8625 - hw_resc->max_irqs); 8617 + hw_resc->max_irqs - bnxt_get_ulp_msix_num(bp)); 8626 8618 *max_cp = min_t(int, *max_cp, hw_resc->max_stat_ctxs); 8627 8619 max_ring_grps = hw_resc->max_hw_ring_grps; 8628 8620 if (BNXT_CHIP_TYPE_NITRO_A0(bp) && BNXT_PF(bp)) { ··· 9058 9050 bnxt_clear_int_mode(bp); 9059 9051 9060 9052 init_err_pci_clean: 9053 + bnxt_free_hwrm_resources(bp); 9061 9054 bnxt_cleanup_pci(bp); 9062 9055 9063 9056 init_err_free:
+3 -3
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
··· 98 98 99 99 bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_QUEUE_COS2BW_CFG, -1, -1); 100 100 for (i = 0; i < max_tc; i++) { 101 - u8 qidx; 101 + u8 qidx = bp->tc_to_qidx[i]; 102 102 103 103 req.enables |= cpu_to_le32( 104 - QUEUE_COS2BW_CFG_REQ_ENABLES_COS_QUEUE_ID0_VALID << i); 104 + QUEUE_COS2BW_CFG_REQ_ENABLES_COS_QUEUE_ID0_VALID << 105 + qidx); 105 106 106 107 memset(&cos2bw, 0, sizeof(cos2bw)); 107 - qidx = bp->tc_to_qidx[i]; 108 108 cos2bw.queue_id = bp->q_info[qidx].queue_id; 109 109 if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_STRICT) { 110 110 cos2bw.tsa =
+1
drivers/net/ethernet/cadence/macb_main.c
··· 2160 2160 else 2161 2161 dmacfg &= ~GEM_BIT(TXCOEN); 2162 2162 2163 + dmacfg &= ~GEM_BIT(ADDR64); 2163 2164 #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT 2164 2165 if (bp->hw_dma_cap & HW_DMA_CAP_64B) 2165 2166 dmacfg |= GEM_BIT(ADDR64);
+17
drivers/net/ethernet/chelsio/cxgb3/cxgb3_main.c
··· 2159 2159 return -EPERM; 2160 2160 if (copy_from_user(&t, useraddr, sizeof(t))) 2161 2161 return -EFAULT; 2162 + if (t.cmd != CHELSIO_SET_QSET_PARAMS) 2163 + return -EINVAL; 2162 2164 if (t.qset_idx >= SGE_QSETS) 2163 2165 return -EINVAL; 2164 2166 if (!in_range(t.intr_lat, 0, M_NEWTIMER) || ··· 2260 2258 if (copy_from_user(&t, useraddr, sizeof(t))) 2261 2259 return -EFAULT; 2262 2260 2261 + if (t.cmd != CHELSIO_GET_QSET_PARAMS) 2262 + return -EINVAL; 2263 + 2263 2264 /* Display qsets for all ports when offload enabled */ 2264 2265 if (test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) { 2265 2266 q1 = 0; ··· 2308 2303 return -EBUSY; 2309 2304 if (copy_from_user(&edata, useraddr, sizeof(edata))) 2310 2305 return -EFAULT; 2306 + if (edata.cmd != CHELSIO_SET_QSET_NUM) 2307 + return -EINVAL; 2311 2308 if (edata.val < 1 || 2312 2309 (edata.val > 1 && !(adapter->flags & USING_MSIX))) 2313 2310 return -EINVAL; ··· 2350 2343 return -EPERM; 2351 2344 if (copy_from_user(&t, useraddr, sizeof(t))) 2352 2345 return -EFAULT; 2346 + if (t.cmd != CHELSIO_LOAD_FW) 2347 + return -EINVAL; 2353 2348 /* Check t.len sanity ? */ 2354 2349 fw_data = memdup_user(useraddr + sizeof(t), t.len); 2355 2350 if (IS_ERR(fw_data)) ··· 2375 2366 return -EBUSY; 2376 2367 if (copy_from_user(&m, useraddr, sizeof(m))) 2377 2368 return -EFAULT; 2369 + if (m.cmd != CHELSIO_SETMTUTAB) 2370 + return -EINVAL; 2378 2371 if (m.nmtus != NMTUS) 2379 2372 return -EINVAL; 2380 2373 if (m.mtus[0] < 81) /* accommodate SACK */ ··· 2418 2407 return -EBUSY; 2419 2408 if (copy_from_user(&m, useraddr, sizeof(m))) 2420 2409 return -EFAULT; 2410 + if (m.cmd != CHELSIO_SET_PM) 2411 + return -EINVAL; 2421 2412 if (!is_power_of_2(m.rx_pg_sz) || 2422 2413 !is_power_of_2(m.tx_pg_sz)) 2423 2414 return -EINVAL; /* not power of 2 */ ··· 2453 2440 return -EIO; /* need the memory controllers */ 2454 2441 if (copy_from_user(&t, useraddr, sizeof(t))) 2455 2442 return -EFAULT; 2443 + if (t.cmd != CHELSIO_GET_MEM) 2444 + return -EINVAL; 2456 2445 if ((t.addr & 7) || (t.len & 7)) 2457 2446 return -EINVAL; 2458 2447 if (t.mem_id == MEM_CM) ··· 2507 2492 return -EAGAIN; 2508 2493 if (copy_from_user(&t, useraddr, sizeof(t))) 2509 2494 return -EFAULT; 2495 + if (t.cmd != CHELSIO_SET_TRACE_FILTER) 2496 + return -EINVAL; 2510 2497 2511 2498 tp = (const struct trace_params *)&t.sip; 2512 2499 if (t.config_tx)
+1 -4
drivers/net/ethernet/emulex/benet/be_main.c
··· 4002 4002 netdev->hw_enc_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | 4003 4003 NETIF_F_TSO | NETIF_F_TSO6 | 4004 4004 NETIF_F_GSO_UDP_TUNNEL; 4005 - netdev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; 4006 - netdev->features |= NETIF_F_GSO_UDP_TUNNEL; 4007 4005 4008 4006 dev_info(dev, "Enabled VxLAN offloads for UDP port %d\n", 4009 4007 be16_to_cpu(port)); ··· 4023 4025 adapter->vxlan_port = 0; 4024 4026 4025 4027 netdev->hw_enc_features = 0; 4026 - netdev->hw_features &= ~(NETIF_F_GSO_UDP_TUNNEL); 4027 - netdev->features &= ~(NETIF_F_GSO_UDP_TUNNEL); 4028 4028 } 4029 4029 4030 4030 static void be_calculate_vf_res(struct be_adapter *adapter, u16 num_vfs, ··· 5316 5320 struct be_adapter *adapter = netdev_priv(netdev); 5317 5321 5318 5322 netdev->hw_features |= NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 | 5323 + NETIF_F_GSO_UDP_TUNNEL | 5319 5324 NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | 5320 5325 NETIF_F_HW_VLAN_CTAG_TX; 5321 5326 if ((be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS))
+4 -4
drivers/net/ethernet/freescale/fec_main.c
··· 1158 1158 napi_disable(&fep->napi); 1159 1159 netif_tx_lock_bh(ndev); 1160 1160 fec_restart(ndev); 1161 - netif_wake_queue(ndev); 1161 + netif_tx_wake_all_queues(ndev); 1162 1162 netif_tx_unlock_bh(ndev); 1163 1163 napi_enable(&fep->napi); 1164 1164 } ··· 1273 1273 1274 1274 /* Since we have freed up a buffer, the ring is no longer full 1275 1275 */ 1276 - if (netif_queue_stopped(ndev)) { 1276 + if (netif_tx_queue_stopped(nq)) { 1277 1277 entries_free = fec_enet_get_free_txdesc_num(txq); 1278 1278 if (entries_free >= txq->tx_wake_threshold) 1279 1279 netif_tx_wake_queue(nq); ··· 1746 1746 napi_disable(&fep->napi); 1747 1747 netif_tx_lock_bh(ndev); 1748 1748 fec_restart(ndev); 1749 - netif_wake_queue(ndev); 1749 + netif_tx_wake_all_queues(ndev); 1750 1750 netif_tx_unlock_bh(ndev); 1751 1751 napi_enable(&fep->napi); 1752 1752 } ··· 2247 2247 napi_disable(&fep->napi); 2248 2248 netif_tx_lock_bh(ndev); 2249 2249 fec_restart(ndev); 2250 - netif_wake_queue(ndev); 2250 + netif_tx_wake_all_queues(ndev); 2251 2251 netif_tx_unlock_bh(ndev); 2252 2252 napi_enable(&fep->napi); 2253 2253 }
+1 -1
drivers/net/ethernet/hisilicon/hns/hnae.c
··· 84 84 if (cb->type == DESC_TYPE_SKB) 85 85 dma_unmap_single(ring_to_dev(ring), cb->dma, cb->length, 86 86 ring_to_dma_dir(ring)); 87 - else 87 + else if (cb->length) 88 88 dma_unmap_page(ring_to_dev(ring), cb->dma, cb->length, 89 89 ring_to_dma_dir(ring)); 90 90 }
+19 -29
drivers/net/ethernet/hisilicon/hns/hns_enet.c
··· 40 40 #define SKB_TMP_LEN(SKB) \ 41 41 (((SKB)->transport_header - (SKB)->mac_header) + tcp_hdrlen(SKB)) 42 42 43 - static void fill_v2_desc(struct hnae_ring *ring, void *priv, 44 - int size, dma_addr_t dma, int frag_end, 45 - int buf_num, enum hns_desc_type type, int mtu) 43 + static void fill_v2_desc_hw(struct hnae_ring *ring, void *priv, int size, 44 + int send_sz, dma_addr_t dma, int frag_end, 45 + int buf_num, enum hns_desc_type type, int mtu) 46 46 { 47 47 struct hnae_desc *desc = &ring->desc[ring->next_to_use]; 48 48 struct hnae_desc_cb *desc_cb = &ring->desc_cb[ring->next_to_use]; ··· 64 64 desc_cb->type = type; 65 65 66 66 desc->addr = cpu_to_le64(dma); 67 - desc->tx.send_size = cpu_to_le16((u16)size); 67 + desc->tx.send_size = cpu_to_le16((u16)send_sz); 68 68 69 69 /* config bd buffer end */ 70 70 hnae_set_bit(rrcfv, HNSV2_TXD_VLD_B, 1); ··· 131 131 desc->tx.ra_ri_cs_fe_vld = rrcfv; 132 132 133 133 ring_ptr_move_fw(ring, next_to_use); 134 + } 135 + 136 + static void fill_v2_desc(struct hnae_ring *ring, void *priv, 137 + int size, dma_addr_t dma, int frag_end, 138 + int buf_num, enum hns_desc_type type, int mtu) 139 + { 140 + fill_v2_desc_hw(ring, priv, size, size, dma, frag_end, 141 + buf_num, type, mtu); 134 142 } 135 143 136 144 static const struct acpi_device_id hns_enet_acpi_match[] = { ··· 297 289 298 290 /* when the frag size is bigger than hardware, split this frag */ 299 291 for (k = 0; k < frag_buf_num; k++) 300 - fill_v2_desc(ring, priv, 301 - (k == frag_buf_num - 1) ? 292 + fill_v2_desc_hw(ring, priv, k == 0 ? size : 0, 293 + (k == frag_buf_num - 1) ? 302 294 sizeoflast : BD_MAX_SEND_SIZE, 303 - dma + BD_MAX_SEND_SIZE * k, 304 - frag_end && (k == frag_buf_num - 1) ? 1 : 0, 305 - buf_num, 306 - (type == DESC_TYPE_SKB && !k) ? 295 + dma + BD_MAX_SEND_SIZE * k, 296 + frag_end && (k == frag_buf_num - 1) ? 1 : 0, 297 + buf_num, 298 + (type == DESC_TYPE_SKB && !k) ? 307 299 DESC_TYPE_SKB : DESC_TYPE_PAGE, 308 - mtu); 300 + mtu); 309 301 } 310 302 311 303 netdev_tx_t hns_nic_net_xmit_hw(struct net_device *ndev, ··· 1503 1495 return phy_mii_ioctl(phy_dev, ifr, cmd); 1504 1496 } 1505 1497 1506 - /* use only for netconsole to poll with the device without interrupt */ 1507 - #ifdef CONFIG_NET_POLL_CONTROLLER 1508 - static void hns_nic_poll_controller(struct net_device *ndev) 1509 - { 1510 - struct hns_nic_priv *priv = netdev_priv(ndev); 1511 - unsigned long flags; 1512 - int i; 1513 - 1514 - local_irq_save(flags); 1515 - for (i = 0; i < priv->ae_handle->q_num * 2; i++) 1516 - napi_schedule(&priv->ring_data[i].napi); 1517 - local_irq_restore(flags); 1518 - } 1519 - #endif 1520 - 1521 1498 static netdev_tx_t hns_nic_net_xmit(struct sk_buff *skb, 1522 1499 struct net_device *ndev) 1523 1500 { ··· 1955 1962 .ndo_set_features = hns_nic_set_features, 1956 1963 .ndo_fix_features = hns_nic_fix_features, 1957 1964 .ndo_get_stats64 = hns_nic_get_stats64, 1958 - #ifdef CONFIG_NET_POLL_CONTROLLER 1959 - .ndo_poll_controller = hns_nic_poll_controller, 1960 - #endif 1961 1965 .ndo_set_rx_mode = hns_nic_set_rx_mode, 1962 1966 .ndo_select_queue = hns_nic_select_queue, 1963 1967 };
-20
drivers/net/ethernet/huawei/hinic/hinic_main.c
··· 789 789 stats->tx_errors = nic_tx_stats->tx_dropped; 790 790 } 791 791 792 - #ifdef CONFIG_NET_POLL_CONTROLLER 793 - static void hinic_netpoll(struct net_device *netdev) 794 - { 795 - struct hinic_dev *nic_dev = netdev_priv(netdev); 796 - int i, num_qps; 797 - 798 - num_qps = hinic_hwdev_num_qps(nic_dev->hwdev); 799 - for (i = 0; i < num_qps; i++) { 800 - struct hinic_txq *txq = &nic_dev->txqs[i]; 801 - struct hinic_rxq *rxq = &nic_dev->rxqs[i]; 802 - 803 - napi_schedule(&txq->napi); 804 - napi_schedule(&rxq->napi); 805 - } 806 - } 807 - #endif 808 - 809 792 static const struct net_device_ops hinic_netdev_ops = { 810 793 .ndo_open = hinic_open, 811 794 .ndo_stop = hinic_close, ··· 801 818 .ndo_start_xmit = hinic_xmit_frame, 802 819 .ndo_tx_timeout = hinic_tx_timeout, 803 820 .ndo_get_stats64 = hinic_get_stats64, 804 - #ifdef CONFIG_NET_POLL_CONTROLLER 805 - .ndo_poll_controller = hinic_netpoll, 806 - #endif 807 821 }; 808 822 809 823 static void netdev_features_init(struct net_device *netdev)
-14
drivers/net/ethernet/ibm/ehea/ehea_main.c
··· 921 921 return rx; 922 922 } 923 923 924 - #ifdef CONFIG_NET_POLL_CONTROLLER 925 - static void ehea_netpoll(struct net_device *dev) 926 - { 927 - struct ehea_port *port = netdev_priv(dev); 928 - int i; 929 - 930 - for (i = 0; i < port->num_def_qps; i++) 931 - napi_schedule(&port->port_res[i].napi); 932 - } 933 - #endif 934 - 935 924 static irqreturn_t ehea_recv_irq_handler(int irq, void *param) 936 925 { 937 926 struct ehea_port_res *pr = param; ··· 2942 2953 .ndo_open = ehea_open, 2943 2954 .ndo_stop = ehea_stop, 2944 2955 .ndo_start_xmit = ehea_start_xmit, 2945 - #ifdef CONFIG_NET_POLL_CONTROLLER 2946 - .ndo_poll_controller = ehea_netpoll, 2947 - #endif 2948 2956 .ndo_get_stats64 = ehea_get_stats64, 2949 2957 .ndo_set_mac_address = ehea_set_mac_addr, 2950 2958 .ndo_validate_addr = eth_validate_addr,
-16
drivers/net/ethernet/ibm/ibmvnic.c
··· 2207 2207 return frames_processed; 2208 2208 } 2209 2209 2210 - #ifdef CONFIG_NET_POLL_CONTROLLER 2211 - static void ibmvnic_netpoll_controller(struct net_device *dev) 2212 - { 2213 - struct ibmvnic_adapter *adapter = netdev_priv(dev); 2214 - int i; 2215 - 2216 - replenish_pools(netdev_priv(dev)); 2217 - for (i = 0; i < adapter->req_rx_queues; i++) 2218 - ibmvnic_interrupt_rx(adapter->rx_scrq[i]->irq, 2219 - adapter->rx_scrq[i]); 2220 - } 2221 - #endif 2222 - 2223 2210 static int wait_for_reset(struct ibmvnic_adapter *adapter) 2224 2211 { 2225 2212 int rc, ret; ··· 2279 2292 .ndo_set_mac_address = ibmvnic_set_mac, 2280 2293 .ndo_validate_addr = eth_validate_addr, 2281 2294 .ndo_tx_timeout = ibmvnic_tx_timeout, 2282 - #ifdef CONFIG_NET_POLL_CONTROLLER 2283 - .ndo_poll_controller = ibmvnic_netpoll_controller, 2284 - #endif 2285 2295 .ndo_change_mtu = ibmvnic_change_mtu, 2286 2296 .ndo_features_check = ibmvnic_features_check, 2287 2297 };
+7 -5
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
··· 3196 3196 return budget; 3197 3197 3198 3198 /* all work done, exit the polling mode */ 3199 - napi_complete_done(napi, work_done); 3200 - if (adapter->rx_itr_setting & 1) 3201 - ixgbe_set_itr(q_vector); 3202 - if (!test_bit(__IXGBE_DOWN, &adapter->state)) 3203 - ixgbe_irq_enable_queues(adapter, BIT_ULL(q_vector->v_idx)); 3199 + if (likely(napi_complete_done(napi, work_done))) { 3200 + if (adapter->rx_itr_setting & 1) 3201 + ixgbe_set_itr(q_vector); 3202 + if (!test_bit(__IXGBE_DOWN, &adapter->state)) 3203 + ixgbe_irq_enable_queues(adapter, 3204 + BIT_ULL(q_vector->v_idx)); 3205 + } 3204 3206 3205 3207 return min(work_done, budget - 1); 3206 3208 }
+5 -4
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 1725 1725 } 1726 1726 1727 1727 /* Set Tx descriptors fields relevant for CSUM calculation */ 1728 - static u32 mvpp2_txq_desc_csum(int l3_offs, int l3_proto, 1728 + static u32 mvpp2_txq_desc_csum(int l3_offs, __be16 l3_proto, 1729 1729 int ip_hdr_len, int l4_proto) 1730 1730 { 1731 1731 u32 command; ··· 2600 2600 if (skb->ip_summed == CHECKSUM_PARTIAL) { 2601 2601 int ip_hdr_len = 0; 2602 2602 u8 l4_proto; 2603 + __be16 l3_proto = vlan_get_protocol(skb); 2603 2604 2604 - if (skb->protocol == htons(ETH_P_IP)) { 2605 + if (l3_proto == htons(ETH_P_IP)) { 2605 2606 struct iphdr *ip4h = ip_hdr(skb); 2606 2607 2607 2608 /* Calculate IPv4 checksum and L4 checksum */ 2608 2609 ip_hdr_len = ip4h->ihl; 2609 2610 l4_proto = ip4h->protocol; 2610 - } else if (skb->protocol == htons(ETH_P_IPV6)) { 2611 + } else if (l3_proto == htons(ETH_P_IPV6)) { 2611 2612 struct ipv6hdr *ip6h = ipv6_hdr(skb); 2612 2613 2613 2614 /* Read l4_protocol from one of IPv6 extra headers */ ··· 2620 2619 } 2621 2620 2622 2621 return mvpp2_txq_desc_csum(skb_network_offset(skb), 2623 - skb->protocol, ip_hdr_len, l4_proto); 2622 + l3_proto, ip_hdr_len, l4_proto); 2624 2623 } 2625 2624 2626 2625 return MVPP2_TXD_L4_CSUM_NOT | MVPP2_TXD_IP_CSUM_DISABLE;
+1
drivers/net/ethernet/mellanox/mlx5/core/en.h
··· 54 54 #include "en_stats.h" 55 55 #include "en/fs.h" 56 56 57 + extern const struct net_device_ops mlx5e_netdev_ops; 57 58 struct page_pool; 58 59 59 60 #define MLX5E_METADATA_ETHER_TYPE (0x8CE4)
+2
drivers/net/ethernet/mellanox/mlx5/core/en/fs.h
··· 16 16 17 17 DECLARE_HASHTABLE(mod_hdr_tbl, 8); 18 18 DECLARE_HASHTABLE(hairpin_tbl, 8); 19 + 20 + struct notifier_block netdevice_nb; 19 21 }; 20 22 21 23 struct mlx5e_flow_table {
+1 -1
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
··· 4315 4315 } 4316 4316 } 4317 4317 4318 - static const struct net_device_ops mlx5e_netdev_ops = { 4318 + const struct net_device_ops mlx5e_netdev_ops = { 4319 4319 .ndo_open = mlx5e_open, 4320 4320 .ndo_stop = mlx5e_close, 4321 4321 .ndo_start_xmit = mlx5e_xmit,
+64 -1
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
··· 1368 1368 1369 1369 *match_level = MLX5_MATCH_L2; 1370 1370 } 1371 + } else { 1372 + MLX5_SET(fte_match_set_lyr_2_4, headers_c, svlan_tag, 1); 1373 + MLX5_SET(fte_match_set_lyr_2_4, headers_c, cvlan_tag, 1); 1371 1374 } 1372 1375 1373 1376 if (dissector_uses_key(f->dissector, FLOW_DISSECTOR_KEY_CVLAN)) { ··· 2949 2946 return 0; 2950 2947 } 2951 2948 2949 + static void mlx5e_tc_hairpin_update_dead_peer(struct mlx5e_priv *priv, 2950 + struct mlx5e_priv *peer_priv) 2951 + { 2952 + struct mlx5_core_dev *peer_mdev = peer_priv->mdev; 2953 + struct mlx5e_hairpin_entry *hpe; 2954 + u16 peer_vhca_id; 2955 + int bkt; 2956 + 2957 + if (!same_hw_devs(priv, peer_priv)) 2958 + return; 2959 + 2960 + peer_vhca_id = MLX5_CAP_GEN(peer_mdev, vhca_id); 2961 + 2962 + hash_for_each(priv->fs.tc.hairpin_tbl, bkt, hpe, hairpin_hlist) { 2963 + if (hpe->peer_vhca_id == peer_vhca_id) 2964 + hpe->hp->pair->peer_gone = true; 2965 + } 2966 + } 2967 + 2968 + static int mlx5e_tc_netdev_event(struct notifier_block *this, 2969 + unsigned long event, void *ptr) 2970 + { 2971 + struct net_device *ndev = netdev_notifier_info_to_dev(ptr); 2972 + struct mlx5e_flow_steering *fs; 2973 + struct mlx5e_priv *peer_priv; 2974 + struct mlx5e_tc_table *tc; 2975 + struct mlx5e_priv *priv; 2976 + 2977 + if (ndev->netdev_ops != &mlx5e_netdev_ops || 2978 + event != NETDEV_UNREGISTER || 2979 + ndev->reg_state == NETREG_REGISTERED) 2980 + return NOTIFY_DONE; 2981 + 2982 + tc = container_of(this, struct mlx5e_tc_table, netdevice_nb); 2983 + fs = container_of(tc, struct mlx5e_flow_steering, tc); 2984 + priv = container_of(fs, struct mlx5e_priv, fs); 2985 + peer_priv = netdev_priv(ndev); 2986 + if (priv == peer_priv || 2987 + !(priv->netdev->features & NETIF_F_HW_TC)) 2988 + return NOTIFY_DONE; 2989 + 2990 + mlx5e_tc_hairpin_update_dead_peer(priv, peer_priv); 2991 + 2992 + return NOTIFY_DONE; 2993 + } 2994 + 2952 2995 int mlx5e_tc_nic_init(struct mlx5e_priv *priv) 2953 2996 { 2954 2997 struct mlx5e_tc_table *tc = &priv->fs.tc; 2998 + int err; 2955 2999 2956 3000 hash_init(tc->mod_hdr_tbl); 2957 3001 hash_init(tc->hairpin_tbl); 2958 3002 2959 - return rhashtable_init(&tc->ht, &tc_ht_params); 3003 + err = rhashtable_init(&tc->ht, &tc_ht_params); 3004 + if (err) 3005 + return err; 3006 + 3007 + tc->netdevice_nb.notifier_call = mlx5e_tc_netdev_event; 3008 + if (register_netdevice_notifier(&tc->netdevice_nb)) { 3009 + tc->netdevice_nb.notifier_call = NULL; 3010 + mlx5_core_warn(priv->mdev, "Failed to register netdev notifier\n"); 3011 + } 3012 + 3013 + return err; 2960 3014 } 2961 3015 2962 3016 static void _mlx5e_tc_del_flow(void *ptr, void *arg) ··· 3028 2968 void mlx5e_tc_nic_cleanup(struct mlx5e_priv *priv) 3029 2969 { 3030 2970 struct mlx5e_tc_table *tc = &priv->fs.tc; 2971 + 2972 + if (tc->netdevice_nb.notifier_call) 2973 + unregister_netdevice_notifier(&tc->netdevice_nb); 3031 2974 3032 2975 rhashtable_free_and_destroy(&tc->ht, _mlx5e_tc_del_flow, NULL); 3033 2976
+2 -2
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
··· 2000 2000 u32 max_guarantee = 0; 2001 2001 int i; 2002 2002 2003 - for (i = 0; i <= esw->total_vports; i++) { 2003 + for (i = 0; i < esw->total_vports; i++) { 2004 2004 evport = &esw->vports[i]; 2005 2005 if (!evport->enabled || evport->info.min_rate < max_guarantee) 2006 2006 continue; ··· 2020 2020 int err; 2021 2021 int i; 2022 2022 2023 - for (i = 0; i <= esw->total_vports; i++) { 2023 + for (i = 0; i < esw->total_vports; i++) { 2024 2024 evport = &esw->vports[i]; 2025 2025 if (!evport->enabled) 2026 2026 continue;
+4 -1
drivers/net/ethernet/mellanox/mlx5/core/transobj.c
··· 475 475 476 476 for (i = 0; i < hp->num_channels; i++) { 477 477 mlx5_core_destroy_rq(hp->func_mdev, hp->rqn[i]); 478 - mlx5_core_destroy_sq(hp->peer_mdev, hp->sqn[i]); 478 + if (!hp->peer_gone) 479 + mlx5_core_destroy_sq(hp->peer_mdev, hp->sqn[i]); 479 480 } 480 481 } 481 482 ··· 568 567 MLX5_RQC_STATE_RST, 0, 0); 569 568 570 569 /* unset peer SQs */ 570 + if (hp->peer_gone) 571 + return; 571 572 for (i = 0; i < hp->num_channels; i++) 572 573 mlx5_hairpin_modify_sq(hp->peer_mdev, hp->sqn[i], MLX5_SQC_STATE_RDY, 573 574 MLX5_SQC_STATE_RST, 0, 0);
+7 -4
drivers/net/ethernet/mellanox/mlxsw/pci.c
··· 718 718 memset(&active_cqns, 0, sizeof(active_cqns)); 719 719 720 720 while ((eqe = mlxsw_pci_eq_sw_eqe_get(q))) { 721 - u8 event_type = mlxsw_pci_eqe_event_type_get(eqe); 722 721 723 - switch (event_type) { 724 - case MLXSW_PCI_EQE_EVENT_TYPE_CMD: 722 + /* Command interface completion events are always received on 723 + * queue MLXSW_PCI_EQ_ASYNC_NUM (EQ0) and completion events 724 + * are mapped to queue MLXSW_PCI_EQ_COMP_NUM (EQ1). 725 + */ 726 + switch (q->num) { 727 + case MLXSW_PCI_EQ_ASYNC_NUM: 725 728 mlxsw_pci_eq_cmd_event(mlxsw_pci, eqe); 726 729 q->u.eq.ev_cmd_count++; 727 730 break; 728 - case MLXSW_PCI_EQE_EVENT_TYPE_COMP: 731 + case MLXSW_PCI_EQ_COMP_NUM: 729 732 cqn = mlxsw_pci_eqe_cqn_get(eqe); 730 733 set_bit(cqn, active_cqns); 731 734 cq_handle = true;
+2
drivers/net/ethernet/mellanox/mlxsw/spectrum.c
··· 4845 4845 upper_dev = info->upper_dev; 4846 4846 if (info->linking) 4847 4847 break; 4848 + if (is_vlan_dev(upper_dev)) 4849 + mlxsw_sp_rif_destroy_by_dev(mlxsw_sp, upper_dev); 4848 4850 if (netif_is_macvlan(upper_dev)) 4849 4851 mlxsw_sp_rif_macvlan_del(mlxsw_sp, upper_dev); 4850 4852 break;
+12 -5
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
··· 2077 2077 return true; 2078 2078 } 2079 2079 2080 - static void nfp_ctrl_rx(struct nfp_net_r_vector *r_vec) 2080 + static bool nfp_ctrl_rx(struct nfp_net_r_vector *r_vec) 2081 2081 { 2082 2082 struct nfp_net_rx_ring *rx_ring = r_vec->rx_ring; 2083 2083 struct nfp_net *nn = r_vec->nfp_net; 2084 2084 struct nfp_net_dp *dp = &nn->dp; 2085 + unsigned int budget = 512; 2085 2086 2086 - while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring)) 2087 + while (nfp_ctrl_rx_one(nn, dp, r_vec, rx_ring) && budget--) 2087 2088 continue; 2089 + 2090 + return budget; 2088 2091 } 2089 2092 2090 2093 static void nfp_ctrl_poll(unsigned long arg) ··· 2099 2096 __nfp_ctrl_tx_queued(r_vec); 2100 2097 spin_unlock_bh(&r_vec->lock); 2101 2098 2102 - nfp_ctrl_rx(r_vec); 2103 - 2104 - nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry); 2099 + if (nfp_ctrl_rx(r_vec)) { 2100 + nfp_net_irq_unmask(r_vec->nfp_net, r_vec->irq_entry); 2101 + } else { 2102 + tasklet_schedule(&r_vec->tasklet); 2103 + nn_dp_warn(&r_vec->nfp_net->dp, 2104 + "control message budget exceeded!\n"); 2105 + } 2105 2106 } 2106 2107 2107 2108 /* Setup and Configuration
-23
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
··· 72 72 work_func_t func, int delay); 73 73 static void netxen_cancel_fw_work(struct netxen_adapter *adapter); 74 74 static int netxen_nic_poll(struct napi_struct *napi, int budget); 75 - #ifdef CONFIG_NET_POLL_CONTROLLER 76 - static void netxen_nic_poll_controller(struct net_device *netdev); 77 - #endif 78 75 79 76 static void netxen_create_sysfs_entries(struct netxen_adapter *adapter); 80 77 static void netxen_remove_sysfs_entries(struct netxen_adapter *adapter); ··· 578 581 .ndo_tx_timeout = netxen_tx_timeout, 579 582 .ndo_fix_features = netxen_fix_features, 580 583 .ndo_set_features = netxen_set_features, 581 - #ifdef CONFIG_NET_POLL_CONTROLLER 582 - .ndo_poll_controller = netxen_nic_poll_controller, 583 - #endif 584 584 }; 585 585 586 586 static inline bool netxen_function_zero(struct pci_dev *pdev) ··· 2395 2401 2396 2402 return work_done; 2397 2403 } 2398 - 2399 - #ifdef CONFIG_NET_POLL_CONTROLLER 2400 - static void netxen_nic_poll_controller(struct net_device *netdev) 2401 - { 2402 - int ring; 2403 - struct nx_host_sds_ring *sds_ring; 2404 - struct netxen_adapter *adapter = netdev_priv(netdev); 2405 - struct netxen_recv_context *recv_ctx = &adapter->recv_ctx; 2406 - 2407 - disable_irq(adapter->irq); 2408 - for (ring = 0; ring < adapter->max_sds_rings; ring++) { 2409 - sds_ring = &recv_ctx->sds_rings[ring]; 2410 - netxen_intr(adapter->irq, sds_ring); 2411 - } 2412 - enable_irq(adapter->irq); 2413 - } 2414 - #endif 2415 2404 2416 2405 static int 2417 2406 nx_incr_dev_ref_cnt(struct netxen_adapter *adapter)
+1
drivers/net/ethernet/qlogic/qed/qed_hsi.h
··· 11987 11987 u32 running_bundle_id; 11988 11988 s32 external_temperature; 11989 11989 u32 mdump_reason; 11990 + u64 reserved; 11990 11991 u32 data_ptr; 11991 11992 u32 data_size; 11992 11993 };
+2 -2
drivers/net/ethernet/qlogic/qed/qed_iwarp.c
··· 1710 1710 1711 1711 cm_info->local_ip[0] = ntohl(iph->daddr); 1712 1712 cm_info->remote_ip[0] = ntohl(iph->saddr); 1713 - cm_info->ip_version = TCP_IPV4; 1713 + cm_info->ip_version = QED_TCP_IPV4; 1714 1714 1715 1715 ip_hlen = (iph->ihl) * sizeof(u32); 1716 1716 *payload_len = ntohs(iph->tot_len) - ip_hlen; ··· 1730 1730 cm_info->remote_ip[i] = 1731 1731 ntohl(ip6h->saddr.in6_u.u6_addr32[i]); 1732 1732 } 1733 - cm_info->ip_version = TCP_IPV6; 1733 + cm_info->ip_version = QED_TCP_IPV6; 1734 1734 1735 1735 ip_hlen = sizeof(*ip6h); 1736 1736 *payload_len = ntohs(ip6h->payload_len);
+1 -1
drivers/net/ethernet/qlogic/qed/qed_rdma.c
··· 228 228 num_cons, "Toggle"); 229 229 if (rc) { 230 230 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, 231 - "Failed to allocate toogle bits, rc = %d\n", rc); 231 + "Failed to allocate toggle bits, rc = %d\n", rc); 232 232 goto free_cq_map; 233 233 } 234 234
+4 -11
drivers/net/ethernet/qlogic/qed/qed_roce.c
··· 140 140 141 141 static enum roce_flavor qed_roce_mode_to_flavor(enum roce_mode roce_mode) 142 142 { 143 - enum roce_flavor flavor; 144 - 145 143 switch (roce_mode) { 146 144 case ROCE_V1: 147 - flavor = PLAIN_ROCE; 148 - break; 145 + return PLAIN_ROCE; 149 146 case ROCE_V2_IPV4: 150 - flavor = RROCE_IPV4; 151 - break; 147 + return RROCE_IPV4; 152 148 case ROCE_V2_IPV6: 153 - flavor = ROCE_V2_IPV6; 154 - break; 149 + return RROCE_IPV6; 155 150 default: 156 - flavor = MAX_ROCE_MODE; 157 - break; 151 + return MAX_ROCE_FLAVOR; 158 152 } 159 - return flavor; 160 153 } 161 154 162 155 static void qed_roce_free_cid_pair(struct qed_hwfn *p_hwfn, u16 cid)
+1 -1
drivers/net/ethernet/qlogic/qed/qed_sp_commands.c
··· 154 154 static void qed_set_tunn_cls_info(struct qed_tunnel_info *p_tun, 155 155 struct qed_tunnel_info *p_src) 156 156 { 157 - enum tunnel_clss type; 157 + int type; 158 158 159 159 p_tun->b_update_rx_cls = p_src->b_update_rx_cls; 160 160 p_tun->b_update_tx_cls = p_src->b_update_tx_cls;
+2 -3
drivers/net/ethernet/qlogic/qed/qed_vf.c
··· 413 413 } 414 414 415 415 if (!p_iov->b_pre_fp_hsi && 416 - ETH_HSI_VER_MINOR && 417 416 (resp->pfdev_info.minor_fp_hsi < ETH_HSI_VER_MINOR)) { 418 417 DP_INFO(p_hwfn, 419 418 "PF is using older fastpath HSI; %02x.%02x is configured\n", ··· 571 572 static void 572 573 __qed_vf_prep_tunn_req_tlv(struct vfpf_update_tunn_param_tlv *p_req, 573 574 struct qed_tunn_update_type *p_src, 574 - enum qed_tunn_clss mask, u8 *p_cls) 575 + enum qed_tunn_mode mask, u8 *p_cls) 575 576 { 576 577 if (p_src->b_update_mode) { 577 578 p_req->tun_mode_update_mask |= BIT(mask); ··· 586 587 static void 587 588 qed_vf_prep_tunn_req_tlv(struct vfpf_update_tunn_param_tlv *p_req, 588 589 struct qed_tunn_update_type *p_src, 589 - enum qed_tunn_clss mask, 590 + enum qed_tunn_mode mask, 590 591 u8 *p_cls, struct qed_tunn_update_udp_port *p_port, 591 592 u8 *p_update_port, u16 *p_udp_port) 592 593 {
+5 -3
drivers/net/ethernet/qlogic/qlcnic/qlcnic.h
··· 1800 1800 int (*config_loopback) (struct qlcnic_adapter *, u8); 1801 1801 int (*clear_loopback) (struct qlcnic_adapter *, u8); 1802 1802 int (*config_promisc_mode) (struct qlcnic_adapter *, u32); 1803 - void (*change_l2_filter) (struct qlcnic_adapter *, u64 *, u16); 1803 + void (*change_l2_filter)(struct qlcnic_adapter *adapter, u64 *addr, 1804 + u16 vlan, struct qlcnic_host_tx_ring *tx_ring); 1804 1805 int (*get_board_info) (struct qlcnic_adapter *); 1805 1806 void (*set_mac_filter_count) (struct qlcnic_adapter *); 1806 1807 void (*free_mac_list) (struct qlcnic_adapter *); ··· 2065 2064 } 2066 2065 2067 2066 static inline void qlcnic_change_filter(struct qlcnic_adapter *adapter, 2068 - u64 *addr, u16 id) 2067 + u64 *addr, u16 vlan, 2068 + struct qlcnic_host_tx_ring *tx_ring) 2069 2069 { 2070 - adapter->ahw->hw_ops->change_l2_filter(adapter, addr, id); 2070 + adapter->ahw->hw_ops->change_l2_filter(adapter, addr, vlan, tx_ring); 2071 2071 } 2072 2072 2073 2073 static inline int qlcnic_get_board_info(struct qlcnic_adapter *adapter)
+2 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.c
··· 2135 2135 } 2136 2136 2137 2137 void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr, 2138 - u16 vlan_id) 2138 + u16 vlan_id, 2139 + struct qlcnic_host_tx_ring *tx_ring) 2139 2140 { 2140 2141 u8 mac[ETH_ALEN]; 2141 2142 memcpy(&mac, addr, ETH_ALEN);
+2 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_83xx_hw.h
··· 550 550 int qlcnic_83xx_nic_set_promisc(struct qlcnic_adapter *, u32); 551 551 int qlcnic_83xx_config_hw_lro(struct qlcnic_adapter *, int); 552 552 int qlcnic_83xx_config_rss(struct qlcnic_adapter *, int); 553 - void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *, u64 *, u16); 553 + void qlcnic_83xx_change_l2_filter(struct qlcnic_adapter *adapter, u64 *addr, 554 + u16 vlan, struct qlcnic_host_tx_ring *ring); 554 555 int qlcnic_83xx_get_pci_info(struct qlcnic_adapter *, struct qlcnic_pci_info *); 555 556 int qlcnic_83xx_set_nic_info(struct qlcnic_adapter *, struct qlcnic_info *); 556 557 void qlcnic_83xx_initialize_nic(struct qlcnic_adapter *, int);
+2 -1
drivers/net/ethernet/qlogic/qlcnic/qlcnic_hw.h
··· 173 173 struct net_device *netdev); 174 174 void qlcnic_82xx_get_beacon_state(struct qlcnic_adapter *); 175 175 void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, 176 - u64 *uaddr, u16 vlan_id); 176 + u64 *uaddr, u16 vlan_id, 177 + struct qlcnic_host_tx_ring *tx_ring); 177 178 int qlcnic_82xx_config_intr_coalesce(struct qlcnic_adapter *, 178 179 struct ethtool_coalesce *); 179 180 int qlcnic_82xx_set_rx_coalesce(struct qlcnic_adapter *);
+6 -6
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c
··· 268 268 } 269 269 270 270 void qlcnic_82xx_change_filter(struct qlcnic_adapter *adapter, u64 *uaddr, 271 - u16 vlan_id) 271 + u16 vlan_id, struct qlcnic_host_tx_ring *tx_ring) 272 272 { 273 273 struct cmd_desc_type0 *hwdesc; 274 274 struct qlcnic_nic_req *req; 275 275 struct qlcnic_mac_req *mac_req; 276 276 struct qlcnic_vlan_req *vlan_req; 277 - struct qlcnic_host_tx_ring *tx_ring = adapter->tx_ring; 278 277 u32 producer; 279 278 u64 word; 280 279 ··· 300 301 301 302 static void qlcnic_send_filter(struct qlcnic_adapter *adapter, 302 303 struct cmd_desc_type0 *first_desc, 303 - struct sk_buff *skb) 304 + struct sk_buff *skb, 305 + struct qlcnic_host_tx_ring *tx_ring) 304 306 { 305 307 struct vlan_ethhdr *vh = (struct vlan_ethhdr *)(skb->data); 306 308 struct ethhdr *phdr = (struct ethhdr *)(skb->data); ··· 335 335 tmp_fil->vlan_id == vlan_id) { 336 336 if (jiffies > (QLCNIC_READD_AGE * HZ + tmp_fil->ftime)) 337 337 qlcnic_change_filter(adapter, &src_addr, 338 - vlan_id); 338 + vlan_id, tx_ring); 339 339 tmp_fil->ftime = jiffies; 340 340 return; 341 341 } ··· 350 350 if (!fil) 351 351 return; 352 352 353 - qlcnic_change_filter(adapter, &src_addr, vlan_id); 353 + qlcnic_change_filter(adapter, &src_addr, vlan_id, tx_ring); 354 354 fil->ftime = jiffies; 355 355 fil->vlan_id = vlan_id; 356 356 memcpy(fil->faddr, &src_addr, ETH_ALEN); ··· 766 766 } 767 767 768 768 if (adapter->drv_mac_learn) 769 - qlcnic_send_filter(adapter, first_desc, skb); 769 + qlcnic_send_filter(adapter, first_desc, skb, tx_ring); 770 770 771 771 tx_ring->tx_stats.tx_bytes += skb->len; 772 772 tx_ring->tx_stats.xmit_called++;
-45
drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
··· 59 59 static void qlcnic_tx_timeout(struct net_device *netdev); 60 60 static void qlcnic_attach_work(struct work_struct *work); 61 61 static void qlcnic_fwinit_work(struct work_struct *work); 62 - #ifdef CONFIG_NET_POLL_CONTROLLER 63 - static void qlcnic_poll_controller(struct net_device *netdev); 64 - #endif 65 62 66 63 static void qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding); 67 64 static int qlcnic_can_start_firmware(struct qlcnic_adapter *adapter); ··· 542 545 .ndo_udp_tunnel_add = qlcnic_add_vxlan_port, 543 546 .ndo_udp_tunnel_del = qlcnic_del_vxlan_port, 544 547 .ndo_features_check = qlcnic_features_check, 545 - #ifdef CONFIG_NET_POLL_CONTROLLER 546 - .ndo_poll_controller = qlcnic_poll_controller, 547 - #endif 548 548 #ifdef CONFIG_QLCNIC_SRIOV 549 549 .ndo_set_vf_mac = qlcnic_sriov_set_vf_mac, 550 550 .ndo_set_vf_rate = qlcnic_sriov_set_vf_tx_rate, ··· 3193 3199 napi_schedule(&tx_ring->napi); 3194 3200 return IRQ_HANDLED; 3195 3201 } 3196 - 3197 - #ifdef CONFIG_NET_POLL_CONTROLLER 3198 - static void qlcnic_poll_controller(struct net_device *netdev) 3199 - { 3200 - struct qlcnic_adapter *adapter = netdev_priv(netdev); 3201 - struct qlcnic_host_sds_ring *sds_ring; 3202 - struct qlcnic_recv_context *recv_ctx; 3203 - struct qlcnic_host_tx_ring *tx_ring; 3204 - int ring; 3205 - 3206 - if (!test_bit(__QLCNIC_DEV_UP, &adapter->state)) 3207 - return; 3208 - 3209 - recv_ctx = adapter->recv_ctx; 3210 - 3211 - for (ring = 0; ring < adapter->drv_sds_rings; ring++) { 3212 - sds_ring = &recv_ctx->sds_rings[ring]; 3213 - qlcnic_disable_sds_intr(adapter, sds_ring); 3214 - napi_schedule(&sds_ring->napi); 3215 - } 3216 - 3217 - if (adapter->flags & QLCNIC_MSIX_ENABLED) { 3218 - /* Only Multi-Tx queue capable devices need to 3219 - * schedule NAPI for TX rings 3220 - */ 3221 - if ((qlcnic_83xx_check(adapter) && 3222 - (adapter->flags & QLCNIC_TX_INTR_SHARED)) || 3223 - (qlcnic_82xx_check(adapter) && 3224 - !qlcnic_check_multi_tx(adapter))) 3225 - return; 3226 - 3227 - for (ring = 0; ring < adapter->drv_tx_rings; ring++) { 3228 - tx_ring = &adapter->tx_ring[ring]; 3229 - qlcnic_disable_tx_intr(adapter, tx_ring); 3230 - napi_schedule(&tx_ring->napi); 3231 - } 3232 - } 3233 - } 3234 - #endif 3235 3202 3236 3203 static void 3237 3204 qlcnic_idc_debug_info(struct qlcnic_adapter *adapter, u8 encoding)
+5 -2
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
··· 113 113 struct sk_buff *skbn; 114 114 115 115 if (skb->dev->type == ARPHRD_ETHER) { 116 - if (pskb_expand_head(skb, ETH_HLEN, 0, GFP_KERNEL)) { 116 + if (pskb_expand_head(skb, ETH_HLEN, 0, GFP_ATOMIC)) { 117 117 kfree_skb(skb); 118 118 return; 119 119 } ··· 147 147 } 148 148 149 149 if (skb_headroom(skb) < required_headroom) { 150 - if (pskb_expand_head(skb, required_headroom, 0, GFP_KERNEL)) 150 + if (pskb_expand_head(skb, required_headroom, 0, GFP_ATOMIC)) 151 151 return -ENOMEM; 152 152 } 153 153 ··· 188 188 189 189 if (!skb) 190 190 goto done; 191 + 192 + if (skb->pkt_type == PACKET_LOOPBACK) 193 + return RX_HANDLER_PASS; 191 194 192 195 dev = skb->dev; 193 196 port = rmnet_get_port(dev);
+16 -16
drivers/net/ethernet/realtek/r8169.c
··· 4072 4072 4073 4073 genphy_soft_reset(dev->phydev); 4074 4074 4075 - /* It was reported that chip version 33 ends up with 10MBit/Half on a 4075 + /* It was reported that several chips end up with 10MBit/Half on a 4076 4076 * 1GBit link after resuming from S3. For whatever reason the PHY on 4077 - * this chip doesn't properly start a renegotiation when soft-reset. 4077 + * these chips doesn't properly start a renegotiation when soft-reset. 4078 4078 * Explicitly requesting a renegotiation fixes this. 4079 4079 */ 4080 - if (tp->mac_version == RTL_GIGA_MAC_VER_33 && 4081 - dev->phydev->autoneg == AUTONEG_ENABLE) 4080 + if (dev->phydev->autoneg == AUTONEG_ENABLE) 4082 4081 phy_restart_aneg(dev->phydev); 4083 4082 } 4084 4083 ··· 4535 4536 4536 4537 static void rtl_set_tx_config_registers(struct rtl8169_private *tp) 4537 4538 { 4538 - /* Set DMA burst size and Interframe Gap Time */ 4539 - RTL_W32(tp, TxConfig, (TX_DMA_BURST << TxDMAShift) | 4540 - (InterFrameGap << TxInterFrameGapShift)); 4539 + u32 val = TX_DMA_BURST << TxDMAShift | 4540 + InterFrameGap << TxInterFrameGapShift; 4541 + 4542 + if (tp->mac_version >= RTL_GIGA_MAC_VER_34 && 4543 + tp->mac_version != RTL_GIGA_MAC_VER_39) 4544 + val |= TXCFG_AUTO_FIFO; 4545 + 4546 + RTL_W32(tp, TxConfig, val); 4541 4547 } 4542 4548 4543 4549 static void rtl_set_rx_max_size(struct rtl8169_private *tp) ··· 5037 5033 5038 5034 rtl_disable_clock_request(tp); 5039 5035 5040 - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); 5041 5036 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB); 5042 5037 5043 5038 /* Adjust EEE LED frequency */ ··· 5070 5067 5071 5068 rtl_disable_clock_request(tp); 5072 5069 5073 - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); 5074 5070 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB); 5075 5071 RTL_W8(tp, DLLPR, RTL_R8(tp, DLLPR) | PFM_EN); 5076 5072 RTL_W32(tp, MISC, RTL_R32(tp, MISC) | PWM_EN); ··· 5114 5112 5115 5113 static void rtl_hw_start_8168g(struct rtl8169_private *tp) 5116 5114 { 5117 - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); 5118 - 5119 5115 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x080002, ERIAR_EXGMAC); 5120 5116 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC); 5121 5117 rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC); ··· 5211 5211 rtl_hw_aspm_clkreq_enable(tp, false); 5212 5212 rtl_ephy_init(tp, e_info_8168h_1, ARRAY_SIZE(e_info_8168h_1)); 5213 5213 5214 - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); 5215 - 5216 5214 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC); 5217 5215 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x38, ERIAR_EXGMAC); 5218 5216 rtl_eri_write(tp, 0xd0, ERIAR_MASK_0001, 0x48, ERIAR_EXGMAC); ··· 5292 5294 static void rtl_hw_start_8168ep(struct rtl8169_private *tp) 5293 5295 { 5294 5296 rtl8168ep_stop_cmac(tp); 5295 - 5296 - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); 5297 5297 5298 5298 rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC); 5299 5299 rtl_eri_write(tp, 0xcc, ERIAR_MASK_0001, 0x2f, ERIAR_EXGMAC); ··· 5614 5618 /* Force LAN exit from ASPM if Rx/Tx are not idle */ 5615 5619 RTL_W32(tp, FuncEvent, RTL_R32(tp, FuncEvent) | 0x002800); 5616 5620 5617 - RTL_W32(tp, TxConfig, RTL_R32(tp, TxConfig) | TXCFG_AUTO_FIFO); 5618 5621 RTL_W8(tp, MCU, RTL_R8(tp, MCU) & ~NOW_IS_OOB); 5619 5622 5620 5623 rtl_ephy_init(tp, e_info_8402, ARRAY_SIZE(e_info_8402)); ··· 6864 6869 { 6865 6870 struct pci_dev *pdev = to_pci_dev(device); 6866 6871 struct net_device *dev = pci_get_drvdata(pdev); 6872 + struct rtl8169_private *tp = netdev_priv(dev); 6867 6873 6868 6874 rtl8169_net_suspend(dev); 6875 + clk_disable_unprepare(tp->clk); 6869 6876 6870 6877 return 0; 6871 6878 } ··· 6895 6898 { 6896 6899 struct pci_dev *pdev = to_pci_dev(device); 6897 6900 struct net_device *dev = pci_get_drvdata(pdev); 6901 + struct rtl8169_private *tp = netdev_priv(dev); 6902 + 6903 + clk_prepare_enable(tp->clk); 6898 6904 6899 6905 if (netif_running(dev)) 6900 6906 __rtl8169_resume(dev);
-26
drivers/net/ethernet/sfc/efx.c
··· 2208 2208 2209 2209 /************************************************************************** 2210 2210 * 2211 - * Kernel netpoll interface 2212 - * 2213 - *************************************************************************/ 2214 - 2215 - #ifdef CONFIG_NET_POLL_CONTROLLER 2216 - 2217 - /* Although in the common case interrupts will be disabled, this is not 2218 - * guaranteed. However, all our work happens inside the NAPI callback, 2219 - * so no locking is required. 2220 - */ 2221 - static void efx_netpoll(struct net_device *net_dev) 2222 - { 2223 - struct efx_nic *efx = netdev_priv(net_dev); 2224 - struct efx_channel *channel; 2225 - 2226 - efx_for_each_channel(channel, efx) 2227 - efx_schedule_channel(channel); 2228 - } 2229 - 2230 - #endif 2231 - 2232 - /************************************************************************** 2233 - * 2234 2211 * Kernel net device interface 2235 2212 * 2236 2213 *************************************************************************/ ··· 2486 2509 #endif 2487 2510 .ndo_get_phys_port_id = efx_get_phys_port_id, 2488 2511 .ndo_get_phys_port_name = efx_get_phys_port_name, 2489 - #ifdef CONFIG_NET_POLL_CONTROLLER 2490 - .ndo_poll_controller = efx_netpoll, 2491 - #endif 2492 2512 .ndo_setup_tc = efx_setup_tc, 2493 2513 #ifdef CONFIG_RFS_ACCEL 2494 2514 .ndo_rx_flow_steer = efx_filter_rfs,
-26
drivers/net/ethernet/sfc/falcon/efx.c
··· 2054 2054 2055 2055 /************************************************************************** 2056 2056 * 2057 - * Kernel netpoll interface 2058 - * 2059 - *************************************************************************/ 2060 - 2061 - #ifdef CONFIG_NET_POLL_CONTROLLER 2062 - 2063 - /* Although in the common case interrupts will be disabled, this is not 2064 - * guaranteed. However, all our work happens inside the NAPI callback, 2065 - * so no locking is required. 2066 - */ 2067 - static void ef4_netpoll(struct net_device *net_dev) 2068 - { 2069 - struct ef4_nic *efx = netdev_priv(net_dev); 2070 - struct ef4_channel *channel; 2071 - 2072 - ef4_for_each_channel(channel, efx) 2073 - ef4_schedule_channel(channel); 2074 - } 2075 - 2076 - #endif 2077 - 2078 - /************************************************************************** 2079 - * 2080 2057 * Kernel net device interface 2081 2058 * 2082 2059 *************************************************************************/ ··· 2227 2250 .ndo_set_mac_address = ef4_set_mac_address, 2228 2251 .ndo_set_rx_mode = ef4_set_rx_mode, 2229 2252 .ndo_set_features = ef4_set_features, 2230 - #ifdef CONFIG_NET_POLL_CONTROLLER 2231 - .ndo_poll_controller = ef4_netpoll, 2232 - #endif 2233 2253 .ndo_setup_tc = ef4_setup_tc, 2234 2254 #ifdef CONFIG_RFS_ACCEL 2235 2255 .ndo_rx_flow_steer = ef4_filter_rfs,
+4
drivers/net/hamradio/yam.c
··· 966 966 sizeof(struct yamdrv_ioctl_mcs)); 967 967 if (IS_ERR(ym)) 968 968 return PTR_ERR(ym); 969 + if (ym->cmd != SIOCYAMSMCS) 970 + return -EINVAL; 969 971 if (ym->bitrate > YAM_MAXBITRATE) { 970 972 kfree(ym); 971 973 return -EINVAL; ··· 983 981 if (copy_from_user(&yi, ifr->ifr_data, sizeof(struct yamdrv_ioctl_cfg))) 984 982 return -EFAULT; 985 983 984 + if (yi.cmd != SIOCYAMSCFG) 985 + return -EINVAL; 986 986 if ((yi.cfg.mask & YAM_IOBASE) && netif_running(dev)) 987 987 return -EINVAL; /* Cannot change this parameter when up */ 988 988 if ((yi.cfg.mask & YAM_IRQ) && netif_running(dev))
+1 -2
drivers/net/ieee802154/adf7242.c
··· 1308 1308 { 1309 1309 struct adf7242_local *lp = spi_get_drvdata(spi); 1310 1310 1311 - if (!IS_ERR_OR_NULL(lp->debugfs_root)) 1312 - debugfs_remove_recursive(lp->debugfs_root); 1311 + debugfs_remove_recursive(lp->debugfs_root); 1313 1312 1314 1313 cancel_delayed_work_sync(&lp->work); 1315 1314 destroy_workqueue(lp->wqueue);
+2 -4
drivers/net/ieee802154/ca8210.c
··· 634 634 for (i = 0; i < len; i++) 635 635 dev_dbg(&priv->spi->dev, "%#03x\n", buf[i]); 636 636 637 - fifo_buffer = kmalloc(len, GFP_KERNEL); 637 + fifo_buffer = kmemdup(buf, len, GFP_KERNEL); 638 638 if (!fifo_buffer) 639 639 return -ENOMEM; 640 - memcpy(fifo_buffer, buf, len); 641 640 kfifo_in(&test->up_fifo, &fifo_buffer, 4); 642 641 wake_up_interruptible(&priv->test.readq); 643 642 ··· 3043 3044 { 3044 3045 struct ca8210_test *test = &priv->test; 3045 3046 3046 - if (!IS_ERR(test->ca8210_dfs_spi_int)) 3047 - debugfs_remove(test->ca8210_dfs_spi_int); 3047 + debugfs_remove(test->ca8210_dfs_spi_int); 3048 3048 kfifo_free(&test->up_fifo); 3049 3049 dev_info(&priv->spi->dev, "Test interface removed\n"); 3050 3050 }
+4 -4
drivers/net/ieee802154/mcr20a.c
··· 903 903 904 904 switch (seq_state) { 905 905 /* TX IRQ, RX IRQ and SEQ IRQ */ 906 - case (0x03): 906 + case (DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ): 907 907 if (lp->is_tx) { 908 908 lp->is_tx = 0; 909 909 dev_dbg(printdev(lp), "TX is done. No ACK\n"); 910 910 mcr20a_handle_tx_complete(lp); 911 911 } 912 912 break; 913 - case (0x05): 913 + case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_SEQIRQ): 914 914 /* rx is starting */ 915 915 dev_dbg(printdev(lp), "RX is starting\n"); 916 916 mcr20a_handle_rx(lp); 917 917 break; 918 - case (0x07): 918 + case (DAR_IRQSTS1_RXIRQ | DAR_IRQSTS1_TXIRQ | DAR_IRQSTS1_SEQIRQ): 919 919 if (lp->is_tx) { 920 920 /* tx is done */ 921 921 lp->is_tx = 0; ··· 927 927 mcr20a_handle_rx(lp); 928 928 } 929 929 break; 930 - case (0x01): 930 + case (DAR_IRQSTS1_SEQIRQ): 931 931 if (lp->is_tx) { 932 932 dev_dbg(printdev(lp), "TX is starting\n"); 933 933 mcr20a_handle_tx(lp);
+9 -3
drivers/net/phy/phy_device.c
··· 93 93 if (!netdev) 94 94 return !phydev->suspended; 95 95 96 - /* Don't suspend PHY if the attached netdev parent may wakeup. 96 + if (netdev->wol_enabled) 97 + return false; 98 + 99 + /* As long as not all affected network drivers support the 100 + * wol_enabled flag, let's check for hints that WoL is enabled. 101 + * Don't suspend PHY if the attached netdev parent may wake up. 97 102 * The parent may point to a PCI device, as in tg3 driver. 98 103 */ 99 104 if (netdev->dev.parent && device_may_wakeup(netdev->dev.parent)) ··· 1137 1132 sysfs_remove_link(&dev->dev.kobj, "phydev"); 1138 1133 sysfs_remove_link(&phydev->mdio.dev.kobj, "attached_dev"); 1139 1134 } 1135 + phy_suspend(phydev); 1140 1136 phydev->attached_dev->phydev = NULL; 1141 1137 phydev->attached_dev = NULL; 1142 - phy_suspend(phydev); 1143 1138 phydev->phylink = NULL; 1144 1139 1145 1140 phy_led_triggers_unregister(phydev); ··· 1173 1168 int phy_suspend(struct phy_device *phydev) 1174 1169 { 1175 1170 struct phy_driver *phydrv = to_phy_driver(phydev->mdio.dev.driver); 1171 + struct net_device *netdev = phydev->attached_dev; 1176 1172 struct ethtool_wolinfo wol = { .cmd = ETHTOOL_GWOL }; 1177 1173 int ret = 0; 1178 1174 1179 1175 /* If the device has WOL enabled, we cannot suspend the PHY */ 1180 1176 phy_ethtool_get_wol(phydev, &wol); 1181 - if (wol.wolopts) 1177 + if (wol.wolopts || (netdev && netdev->wol_enabled)) 1182 1178 return -EBUSY; 1183 1179 1184 1180 if (phydev->drv && phydrv->suspend)
+28 -20
drivers/net/phy/phylink.c
··· 717 717 return 0; 718 718 } 719 719 720 + static int __phylink_connect_phy(struct phylink *pl, struct phy_device *phy, 721 + phy_interface_t interface) 722 + { 723 + int ret; 724 + 725 + if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED || 726 + (pl->link_an_mode == MLO_AN_INBAND && 727 + phy_interface_mode_is_8023z(interface)))) 728 + return -EINVAL; 729 + 730 + if (pl->phydev) 731 + return -EBUSY; 732 + 733 + ret = phy_attach_direct(pl->netdev, phy, 0, interface); 734 + if (ret) 735 + return ret; 736 + 737 + ret = phylink_bringup_phy(pl, phy); 738 + if (ret) 739 + phy_detach(phy); 740 + 741 + return ret; 742 + } 743 + 720 744 /** 721 745 * phylink_connect_phy() - connect a PHY to the phylink instance 722 746 * @pl: a pointer to a &struct phylink returned from phylink_create() ··· 758 734 */ 759 735 int phylink_connect_phy(struct phylink *pl, struct phy_device *phy) 760 736 { 761 - int ret; 762 - 763 - if (WARN_ON(pl->link_an_mode == MLO_AN_FIXED || 764 - (pl->link_an_mode == MLO_AN_INBAND && 765 - phy_interface_mode_is_8023z(pl->link_interface)))) 766 - return -EINVAL; 767 - 768 - if (pl->phydev) 769 - return -EBUSY; 770 - 771 737 /* Use PHY device/driver interface */ 772 738 if (pl->link_interface == PHY_INTERFACE_MODE_NA) { 773 739 pl->link_interface = phy->interface; 774 740 pl->link_config.interface = pl->link_interface; 775 741 } 776 742 777 - ret = phy_attach_direct(pl->netdev, phy, 0, pl->link_interface); 778 - if (ret) 779 - return ret; 780 - 781 - ret = phylink_bringup_phy(pl, phy); 782 - if (ret) 783 - phy_detach(phy); 784 - 785 - return ret; 743 + return __phylink_connect_phy(pl, phy, pl->link_interface); 786 744 } 787 745 EXPORT_SYMBOL_GPL(phylink_connect_phy); 788 746 ··· 1678 1672 1679 1673 static int phylink_sfp_connect_phy(void *upstream, struct phy_device *phy) 1680 1674 { 1681 - return phylink_connect_phy(upstream, phy); 1675 + struct phylink *pl = upstream; 1676 + 1677 + return __phylink_connect_phy(upstream, phy, pl->link_config.interface); 1682 1678 } 1683 1679 1684 1680 static void phylink_sfp_disconnect_phy(void *upstream)
+5 -2
drivers/net/phy/sfp.c
··· 1098 1098 1099 1099 static void sfp_hwmon_remove(struct sfp *sfp) 1100 1100 { 1101 - hwmon_device_unregister(sfp->hwmon_dev); 1102 - kfree(sfp->hwmon_name); 1101 + if (!IS_ERR_OR_NULL(sfp->hwmon_dev)) { 1102 + hwmon_device_unregister(sfp->hwmon_dev); 1103 + sfp->hwmon_dev = NULL; 1104 + kfree(sfp->hwmon_name); 1105 + } 1103 1106 } 1104 1107 #else 1105 1108 static int sfp_hwmon_insert(struct sfp *sfp)
+6
drivers/net/team/team.c
··· 1167 1167 return -EBUSY; 1168 1168 } 1169 1169 1170 + if (dev == port_dev) { 1171 + NL_SET_ERR_MSG(extack, "Cannot enslave team device to itself"); 1172 + netdev_err(dev, "Cannot enslave team device to itself\n"); 1173 + return -EINVAL; 1174 + } 1175 + 1170 1176 if (port_dev->features & NETIF_F_VLAN_CHALLENGED && 1171 1177 vlan_uses_dev(dev)) { 1172 1178 NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up");
+21 -16
drivers/net/tun.c
··· 181 181 }; 182 182 struct napi_struct napi; 183 183 bool napi_enabled; 184 + bool napi_frags_enabled; 184 185 struct mutex napi_mutex; /* Protects access to the above napi */ 185 186 struct list_head next; 186 187 struct tun_struct *detached; ··· 314 313 } 315 314 316 315 static void tun_napi_init(struct tun_struct *tun, struct tun_file *tfile, 317 - bool napi_en) 316 + bool napi_en, bool napi_frags) 318 317 { 319 318 tfile->napi_enabled = napi_en; 319 + tfile->napi_frags_enabled = napi_en && napi_frags; 320 320 if (napi_en) { 321 321 netif_napi_add(tun->dev, &tfile->napi, tun_napi_poll, 322 322 NAPI_POLL_WEIGHT); 323 323 napi_enable(&tfile->napi); 324 - mutex_init(&tfile->napi_mutex); 325 324 } 326 325 } 327 326 328 - static void tun_napi_disable(struct tun_struct *tun, struct tun_file *tfile) 327 + static void tun_napi_disable(struct tun_file *tfile) 329 328 { 330 329 if (tfile->napi_enabled) 331 330 napi_disable(&tfile->napi); 332 331 } 333 332 334 - static void tun_napi_del(struct tun_struct *tun, struct tun_file *tfile) 333 + static void tun_napi_del(struct tun_file *tfile) 335 334 { 336 335 if (tfile->napi_enabled) 337 336 netif_napi_del(&tfile->napi); 338 337 } 339 338 340 - static bool tun_napi_frags_enabled(const struct tun_struct *tun) 339 + static bool tun_napi_frags_enabled(const struct tun_file *tfile) 341 340 { 342 - return READ_ONCE(tun->flags) & IFF_NAPI_FRAGS; 341 + return tfile->napi_frags_enabled; 343 342 } 344 343 345 344 #ifdef CONFIG_TUN_VNET_CROSS_LE ··· 691 690 tun = rtnl_dereference(tfile->tun); 692 691 693 692 if (tun && clean) { 694 - tun_napi_disable(tun, tfile); 695 - tun_napi_del(tun, tfile); 693 + tun_napi_disable(tfile); 694 + tun_napi_del(tfile); 696 695 } 697 696 698 697 if (tun && !tfile->detached) { ··· 759 758 for (i = 0; i < n; i++) { 760 759 tfile = rtnl_dereference(tun->tfiles[i]); 761 760 BUG_ON(!tfile); 762 - tun_napi_disable(tun, tfile); 761 + tun_napi_disable(tfile); 763 762 tfile->socket.sk->sk_shutdown = RCV_SHUTDOWN; 764 763 tfile->socket.sk->sk_data_ready(tfile->socket.sk); 765 764 RCU_INIT_POINTER(tfile->tun, NULL); ··· 775 774 synchronize_net(); 776 775 for (i = 0; i < n; i++) { 777 776 tfile = rtnl_dereference(tun->tfiles[i]); 778 - tun_napi_del(tun, tfile); 777 + tun_napi_del(tfile); 779 778 /* Drop read queue */ 780 779 tun_queue_purge(tfile); 781 780 xdp_rxq_info_unreg(&tfile->xdp_rxq); ··· 794 793 } 795 794 796 795 static int tun_attach(struct tun_struct *tun, struct file *file, 797 - bool skip_filter, bool napi) 796 + bool skip_filter, bool napi, bool napi_frags) 798 797 { 799 798 struct tun_file *tfile = file->private_data; 800 799 struct net_device *dev = tun->dev; ··· 867 866 tun_enable_queue(tfile); 868 867 } else { 869 868 sock_hold(&tfile->sk); 870 - tun_napi_init(tun, tfile, napi); 869 + tun_napi_init(tun, tfile, napi, napi_frags); 871 870 } 872 871 873 872 tun_set_real_num_queues(tun); ··· 1710 1709 int err; 1711 1710 u32 rxhash = 0; 1712 1711 int skb_xdp = 1; 1713 - bool frags = tun_napi_frags_enabled(tun); 1712 + bool frags = tun_napi_frags_enabled(tfile); 1714 1713 1715 1714 if (!(tun->dev->flags & IFF_UP)) 1716 1715 return -EIO; ··· 2535 2534 return err; 2536 2535 2537 2536 err = tun_attach(tun, file, ifr->ifr_flags & IFF_NOFILTER, 2538 - ifr->ifr_flags & IFF_NAPI); 2537 + ifr->ifr_flags & IFF_NAPI, 2538 + ifr->ifr_flags & IFF_NAPI_FRAGS); 2539 2539 if (err < 0) 2540 2540 return err; 2541 2541 ··· 2634 2632 (ifr->ifr_flags & TUN_FEATURES); 2635 2633 2636 2634 INIT_LIST_HEAD(&tun->disabled); 2637 - err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI); 2635 + err = tun_attach(tun, file, false, ifr->ifr_flags & IFF_NAPI, 2636 + ifr->ifr_flags & IFF_NAPI_FRAGS); 2638 2637 if (err < 0) 2639 2638 goto err_free_flow; 2640 2639 ··· 2784 2781 ret = security_tun_dev_attach_queue(tun->security); 2785 2782 if (ret < 0) 2786 2783 goto unlock; 2787 - ret = tun_attach(tun, file, false, tun->flags & IFF_NAPI); 2784 + ret = tun_attach(tun, file, false, tun->flags & IFF_NAPI, 2785 + tun->flags & IFF_NAPI_FRAGS); 2788 2786 } else if (ifr->ifr_flags & IFF_DETACH_QUEUE) { 2789 2787 tun = rtnl_dereference(tfile->tun); 2790 2788 if (!tun || !(tun->flags & IFF_MULTI_QUEUE) || tfile->detached) ··· 3203 3199 return -ENOMEM; 3204 3200 } 3205 3201 3202 + mutex_init(&tfile->napi_mutex); 3206 3203 RCU_INIT_POINTER(tfile->tun, NULL); 3207 3204 tfile->flags = 0; 3208 3205 tfile->ifindex = 0;
+3
drivers/net/usb/asix_common.c
··· 607 607 struct usbnet *dev = netdev_priv(net); 608 608 u8 opt = 0; 609 609 610 + if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC)) 611 + return -EINVAL; 612 + 610 613 if (wolinfo->wolopts & WAKE_PHY) 611 614 opt |= AX_MONITOR_LINK; 612 615 if (wolinfo->wolopts & WAKE_MAGIC)
+3
drivers/net/usb/ax88179_178a.c
··· 566 566 struct usbnet *dev = netdev_priv(net); 567 567 u8 opt = 0; 568 568 569 + if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC)) 570 + return -EINVAL; 571 + 569 572 if (wolinfo->wolopts & WAKE_PHY) 570 573 opt |= AX_MONITOR_MODE_RWLC; 571 574 if (wolinfo->wolopts & WAKE_MAGIC)
+4 -13
drivers/net/usb/lan78xx.c
··· 1401 1401 if (ret < 0) 1402 1402 return ret; 1403 1403 1404 - pdata->wol = 0; 1405 - if (wol->wolopts & WAKE_UCAST) 1406 - pdata->wol |= WAKE_UCAST; 1407 - if (wol->wolopts & WAKE_MCAST) 1408 - pdata->wol |= WAKE_MCAST; 1409 - if (wol->wolopts & WAKE_BCAST) 1410 - pdata->wol |= WAKE_BCAST; 1411 - if (wol->wolopts & WAKE_MAGIC) 1412 - pdata->wol |= WAKE_MAGIC; 1413 - if (wol->wolopts & WAKE_PHY) 1414 - pdata->wol |= WAKE_PHY; 1415 - if (wol->wolopts & WAKE_ARP) 1416 - pdata->wol |= WAKE_ARP; 1404 + if (wol->wolopts & ~WAKE_ALL) 1405 + return -EINVAL; 1406 + 1407 + pdata->wol = wol->wolopts; 1417 1408 1418 1409 device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts); 1419 1410
+3
drivers/net/usb/r8152.c
··· 4506 4506 if (!rtl_can_wakeup(tp)) 4507 4507 return -EOPNOTSUPP; 4508 4508 4509 + if (wol->wolopts & ~WAKE_ANY) 4510 + return -EINVAL; 4511 + 4509 4512 ret = usb_autopm_get_interface(tp->intf); 4510 4513 if (ret < 0) 4511 4514 goto out_set_wol;
+4
drivers/net/usb/smsc75xx.c
··· 731 731 struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]); 732 732 int ret; 733 733 734 + if (wolinfo->wolopts & ~SUPPORTED_WAKE) 735 + return -EINVAL; 736 + 734 737 pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE; 735 738 736 739 ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts); ··· 1520 1517 { 1521 1518 struct smsc75xx_priv *pdata = (struct smsc75xx_priv *)(dev->data[0]); 1522 1519 if (pdata) { 1520 + cancel_work_sync(&pdata->set_multicast); 1523 1521 netif_dbg(dev, ifdown, dev->net, "free pdata\n"); 1524 1522 kfree(pdata); 1525 1523 pdata = NULL;
+3
drivers/net/usb/smsc95xx.c
··· 774 774 struct smsc95xx_priv *pdata = (struct smsc95xx_priv *)(dev->data[0]); 775 775 int ret; 776 776 777 + if (wolinfo->wolopts & ~SUPPORTED_WAKE) 778 + return -EINVAL; 779 + 777 780 pdata->wolopts = wolinfo->wolopts & SUPPORTED_WAKE; 778 781 779 782 ret = device_set_wakeup_enable(&dev->udev->dev, pdata->wolopts);
+3
drivers/net/usb/sr9800.c
··· 421 421 struct usbnet *dev = netdev_priv(net); 422 422 u8 opt = 0; 423 423 424 + if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC)) 425 + return -EINVAL; 426 + 424 427 if (wolinfo->wolopts & WAKE_PHY) 425 428 opt |= SR_MONITOR_LINK; 426 429 if (wolinfo->wolopts & WAKE_MAGIC)
-14
drivers/net/virtio_net.c
··· 1699 1699 tot->rx_frame_errors = dev->stats.rx_frame_errors; 1700 1700 } 1701 1701 1702 - #ifdef CONFIG_NET_POLL_CONTROLLER 1703 - static void virtnet_netpoll(struct net_device *dev) 1704 - { 1705 - struct virtnet_info *vi = netdev_priv(dev); 1706 - int i; 1707 - 1708 - for (i = 0; i < vi->curr_queue_pairs; i++) 1709 - napi_schedule(&vi->rq[i].napi); 1710 - } 1711 - #endif 1712 - 1713 1702 static void virtnet_ack_link_announce(struct virtnet_info *vi) 1714 1703 { 1715 1704 rtnl_lock(); ··· 2436 2447 .ndo_get_stats64 = virtnet_stats, 2437 2448 .ndo_vlan_rx_add_vid = virtnet_vlan_rx_add_vid, 2438 2449 .ndo_vlan_rx_kill_vid = virtnet_vlan_rx_kill_vid, 2439 - #ifdef CONFIG_NET_POLL_CONTROLLER 2440 - .ndo_poll_controller = virtnet_netpoll, 2441 - #endif 2442 2450 .ndo_bpf = virtnet_xdp, 2443 2451 .ndo_xdp_xmit = virtnet_xdp_xmit, 2444 2452 .ndo_features_check = passthru_features_check,
+3
drivers/net/vxlan.c
··· 3539 3539 nla_total_size(sizeof(__u32)) + /* IFLA_VXLAN_LINK */ 3540 3540 nla_total_size(sizeof(struct in6_addr)) + /* IFLA_VXLAN_LOCAL{6} */ 3541 3541 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TTL */ 3542 + nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TTL_INHERIT */ 3542 3543 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_TOS */ 3543 3544 nla_total_size(sizeof(__be32)) + /* IFLA_VXLAN_LABEL */ 3544 3545 nla_total_size(sizeof(__u8)) + /* IFLA_VXLAN_LEARNING */ ··· 3604 3603 } 3605 3604 3606 3605 if (nla_put_u8(skb, IFLA_VXLAN_TTL, vxlan->cfg.ttl) || 3606 + nla_put_u8(skb, IFLA_VXLAN_TTL_INHERIT, 3607 + !!(vxlan->cfg.flags & VXLAN_F_TTL_INHERIT)) || 3607 3608 nla_put_u8(skb, IFLA_VXLAN_TOS, vxlan->cfg.tos) || 3608 3609 nla_put_be32(skb, IFLA_VXLAN_LABEL, vxlan->cfg.label) || 3609 3610 nla_put_u8(skb, IFLA_VXLAN_LEARNING,
+1 -1
drivers/net/wimax/i2400m/control.c
··· 257 257 [I2400M_MS_ACCESSIBILITY_ERROR] = { "accesibility error", -EIO }, 258 258 [I2400M_MS_BUSY] = { "busy", -EBUSY }, 259 259 [I2400M_MS_CORRUPTED_TLV] = { "corrupted TLV", -EILSEQ }, 260 - [I2400M_MS_UNINITIALIZED] = { "not unitialized", -EILSEQ }, 260 + [I2400M_MS_UNINITIALIZED] = { "uninitialized", -EILSEQ }, 261 261 [I2400M_MS_UNKNOWN_ERROR] = { "unknown error", -EIO }, 262 262 [I2400M_MS_PRODUCTION_ERROR] = { "production error", -EIO }, 263 263 [I2400M_MS_NO_RF] = { "no RF", -EIO },
+4 -2
drivers/net/wireless/broadcom/b43/dma.c
··· 1518 1518 } 1519 1519 } else { 1520 1520 /* More than a single header/data pair were missed. 1521 - * Report this error, and reset the controller to 1521 + * Report this error. If running with open-source 1522 + * firmware, then reset the controller to 1522 1523 * revive operation. 1523 1524 */ 1524 1525 b43dbg(dev->wl, 1525 1526 "Out of order TX status report on DMA ring %d. Expected %d, but got %d\n", 1526 1527 ring->index, firstused, slot); 1527 - b43_controller_restart(dev, "Out of order TX"); 1528 + if (dev->fw.opensource) 1529 + b43_controller_restart(dev, "Out of order TX"); 1528 1530 return; 1529 1531 } 1530 1532 }
+1
drivers/net/wireless/intel/iwlwifi/cfg/1000.c
··· 51 51 52 52 static const struct iwl_base_params iwl1000_base_params = { 53 53 .num_of_queues = IWLAGN_NUM_QUEUES, 54 + .max_tfd_queue_size = 256, 54 55 .eeprom_size = OTP_LOW_IMAGE_SIZE, 55 56 .pll_cfg = true, 56 57 .max_ll_items = OTP_MAX_LL_ITEMS_1000,
+17 -19
drivers/net/wireless/mac80211_hwsim.c
··· 520 520 int channels, idx; 521 521 bool use_chanctx; 522 522 bool destroy_on_close; 523 - struct work_struct destroy_work; 524 523 u32 portid; 525 524 char alpha2[2]; 526 525 const struct ieee80211_regdomain *regd; ··· 2934 2935 hwsim_radios_generation++; 2935 2936 spin_unlock_bh(&hwsim_radio_lock); 2936 2937 2937 - if (idx > 0) 2938 - hwsim_mcast_new_radio(idx, info, param); 2938 + hwsim_mcast_new_radio(idx, info, param); 2939 2939 2940 2940 return idx; 2941 2941 ··· 3563 3565 .n_mcgrps = ARRAY_SIZE(hwsim_mcgrps), 3564 3566 }; 3565 3567 3566 - static void destroy_radio(struct work_struct *work) 3567 - { 3568 - struct mac80211_hwsim_data *data = 3569 - container_of(work, struct mac80211_hwsim_data, destroy_work); 3570 - 3571 - hwsim_radios_generation++; 3572 - mac80211_hwsim_del_radio(data, wiphy_name(data->hw->wiphy), NULL); 3573 - } 3574 - 3575 3568 static void remove_user_radios(u32 portid) 3576 3569 { 3577 3570 struct mac80211_hwsim_data *entry, *tmp; 3571 + LIST_HEAD(list); 3578 3572 3579 3573 spin_lock_bh(&hwsim_radio_lock); 3580 3574 list_for_each_entry_safe(entry, tmp, &hwsim_radios, list) { 3581 3575 if (entry->destroy_on_close && entry->portid == portid) { 3582 - list_del(&entry->list); 3576 + list_move(&entry->list, &list); 3583 3577 rhashtable_remove_fast(&hwsim_radios_rht, &entry->rht, 3584 3578 hwsim_rht_params); 3585 - INIT_WORK(&entry->destroy_work, destroy_radio); 3586 - queue_work(hwsim_wq, &entry->destroy_work); 3579 + hwsim_radios_generation++; 3587 3580 } 3588 3581 } 3589 3582 spin_unlock_bh(&hwsim_radio_lock); 3583 + 3584 + list_for_each_entry_safe(entry, tmp, &list, list) { 3585 + list_del(&entry->list); 3586 + mac80211_hwsim_del_radio(entry, wiphy_name(entry->hw->wiphy), 3587 + NULL); 3588 + } 3590 3589 } 3591 3590 3592 3591 static int mac80211_hwsim_netlink_notify(struct notifier_block *nb, ··· 3641 3646 static void __net_exit hwsim_exit_net(struct net *net) 3642 3647 { 3643 3648 struct mac80211_hwsim_data *data, *tmp; 3649 + LIST_HEAD(list); 3644 3650 3645 3651 spin_lock_bh(&hwsim_radio_lock); 3646 3652 list_for_each_entry_safe(data, tmp, &hwsim_radios, list) { ··· 3652 3656 if (data->netgroup == hwsim_net_get_netgroup(&init_net)) 3653 3657 continue; 3654 3658 3655 - list_del(&data->list); 3659 + list_move(&data->list, &list); 3656 3660 rhashtable_remove_fast(&hwsim_radios_rht, &data->rht, 3657 3661 hwsim_rht_params); 3658 3662 hwsim_radios_generation++; 3659 - spin_unlock_bh(&hwsim_radio_lock); 3663 + } 3664 + spin_unlock_bh(&hwsim_radio_lock); 3665 + 3666 + list_for_each_entry_safe(data, tmp, &list, list) { 3667 + list_del(&data->list); 3660 3668 mac80211_hwsim_del_radio(data, 3661 3669 wiphy_name(data->hw->wiphy), 3662 3670 NULL); 3663 - spin_lock_bh(&hwsim_radio_lock); 3664 3671 } 3665 - spin_unlock_bh(&hwsim_radio_lock); 3666 3672 3667 3673 ida_simple_remove(&hwsim_netgroup_ida, hwsim_net_get_netgroup(net)); 3668 3674 }
+1 -2
drivers/net/wireless/mediatek/mt76/mt76x0/main.c
··· 77 77 { 78 78 struct mt76x0_dev *dev = hw->priv; 79 79 struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv; 80 - unsigned int wcid = mvif->group_wcid.idx; 81 80 82 - dev->wcid_mask[wcid / BITS_PER_LONG] &= ~BIT(wcid % BITS_PER_LONG); 81 + dev->vif_mask &= ~BIT(mvif->idx); 83 82 } 84 83 85 84 static int mt76x0_config(struct ieee80211_hw *hw, u32 changed)
+2 -1
drivers/net/xen-netback/common.h
··· 241 241 struct xenvif_hash { 242 242 unsigned int alg; 243 243 u32 flags; 244 + bool mapping_sel; 244 245 u8 key[XEN_NETBK_MAX_HASH_KEY_SIZE]; 245 - u32 mapping[XEN_NETBK_MAX_HASH_MAPPING_SIZE]; 246 + u32 mapping[2][XEN_NETBK_MAX_HASH_MAPPING_SIZE]; 246 247 unsigned int size; 247 248 struct xenvif_hash_cache cache; 248 249 };
+36 -15
drivers/net/xen-netback/hash.c
··· 324 324 return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; 325 325 326 326 vif->hash.size = size; 327 - memset(vif->hash.mapping, 0, sizeof(u32) * size); 327 + memset(vif->hash.mapping[vif->hash.mapping_sel], 0, 328 + sizeof(u32) * size); 328 329 329 330 return XEN_NETIF_CTRL_STATUS_SUCCESS; 330 331 } ··· 333 332 u32 xenvif_set_hash_mapping(struct xenvif *vif, u32 gref, u32 len, 334 333 u32 off) 335 334 { 336 - u32 *mapping = &vif->hash.mapping[off]; 337 - struct gnttab_copy copy_op = { 335 + u32 *mapping = vif->hash.mapping[!vif->hash.mapping_sel]; 336 + unsigned int nr = 1; 337 + struct gnttab_copy copy_op[2] = {{ 338 338 .source.u.ref = gref, 339 339 .source.domid = vif->domid, 340 - .dest.u.gmfn = virt_to_gfn(mapping), 341 340 .dest.domid = DOMID_SELF, 342 - .dest.offset = xen_offset_in_page(mapping), 343 - .len = len * sizeof(u32), 341 + .len = len * sizeof(*mapping), 344 342 .flags = GNTCOPY_source_gref 345 - }; 343 + }}; 346 344 347 - if ((off + len > vif->hash.size) || copy_op.len > XEN_PAGE_SIZE) 345 + if ((off + len < off) || (off + len > vif->hash.size) || 346 + len > XEN_PAGE_SIZE / sizeof(*mapping)) 348 347 return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; 348 + 349 + copy_op[0].dest.u.gmfn = virt_to_gfn(mapping + off); 350 + copy_op[0].dest.offset = xen_offset_in_page(mapping + off); 351 + if (copy_op[0].dest.offset + copy_op[0].len > XEN_PAGE_SIZE) { 352 + copy_op[1] = copy_op[0]; 353 + copy_op[1].source.offset = XEN_PAGE_SIZE - copy_op[0].dest.offset; 354 + copy_op[1].dest.u.gmfn = virt_to_gfn(mapping + off + len); 355 + copy_op[1].dest.offset = 0; 356 + copy_op[1].len = copy_op[0].len - copy_op[1].source.offset; 357 + copy_op[0].len = copy_op[1].source.offset; 358 + nr = 2; 359 + } 360 + 361 + memcpy(mapping, vif->hash.mapping[vif->hash.mapping_sel], 362 + vif->hash.size * sizeof(*mapping)); 363 + 364 + if (copy_op[0].len != 0) { 365 + gnttab_batch_copy(copy_op, nr); 366 + 367 + if (copy_op[0].status != GNTST_okay || 368 + copy_op[nr - 1].status != GNTST_okay) 369 + return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; 370 + } 349 371 350 372 while (len-- != 0) 351 373 if (mapping[off++] >= vif->num_queues) 352 374 return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; 353 375 354 - if (copy_op.len != 0) { 355 - gnttab_batch_copy(&copy_op, 1); 356 - 357 - if (copy_op.status != GNTST_okay) 358 - return XEN_NETIF_CTRL_STATUS_INVALID_PARAMETER; 359 - } 376 + vif->hash.mapping_sel = !vif->hash.mapping_sel; 360 377 361 378 return XEN_NETIF_CTRL_STATUS_SUCCESS; 362 379 } ··· 427 408 } 428 409 429 410 if (vif->hash.size != 0) { 411 + const u32 *mapping = vif->hash.mapping[vif->hash.mapping_sel]; 412 + 430 413 seq_puts(m, "\nHash Mapping:\n"); 431 414 432 415 for (i = 0; i < vif->hash.size; ) { ··· 441 420 seq_printf(m, "[%4u - %4u]: ", i, i + n - 1); 442 421 443 422 for (j = 0; j < n; j++, i++) 444 - seq_printf(m, "%4u ", vif->hash.mapping[i]); 423 + seq_printf(m, "%4u ", mapping[i]); 445 424 446 425 seq_puts(m, "\n"); 447 426 }
+2 -1
drivers/net/xen-netback/interface.c
··· 162 162 if (size == 0) 163 163 return skb_get_hash_raw(skb) % dev->real_num_tx_queues; 164 164 165 - return vif->hash.mapping[skb_get_hash_raw(skb) % size]; 165 + return vif->hash.mapping[vif->hash.mapping_sel] 166 + [skb_get_hash_raw(skb) % size]; 166 167 } 167 168 168 169 static int xenvif_start_xmit(struct sk_buff *skb, struct net_device *dev)
+49 -5
drivers/pci/controller/pci-mvebu.c
··· 1145 1145 { 1146 1146 struct device *dev = &pcie->pdev->dev; 1147 1147 struct device_node *np = dev->of_node; 1148 - unsigned int i; 1149 1148 int ret; 1150 1149 1151 1150 INIT_LIST_HEAD(&pcie->resources); ··· 1178 1179 resource_size(&pcie->io) - 1); 1179 1180 pcie->realio.name = "PCI I/O"; 1180 1181 1181 - for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K) 1182 - pci_ioremap_io(i, pcie->io.start + i); 1183 - 1184 1182 pci_add_resource(&pcie->resources, &pcie->realio); 1185 1183 } 1186 1184 1187 1185 return devm_request_pci_bus_resources(dev, &pcie->resources); 1186 + } 1187 + 1188 + /* 1189 + * This is a copy of pci_host_probe(), except that it does the I/O 1190 + * remap as the last step, once we are sure we won't fail. 1191 + * 1192 + * It should be removed once the I/O remap error handling issue has 1193 + * been sorted out. 1194 + */ 1195 + static int mvebu_pci_host_probe(struct pci_host_bridge *bridge) 1196 + { 1197 + struct mvebu_pcie *pcie; 1198 + struct pci_bus *bus, *child; 1199 + int ret; 1200 + 1201 + ret = pci_scan_root_bus_bridge(bridge); 1202 + if (ret < 0) { 1203 + dev_err(bridge->dev.parent, "Scanning root bridge failed"); 1204 + return ret; 1205 + } 1206 + 1207 + pcie = pci_host_bridge_priv(bridge); 1208 + if (resource_size(&pcie->io) != 0) { 1209 + unsigned int i; 1210 + 1211 + for (i = 0; i < resource_size(&pcie->realio); i += SZ_64K) 1212 + pci_ioremap_io(i, pcie->io.start + i); 1213 + } 1214 + 1215 + bus = bridge->bus; 1216 + 1217 + /* 1218 + * We insert PCI resources into the iomem_resource and 1219 + * ioport_resource trees in either pci_bus_claim_resources() 1220 + * or pci_bus_assign_resources(). 1221 + */ 1222 + if (pci_has_flag(PCI_PROBE_ONLY)) { 1223 + pci_bus_claim_resources(bus); 1224 + } else { 1225 + pci_bus_size_bridges(bus); 1226 + pci_bus_assign_resources(bus); 1227 + 1228 + list_for_each_entry(child, &bus->children, node) 1229 + pcie_bus_configure_settings(child); 1230 + } 1231 + 1232 + pci_bus_add_devices(bus); 1233 + return 0; 1188 1234 } 1189 1235 1190 1236 static int mvebu_pcie_probe(struct platform_device *pdev) ··· 1312 1268 bridge->align_resource = mvebu_pcie_align_resource; 1313 1269 bridge->msi = pcie->msi; 1314 1270 1315 - return pci_host_probe(bridge); 1271 + return mvebu_pci_host_probe(bridge); 1316 1272 } 1317 1273 1318 1274 static const struct of_device_id mvebu_pcie_of_match_table[] = {
+19 -8
drivers/pci/pci.c
··· 1289 1289 EXPORT_SYMBOL(pci_save_state); 1290 1290 1291 1291 static void pci_restore_config_dword(struct pci_dev *pdev, int offset, 1292 - u32 saved_val, int retry) 1292 + u32 saved_val, int retry, bool force) 1293 1293 { 1294 1294 u32 val; 1295 1295 1296 1296 pci_read_config_dword(pdev, offset, &val); 1297 - if (val == saved_val) 1297 + if (!force && val == saved_val) 1298 1298 return; 1299 1299 1300 1300 for (;;) { ··· 1313 1313 } 1314 1314 1315 1315 static void pci_restore_config_space_range(struct pci_dev *pdev, 1316 - int start, int end, int retry) 1316 + int start, int end, int retry, 1317 + bool force) 1317 1318 { 1318 1319 int index; 1319 1320 1320 1321 for (index = end; index >= start; index--) 1321 1322 pci_restore_config_dword(pdev, 4 * index, 1322 1323 pdev->saved_config_space[index], 1323 - retry); 1324 + retry, force); 1324 1325 } 1325 1326 1326 1327 static void pci_restore_config_space(struct pci_dev *pdev) 1327 1328 { 1328 1329 if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) { 1329 - pci_restore_config_space_range(pdev, 10, 15, 0); 1330 + pci_restore_config_space_range(pdev, 10, 15, 0, false); 1330 1331 /* Restore BARs before the command register. */ 1331 - pci_restore_config_space_range(pdev, 4, 9, 10); 1332 - pci_restore_config_space_range(pdev, 0, 3, 0); 1332 + pci_restore_config_space_range(pdev, 4, 9, 10, false); 1333 + pci_restore_config_space_range(pdev, 0, 3, 0, false); 1334 + } else if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { 1335 + pci_restore_config_space_range(pdev, 12, 15, 0, false); 1336 + 1337 + /* 1338 + * Force rewriting of prefetch registers to avoid S3 resume 1339 + * issues on Intel PCI bridges that occur when these 1340 + * registers are not explicitly written. 1341 + */ 1342 + pci_restore_config_space_range(pdev, 9, 11, 0, true); 1343 + pci_restore_config_space_range(pdev, 0, 8, 0, false); 1333 1344 } else { 1334 - pci_restore_config_space_range(pdev, 0, 15, 0); 1345 + pci_restore_config_space_range(pdev, 0, 15, 0, false); 1335 1346 } 1336 1347 } 1337 1348
+1 -1
drivers/s390/net/qeth_core_main.c
··· 610 610 static void qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, int rc, 611 611 struct qeth_card *card) 612 612 { 613 - char *ipa_name; 613 + const char *ipa_name; 614 614 int com = cmd->hdr.command; 615 615 ipa_name = qeth_get_ipa_cmd_name(com); 616 616 if (rc)
+16 -17
drivers/s390/net/qeth_core_mpc.c
··· 148 148 149 149 struct ipa_rc_msg { 150 150 enum qeth_ipa_return_codes rc; 151 - char *msg; 151 + const char *msg; 152 152 }; 153 153 154 - static struct ipa_rc_msg qeth_ipa_rc_msg[] = { 154 + static const struct ipa_rc_msg qeth_ipa_rc_msg[] = { 155 155 {IPA_RC_SUCCESS, "success"}, 156 156 {IPA_RC_NOTSUPP, "Command not supported"}, 157 157 {IPA_RC_IP_TABLE_FULL, "Add Addr IP Table Full - ipv6"}, ··· 219 219 220 220 221 221 222 - char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc) 222 + const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc) 223 223 { 224 - int x = 0; 225 - qeth_ipa_rc_msg[sizeof(qeth_ipa_rc_msg) / 226 - sizeof(struct ipa_rc_msg) - 1].rc = rc; 227 - while (qeth_ipa_rc_msg[x].rc != rc) 228 - x++; 224 + int x; 225 + 226 + for (x = 0; x < ARRAY_SIZE(qeth_ipa_rc_msg) - 1; x++) 227 + if (qeth_ipa_rc_msg[x].rc == rc) 228 + return qeth_ipa_rc_msg[x].msg; 229 229 return qeth_ipa_rc_msg[x].msg; 230 230 } 231 231 232 232 233 233 struct ipa_cmd_names { 234 234 enum qeth_ipa_cmds cmd; 235 - char *name; 235 + const char *name; 236 236 }; 237 237 238 - static struct ipa_cmd_names qeth_ipa_cmd_names[] = { 238 + static const struct ipa_cmd_names qeth_ipa_cmd_names[] = { 239 239 {IPA_CMD_STARTLAN, "startlan"}, 240 240 {IPA_CMD_STOPLAN, "stoplan"}, 241 241 {IPA_CMD_SETVMAC, "setvmac"}, ··· 267 267 {IPA_CMD_UNKNOWN, "unknown"}, 268 268 }; 269 269 270 - char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd) 270 + const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd) 271 271 { 272 - int x = 0; 273 - qeth_ipa_cmd_names[ 274 - sizeof(qeth_ipa_cmd_names) / 275 - sizeof(struct ipa_cmd_names)-1].cmd = cmd; 276 - while (qeth_ipa_cmd_names[x].cmd != cmd) 277 - x++; 272 + int x; 273 + 274 + for (x = 0; x < ARRAY_SIZE(qeth_ipa_cmd_names) - 1; x++) 275 + if (qeth_ipa_cmd_names[x].cmd == cmd) 276 + return qeth_ipa_cmd_names[x].name; 278 277 return qeth_ipa_cmd_names[x].name; 279 278 }
+2 -2
drivers/s390/net/qeth_core_mpc.h
··· 797 797 QETH_IPA_ARP_RC_Q_NO_DATA = 0x0008, 798 798 }; 799 799 800 - extern char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc); 801 - extern char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd); 800 + extern const char *qeth_get_ipa_msg(enum qeth_ipa_return_codes rc); 801 + extern const char *qeth_get_ipa_cmd_name(enum qeth_ipa_cmds cmd); 802 802 803 803 #define QETH_SETASS_BASE_LEN (sizeof(struct qeth_ipacmd_hdr) + \ 804 804 sizeof(struct qeth_ipacmd_setassparms_hdr))
+1
drivers/scsi/qedi/qedi_main.c
··· 2472 2472 /* start qedi context */ 2473 2473 spin_lock_init(&qedi->hba_lock); 2474 2474 spin_lock_init(&qedi->task_idx_lock); 2475 + mutex_init(&qedi->stats_lock); 2475 2476 } 2476 2477 qedi_ops->ll2->register_cb_ops(qedi->cdev, &qedi_ll2_cb_ops, qedi); 2477 2478 qedi_ops->ll2->start(qedi->cdev, &params);
+3
drivers/soc/fsl/qbman/qman.c
··· 2729 2729 { 2730 2730 unsigned long addr; 2731 2731 2732 + if (!p) 2733 + return -ENODEV; 2734 + 2732 2735 addr = gen_pool_alloc(p, cnt); 2733 2736 if (!addr) 2734 2737 return -ENOMEM;
+1 -1
drivers/soc/fsl/qe/ucc.c
··· 626 626 { 627 627 u32 shift; 628 628 629 - shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : RX_SYNC_SHIFT_BASE; 629 + shift = (mode == COMM_DIR_RX) ? RX_SYNC_SHIFT_BASE : TX_SYNC_SHIFT_BASE; 630 630 shift -= tdm_num * 2; 631 631 632 632 return shift;
+20 -29
drivers/thunderbolt/icm.c
··· 735 735 u8 link, depth; 736 736 u64 route; 737 737 738 - /* 739 - * After NVM upgrade adding root switch device fails because we 740 - * initiated reset. During that time ICM might still send 741 - * XDomain connected message which we ignore here. 742 - */ 743 - if (!tb->root_switch) 744 - return; 745 - 746 738 link = pkg->link_info & ICM_LINK_INFO_LINK_MASK; 747 739 depth = (pkg->link_info & ICM_LINK_INFO_DEPTH_MASK) >> 748 740 ICM_LINK_INFO_DEPTH_SHIFT; ··· 1024 1032 * packet for now. 1025 1033 */ 1026 1034 if (pkg->hdr.packet_id) 1027 - return; 1028 - 1029 - /* 1030 - * After NVM upgrade adding root switch device fails because we 1031 - * initiated reset. During that time ICM might still send device 1032 - * connected message which we ignore here. 1033 - */ 1034 - if (!tb->root_switch) 1035 1035 return; 1036 1036 1037 1037 route = get_route(pkg->route_hi, pkg->route_lo); ··· 1389 1405 1390 1406 mutex_lock(&tb->lock); 1391 1407 1392 - switch (n->pkg->code) { 1393 - case ICM_EVENT_DEVICE_CONNECTED: 1394 - icm->device_connected(tb, n->pkg); 1395 - break; 1396 - case ICM_EVENT_DEVICE_DISCONNECTED: 1397 - icm->device_disconnected(tb, n->pkg); 1398 - break; 1399 - case ICM_EVENT_XDOMAIN_CONNECTED: 1400 - icm->xdomain_connected(tb, n->pkg); 1401 - break; 1402 - case ICM_EVENT_XDOMAIN_DISCONNECTED: 1403 - icm->xdomain_disconnected(tb, n->pkg); 1404 - break; 1408 + /* 1409 + * When the domain is stopped we flush its workqueue but before 1410 + * that the root switch is removed. In that case we should treat 1411 + * the queued events as being canceled. 1412 + */ 1413 + if (tb->root_switch) { 1414 + switch (n->pkg->code) { 1415 + case ICM_EVENT_DEVICE_CONNECTED: 1416 + icm->device_connected(tb, n->pkg); 1417 + break; 1418 + case ICM_EVENT_DEVICE_DISCONNECTED: 1419 + icm->device_disconnected(tb, n->pkg); 1420 + break; 1421 + case ICM_EVENT_XDOMAIN_CONNECTED: 1422 + icm->xdomain_connected(tb, n->pkg); 1423 + break; 1424 + case ICM_EVENT_XDOMAIN_DISCONNECTED: 1425 + icm->xdomain_disconnected(tb, n->pkg); 1426 + break; 1427 + } 1405 1428 } 1406 1429 1407 1430 mutex_unlock(&tb->lock);
+1 -1
drivers/thunderbolt/nhi.c
··· 1192 1192 tb_domain_exit(); 1193 1193 } 1194 1194 1195 - fs_initcall(nhi_init); 1195 + rootfs_initcall(nhi_init); 1196 1196 module_exit(nhi_unload);
-4
drivers/tty/serial/8250/8250_dw.c
··· 630 630 if (!data->skip_autocfg) 631 631 dw8250_setup_port(p); 632 632 633 - #ifdef CONFIG_PM 634 - uart.capabilities |= UART_CAP_RPM; 635 - #endif 636 - 637 633 /* If we have a valid fifosize, try hooking up DMA */ 638 634 if (p->fifosize) { 639 635 data->dma.rxconf.src_maxburst = p->fifosize / 4;
+41 -15
drivers/tty/serial/sh-sci.c
··· 292 292 }, 293 293 294 294 /* 295 + * The "SCIFA" that is in RZ/T and RZ/A2. 296 + * It looks like a normal SCIF with FIFO data, but with a 297 + * compressed address space. Also, the break out of interrupts 298 + * are different: ERI/BRI, RXI, TXI, TEI, DRI. 299 + */ 300 + [SCIx_RZ_SCIFA_REGTYPE] = { 301 + .regs = { 302 + [SCSMR] = { 0x00, 16 }, 303 + [SCBRR] = { 0x02, 8 }, 304 + [SCSCR] = { 0x04, 16 }, 305 + [SCxTDR] = { 0x06, 8 }, 306 + [SCxSR] = { 0x08, 16 }, 307 + [SCxRDR] = { 0x0A, 8 }, 308 + [SCFCR] = { 0x0C, 16 }, 309 + [SCFDR] = { 0x0E, 16 }, 310 + [SCSPTR] = { 0x10, 16 }, 311 + [SCLSR] = { 0x12, 16 }, 312 + }, 313 + .fifosize = 16, 314 + .overrun_reg = SCLSR, 315 + .overrun_mask = SCLSR_ORER, 316 + .sampling_rate_mask = SCI_SR(32), 317 + .error_mask = SCIF_DEFAULT_ERROR_MASK, 318 + .error_clear = SCIF_ERROR_CLEAR, 319 + }, 320 + 321 + /* 295 322 * Common SH-3 SCIF definitions. 296 323 */ 297 324 [SCIx_SH3_SCIF_REGTYPE] = { ··· 346 319 [SCIx_SH4_SCIF_REGTYPE] = { 347 320 .regs = { 348 321 [SCSMR] = { 0x00, 16 }, 349 - [SCBRR] = { 0x02, 8 }, 350 - [SCSCR] = { 0x04, 16 }, 351 - [SCxTDR] = { 0x06, 8 }, 352 - [SCxSR] = { 0x08, 16 }, 353 - [SCxRDR] = { 0x0a, 8 }, 354 - [SCFCR] = { 0x0c, 16 }, 355 - [SCFDR] = { 0x0e, 16 }, 356 - [SCSPTR] = { 0x10, 16 }, 357 - [SCLSR] = { 0x12, 16 }, 322 + [SCBRR] = { 0x04, 8 }, 323 + [SCSCR] = { 0x08, 16 }, 324 + [SCxTDR] = { 0x0c, 8 }, 325 + [SCxSR] = { 0x10, 16 }, 326 + [SCxRDR] = { 0x14, 8 }, 327 + [SCFCR] = { 0x18, 16 }, 328 + [SCFDR] = { 0x1c, 16 }, 329 + [SCSPTR] = { 0x20, 16 }, 330 + [SCLSR] = { 0x24, 16 }, 358 331 }, 359 332 .fifosize = 16, 360 333 .overrun_reg = SCLSR, ··· 2837 2810 { 2838 2811 struct uart_port *port = &sci_port->port; 2839 2812 const struct resource *res; 2840 - unsigned int i, regtype; 2813 + unsigned int i; 2841 2814 int ret; 2842 2815 2843 2816 sci_port->cfg = p; ··· 2874 2847 if (unlikely(sci_port->params == NULL)) 2875 2848 return -EINVAL; 2876 2849 2877 - regtype = sci_port->params - sci_port_params; 2878 2850 switch (p->type) { 2879 2851 case PORT_SCIFB: 2880 2852 sci_port->rx_trigger = 48; ··· 2927 2901 else 2928 2902 port->regshift = 1; 2929 2903 } 2930 - 2931 - if (regtype == SCIx_SH4_SCIF_REGTYPE) 2932 - if (sci_port->reg_size >= 0x20) 2933 - port->regshift = 1; 2934 2904 2935 2905 /* 2936 2906 * The UART port needs an IRQ value, so we peg this to the RX IRQ ··· 3131 3109 { 3132 3110 .compatible = "renesas,scif-r7s72100", 3133 3111 .data = SCI_OF_DATA(PORT_SCIF, SCIx_SH2_SCIF_FIFODATA_REGTYPE), 3112 + }, 3113 + { 3114 + .compatible = "renesas,scif-r7s9210", 3115 + .data = SCI_OF_DATA(PORT_SCIF, SCIx_RZ_SCIFA_REGTYPE), 3134 3116 }, 3135 3117 /* Family-specific types */ 3136 3118 {
+6
drivers/usb/class/cdc-acm.c
··· 1514 1514 { 1515 1515 struct acm *acm = usb_get_intfdata(intf); 1516 1516 struct tty_struct *tty; 1517 + int i; 1517 1518 1518 1519 /* sibling interface is already cleaning up */ 1519 1520 if (!acm) ··· 1545 1544 1546 1545 tty_unregister_device(acm_tty_driver, acm->minor); 1547 1546 1547 + usb_free_urb(acm->ctrlurb); 1548 + for (i = 0; i < ACM_NW; i++) 1549 + usb_free_urb(acm->wb[i].urb); 1550 + for (i = 0; i < acm->rx_buflimit; i++) 1551 + usb_free_urb(acm->read_urbs[i]); 1548 1552 acm_write_buffers_free(acm); 1549 1553 usb_free_coherent(acm->dev, acm->ctrlsize, acm->ctrl_buffer, acm->ctrl_dma); 1550 1554 acm_read_buffers_free(acm);
+2 -2
drivers/usb/host/xhci-mtk.c
··· 642 642 xhci_mtk_host_enable(mtk); 643 643 644 644 xhci_dbg(xhci, "%s: restart port polling\n", __func__); 645 - set_bit(HCD_FLAG_POLL_RH, &hcd->flags); 646 - usb_hcd_poll_rh_status(hcd); 647 645 set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); 648 646 usb_hcd_poll_rh_status(xhci->shared_hcd); 647 + set_bit(HCD_FLAG_POLL_RH, &hcd->flags); 648 + usb_hcd_poll_rh_status(hcd); 649 649 return 0; 650 650 } 651 651
+2
drivers/usb/host/xhci-pci.c
··· 185 185 } 186 186 if (pdev->vendor == PCI_VENDOR_ID_INTEL && 187 187 (pdev->device == PCI_DEVICE_ID_INTEL_CHERRYVIEW_XHCI || 188 + pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_LP_XHCI || 189 + pdev->device == PCI_DEVICE_ID_INTEL_SUNRISEPOINT_H_XHCI || 188 190 pdev->device == PCI_DEVICE_ID_INTEL_APL_XHCI || 189 191 pdev->device == PCI_DEVICE_ID_INTEL_DNV_XHCI)) 190 192 xhci->quirks |= XHCI_MISSING_CAS;
+13 -2
drivers/usb/serial/option.c
··· 561 561 /* Interface is reserved */ 562 562 #define RSVD(ifnum) ((BIT(ifnum) & 0xff) << 0) 563 563 564 + /* Interface must have two endpoints */ 565 + #define NUMEP2 BIT(16) 566 + 564 567 565 568 static const struct usb_device_id option_ids[] = { 566 569 { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, ··· 1084 1081 .driver_info = RSVD(4) }, 1085 1082 { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_BG96), 1086 1083 .driver_info = RSVD(4) }, 1087 - { USB_DEVICE(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06), 1088 - .driver_info = RSVD(4) | RSVD(5) }, 1084 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0xff, 0xff), 1085 + .driver_info = RSVD(1) | RSVD(2) | RSVD(3) | RSVD(4) | NUMEP2 }, 1086 + { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EP06, 0xff, 0, 0) }, 1089 1087 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6001) }, 1090 1088 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_CMU_300) }, 1091 1089 { USB_DEVICE(CMOTECH_VENDOR_ID, CMOTECH_PRODUCT_6003), ··· 2001 1997 * the Windows driver .INF files for reserved interface numbers. 2002 1998 */ 2003 1999 if (device_flags & RSVD(iface_desc->bInterfaceNumber)) 2000 + return -ENODEV; 2001 + 2002 + /* 2003 + * Allow matching on bNumEndpoints for devices whose interface numbers 2004 + * can change (e.g. Quectel EP06). 2005 + */ 2006 + if (device_flags & NUMEP2 && iface_desc->bNumEndpoints != 2) 2004 2007 return -ENODEV; 2005 2008 2006 2009 /* Store the device flags so we can use them during attach. */
+2 -1
drivers/usb/serial/usb-serial-simple.c
··· 84 84 85 85 /* Motorola Tetra driver */ 86 86 #define MOTOROLA_TETRA_IDS() \ 87 - { USB_DEVICE(0x0cad, 0x9011) } /* Motorola Solutions TETRA PEI */ 87 + { USB_DEVICE(0x0cad, 0x9011) }, /* Motorola Solutions TETRA PEI */ \ 88 + { USB_DEVICE(0x0cad, 0x9012) } /* MTP6550 */ 88 89 DEVICE(motorola_tetra, MOTOROLA_TETRA_IDS); 89 90 90 91 /* Novatel Wireless GPS driver */
+6
drivers/video/fbdev/efifb.c
··· 42 42 u32 colors_important; 43 43 } __packed; 44 44 45 + static bool use_bgrt = true; 45 46 static bool request_mem_succeeded = false; 46 47 static u64 mem_flags = EFI_MEMORY_WC | EFI_MEMORY_UC; 47 48 ··· 160 159 struct bmp_dib_header *dib_header; 161 160 void *bgrt_image = NULL; 162 161 u8 *dst = info->screen_base; 162 + 163 + if (!use_bgrt) 164 + return; 163 165 164 166 if (!bgrt_tab.image_address) { 165 167 pr_info("efifb: No BGRT, not showing boot graphics\n"); ··· 294 290 screen_info.lfb_width = simple_strtoul(this_opt+6, NULL, 0); 295 291 else if (!strcmp(this_opt, "nowc")) 296 292 mem_flags &= ~EFI_MEMORY_WC; 293 + else if (!strcmp(this_opt, "nobgrt")) 294 + use_bgrt = false; 297 295 } 298 296 } 299 297
+4 -1
drivers/video/fbdev/omap2/omapfb/omapfb-ioctl.c
··· 496 496 if (!access_ok(VERIFY_WRITE, mr->buffer, mr->buffer_size)) 497 497 return -EFAULT; 498 498 499 + if (mr->w > 4096 || mr->h > 4096) 500 + return -EINVAL; 501 + 499 502 if (mr->w * mr->h * 3 > mr->buffer_size) 500 503 return -EINVAL; 501 504 ··· 512 509 mr->x, mr->y, mr->w, mr->h); 513 510 514 511 if (r > 0) { 515 - if (copy_to_user(mr->buffer, buf, mr->buffer_size)) 512 + if (copy_to_user(mr->buffer, buf, r)) 516 513 r = -EFAULT; 517 514 } 518 515
+3 -3
drivers/video/fbdev/pxa168fb.c
··· 712 712 /* 713 713 * enable controller clock 714 714 */ 715 - clk_enable(fbi->clk); 715 + clk_prepare_enable(fbi->clk); 716 716 717 717 pxa168fb_set_par(info); 718 718 ··· 767 767 failed_free_cmap: 768 768 fb_dealloc_cmap(&info->cmap); 769 769 failed_free_clk: 770 - clk_disable(fbi->clk); 770 + clk_disable_unprepare(fbi->clk); 771 771 failed_free_fbmem: 772 772 dma_free_coherent(fbi->dev, info->fix.smem_len, 773 773 info->screen_base, fbi->fb_start_dma); ··· 807 807 dma_free_wc(fbi->dev, PAGE_ALIGN(info->fix.smem_len), 808 808 info->screen_base, info->fix.smem_start); 809 809 810 - clk_disable(fbi->clk); 810 + clk_disable_unprepare(fbi->clk); 811 811 812 812 framebuffer_release(info); 813 813
+1 -1
drivers/video/fbdev/stifb.c
··· 1157 1157 dev_name); 1158 1158 goto out_err0; 1159 1159 } 1160 - /* fall though */ 1160 + /* fall through */ 1161 1161 case S9000_ID_ARTIST: 1162 1162 case S9000_ID_HCRX: 1163 1163 case S9000_ID_TIMBER:
+1
fs/cifs/cifsglob.h
··· 1553 1553 1554 1554 /* Flags */ 1555 1555 #define MID_WAIT_CANCELLED 1 /* Cancelled while waiting for response */ 1556 + #define MID_DELETED 2 /* Mid has been dequeued/deleted */ 1556 1557 1557 1558 /* Types of response buffer returned from SendReceive2 */ 1558 1559 #define CIFS_NO_BUFFER 0 /* Response buffer not returned */
+10 -3
fs/cifs/connect.c
··· 659 659 mid->mid_state = MID_RESPONSE_RECEIVED; 660 660 else 661 661 mid->mid_state = MID_RESPONSE_MALFORMED; 662 - list_del_init(&mid->qhead); 662 + /* 663 + * Trying to handle/dequeue a mid after the send_recv() 664 + * function has finished processing it is a bug. 665 + */ 666 + if (mid->mid_flags & MID_DELETED) 667 + printk_once(KERN_WARNING 668 + "trying to dequeue a deleted mid\n"); 669 + else 670 + list_del_init(&mid->qhead); 663 671 spin_unlock(&GlobalMid_Lock); 664 672 } 665 673 ··· 946 938 } else { 947 939 mids[0] = server->ops->find_mid(server, buf); 948 940 bufs[0] = buf; 949 - if (mids[0]) 950 - num_mids = 1; 941 + num_mids = 1; 951 942 952 943 if (!mids[0] || !mids[0]->receive) 953 944 length = standard_receive3(server, mids[0]);
+1 -1
fs/cifs/smb2ops.c
··· 1477 1477 } 1478 1478 1479 1479 srch_inf->entries_in_buffer = 0; 1480 - srch_inf->index_of_last_entry = 0; 1480 + srch_inf->index_of_last_entry = 2; 1481 1481 1482 1482 rc = SMB2_query_directory(xid, tcon, fid->persistent_fid, 1483 1483 fid->volatile_fid, 0, srch_inf);
+19 -2
fs/cifs/transport.c
··· 142 142 cifs_delete_mid(struct mid_q_entry *mid) 143 143 { 144 144 spin_lock(&GlobalMid_Lock); 145 - list_del(&mid->qhead); 145 + list_del_init(&mid->qhead); 146 + mid->mid_flags |= MID_DELETED; 146 147 spin_unlock(&GlobalMid_Lock); 147 148 148 149 DeleteMidQEntry(mid); ··· 773 772 return mid; 774 773 } 775 774 775 + static void 776 + cifs_noop_callback(struct mid_q_entry *mid) 777 + { 778 + } 779 + 776 780 int 777 781 compound_send_recv(const unsigned int xid, struct cifs_ses *ses, 778 782 const int flags, const int num_rqst, struct smb_rqst *rqst, ··· 832 826 } 833 827 834 828 midQ[i]->mid_state = MID_REQUEST_SUBMITTED; 829 + /* 830 + * We don't invoke the callback compounds unless it is the last 831 + * request. 832 + */ 833 + if (i < num_rqst - 1) 834 + midQ[i]->callback = cifs_noop_callback; 835 835 } 836 - 837 836 cifs_in_send_inc(ses->server); 838 837 rc = smb_send_rqst(ses->server, num_rqst, rqst, flags); 839 838 cifs_in_send_dec(ses->server); ··· 919 908 midQ[i]->resp_buf = NULL; 920 909 } 921 910 out: 911 + /* 912 + * This will dequeue all mids. After this it is important that the 913 + * demultiplex_thread will not process any of these mids any futher. 914 + * This is prevented above by using a noop callback that will not 915 + * wake this thread except for the very last PDU. 916 + */ 922 917 for (i = 0; i < num_rqst; i++) 923 918 cifs_delete_mid(midQ[i]); 924 919 add_credits(ses->server, credits, optype);
+1 -1
fs/ioctl.c
··· 230 230 ret = -EXDEV; 231 231 if (src_file.file->f_path.mnt != dst_file->f_path.mnt) 232 232 goto fdput; 233 - ret = do_clone_file_range(src_file.file, off, dst_file, destoff, olen); 233 + ret = vfs_clone_file_range(src_file.file, off, dst_file, destoff, olen); 234 234 fdput: 235 235 fdput(src_file); 236 236 return ret;
+1 -1
fs/iomap.c
··· 1051 1051 } else { 1052 1052 WARN_ON_ONCE(!PageUptodate(page)); 1053 1053 iomap_page_create(inode, page); 1054 + set_page_dirty(page); 1054 1055 } 1055 1056 1056 1057 return length; ··· 1091 1090 length -= ret; 1092 1091 } 1093 1092 1094 - set_page_dirty(page); 1095 1093 wait_for_stable_page(page); 1096 1094 return VM_FAULT_LOCKED; 1097 1095 out_unlock:
+2 -1
fs/nfsd/vfs.c
··· 541 541 __be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, 542 542 u64 dst_pos, u64 count) 543 543 { 544 - return nfserrno(do_clone_file_range(src, src_pos, dst, dst_pos, count)); 544 + return nfserrno(vfs_clone_file_range(src, src_pos, dst, dst_pos, 545 + count)); 545 546 } 546 547 547 548 ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst,
+2 -2
fs/ocfs2/dlm/dlmmaster.c
··· 584 584 585 585 res->last_used = 0; 586 586 587 - spin_lock(&dlm->spinlock); 587 + spin_lock(&dlm->track_lock); 588 588 list_add_tail(&res->tracking, &dlm->tracking_list); 589 - spin_unlock(&dlm->spinlock); 589 + spin_unlock(&dlm->track_lock); 590 590 591 591 memset(res->lvb, 0, DLM_LVB_LEN); 592 592 memset(res->refmap, 0, sizeof(res->refmap));
+12 -4
fs/ocfs2/refcounttree.c
··· 2946 2946 if (map_end & (PAGE_SIZE - 1)) 2947 2947 to = map_end & (PAGE_SIZE - 1); 2948 2948 2949 + retry: 2949 2950 page = find_or_create_page(mapping, page_index, GFP_NOFS); 2950 2951 if (!page) { 2951 2952 ret = -ENOMEM; ··· 2955 2954 } 2956 2955 2957 2956 /* 2958 - * In case PAGE_SIZE <= CLUSTER_SIZE, This page 2959 - * can't be dirtied before we CoW it out. 2957 + * In case PAGE_SIZE <= CLUSTER_SIZE, we do not expect a dirty 2958 + * page, so write it back. 2960 2959 */ 2961 - if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize) 2962 - BUG_ON(PageDirty(page)); 2960 + if (PAGE_SIZE <= OCFS2_SB(sb)->s_clustersize) { 2961 + if (PageDirty(page)) { 2962 + /* 2963 + * write_on_page will unlock the page on return 2964 + */ 2965 + ret = write_one_page(page); 2966 + goto retry; 2967 + } 2968 + } 2963 2969 2964 2970 if (!PageUptodate(page)) { 2965 2971 ret = block_read_full_page(page, ocfs2_get_block);
+1 -1
fs/overlayfs/copy_up.c
··· 141 141 } 142 142 143 143 /* Try to use clone_file_range to clone up within the same fs */ 144 - error = vfs_clone_file_range(old_file, 0, new_file, 0, len); 144 + error = do_clone_file_range(old_file, 0, new_file, 0, len); 145 145 if (!error) 146 146 goto out; 147 147 /* Couldn't clone, so now we try to copy the data */
+2
fs/overlayfs/file.c
··· 240 240 goto out_unlock; 241 241 242 242 old_cred = ovl_override_creds(file_inode(file)->i_sb); 243 + file_start_write(real.file); 243 244 ret = vfs_iter_write(real.file, iter, &iocb->ki_pos, 244 245 ovl_iocb_to_rwf(iocb)); 246 + file_end_write(real.file); 245 247 revert_creds(old_cred); 246 248 247 249 /* Update size */
+1 -1
fs/overlayfs/inode.c
··· 504 504 .update_time = ovl_update_time, 505 505 }; 506 506 507 - const struct address_space_operations ovl_aops = { 507 + static const struct address_space_operations ovl_aops = { 508 508 /* For O_DIRECT dentry_open() checks f_mapping->a_ops->direct_IO */ 509 509 .direct_IO = noop_direct_IO, 510 510 };
+1 -1
fs/overlayfs/namei.c
··· 686 686 index = NULL; 687 687 goto out; 688 688 } 689 - pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%*s, err=%i);\n" 689 + pr_warn_ratelimited("overlayfs: failed inode index lookup (ino=%lu, key=%.*s, err=%i);\n" 690 690 "overlayfs: mount with '-o index=off' to disable inodes index.\n", 691 691 d_inode(origin)->i_ino, name.len, name.name, 692 692 err);
+2 -2
fs/overlayfs/overlayfs.h
··· 152 152 const void *value, size_t size, int flags) 153 153 { 154 154 int err = vfs_setxattr(dentry, name, value, size, flags); 155 - pr_debug("setxattr(%pd2, \"%s\", \"%*s\", 0x%x) = %i\n", 156 - dentry, name, (int) size, (char *) value, flags, err); 155 + pr_debug("setxattr(%pd2, \"%s\", \"%*pE\", %zu, 0x%x) = %i\n", 156 + dentry, name, min((int)size, 48), value, size, flags, err); 157 157 return err; 158 158 } 159 159
+2 -1
fs/overlayfs/util.c
··· 683 683 struct dentry *upperdentry = ovl_dentry_upper(dentry); 684 684 struct dentry *index = NULL; 685 685 struct inode *inode; 686 - struct qstr name; 686 + struct qstr name = { }; 687 687 int err; 688 688 689 689 err = ovl_get_index_name(lowerdentry, &name); ··· 726 726 goto fail; 727 727 728 728 out: 729 + kfree(name.name); 729 730 dput(index); 730 731 return; 731 732
+14
fs/proc/base.c
··· 407 407 unsigned long *entries; 408 408 int err; 409 409 410 + /* 411 + * The ability to racily run the kernel stack unwinder on a running task 412 + * and then observe the unwinder output is scary; while it is useful for 413 + * debugging kernel issues, it can also allow an attacker to leak kernel 414 + * stack contents. 415 + * Doing this in a manner that is at least safe from races would require 416 + * some work to ensure that the remote task can not be scheduled; and 417 + * even then, this would still expose the unwinder as local attack 418 + * surface. 419 + * Therefore, this interface is restricted to root. 420 + */ 421 + if (!file_ns_capable(m->file, &init_user_ns, CAP_SYS_ADMIN)) 422 + return -EACCES; 423 + 410 424 entries = kmalloc_array(MAX_STACK_TRACE_DEPTH, sizeof(*entries), 411 425 GFP_KERNEL); 412 426 if (!entries)
+25 -4
fs/pstore/ram.c
··· 898 898 }, 899 899 }; 900 900 901 - static void ramoops_register_dummy(void) 901 + static inline void ramoops_unregister_dummy(void) 902 902 { 903 + platform_device_unregister(dummy); 904 + dummy = NULL; 905 + 906 + kfree(dummy_data); 907 + dummy_data = NULL; 908 + } 909 + 910 + static void __init ramoops_register_dummy(void) 911 + { 912 + /* 913 + * Prepare a dummy platform data structure to carry the module 914 + * parameters. If mem_size isn't set, then there are no module 915 + * parameters, and we can skip this. 916 + */ 903 917 if (!mem_size) 904 918 return; 905 919 ··· 946 932 if (IS_ERR(dummy)) { 947 933 pr_info("could not create platform device: %ld\n", 948 934 PTR_ERR(dummy)); 935 + dummy = NULL; 936 + ramoops_unregister_dummy(); 949 937 } 950 938 } 951 939 952 940 static int __init ramoops_init(void) 953 941 { 942 + int ret; 943 + 954 944 ramoops_register_dummy(); 955 - return platform_driver_register(&ramoops_driver); 945 + ret = platform_driver_register(&ramoops_driver); 946 + if (ret != 0) 947 + ramoops_unregister_dummy(); 948 + 949 + return ret; 956 950 } 957 951 late_initcall(ramoops_init); 958 952 959 953 static void __exit ramoops_exit(void) 960 954 { 961 955 platform_driver_unregister(&ramoops_driver); 962 - platform_device_unregister(dummy); 963 - kfree(dummy_data); 956 + ramoops_unregister_dummy(); 964 957 } 965 958 module_exit(ramoops_exit); 966 959
+15 -2
fs/read_write.c
··· 1818 1818 } 1819 1819 EXPORT_SYMBOL(vfs_clone_file_prep_inodes); 1820 1820 1821 - int vfs_clone_file_range(struct file *file_in, loff_t pos_in, 1822 - struct file *file_out, loff_t pos_out, u64 len) 1821 + int do_clone_file_range(struct file *file_in, loff_t pos_in, 1822 + struct file *file_out, loff_t pos_out, u64 len) 1823 1823 { 1824 1824 struct inode *inode_in = file_inode(file_in); 1825 1825 struct inode *inode_out = file_inode(file_out); ··· 1863 1863 fsnotify_access(file_in); 1864 1864 fsnotify_modify(file_out); 1865 1865 } 1866 + 1867 + return ret; 1868 + } 1869 + EXPORT_SYMBOL(do_clone_file_range); 1870 + 1871 + int vfs_clone_file_range(struct file *file_in, loff_t pos_in, 1872 + struct file *file_out, loff_t pos_out, u64 len) 1873 + { 1874 + int ret; 1875 + 1876 + file_start_write(file_out); 1877 + ret = do_clone_file_range(file_in, pos_in, file_out, pos_out, len); 1878 + file_end_write(file_out); 1866 1879 1867 1880 return ret; 1868 1881 }
+13 -11
fs/xattr.c
··· 948 948 int err = 0; 949 949 950 950 #ifdef CONFIG_FS_POSIX_ACL 951 - if (inode->i_acl) { 952 - err = xattr_list_one(&buffer, &remaining_size, 953 - XATTR_NAME_POSIX_ACL_ACCESS); 954 - if (err) 955 - return err; 956 - } 957 - if (inode->i_default_acl) { 958 - err = xattr_list_one(&buffer, &remaining_size, 959 - XATTR_NAME_POSIX_ACL_DEFAULT); 960 - if (err) 961 - return err; 951 + if (IS_POSIXACL(inode)) { 952 + if (inode->i_acl) { 953 + err = xattr_list_one(&buffer, &remaining_size, 954 + XATTR_NAME_POSIX_ACL_ACCESS); 955 + if (err) 956 + return err; 957 + } 958 + if (inode->i_default_acl) { 959 + err = xattr_list_one(&buffer, &remaining_size, 960 + XATTR_NAME_POSIX_ACL_DEFAULT); 961 + if (err) 962 + return err; 963 + } 962 964 } 963 965 #endif 964 966
+8 -20
fs/xfs/libxfs/xfs_attr.c
··· 587 587 */ 588 588 error = xfs_attr3_leaf_to_node(args); 589 589 if (error) 590 - goto out_defer_cancel; 590 + return error; 591 591 error = xfs_defer_finish(&args->trans); 592 592 if (error) 593 593 return error; ··· 675 675 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); 676 676 /* bp is gone due to xfs_da_shrink_inode */ 677 677 if (error) 678 - goto out_defer_cancel; 678 + return error; 679 679 error = xfs_defer_finish(&args->trans); 680 680 if (error) 681 681 return error; ··· 692 692 */ 693 693 error = xfs_attr3_leaf_clearflag(args); 694 694 } 695 - return error; 696 - out_defer_cancel: 697 - xfs_defer_cancel(args->trans); 698 695 return error; 699 696 } 700 697 ··· 735 738 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); 736 739 /* bp is gone due to xfs_da_shrink_inode */ 737 740 if (error) 738 - goto out_defer_cancel; 741 + return error; 739 742 error = xfs_defer_finish(&args->trans); 740 743 if (error) 741 744 return error; 742 745 } 743 746 return 0; 744 - out_defer_cancel: 745 - xfs_defer_cancel(args->trans); 746 - return error; 747 747 } 748 748 749 749 /* ··· 858 864 state = NULL; 859 865 error = xfs_attr3_leaf_to_node(args); 860 866 if (error) 861 - goto out_defer_cancel; 867 + goto out; 862 868 error = xfs_defer_finish(&args->trans); 863 869 if (error) 864 870 goto out; ··· 882 888 */ 883 889 error = xfs_da3_split(state); 884 890 if (error) 885 - goto out_defer_cancel; 891 + goto out; 886 892 error = xfs_defer_finish(&args->trans); 887 893 if (error) 888 894 goto out; ··· 978 984 if (retval && (state->path.active > 1)) { 979 985 error = xfs_da3_join(state); 980 986 if (error) 981 - goto out_defer_cancel; 987 + goto out; 982 988 error = xfs_defer_finish(&args->trans); 983 989 if (error) 984 990 goto out; ··· 1007 1013 if (error) 1008 1014 return error; 1009 1015 return retval; 1010 - out_defer_cancel: 1011 - xfs_defer_cancel(args->trans); 1012 - goto out; 1013 1016 } 1014 1017 1015 1018 /* ··· 1098 1107 if (retval && (state->path.active > 1)) { 1099 1108 error = xfs_da3_join(state); 1100 1109 if (error) 1101 - goto out_defer_cancel; 1110 + goto out; 1102 1111 error = xfs_defer_finish(&args->trans); 1103 1112 if (error) 1104 1113 goto out; ··· 1129 1138 error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); 1130 1139 /* bp is gone due to xfs_da_shrink_inode */ 1131 1140 if (error) 1132 - goto out_defer_cancel; 1141 + goto out; 1133 1142 error = xfs_defer_finish(&args->trans); 1134 1143 if (error) 1135 1144 goto out; ··· 1141 1150 out: 1142 1151 xfs_da_state_free(state); 1143 1152 return error; 1144 - out_defer_cancel: 1145 - xfs_defer_cancel(args->trans); 1146 - goto out; 1147 1153 } 1148 1154 1149 1155 /*
+2 -8
fs/xfs/libxfs/xfs_attr_remote.c
··· 485 485 blkcnt, XFS_BMAPI_ATTRFORK, args->total, &map, 486 486 &nmap); 487 487 if (error) 488 - goto out_defer_cancel; 488 + return error; 489 489 error = xfs_defer_finish(&args->trans); 490 490 if (error) 491 491 return error; ··· 553 553 } 554 554 ASSERT(valuelen == 0); 555 555 return 0; 556 - out_defer_cancel: 557 - xfs_defer_cancel(args->trans); 558 - return error; 559 556 } 560 557 561 558 /* ··· 622 625 error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, 623 626 XFS_BMAPI_ATTRFORK, 1, &done); 624 627 if (error) 625 - goto out_defer_cancel; 628 + return error; 626 629 error = xfs_defer_finish(&args->trans); 627 630 if (error) 628 631 return error; ··· 635 638 return error; 636 639 } 637 640 return 0; 638 - out_defer_cancel: 639 - xfs_defer_cancel(args->trans); 640 - return error; 641 641 }
+13 -11
fs/xfs/libxfs/xfs_bmap.c
··· 673 673 ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_EXTENTS); 674 674 675 675 /* 676 - * Make space in the inode incore. 676 + * Make space in the inode incore. This needs to be undone if we fail 677 + * to expand the root. 677 678 */ 678 679 xfs_iroot_realloc(ip, 1, whichfork); 679 680 ifp->if_flags |= XFS_IFBROOT; ··· 712 711 args.minlen = args.maxlen = args.prod = 1; 713 712 args.wasdel = wasdel; 714 713 *logflagsp = 0; 715 - if ((error = xfs_alloc_vextent(&args))) { 716 - ASSERT(ifp->if_broot == NULL); 717 - goto err1; 718 - } 714 + error = xfs_alloc_vextent(&args); 715 + if (error) 716 + goto out_root_realloc; 719 717 720 718 if (WARN_ON_ONCE(args.fsbno == NULLFSBLOCK)) { 721 - ASSERT(ifp->if_broot == NULL); 722 719 error = -ENOSPC; 723 - goto err1; 720 + goto out_root_realloc; 724 721 } 722 + 725 723 /* 726 724 * Allocation can't fail, the space was reserved. 727 725 */ ··· 732 732 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L); 733 733 abp = xfs_btree_get_bufl(mp, tp, args.fsbno, 0); 734 734 if (!abp) { 735 - error = -ENOSPC; 736 - goto err2; 735 + error = -EFSCORRUPTED; 736 + goto out_unreserve_dquot; 737 737 } 738 + 738 739 /* 739 740 * Fill in the child block. 740 741 */ ··· 776 775 *logflagsp = XFS_ILOG_CORE | xfs_ilog_fbroot(whichfork); 777 776 return 0; 778 777 779 - err2: 778 + out_unreserve_dquot: 780 779 xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L); 781 - err1: 780 + out_root_realloc: 782 781 xfs_iroot_realloc(ip, -1, whichfork); 783 782 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS); 783 + ASSERT(ifp->if_broot == NULL); 784 784 xfs_btree_del_cursor(cur, XFS_BTREE_ERROR); 785 785 786 786 return error;
+2
fs/xfs/libxfs/xfs_format.h
··· 1016 1016 #define XFS_DIFLAG_EXTSZINHERIT_BIT 12 /* inherit inode extent size */ 1017 1017 #define XFS_DIFLAG_NODEFRAG_BIT 13 /* do not reorganize/defragment */ 1018 1018 #define XFS_DIFLAG_FILESTREAM_BIT 14 /* use filestream allocator */ 1019 + /* Do not use bit 15, di_flags is legacy and unchanging now */ 1020 + 1019 1021 #define XFS_DIFLAG_REALTIME (1 << XFS_DIFLAG_REALTIME_BIT) 1020 1022 #define XFS_DIFLAG_PREALLOC (1 << XFS_DIFLAG_PREALLOC_BIT) 1021 1023 #define XFS_DIFLAG_NEWRTBM (1 << XFS_DIFLAG_NEWRTBM_BIT)
+30
fs/xfs/libxfs/xfs_inode_buf.c
··· 415 415 return NULL; 416 416 } 417 417 418 + static xfs_failaddr_t 419 + xfs_dinode_verify_forkoff( 420 + struct xfs_dinode *dip, 421 + struct xfs_mount *mp) 422 + { 423 + if (!XFS_DFORK_Q(dip)) 424 + return NULL; 425 + 426 + switch (dip->di_format) { 427 + case XFS_DINODE_FMT_DEV: 428 + if (dip->di_forkoff != (roundup(sizeof(xfs_dev_t), 8) >> 3)) 429 + return __this_address; 430 + break; 431 + case XFS_DINODE_FMT_LOCAL: /* fall through ... */ 432 + case XFS_DINODE_FMT_EXTENTS: /* fall through ... */ 433 + case XFS_DINODE_FMT_BTREE: 434 + if (dip->di_forkoff >= (XFS_LITINO(mp, dip->di_version) >> 3)) 435 + return __this_address; 436 + break; 437 + default: 438 + return __this_address; 439 + } 440 + return NULL; 441 + } 442 + 418 443 xfs_failaddr_t 419 444 xfs_dinode_verify( 420 445 struct xfs_mount *mp, ··· 494 469 495 470 if (mode && (flags & XFS_DIFLAG_REALTIME) && !mp->m_rtdev_targp) 496 471 return __this_address; 472 + 473 + /* check for illegal values of forkoff */ 474 + fa = xfs_dinode_verify_forkoff(dip, mp); 475 + if (fa) 476 + return fa; 497 477 498 478 /* Do we have appropriate data fork formats for the mode? */ 499 479 switch (mode & S_IFMT) {
-1
fs/xfs/scrub/alloc.c
··· 17 17 #include "xfs_sb.h" 18 18 #include "xfs_alloc.h" 19 19 #include "xfs_rmap.h" 20 - #include "xfs_alloc.h" 21 20 #include "scrub/xfs_scrub.h" 22 21 #include "scrub/scrub.h" 23 22 #include "scrub/common.h"
+3 -1
fs/xfs/scrub/inode.c
··· 126 126 { 127 127 struct xfs_mount *mp = sc->mp; 128 128 129 + /* di_flags are all taken, last bit cannot be used */ 129 130 if (flags & ~XFS_DIFLAG_ANY) 130 131 goto bad; 131 132 ··· 173 172 { 174 173 struct xfs_mount *mp = sc->mp; 175 174 175 + /* Unknown di_flags2 could be from a future kernel */ 176 176 if (flags2 & ~XFS_DIFLAG2_ANY) 177 - goto bad; 177 + xchk_ino_set_warning(sc, ino); 178 178 179 179 /* reflink flag requires reflink feature */ 180 180 if ((flags2 & XFS_DIFLAG2_REFLINK) &&
+7 -13
fs/xfs/xfs_bmap_util.c
··· 702 702 struct xfs_iext_cursor icur; 703 703 int error = 0; 704 704 705 - xfs_ilock(ip, XFS_ILOCK_EXCL); 706 - if (!(ifp->if_flags & XFS_IFEXTENTS)) { 707 - error = xfs_iread_extents(NULL, ip, XFS_DATA_FORK); 708 - if (error) 709 - goto out_unlock; 710 - } 705 + ASSERT(ifp->if_flags & XFS_IFEXTENTS); 711 706 707 + xfs_ilock(ip, XFS_ILOCK_EXCL); 712 708 if (!xfs_iext_lookup_extent_before(ip, ifp, &end_fsb, &icur, &got)) 713 709 goto out_unlock; 714 710 ··· 1580 1584 tirec.br_blockcount, &irec, 1581 1585 &nimaps, 0); 1582 1586 if (error) 1583 - goto out_defer; 1587 + goto out; 1584 1588 ASSERT(nimaps == 1); 1585 1589 ASSERT(tirec.br_startoff == irec.br_startoff); 1586 1590 trace_xfs_swap_extent_rmap_remap_piece(ip, &irec); ··· 1595 1599 /* Remove the mapping from the donor file. */ 1596 1600 error = xfs_bmap_unmap_extent(tp, tip, &uirec); 1597 1601 if (error) 1598 - goto out_defer; 1602 + goto out; 1599 1603 1600 1604 /* Remove the mapping from the source file. */ 1601 1605 error = xfs_bmap_unmap_extent(tp, ip, &irec); 1602 1606 if (error) 1603 - goto out_defer; 1607 + goto out; 1604 1608 1605 1609 /* Map the donor file's blocks into the source file. */ 1606 1610 error = xfs_bmap_map_extent(tp, ip, &uirec); 1607 1611 if (error) 1608 - goto out_defer; 1612 + goto out; 1609 1613 1610 1614 /* Map the source file's blocks into the donor file. */ 1611 1615 error = xfs_bmap_map_extent(tp, tip, &irec); 1612 1616 if (error) 1613 - goto out_defer; 1617 + goto out; 1614 1618 1615 1619 error = xfs_defer_finish(tpp); 1616 1620 tp = *tpp; ··· 1632 1636 tip->i_d.di_flags2 = tip_flags2; 1633 1637 return 0; 1634 1638 1635 - out_defer: 1636 - xfs_defer_cancel(tp); 1637 1639 out: 1638 1640 trace_xfs_swap_extent_rmap_error(ip, error, _RET_IP_); 1639 1641 tip->i_d.di_flags2 = tip_flags2;
+64 -55
fs/xfs/xfs_buf_item.c
··· 532 532 } 533 533 534 534 /* 535 + * Drop the buffer log item refcount and take appropriate action. This helper 536 + * determines whether the bli must be freed or not, since a decrement to zero 537 + * does not necessarily mean the bli is unused. 538 + * 539 + * Return true if the bli is freed, false otherwise. 540 + */ 541 + bool 542 + xfs_buf_item_put( 543 + struct xfs_buf_log_item *bip) 544 + { 545 + struct xfs_log_item *lip = &bip->bli_item; 546 + bool aborted; 547 + bool dirty; 548 + 549 + /* drop the bli ref and return if it wasn't the last one */ 550 + if (!atomic_dec_and_test(&bip->bli_refcount)) 551 + return false; 552 + 553 + /* 554 + * We dropped the last ref and must free the item if clean or aborted. 555 + * If the bli is dirty and non-aborted, the buffer was clean in the 556 + * transaction but still awaiting writeback from previous changes. In 557 + * that case, the bli is freed on buffer writeback completion. 558 + */ 559 + aborted = test_bit(XFS_LI_ABORTED, &lip->li_flags) || 560 + XFS_FORCED_SHUTDOWN(lip->li_mountp); 561 + dirty = bip->bli_flags & XFS_BLI_DIRTY; 562 + if (dirty && !aborted) 563 + return false; 564 + 565 + /* 566 + * The bli is aborted or clean. An aborted item may be in the AIL 567 + * regardless of dirty state. For example, consider an aborted 568 + * transaction that invalidated a dirty bli and cleared the dirty 569 + * state. 570 + */ 571 + if (aborted) 572 + xfs_trans_ail_remove(lip, SHUTDOWN_LOG_IO_ERROR); 573 + xfs_buf_item_relse(bip->bli_buf); 574 + return true; 575 + } 576 + 577 + /* 535 578 * Release the buffer associated with the buf log item. If there is no dirty 536 579 * logged data associated with the buffer recorded in the buf log item, then 537 580 * free the buf log item and remove the reference to it in the buffer. ··· 599 556 { 600 557 struct xfs_buf_log_item *bip = BUF_ITEM(lip); 601 558 struct xfs_buf *bp = bip->bli_buf; 602 - bool aborted; 603 - bool hold = !!(bip->bli_flags & XFS_BLI_HOLD); 604 - bool dirty = !!(bip->bli_flags & XFS_BLI_DIRTY); 559 + bool released; 560 + bool hold = bip->bli_flags & XFS_BLI_HOLD; 561 + bool stale = bip->bli_flags & XFS_BLI_STALE; 605 562 #if defined(DEBUG) || defined(XFS_WARN) 606 - bool ordered = !!(bip->bli_flags & XFS_BLI_ORDERED); 563 + bool ordered = bip->bli_flags & XFS_BLI_ORDERED; 564 + bool dirty = bip->bli_flags & XFS_BLI_DIRTY; 607 565 #endif 608 - 609 - aborted = test_bit(XFS_LI_ABORTED, &lip->li_flags); 610 - 611 - /* Clear the buffer's association with this transaction. */ 612 - bp->b_transp = NULL; 613 - 614 - /* 615 - * The per-transaction state has been copied above so clear it from the 616 - * bli. 617 - */ 618 - bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED); 619 - 620 - /* 621 - * If the buf item is marked stale, then don't do anything. We'll 622 - * unlock the buffer and free the buf item when the buffer is unpinned 623 - * for the last time. 624 - */ 625 - if (bip->bli_flags & XFS_BLI_STALE) { 626 - trace_xfs_buf_item_unlock_stale(bip); 627 - ASSERT(bip->__bli_format.blf_flags & XFS_BLF_CANCEL); 628 - if (!aborted) { 629 - atomic_dec(&bip->bli_refcount); 630 - return; 631 - } 632 - } 633 566 634 567 trace_xfs_buf_item_unlock(bip); 635 568 636 569 /* 637 - * If the buf item isn't tracking any data, free it, otherwise drop the 638 - * reference we hold to it. If we are aborting the transaction, this may 639 - * be the only reference to the buf item, so we free it anyway 640 - * regardless of whether it is dirty or not. A dirty abort implies a 641 - * shutdown, anyway. 642 - * 643 570 * The bli dirty state should match whether the blf has logged segments 644 571 * except for ordered buffers, where only the bli should be dirty. 645 572 */ 646 573 ASSERT((!ordered && dirty == xfs_buf_item_dirty_format(bip)) || 647 574 (ordered && dirty && !xfs_buf_item_dirty_format(bip))); 575 + ASSERT(!stale || (bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); 648 576 649 577 /* 650 - * Clean buffers, by definition, cannot be in the AIL. However, aborted 651 - * buffers may be in the AIL regardless of dirty state. An aborted 652 - * transaction that invalidates a buffer already in the AIL may have 653 - * marked it stale and cleared the dirty state, for example. 654 - * 655 - * Therefore if we are aborting a buffer and we've just taken the last 656 - * reference away, we have to check if it is in the AIL before freeing 657 - * it. We need to free it in this case, because an aborted transaction 658 - * has already shut the filesystem down and this is the last chance we 659 - * will have to do so. 578 + * Clear the buffer's association with this transaction and 579 + * per-transaction state from the bli, which has been copied above. 660 580 */ 661 - if (atomic_dec_and_test(&bip->bli_refcount)) { 662 - if (aborted) { 663 - ASSERT(XFS_FORCED_SHUTDOWN(lip->li_mountp)); 664 - xfs_trans_ail_remove(lip, SHUTDOWN_LOG_IO_ERROR); 665 - xfs_buf_item_relse(bp); 666 - } else if (!dirty) 667 - xfs_buf_item_relse(bp); 668 - } 581 + bp->b_transp = NULL; 582 + bip->bli_flags &= ~(XFS_BLI_LOGGED | XFS_BLI_HOLD | XFS_BLI_ORDERED); 669 583 670 - if (!hold) 671 - xfs_buf_relse(bp); 584 + /* 585 + * Unref the item and unlock the buffer unless held or stale. Stale 586 + * buffers remain locked until final unpin unless the bli is freed by 587 + * the unref call. The latter implies shutdown because buffer 588 + * invalidation dirties the bli and transaction. 589 + */ 590 + released = xfs_buf_item_put(bip); 591 + if (hold || (stale && !released)) 592 + return; 593 + ASSERT(!stale || test_bit(XFS_LI_ABORTED, &lip->li_flags)); 594 + xfs_buf_relse(bp); 672 595 } 673 596 674 597 /*
+1
fs/xfs/xfs_buf_item.h
··· 51 51 52 52 int xfs_buf_item_init(struct xfs_buf *, struct xfs_mount *); 53 53 void xfs_buf_item_relse(struct xfs_buf *); 54 + bool xfs_buf_item_put(struct xfs_buf_log_item *); 54 55 void xfs_buf_item_log(struct xfs_buf_log_item *, uint, uint); 55 56 bool xfs_buf_item_dirty_format(struct xfs_buf_log_item *); 56 57 void xfs_buf_attach_iodone(struct xfs_buf *,
+1 -9
fs/xfs/xfs_inode.c
··· 1563 1563 error = xfs_bunmapi(tp, ip, first_unmap_block, unmap_len, flags, 1564 1564 XFS_ITRUNC_MAX_EXTENTS, &done); 1565 1565 if (error) 1566 - goto out_bmap_cancel; 1566 + goto out; 1567 1567 1568 1568 /* 1569 1569 * Duplicate the transaction that has the permanent ··· 1599 1599 out: 1600 1600 *tpp = tp; 1601 1601 return error; 1602 - out_bmap_cancel: 1603 - /* 1604 - * If the bunmapi call encounters an error, return to the caller where 1605 - * the transaction can be properly aborted. We just need to make sure 1606 - * we're not holding any resources that we were not when we came in. 1607 - */ 1608 - xfs_defer_cancel(tp); 1609 - goto out; 1610 1602 } 1611 1603 1612 1604 int
+11 -1
fs/xfs/xfs_iops.c
··· 471 471 struct inode *inode, 472 472 struct delayed_call *done) 473 473 { 474 + char *link; 475 + 474 476 ASSERT(XFS_I(inode)->i_df.if_flags & XFS_IFINLINE); 475 - return XFS_I(inode)->i_df.if_u1.if_data; 477 + 478 + /* 479 + * The VFS crashes on a NULL pointer, so return -EFSCORRUPTED if 480 + * if_data is junk. 481 + */ 482 + link = XFS_I(inode)->i_df.if_u1.if_data; 483 + if (!link) 484 + return ERR_PTR(-EFSCORRUPTED); 485 + return link; 476 486 } 477 487 478 488 STATIC int
-10
fs/xfs/xfs_log_recover.c
··· 1570 1570 if (last_cycle != 0) { /* log completely written to */ 1571 1571 xlog_put_bp(bp); 1572 1572 return 0; 1573 - } else if (first_cycle != 1) { 1574 - /* 1575 - * If the cycle of the last block is zero, the cycle of 1576 - * the first block must be 1. If it's not, maybe we're 1577 - * not looking at a log... Bail out. 1578 - */ 1579 - xfs_warn(log->l_mp, 1580 - "Log inconsistent or not a log (last==0, first!=1)"); 1581 - error = -EINVAL; 1582 - goto bp_err; 1583 1573 } 1584 1574 1585 1575 /* we have a partially zeroed log */
+84 -59
fs/xfs/xfs_reflink.c
··· 352 352 return error; 353 353 } 354 354 355 + /* 356 + * Find the extent that maps the given range in the COW fork. Even if the extent 357 + * is not shared we might have a preallocation for it in the COW fork. If so we 358 + * use it that rather than trigger a new allocation. 359 + */ 360 + static int 361 + xfs_find_trim_cow_extent( 362 + struct xfs_inode *ip, 363 + struct xfs_bmbt_irec *imap, 364 + bool *shared, 365 + bool *found) 366 + { 367 + xfs_fileoff_t offset_fsb = imap->br_startoff; 368 + xfs_filblks_t count_fsb = imap->br_blockcount; 369 + struct xfs_iext_cursor icur; 370 + struct xfs_bmbt_irec got; 371 + bool trimmed; 372 + 373 + *found = false; 374 + 375 + /* 376 + * If we don't find an overlapping extent, trim the range we need to 377 + * allocate to fit the hole we found. 378 + */ 379 + if (!xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) || 380 + got.br_startoff > offset_fsb) 381 + return xfs_reflink_trim_around_shared(ip, imap, shared, &trimmed); 382 + 383 + *shared = true; 384 + if (isnullstartblock(got.br_startblock)) { 385 + xfs_trim_extent(imap, got.br_startoff, got.br_blockcount); 386 + return 0; 387 + } 388 + 389 + /* real extent found - no need to allocate */ 390 + xfs_trim_extent(&got, offset_fsb, count_fsb); 391 + *imap = got; 392 + *found = true; 393 + return 0; 394 + } 395 + 355 396 /* Allocate all CoW reservations covering a range of blocks in a file. */ 356 397 int 357 398 xfs_reflink_allocate_cow( ··· 404 363 struct xfs_mount *mp = ip->i_mount; 405 364 xfs_fileoff_t offset_fsb = imap->br_startoff; 406 365 xfs_filblks_t count_fsb = imap->br_blockcount; 407 - struct xfs_bmbt_irec got; 408 - struct xfs_trans *tp = NULL; 366 + struct xfs_trans *tp; 409 367 int nimaps, error = 0; 410 - bool trimmed; 368 + bool found; 411 369 xfs_filblks_t resaligned; 412 370 xfs_extlen_t resblks = 0; 413 - struct xfs_iext_cursor icur; 414 371 415 - retry: 416 - ASSERT(xfs_is_reflink_inode(ip)); 417 372 ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); 373 + ASSERT(xfs_is_reflink_inode(ip)); 374 + 375 + error = xfs_find_trim_cow_extent(ip, imap, shared, &found); 376 + if (error || !*shared) 377 + return error; 378 + if (found) 379 + goto convert; 380 + 381 + resaligned = xfs_aligned_fsb_count(imap->br_startoff, 382 + imap->br_blockcount, xfs_get_cowextsz_hint(ip)); 383 + resblks = XFS_DIOSTRAT_SPACE_RES(mp, resaligned); 384 + 385 + xfs_iunlock(ip, *lockmode); 386 + error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp); 387 + *lockmode = XFS_ILOCK_EXCL; 388 + xfs_ilock(ip, *lockmode); 389 + 390 + if (error) 391 + return error; 392 + 393 + error = xfs_qm_dqattach_locked(ip, false); 394 + if (error) 395 + goto out_trans_cancel; 418 396 419 397 /* 420 - * Even if the extent is not shared we might have a preallocation for 421 - * it in the COW fork. If so use it. 398 + * Check for an overlapping extent again now that we dropped the ilock. 422 399 */ 423 - if (xfs_iext_lookup_extent(ip, ip->i_cowfp, offset_fsb, &icur, &got) && 424 - got.br_startoff <= offset_fsb) { 425 - *shared = true; 426 - 427 - /* If we have a real allocation in the COW fork we're done. */ 428 - if (!isnullstartblock(got.br_startblock)) { 429 - xfs_trim_extent(&got, offset_fsb, count_fsb); 430 - *imap = got; 431 - goto convert; 432 - } 433 - 434 - xfs_trim_extent(imap, got.br_startoff, got.br_blockcount); 435 - } else { 436 - error = xfs_reflink_trim_around_shared(ip, imap, shared, &trimmed); 437 - if (error || !*shared) 438 - goto out; 439 - } 440 - 441 - if (!tp) { 442 - resaligned = xfs_aligned_fsb_count(imap->br_startoff, 443 - imap->br_blockcount, xfs_get_cowextsz_hint(ip)); 444 - resblks = XFS_DIOSTRAT_SPACE_RES(mp, resaligned); 445 - 446 - xfs_iunlock(ip, *lockmode); 447 - error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0, 0, &tp); 448 - *lockmode = XFS_ILOCK_EXCL; 449 - xfs_ilock(ip, *lockmode); 450 - 451 - if (error) 452 - return error; 453 - 454 - error = xfs_qm_dqattach_locked(ip, false); 455 - if (error) 456 - goto out; 457 - goto retry; 400 + error = xfs_find_trim_cow_extent(ip, imap, shared, &found); 401 + if (error || !*shared) 402 + goto out_trans_cancel; 403 + if (found) { 404 + xfs_trans_cancel(tp); 405 + goto convert; 458 406 } 459 407 460 408 error = xfs_trans_reserve_quota_nblks(tp, ip, resblks, 0, 461 409 XFS_QMOPT_RES_REGBLKS); 462 410 if (error) 463 - goto out; 411 + goto out_trans_cancel; 464 412 465 413 xfs_trans_ijoin(tp, ip, 0); 466 414 467 - nimaps = 1; 468 - 469 415 /* Allocate the entire reservation as unwritten blocks. */ 416 + nimaps = 1; 470 417 error = xfs_bmapi_write(tp, ip, imap->br_startoff, imap->br_blockcount, 471 418 XFS_BMAPI_COWFORK | XFS_BMAPI_PREALLOC, 472 419 resblks, imap, &nimaps); 473 420 if (error) 474 - goto out_trans_cancel; 421 + goto out_unreserve; 475 422 476 423 xfs_inode_set_cowblocks_tag(ip); 477 - 478 - /* Finish up. */ 479 424 error = xfs_trans_commit(tp); 480 425 if (error) 481 426 return error; ··· 474 447 return -ENOSPC; 475 448 convert: 476 449 return xfs_reflink_convert_cow_extent(ip, imap, offset_fsb, count_fsb); 477 - out_trans_cancel: 450 + 451 + out_unreserve: 478 452 xfs_trans_unreserve_quota_nblks(tp, ip, (long)resblks, 0, 479 453 XFS_QMOPT_RES_REGBLKS); 480 - out: 481 - if (tp) 482 - xfs_trans_cancel(tp); 454 + out_trans_cancel: 455 + xfs_trans_cancel(tp); 483 456 return error; 484 457 } 485 458 ··· 693 666 if (!del.br_blockcount) 694 667 goto prev_extent; 695 668 696 - ASSERT(!isnullstartblock(got.br_startblock)); 697 - 698 669 /* 699 - * Don't remap unwritten extents; these are 700 - * speculatively preallocated CoW extents that have been 701 - * allocated but have not yet been involved in a write. 670 + * Only remap real extent that contain data. With AIO 671 + * speculatively preallocations can leak into the range we 672 + * are called upon, and we need to skip them. 702 673 */ 703 - if (got.br_state == XFS_EXT_UNWRITTEN) 674 + if (!xfs_bmap_is_real_extent(&got)) 704 675 goto prev_extent; 705 676 706 677 /* Unmap the old blocks in the data fork. */
-1
fs/xfs/xfs_trace.h
··· 473 473 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin); 474 474 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unpin_stale); 475 475 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock); 476 - DEFINE_BUF_ITEM_EVENT(xfs_buf_item_unlock_stale); 477 476 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_committed); 478 477 DEFINE_BUF_ITEM_EVENT(xfs_buf_item_push); 479 478 DEFINE_BUF_ITEM_EVENT(xfs_trans_get_buf);
+8 -2
fs/xfs/xfs_trans.c
··· 259 259 struct xfs_trans *tp; 260 260 int error; 261 261 262 + /* 263 + * Allocate the handle before we do our freeze accounting and setting up 264 + * GFP_NOFS allocation context so that we avoid lockdep false positives 265 + * by doing GFP_KERNEL allocations inside sb_start_intwrite(). 266 + */ 267 + tp = kmem_zone_zalloc(xfs_trans_zone, 268 + (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP); 269 + 262 270 if (!(flags & XFS_TRANS_NO_WRITECOUNT)) 263 271 sb_start_intwrite(mp->m_super); 264 272 ··· 278 270 mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE); 279 271 atomic_inc(&mp->m_active_trans); 280 272 281 - tp = kmem_zone_zalloc(xfs_trans_zone, 282 - (flags & XFS_TRANS_NOFS) ? KM_NOFS : KM_SLEEP); 283 273 tp->t_magic = XFS_TRANS_HEADER_MAGIC; 284 274 tp->t_flags = flags; 285 275 tp->t_mountp = mp;
+25 -76
fs/xfs/xfs_trans_buf.c
··· 322 322 } 323 323 324 324 /* 325 - * Release the buffer bp which was previously acquired with one of the 326 - * xfs_trans_... buffer allocation routines if the buffer has not 327 - * been modified within this transaction. If the buffer is modified 328 - * within this transaction, do decrement the recursion count but do 329 - * not release the buffer even if the count goes to 0. If the buffer is not 330 - * modified within the transaction, decrement the recursion count and 331 - * release the buffer if the recursion count goes to 0. 325 + * Release a buffer previously joined to the transaction. If the buffer is 326 + * modified within this transaction, decrement the recursion count but do not 327 + * release the buffer even if the count goes to 0. If the buffer is not modified 328 + * within the transaction, decrement the recursion count and release the buffer 329 + * if the recursion count goes to 0. 332 330 * 333 - * If the buffer is to be released and it was not modified before 334 - * this transaction began, then free the buf_log_item associated with it. 331 + * If the buffer is to be released and it was not already dirty before this 332 + * transaction began, then also free the buf_log_item associated with it. 335 333 * 336 - * If the transaction pointer is NULL, make this just a normal 337 - * brelse() call. 334 + * If the transaction pointer is NULL, this is a normal xfs_buf_relse() call. 338 335 */ 339 336 void 340 337 xfs_trans_brelse( 341 - xfs_trans_t *tp, 342 - xfs_buf_t *bp) 338 + struct xfs_trans *tp, 339 + struct xfs_buf *bp) 343 340 { 344 - struct xfs_buf_log_item *bip; 345 - int freed; 341 + struct xfs_buf_log_item *bip = bp->b_log_item; 346 342 347 - /* 348 - * Default to a normal brelse() call if the tp is NULL. 349 - */ 350 - if (tp == NULL) { 351 - ASSERT(bp->b_transp == NULL); 343 + ASSERT(bp->b_transp == tp); 344 + 345 + if (!tp) { 352 346 xfs_buf_relse(bp); 353 347 return; 354 348 } 355 349 356 - ASSERT(bp->b_transp == tp); 357 - bip = bp->b_log_item; 350 + trace_xfs_trans_brelse(bip); 358 351 ASSERT(bip->bli_item.li_type == XFS_LI_BUF); 359 - ASSERT(!(bip->bli_flags & XFS_BLI_STALE)); 360 - ASSERT(!(bip->__bli_format.blf_flags & XFS_BLF_CANCEL)); 361 352 ASSERT(atomic_read(&bip->bli_refcount) > 0); 362 353 363 - trace_xfs_trans_brelse(bip); 364 - 365 354 /* 366 - * If the release is just for a recursive lock, 367 - * then decrement the count and return. 355 + * If the release is for a recursive lookup, then decrement the count 356 + * and return. 368 357 */ 369 358 if (bip->bli_recur > 0) { 370 359 bip->bli_recur--; ··· 361 372 } 362 373 363 374 /* 364 - * If the buffer is dirty within this transaction, we can't 375 + * If the buffer is invalidated or dirty in this transaction, we can't 365 376 * release it until we commit. 366 377 */ 367 378 if (test_bit(XFS_LI_DIRTY, &bip->bli_item.li_flags)) 368 379 return; 369 - 370 - /* 371 - * If the buffer has been invalidated, then we can't release 372 - * it until the transaction commits to disk unless it is re-dirtied 373 - * as part of this transaction. This prevents us from pulling 374 - * the item from the AIL before we should. 375 - */ 376 380 if (bip->bli_flags & XFS_BLI_STALE) 377 381 return; 378 382 383 + /* 384 + * Unlink the log item from the transaction and clear the hold flag, if 385 + * set. We wouldn't want the next user of the buffer to get confused. 386 + */ 379 387 ASSERT(!(bip->bli_flags & XFS_BLI_LOGGED)); 380 - 381 - /* 382 - * Free up the log item descriptor tracking the released item. 383 - */ 384 388 xfs_trans_del_item(&bip->bli_item); 389 + bip->bli_flags &= ~XFS_BLI_HOLD; 385 390 386 - /* 387 - * Clear the hold flag in the buf log item if it is set. 388 - * We wouldn't want the next user of the buffer to 389 - * get confused. 390 - */ 391 - if (bip->bli_flags & XFS_BLI_HOLD) { 392 - bip->bli_flags &= ~XFS_BLI_HOLD; 393 - } 394 - 395 - /* 396 - * Drop our reference to the buf log item. 397 - */ 398 - freed = atomic_dec_and_test(&bip->bli_refcount); 399 - 400 - /* 401 - * If the buf item is not tracking data in the log, then we must free it 402 - * before releasing the buffer back to the free pool. 403 - * 404 - * If the fs has shutdown and we dropped the last reference, it may fall 405 - * on us to release a (possibly dirty) bli if it never made it to the 406 - * AIL (e.g., the aborted unpin already happened and didn't release it 407 - * due to our reference). Since we're already shutdown and need 408 - * ail_lock, just force remove from the AIL and release the bli here. 409 - */ 410 - if (XFS_FORCED_SHUTDOWN(tp->t_mountp) && freed) { 411 - xfs_trans_ail_remove(&bip->bli_item, SHUTDOWN_LOG_IO_ERROR); 412 - xfs_buf_item_relse(bp); 413 - } else if (!(bip->bli_flags & XFS_BLI_DIRTY)) { 414 - /*** 415 - ASSERT(bp->b_pincount == 0); 416 - ***/ 417 - ASSERT(atomic_read(&bip->bli_refcount) == 0); 418 - ASSERT(!test_bit(XFS_LI_IN_AIL, &bip->bli_item.li_flags)); 419 - ASSERT(!(bip->bli_flags & XFS_BLI_INODE_ALLOC_BUF)); 420 - xfs_buf_item_relse(bp); 421 - } 391 + /* drop the reference to the bli */ 392 + xfs_buf_item_put(bip); 422 393 423 394 bp->b_transp = NULL; 424 395 xfs_buf_relse(bp);
+3 -2
include/drm/drm_client.h
··· 87 87 struct drm_file *file; 88 88 }; 89 89 90 - int drm_client_new(struct drm_device *dev, struct drm_client_dev *client, 91 - const char *name, const struct drm_client_funcs *funcs); 90 + int drm_client_init(struct drm_device *dev, struct drm_client_dev *client, 91 + const char *name, const struct drm_client_funcs *funcs); 92 92 void drm_client_release(struct drm_client_dev *client); 93 + void drm_client_add(struct drm_client_dev *client); 93 94 94 95 void drm_client_dev_unregister(struct drm_device *dev); 95 96 void drm_client_dev_hotplug(struct drm_device *dev);
+14 -6
include/linux/fpga/fpga-mgr.h
··· 53 53 FPGA_MGR_STATE_OPERATING, 54 54 }; 55 55 56 - /* 57 - * FPGA Manager flags 58 - * FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported 59 - * FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting 60 - * FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first 61 - * FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed 56 + /** 57 + * DOC: FPGA Manager flags 58 + * 59 + * Flags used in the &fpga_image_info->flags field 60 + * 61 + * %FPGA_MGR_PARTIAL_RECONFIG: do partial reconfiguration if supported 62 + * 63 + * %FPGA_MGR_EXTERNAL_CONFIG: FPGA has been configured prior to Linux booting 64 + * 65 + * %FPGA_MGR_ENCRYPTED_BITSTREAM: indicates bitstream is encrypted 66 + * 67 + * %FPGA_MGR_BITSTREAM_LSB_FIRST: SPI bitstream bit order is LSB first 68 + * 69 + * %FPGA_MGR_COMPRESSED_BITSTREAM: FPGA bitstream is compressed 62 70 */ 63 71 #define FPGA_MGR_PARTIAL_RECONFIG BIT(0) 64 72 #define FPGA_MGR_EXTERNAL_CONFIG BIT(1)
+3 -14
include/linux/fs.h
··· 1828 1828 extern int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in, 1829 1829 struct inode *inode_out, loff_t pos_out, 1830 1830 u64 *len, bool is_dedupe); 1831 + extern int do_clone_file_range(struct file *file_in, loff_t pos_in, 1832 + struct file *file_out, loff_t pos_out, u64 len); 1831 1833 extern int vfs_clone_file_range(struct file *file_in, loff_t pos_in, 1832 - struct file *file_out, loff_t pos_out, u64 len); 1834 + struct file *file_out, loff_t pos_out, u64 len); 1833 1835 extern int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff, 1834 1836 struct inode *dest, loff_t destoff, 1835 1837 loff_t len, bool *is_same); ··· 2773 2771 if (!S_ISREG(file_inode(file)->i_mode)) 2774 2772 return; 2775 2773 __sb_end_write(file_inode(file)->i_sb, SB_FREEZE_WRITE); 2776 - } 2777 - 2778 - static inline int do_clone_file_range(struct file *file_in, loff_t pos_in, 2779 - struct file *file_out, loff_t pos_out, 2780 - u64 len) 2781 - { 2782 - int ret; 2783 - 2784 - file_start_write(file_out); 2785 - ret = vfs_clone_file_range(file_in, pos_in, file_out, pos_out, len); 2786 - file_end_write(file_out); 2787 - 2788 - return ret; 2789 2774 } 2790 2775 2791 2776 /*
+14
include/linux/hugetlb.h
··· 140 140 pte_t *huge_pte_offset(struct mm_struct *mm, 141 141 unsigned long addr, unsigned long sz); 142 142 int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep); 143 + void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, 144 + unsigned long *start, unsigned long *end); 143 145 struct page *follow_huge_addr(struct mm_struct *mm, unsigned long address, 144 146 int write); 145 147 struct page *follow_huge_pd(struct vm_area_struct *vma, ··· 170 168 static inline unsigned long hugetlb_total_pages(void) 171 169 { 172 170 return 0; 171 + } 172 + 173 + static inline int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, 174 + pte_t *ptep) 175 + { 176 + return 0; 177 + } 178 + 179 + static inline void adjust_range_if_pmd_sharing_possible( 180 + struct vm_area_struct *vma, 181 + unsigned long *start, unsigned long *end) 182 + { 173 183 } 174 184 175 185 #define follow_hugetlb_page(m,v,p,vs,a,b,i,w,n) ({ BUG(); 0; })
+2
include/linux/mlx5/transobj.h
··· 90 90 91 91 u32 *rqn; 92 92 u32 *sqn; 93 + 94 + bool peer_gone; 93 95 }; 94 96 95 97 struct mlx5_hairpin *
+6
include/linux/mm.h
··· 2455 2455 return vma; 2456 2456 } 2457 2457 2458 + static inline bool range_in_vma(struct vm_area_struct *vma, 2459 + unsigned long start, unsigned long end) 2460 + { 2461 + return (vma && vma->vm_start <= start && end <= vma->vm_end); 2462 + } 2463 + 2458 2464 #ifdef CONFIG_MMU 2459 2465 pgprot_t vm_get_page_prot(unsigned long vm_flags); 2460 2466 void vma_set_page_prot(struct vm_area_struct *vma);
-6
include/linux/mmzone.h
··· 671 671 #ifdef CONFIG_NUMA_BALANCING 672 672 /* Lock serializing the migrate rate limiting window */ 673 673 spinlock_t numabalancing_migrate_lock; 674 - 675 - /* Rate limiting time interval */ 676 - unsigned long numabalancing_migrate_next_window; 677 - 678 - /* Number of pages migrated during the rate limiting time interval */ 679 - unsigned long numabalancing_migrate_nr_pages; 680 674 #endif 681 675 /* 682 676 * This is a per-node reserve of pages that are not available
+3
include/linux/netdevice.h
··· 1730 1730 * switch driver and used to set the phys state of the 1731 1731 * switch port. 1732 1732 * 1733 + * @wol_enabled: Wake-on-LAN is enabled 1734 + * 1733 1735 * FIXME: cleanup struct net_device such that network protocol info 1734 1736 * moves out. 1735 1737 */ ··· 2016 2014 struct lock_class_key *qdisc_tx_busylock; 2017 2015 struct lock_class_key *qdisc_running_key; 2018 2016 bool proto_down; 2017 + unsigned wol_enabled:1; 2019 2018 }; 2020 2019 #define to_net_dev(d) container_of(d, struct net_device, dev) 2021 2020
+2
include/linux/netfilter.h
··· 215 215 break; 216 216 case NFPROTO_ARP: 217 217 #ifdef CONFIG_NETFILTER_FAMILY_ARP 218 + if (WARN_ON_ONCE(hook >= ARRAY_SIZE(net->nf.hooks_arp))) 219 + break; 218 220 hook_head = rcu_dereference(net->nf.hooks_arp[hook]); 219 221 #endif 220 222 break;
+1
include/linux/serial_sci.h
··· 36 36 SCIx_SH4_SCIF_FIFODATA_REGTYPE, 37 37 SCIx_SH7705_SCIF_REGTYPE, 38 38 SCIx_HSCIF_REGTYPE, 39 + SCIx_RZ_SCIFA_REGTYPE, 39 40 40 41 SCIx_NR_REGTYPES, 41 42 };
+18
include/linux/virtio_net.h
··· 5 5 #include <linux/if_vlan.h> 6 6 #include <uapi/linux/virtio_net.h> 7 7 8 + static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, 9 + const struct virtio_net_hdr *hdr) 10 + { 11 + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { 12 + case VIRTIO_NET_HDR_GSO_TCPV4: 13 + case VIRTIO_NET_HDR_GSO_UDP: 14 + skb->protocol = cpu_to_be16(ETH_P_IP); 15 + break; 16 + case VIRTIO_NET_HDR_GSO_TCPV6: 17 + skb->protocol = cpu_to_be16(ETH_P_IPV6); 18 + break; 19 + default: 20 + return -EINVAL; 21 + } 22 + 23 + return 0; 24 + } 25 + 8 26 static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, 9 27 const struct virtio_net_hdr *hdr, 10 28 bool little_endian)
+4
include/media/v4l2-fh.h
··· 38 38 * @prio: priority of the file handler, as defined by &enum v4l2_priority 39 39 * 40 40 * @wait: event' s wait queue 41 + * @subscribe_lock: serialise changes to the subscribed list; guarantee that 42 + * the add and del event callbacks are orderly called 41 43 * @subscribed: list of subscribed events 42 44 * @available: list of events waiting to be dequeued 43 45 * @navailable: number of available events at @available list 44 46 * @sequence: event sequence number 47 + * 45 48 * @m2m_ctx: pointer to &struct v4l2_m2m_ctx 46 49 */ 47 50 struct v4l2_fh { ··· 55 52 56 53 /* Events */ 57 54 wait_queue_head_t wait; 55 + struct mutex subscribe_lock; 58 56 struct list_head subscribed; 59 57 struct list_head available; 60 58 unsigned int navailable;
+1 -6
include/net/bonding.h
··· 139 139 int mode; 140 140 }; 141 141 142 - struct netdev_notify_work { 143 - struct delayed_work work; 144 - struct net_device *dev; 145 - struct netdev_bonding_info bonding_info; 146 - }; 147 - 148 142 struct slave { 149 143 struct net_device *dev; /* first - useful for panic debug */ 150 144 struct bonding *bond; /* our master */ ··· 166 172 #ifdef CONFIG_NET_POLL_CONTROLLER 167 173 struct netpoll *np; 168 174 #endif 175 + struct delayed_work notify_work; 169 176 struct kobject kobj; 170 177 struct rtnl_link_stats64 slave_stats; 171 178 };
-2
include/net/cfg80211.h
··· 4852 4852 * 4853 4853 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried. 4854 4854 * @freq: the freqency(in MHz) to be queried. 4855 - * @ptr: pointer where the regdb wmm data is to be stored (or %NULL if 4856 - * irrelevant). This can be used later for deduplication. 4857 4855 * @rule: pointer to store the wmm rule from the regulatory db. 4858 4856 * 4859 4857 * Self-managed wireless drivers can use this function to query
-6
include/net/inet_sock.h
··· 130 130 return sk->sk_bound_dev_if; 131 131 } 132 132 133 - static inline struct ip_options_rcu *ireq_opt_deref(const struct inet_request_sock *ireq) 134 - { 135 - return rcu_dereference_check(ireq->ireq_opt, 136 - refcount_read(&ireq->req.rsk_refcnt) > 0); 137 - } 138 - 139 133 struct inet_cork { 140 134 unsigned int flags; 141 135 __be32 addr;
+1 -1
include/net/netlink.h
··· 153 153 * nla_find() find attribute in stream of attributes 154 154 * nla_find_nested() find attribute in nested attributes 155 155 * nla_parse() parse and validate stream of attrs 156 - * nla_parse_nested() parse nested attribuets 156 + * nla_parse_nested() parse nested attributes 157 157 * nla_for_each_attr() loop over all attributes 158 158 * nla_for_each_nested() loop over the nested attributes 159 159 *=========================================================================
-27
include/trace/events/migrate.h
··· 70 70 __print_symbolic(__entry->mode, MIGRATE_MODE), 71 71 __print_symbolic(__entry->reason, MIGRATE_REASON)) 72 72 ); 73 - 74 - TRACE_EVENT(mm_numa_migrate_ratelimit, 75 - 76 - TP_PROTO(struct task_struct *p, int dst_nid, unsigned long nr_pages), 77 - 78 - TP_ARGS(p, dst_nid, nr_pages), 79 - 80 - TP_STRUCT__entry( 81 - __array( char, comm, TASK_COMM_LEN) 82 - __field( pid_t, pid) 83 - __field( int, dst_nid) 84 - __field( unsigned long, nr_pages) 85 - ), 86 - 87 - TP_fast_assign( 88 - memcpy(__entry->comm, p->comm, TASK_COMM_LEN); 89 - __entry->pid = p->pid; 90 - __entry->dst_nid = dst_nid; 91 - __entry->nr_pages = nr_pages; 92 - ), 93 - 94 - TP_printk("comm=%s pid=%d dst_nid=%d nr_pages=%lu", 95 - __entry->comm, 96 - __entry->pid, 97 - __entry->dst_nid, 98 - __entry->nr_pages) 99 - ); 100 73 #endif /* _TRACE_MIGRATE_H */ 101 74 102 75 /* This part must be outside protection */
+1 -3
include/trace/events/rxrpc.h
··· 56 56 rxrpc_peer_new, 57 57 rxrpc_peer_processing, 58 58 rxrpc_peer_put, 59 - rxrpc_peer_queued_error, 60 59 }; 61 60 62 61 enum rxrpc_conn_trace { ··· 256 257 EM(rxrpc_peer_got, "GOT") \ 257 258 EM(rxrpc_peer_new, "NEW") \ 258 259 EM(rxrpc_peer_processing, "PRO") \ 259 - EM(rxrpc_peer_put, "PUT") \ 260 - E_(rxrpc_peer_queued_error, "QER") 260 + E_(rxrpc_peer_put, "PUT") 261 261 262 262 #define rxrpc_conn_traces \ 263 263 EM(rxrpc_conn_got, "GOT") \
+2
include/uapi/asm-generic/hugetlb_encode.h
··· 26 26 #define HUGETLB_FLAG_ENCODE_2MB (21 << HUGETLB_FLAG_ENCODE_SHIFT) 27 27 #define HUGETLB_FLAG_ENCODE_8MB (23 << HUGETLB_FLAG_ENCODE_SHIFT) 28 28 #define HUGETLB_FLAG_ENCODE_16MB (24 << HUGETLB_FLAG_ENCODE_SHIFT) 29 + #define HUGETLB_FLAG_ENCODE_32MB (25 << HUGETLB_FLAG_ENCODE_SHIFT) 29 30 #define HUGETLB_FLAG_ENCODE_256MB (28 << HUGETLB_FLAG_ENCODE_SHIFT) 31 + #define HUGETLB_FLAG_ENCODE_512MB (29 << HUGETLB_FLAG_ENCODE_SHIFT) 30 32 #define HUGETLB_FLAG_ENCODE_1GB (30 << HUGETLB_FLAG_ENCODE_SHIFT) 31 33 #define HUGETLB_FLAG_ENCODE_2GB (31 << HUGETLB_FLAG_ENCODE_SHIFT) 32 34 #define HUGETLB_FLAG_ENCODE_16GB (34 << HUGETLB_FLAG_ENCODE_SHIFT)
+2
include/uapi/linux/memfd.h
··· 25 25 #define MFD_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB 26 26 #define MFD_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB 27 27 #define MFD_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB 28 + #define MFD_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB 28 29 #define MFD_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB 30 + #define MFD_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB 29 31 #define MFD_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB 30 32 #define MFD_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB 31 33 #define MFD_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
+2
include/uapi/linux/mman.h
··· 28 28 #define MAP_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB 29 29 #define MAP_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB 30 30 #define MAP_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB 31 + #define MAP_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB 31 32 #define MAP_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB 33 + #define MAP_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB 32 34 #define MAP_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB 33 35 #define MAP_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB 34 36 #define MAP_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
+2
include/uapi/linux/shm.h
··· 65 65 #define SHM_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB 66 66 #define SHM_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB 67 67 #define SHM_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB 68 + #define SHM_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB 68 69 #define SHM_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB 70 + #define SHM_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB 69 71 #define SHM_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB 70 72 #define SHM_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB 71 73 #define SHM_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
+1 -1
ipc/shm.c
··· 206 206 * Callers of shm_lock() must validate the status of the returned ipc 207 207 * object pointer and error out as appropriate. 208 208 */ 209 - return (void *)ipcp; 209 + return ERR_CAST(ipcp); 210 210 } 211 211 212 212 static inline void shm_lock_by_ptr(struct shmid_kernel *ipcp)
+4 -1
kernel/bpf/local_storage.c
··· 129 129 struct bpf_cgroup_storage *storage; 130 130 struct bpf_storage_buffer *new; 131 131 132 - if (flags & BPF_NOEXIST) 132 + if (flags != BPF_ANY && flags != BPF_EXIST) 133 133 return -EINVAL; 134 134 135 135 storage = cgroup_storage_lookup((struct bpf_cgroup_storage_map *)map, ··· 193 193 struct bpf_cgroup_storage_map *map; 194 194 195 195 if (attr->key_size != sizeof(struct bpf_cgroup_storage_key)) 196 + return ERR_PTR(-EINVAL); 197 + 198 + if (attr->value_size == 0) 196 199 return ERR_PTR(-EINVAL); 197 200 198 201 if (attr->value_size > PAGE_SIZE)
+9 -1
kernel/bpf/verifier.c
··· 2896 2896 u64 umin_val, umax_val; 2897 2897 u64 insn_bitness = (BPF_CLASS(insn->code) == BPF_ALU64) ? 64 : 32; 2898 2898 2899 + if (insn_bitness == 32) { 2900 + /* Relevant for 32-bit RSH: Information can propagate towards 2901 + * LSB, so it isn't sufficient to only truncate the output to 2902 + * 32 bits. 2903 + */ 2904 + coerce_reg_to_size(dst_reg, 4); 2905 + coerce_reg_to_size(&src_reg, 4); 2906 + } 2907 + 2899 2908 smin_val = src_reg.smin_value; 2900 2909 smax_val = src_reg.smax_value; 2901 2910 umin_val = src_reg.umin_value; ··· 3140 3131 if (BPF_CLASS(insn->code) != BPF_ALU64) { 3141 3132 /* 32-bit ALU ops are (32,32)->32 */ 3142 3133 coerce_reg_to_size(dst_reg, 4); 3143 - coerce_reg_to_size(&src_reg, 4); 3144 3134 } 3145 3135 3146 3136 __reg_deduce_bounds(dst_reg);
+4 -7
kernel/events/core.c
··· 8314 8314 goto unlock; 8315 8315 8316 8316 list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { 8317 + if (event->cpu != smp_processor_id()) 8318 + continue; 8317 8319 if (event->attr.type != PERF_TYPE_TRACEPOINT) 8318 8320 continue; 8319 8321 if (event->attr.config != entry->type) ··· 9433 9431 if (pmu->task_ctx_nr > perf_invalid_context) 9434 9432 return; 9435 9433 9436 - mutex_lock(&pmus_lock); 9437 9434 free_percpu(pmu->pmu_cpu_context); 9438 - mutex_unlock(&pmus_lock); 9439 9435 } 9440 9436 9441 9437 /* ··· 9689 9689 9690 9690 void perf_pmu_unregister(struct pmu *pmu) 9691 9691 { 9692 - int remove_device; 9693 - 9694 9692 mutex_lock(&pmus_lock); 9695 - remove_device = pmu_bus_running; 9696 9693 list_del_rcu(&pmu->entry); 9697 - mutex_unlock(&pmus_lock); 9698 9694 9699 9695 /* 9700 9696 * We dereference the pmu list under both SRCU and regular RCU, so ··· 9702 9706 free_percpu(pmu->pmu_disable_count); 9703 9707 if (pmu->type >= PERF_TYPE_MAX) 9704 9708 idr_remove(&pmu_idr, pmu->type); 9705 - if (remove_device) { 9709 + if (pmu_bus_running) { 9706 9710 if (pmu->nr_addr_filters) 9707 9711 device_remove_file(pmu->dev, &dev_attr_nr_addr_filters); 9708 9712 device_del(pmu->dev); 9709 9713 put_device(pmu->dev); 9710 9714 } 9711 9715 free_pmu_context(pmu); 9716 + mutex_unlock(&pmus_lock); 9712 9717 } 9713 9718 EXPORT_SYMBOL_GPL(perf_pmu_unregister); 9714 9719
+6 -4
kernel/locking/test-ww_mutex.c
··· 260 260 { 261 261 struct test_cycle *cycle = container_of(work, typeof(*cycle), work); 262 262 struct ww_acquire_ctx ctx; 263 - int err; 263 + int err, erra = 0; 264 264 265 265 ww_acquire_init(&ctx, &ww_class); 266 266 ww_mutex_lock(&cycle->a_mutex, &ctx); ··· 270 270 271 271 err = ww_mutex_lock(cycle->b_mutex, &ctx); 272 272 if (err == -EDEADLK) { 273 + err = 0; 273 274 ww_mutex_unlock(&cycle->a_mutex); 274 275 ww_mutex_lock_slow(cycle->b_mutex, &ctx); 275 - err = ww_mutex_lock(&cycle->a_mutex, &ctx); 276 + erra = ww_mutex_lock(&cycle->a_mutex, &ctx); 276 277 } 277 278 278 279 if (!err) 279 280 ww_mutex_unlock(cycle->b_mutex); 280 - ww_mutex_unlock(&cycle->a_mutex); 281 + if (!erra) 282 + ww_mutex_unlock(&cycle->a_mutex); 281 283 ww_acquire_fini(&ctx); 282 284 283 - cycle->result = err; 285 + cycle->result = err ?: erra; 284 286 } 285 287 286 288 static int __test_cycle(unsigned int nthreads)
+1 -1
kernel/sched/core.c
··· 1167 1167 1168 1168 if (task_cpu(p) != new_cpu) { 1169 1169 if (p->sched_class->migrate_task_rq) 1170 - p->sched_class->migrate_task_rq(p); 1170 + p->sched_class->migrate_task_rq(p, new_cpu); 1171 1171 p->se.nr_migrations++; 1172 1172 rseq_migrate(p); 1173 1173 perf_event_task_migrate(p);
+1 -1
kernel/sched/deadline.c
··· 1607 1607 return cpu; 1608 1608 } 1609 1609 1610 - static void migrate_task_rq_dl(struct task_struct *p) 1610 + static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unused) 1611 1611 { 1612 1612 struct rq *rq; 1613 1613
+91 -13
kernel/sched/fair.c
··· 1392 1392 int last_cpupid, this_cpupid; 1393 1393 1394 1394 this_cpupid = cpu_pid_to_cpupid(dst_cpu, current->pid); 1395 + last_cpupid = page_cpupid_xchg_last(page, this_cpupid); 1396 + 1397 + /* 1398 + * Allow first faults or private faults to migrate immediately early in 1399 + * the lifetime of a task. The magic number 4 is based on waiting for 1400 + * two full passes of the "multi-stage node selection" test that is 1401 + * executed below. 1402 + */ 1403 + if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) && 1404 + (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid))) 1405 + return true; 1395 1406 1396 1407 /* 1397 1408 * Multi-stage node selection is used in conjunction with a periodic ··· 1421 1410 * This quadric squishes small probabilities, making it less likely we 1422 1411 * act on an unlikely task<->page relation. 1423 1412 */ 1424 - last_cpupid = page_cpupid_xchg_last(page, this_cpupid); 1425 1413 if (!cpupid_pid_unset(last_cpupid) && 1426 1414 cpupid_to_nid(last_cpupid) != dst_nid) 1427 1415 return false; ··· 1524 1514 static void task_numa_assign(struct task_numa_env *env, 1525 1515 struct task_struct *p, long imp) 1526 1516 { 1517 + struct rq *rq = cpu_rq(env->dst_cpu); 1518 + 1519 + /* Bail out if run-queue part of active NUMA balance. */ 1520 + if (xchg(&rq->numa_migrate_on, 1)) 1521 + return; 1522 + 1523 + /* 1524 + * Clear previous best_cpu/rq numa-migrate flag, since task now 1525 + * found a better CPU to move/swap. 1526 + */ 1527 + if (env->best_cpu != -1) { 1528 + rq = cpu_rq(env->best_cpu); 1529 + WRITE_ONCE(rq->numa_migrate_on, 0); 1530 + } 1531 + 1527 1532 if (env->best_task) 1528 1533 put_task_struct(env->best_task); 1529 1534 if (p) ··· 1578 1553 } 1579 1554 1580 1555 /* 1556 + * Maximum NUMA importance can be 1998 (2*999); 1557 + * SMALLIMP @ 30 would be close to 1998/64. 1558 + * Used to deter task migration. 1559 + */ 1560 + #define SMALLIMP 30 1561 + 1562 + /* 1581 1563 * This checks if the overall compute and NUMA accesses of the system would 1582 1564 * be improved if the source tasks was migrated to the target dst_cpu taking 1583 1565 * into account that it might be best if task running on the dst_cpu should ··· 1601 1569 long moveimp = imp; 1602 1570 int dist = env->dist; 1603 1571 1572 + if (READ_ONCE(dst_rq->numa_migrate_on)) 1573 + return; 1574 + 1604 1575 rcu_read_lock(); 1605 1576 cur = task_rcu_dereference(&dst_rq->curr); 1606 1577 if (cur && ((cur->flags & PF_EXITING) || is_idle_task(cur))) ··· 1617 1582 goto unlock; 1618 1583 1619 1584 if (!cur) { 1620 - if (maymove || imp > env->best_imp) 1585 + if (maymove && moveimp >= env->best_imp) 1621 1586 goto assign; 1622 1587 else 1623 1588 goto unlock; ··· 1660 1625 task_weight(cur, env->dst_nid, dist); 1661 1626 } 1662 1627 1663 - if (imp <= env->best_imp) 1664 - goto unlock; 1665 - 1666 1628 if (maymove && moveimp > imp && moveimp > env->best_imp) { 1667 - imp = moveimp - 1; 1629 + imp = moveimp; 1668 1630 cur = NULL; 1669 1631 goto assign; 1670 1632 } 1633 + 1634 + /* 1635 + * If the NUMA importance is less than SMALLIMP, 1636 + * task migration might only result in ping pong 1637 + * of tasks and also hurt performance due to cache 1638 + * misses. 1639 + */ 1640 + if (imp < SMALLIMP || imp <= env->best_imp + SMALLIMP / 2) 1641 + goto unlock; 1671 1642 1672 1643 /* 1673 1644 * In the overloaded case, try and keep the load balanced. ··· 1751 1710 .best_cpu = -1, 1752 1711 }; 1753 1712 struct sched_domain *sd; 1713 + struct rq *best_rq; 1754 1714 unsigned long taskweight, groupweight; 1755 1715 int nid, ret, dist; 1756 1716 long taskimp, groupimp; ··· 1847 1805 if (env.best_cpu == -1) 1848 1806 return -EAGAIN; 1849 1807 1850 - /* 1851 - * Reset the scan period if the task is being rescheduled on an 1852 - * alternative node to recheck if the tasks is now properly placed. 1853 - */ 1854 - p->numa_scan_period = task_scan_start(p); 1855 - 1808 + best_rq = cpu_rq(env.best_cpu); 1856 1809 if (env.best_task == NULL) { 1857 1810 ret = migrate_task_to(p, env.best_cpu); 1811 + WRITE_ONCE(best_rq->numa_migrate_on, 0); 1858 1812 if (ret != 0) 1859 1813 trace_sched_stick_numa(p, env.src_cpu, env.best_cpu); 1860 1814 return ret; 1861 1815 } 1862 1816 1863 1817 ret = migrate_swap(p, env.best_task, env.best_cpu, env.src_cpu); 1818 + WRITE_ONCE(best_rq->numa_migrate_on, 0); 1864 1819 1865 1820 if (ret != 0) 1866 1821 trace_sched_stick_numa(p, env.src_cpu, task_cpu(env.best_task)); ··· 2635 2596 } 2636 2597 } 2637 2598 2599 + static void update_scan_period(struct task_struct *p, int new_cpu) 2600 + { 2601 + int src_nid = cpu_to_node(task_cpu(p)); 2602 + int dst_nid = cpu_to_node(new_cpu); 2603 + 2604 + if (!static_branch_likely(&sched_numa_balancing)) 2605 + return; 2606 + 2607 + if (!p->mm || !p->numa_faults || (p->flags & PF_EXITING)) 2608 + return; 2609 + 2610 + if (src_nid == dst_nid) 2611 + return; 2612 + 2613 + /* 2614 + * Allow resets if faults have been trapped before one scan 2615 + * has completed. This is most likely due to a new task that 2616 + * is pulled cross-node due to wakeups or load balancing. 2617 + */ 2618 + if (p->numa_scan_seq) { 2619 + /* 2620 + * Avoid scan adjustments if moving to the preferred 2621 + * node or if the task was not previously running on 2622 + * the preferred node. 2623 + */ 2624 + if (dst_nid == p->numa_preferred_nid || 2625 + (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid)) 2626 + return; 2627 + } 2628 + 2629 + p->numa_scan_period = task_scan_start(p); 2630 + } 2631 + 2638 2632 #else 2639 2633 static void task_tick_numa(struct rq *rq, struct task_struct *curr) 2640 2634 { ··· 2678 2606 } 2679 2607 2680 2608 static inline void account_numa_dequeue(struct rq *rq, struct task_struct *p) 2609 + { 2610 + } 2611 + 2612 + static inline void update_scan_period(struct task_struct *p, int new_cpu) 2681 2613 { 2682 2614 } 2683 2615 ··· 6351 6275 * cfs_rq_of(p) references at time of call are still valid and identify the 6352 6276 * previous CPU. The caller guarantees p->pi_lock or task_rq(p)->lock is held. 6353 6277 */ 6354 - static void migrate_task_rq_fair(struct task_struct *p) 6278 + static void migrate_task_rq_fair(struct task_struct *p, int new_cpu) 6355 6279 { 6356 6280 /* 6357 6281 * As blocked tasks retain absolute vruntime the migration needs to ··· 6404 6328 6405 6329 /* We have migrated, no longer consider this task hot */ 6406 6330 p->se.exec_start = 0; 6331 + 6332 + update_scan_period(p, new_cpu); 6407 6333 } 6408 6334 6409 6335 static void task_dead_fair(struct task_struct *p)
+2 -1
kernel/sched/sched.h
··· 783 783 #ifdef CONFIG_NUMA_BALANCING 784 784 unsigned int nr_numa_running; 785 785 unsigned int nr_preferred_running; 786 + unsigned int numa_migrate_on; 786 787 #endif 787 788 #define CPU_LOAD_IDX_MAX 5 788 789 unsigned long cpu_load[CPU_LOAD_IDX_MAX]; ··· 1524 1523 1525 1524 #ifdef CONFIG_SMP 1526 1525 int (*select_task_rq)(struct task_struct *p, int task_cpu, int sd_flag, int flags); 1527 - void (*migrate_task_rq)(struct task_struct *p); 1526 + void (*migrate_task_rq)(struct task_struct *p, int new_cpu); 1528 1527 1529 1528 void (*task_woken)(struct rq *this_rq, struct task_struct *task); 1530 1529
-1
lib/xz/xz_crc32.c
··· 15 15 * but they are bigger and use more memory for the lookup table. 16 16 */ 17 17 18 - #include <linux/crc32poly.h> 19 18 #include "xz_private.h" 20 19 21 20 /*
+4
lib/xz/xz_private.h
··· 102 102 # endif 103 103 #endif 104 104 105 + #ifndef CRC32_POLY_LE 106 + #define CRC32_POLY_LE 0xedb88320 107 + #endif 108 + 105 109 /* 106 110 * Allocate memory for LZMA2 decoder. xz_dec_lzma2_reset() must be used 107 111 * before calling xz_dec_lzma2_run().
+2 -1
mm/gup_benchmark.c
··· 19 19 struct gup_benchmark *gup) 20 20 { 21 21 ktime_t start_time, end_time; 22 - unsigned long i, nr, nr_pages, addr, next; 22 + unsigned long i, nr_pages, addr, next; 23 + int nr; 23 24 struct page **pages; 24 25 25 26 nr_pages = gup->size / PAGE_SIZE;
+1 -1
mm/huge_memory.c
··· 2931 2931 else 2932 2932 page_add_file_rmap(new, true); 2933 2933 set_pmd_at(mm, mmun_start, pvmw->pmd, pmde); 2934 - if (vma->vm_flags & VM_LOCKED) 2934 + if ((vma->vm_flags & VM_LOCKED) && !PageDoubleMap(new)) 2935 2935 mlock_vma_page(new); 2936 2936 update_mmu_cache_pmd(vma, address, pvmw->pmd); 2937 2937 }
+79 -11
mm/hugetlb.c
··· 3326 3326 struct page *page; 3327 3327 struct hstate *h = hstate_vma(vma); 3328 3328 unsigned long sz = huge_page_size(h); 3329 - const unsigned long mmun_start = start; /* For mmu_notifiers */ 3330 - const unsigned long mmun_end = end; /* For mmu_notifiers */ 3329 + unsigned long mmun_start = start; /* For mmu_notifiers */ 3330 + unsigned long mmun_end = end; /* For mmu_notifiers */ 3331 3331 3332 3332 WARN_ON(!is_vm_hugetlb_page(vma)); 3333 3333 BUG_ON(start & ~huge_page_mask(h)); ··· 3339 3339 */ 3340 3340 tlb_remove_check_page_size_change(tlb, sz); 3341 3341 tlb_start_vma(tlb, vma); 3342 + 3343 + /* 3344 + * If sharing possible, alert mmu notifiers of worst case. 3345 + */ 3346 + adjust_range_if_pmd_sharing_possible(vma, &mmun_start, &mmun_end); 3342 3347 mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end); 3343 3348 address = start; 3344 3349 for (; address < end; address += sz) { ··· 3354 3349 ptl = huge_pte_lock(h, mm, ptep); 3355 3350 if (huge_pmd_unshare(mm, &address, ptep)) { 3356 3351 spin_unlock(ptl); 3352 + /* 3353 + * We just unmapped a page of PMDs by clearing a PUD. 3354 + * The caller's TLB flush range should cover this area. 3355 + */ 3357 3356 continue; 3358 3357 } 3359 3358 ··· 3440 3431 { 3441 3432 struct mm_struct *mm; 3442 3433 struct mmu_gather tlb; 3434 + unsigned long tlb_start = start; 3435 + unsigned long tlb_end = end; 3436 + 3437 + /* 3438 + * If shared PMDs were possibly used within this vma range, adjust 3439 + * start/end for worst case tlb flushing. 3440 + * Note that we can not be sure if PMDs are shared until we try to 3441 + * unmap pages. However, we want to make sure TLB flushing covers 3442 + * the largest possible range. 3443 + */ 3444 + adjust_range_if_pmd_sharing_possible(vma, &tlb_start, &tlb_end); 3443 3445 3444 3446 mm = vma->vm_mm; 3445 3447 3446 - tlb_gather_mmu(&tlb, mm, start, end); 3448 + tlb_gather_mmu(&tlb, mm, tlb_start, tlb_end); 3447 3449 __unmap_hugepage_range(&tlb, vma, start, end, ref_page); 3448 - tlb_finish_mmu(&tlb, start, end); 3450 + tlb_finish_mmu(&tlb, tlb_start, tlb_end); 3449 3451 } 3450 3452 3451 3453 /* ··· 4318 4298 pte_t pte; 4319 4299 struct hstate *h = hstate_vma(vma); 4320 4300 unsigned long pages = 0; 4301 + unsigned long f_start = start; 4302 + unsigned long f_end = end; 4303 + bool shared_pmd = false; 4304 + 4305 + /* 4306 + * In the case of shared PMDs, the area to flush could be beyond 4307 + * start/end. Set f_start/f_end to cover the maximum possible 4308 + * range if PMD sharing is possible. 4309 + */ 4310 + adjust_range_if_pmd_sharing_possible(vma, &f_start, &f_end); 4321 4311 4322 4312 BUG_ON(address >= end); 4323 - flush_cache_range(vma, address, end); 4313 + flush_cache_range(vma, f_start, f_end); 4324 4314 4325 - mmu_notifier_invalidate_range_start(mm, start, end); 4315 + mmu_notifier_invalidate_range_start(mm, f_start, f_end); 4326 4316 i_mmap_lock_write(vma->vm_file->f_mapping); 4327 4317 for (; address < end; address += huge_page_size(h)) { 4328 4318 spinlock_t *ptl; ··· 4343 4313 if (huge_pmd_unshare(mm, &address, ptep)) { 4344 4314 pages++; 4345 4315 spin_unlock(ptl); 4316 + shared_pmd = true; 4346 4317 continue; 4347 4318 } 4348 4319 pte = huge_ptep_get(ptep); ··· 4379 4348 * Must flush TLB before releasing i_mmap_rwsem: x86's huge_pmd_unshare 4380 4349 * may have cleared our pud entry and done put_page on the page table: 4381 4350 * once we release i_mmap_rwsem, another task can do the final put_page 4382 - * and that page table be reused and filled with junk. 4351 + * and that page table be reused and filled with junk. If we actually 4352 + * did unshare a page of pmds, flush the range corresponding to the pud. 4383 4353 */ 4384 - flush_hugetlb_tlb_range(vma, start, end); 4354 + if (shared_pmd) 4355 + flush_hugetlb_tlb_range(vma, f_start, f_end); 4356 + else 4357 + flush_hugetlb_tlb_range(vma, start, end); 4385 4358 /* 4386 4359 * No need to call mmu_notifier_invalidate_range() we are downgrading 4387 4360 * page table protection not changing it to point to a new page. ··· 4393 4358 * See Documentation/vm/mmu_notifier.rst 4394 4359 */ 4395 4360 i_mmap_unlock_write(vma->vm_file->f_mapping); 4396 - mmu_notifier_invalidate_range_end(mm, start, end); 4361 + mmu_notifier_invalidate_range_end(mm, f_start, f_end); 4397 4362 4398 4363 return pages << h->order; 4399 4364 } ··· 4580 4545 /* 4581 4546 * check on proper vm_flags and page table alignment 4582 4547 */ 4583 - if (vma->vm_flags & VM_MAYSHARE && 4584 - vma->vm_start <= base && end <= vma->vm_end) 4548 + if (vma->vm_flags & VM_MAYSHARE && range_in_vma(vma, base, end)) 4585 4549 return true; 4586 4550 return false; 4551 + } 4552 + 4553 + /* 4554 + * Determine if start,end range within vma could be mapped by shared pmd. 4555 + * If yes, adjust start and end to cover range associated with possible 4556 + * shared pmd mappings. 4557 + */ 4558 + void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, 4559 + unsigned long *start, unsigned long *end) 4560 + { 4561 + unsigned long check_addr = *start; 4562 + 4563 + if (!(vma->vm_flags & VM_MAYSHARE)) 4564 + return; 4565 + 4566 + for (check_addr = *start; check_addr < *end; check_addr += PUD_SIZE) { 4567 + unsigned long a_start = check_addr & PUD_MASK; 4568 + unsigned long a_end = a_start + PUD_SIZE; 4569 + 4570 + /* 4571 + * If sharing is possible, adjust start/end if necessary. 4572 + */ 4573 + if (range_in_vma(vma, a_start, a_end)) { 4574 + if (a_start < *start) 4575 + *start = a_start; 4576 + if (a_end > *end) 4577 + *end = a_end; 4578 + } 4579 + } 4587 4580 } 4588 4581 4589 4582 /* ··· 4710 4647 int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep) 4711 4648 { 4712 4649 return 0; 4650 + } 4651 + 4652 + void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma, 4653 + unsigned long *start, unsigned long *end) 4654 + { 4713 4655 } 4714 4656 #define want_pmd_share() (0) 4715 4657 #endif /* CONFIG_ARCH_WANT_HUGE_PMD_SHARE */
+1 -1
mm/madvise.c
··· 96 96 new_flags |= VM_DONTDUMP; 97 97 break; 98 98 case MADV_DODUMP: 99 - if (new_flags & VM_SPECIAL) { 99 + if (!is_vm_hugetlb_page(vma) && new_flags & VM_SPECIAL) { 100 100 error = -EINVAL; 101 101 goto out; 102 102 }
+4 -58
mm/migrate.c
··· 275 275 if (vma->vm_flags & VM_LOCKED && !PageTransCompound(new)) 276 276 mlock_vma_page(new); 277 277 278 + if (PageTransHuge(page) && PageMlocked(page)) 279 + clear_page_mlock(page); 280 + 278 281 /* No need to invalidate - it was non-present before */ 279 282 update_mmu_cache(vma, pvmw.address, pvmw.pte); 280 283 } ··· 1414 1411 * we encounter them after the rest of the list 1415 1412 * is processed. 1416 1413 */ 1417 - if (PageTransHuge(page)) { 1414 + if (PageTransHuge(page) && !PageHuge(page)) { 1418 1415 lock_page(page); 1419 1416 rc = split_huge_page_to_list(page, from); 1420 1417 unlock_page(page); ··· 1858 1855 return newpage; 1859 1856 } 1860 1857 1861 - /* 1862 - * page migration rate limiting control. 1863 - * Do not migrate more than @pages_to_migrate in a @migrate_interval_millisecs 1864 - * window of time. Default here says do not migrate more than 1280M per second. 1865 - */ 1866 - static unsigned int migrate_interval_millisecs __read_mostly = 100; 1867 - static unsigned int ratelimit_pages __read_mostly = 128 << (20 - PAGE_SHIFT); 1868 - 1869 - /* Returns true if the node is migrate rate-limited after the update */ 1870 - static bool numamigrate_update_ratelimit(pg_data_t *pgdat, 1871 - unsigned long nr_pages) 1872 - { 1873 - /* 1874 - * Rate-limit the amount of data that is being migrated to a node. 1875 - * Optimal placement is no good if the memory bus is saturated and 1876 - * all the time is being spent migrating! 1877 - */ 1878 - if (time_after(jiffies, pgdat->numabalancing_migrate_next_window)) { 1879 - spin_lock(&pgdat->numabalancing_migrate_lock); 1880 - pgdat->numabalancing_migrate_nr_pages = 0; 1881 - pgdat->numabalancing_migrate_next_window = jiffies + 1882 - msecs_to_jiffies(migrate_interval_millisecs); 1883 - spin_unlock(&pgdat->numabalancing_migrate_lock); 1884 - } 1885 - if (pgdat->numabalancing_migrate_nr_pages > ratelimit_pages) { 1886 - trace_mm_numa_migrate_ratelimit(current, pgdat->node_id, 1887 - nr_pages); 1888 - return true; 1889 - } 1890 - 1891 - /* 1892 - * This is an unlocked non-atomic update so errors are possible. 1893 - * The consequences are failing to migrate when we potentiall should 1894 - * have which is not severe enough to warrant locking. If it is ever 1895 - * a problem, it can be converted to a per-cpu counter. 1896 - */ 1897 - pgdat->numabalancing_migrate_nr_pages += nr_pages; 1898 - return false; 1899 - } 1900 - 1901 1858 static int numamigrate_isolate_page(pg_data_t *pgdat, struct page *page) 1902 1859 { 1903 1860 int page_lru; ··· 1930 1967 if (page_is_file_cache(page) && PageDirty(page)) 1931 1968 goto out; 1932 1969 1933 - /* 1934 - * Rate-limit the amount of data that is being migrated to a node. 1935 - * Optimal placement is no good if the memory bus is saturated and 1936 - * all the time is being spent migrating! 1937 - */ 1938 - if (numamigrate_update_ratelimit(pgdat, 1)) 1939 - goto out; 1940 - 1941 1970 isolated = numamigrate_isolate_page(pgdat, page); 1942 1971 if (!isolated) 1943 1972 goto out; ··· 1975 2020 int page_lru = page_is_file_cache(page); 1976 2021 unsigned long mmun_start = address & HPAGE_PMD_MASK; 1977 2022 unsigned long mmun_end = mmun_start + HPAGE_PMD_SIZE; 1978 - 1979 - /* 1980 - * Rate-limit the amount of data that is being migrated to a node. 1981 - * Optimal placement is no good if the memory bus is saturated and 1982 - * all the time is being spent migrating! 1983 - */ 1984 - if (numamigrate_update_ratelimit(pgdat, HPAGE_PMD_NR)) 1985 - goto out_dropref; 1986 2023 1987 2024 new_page = alloc_pages_node(node, 1988 2025 (GFP_TRANSHUGE_LIGHT | __GFP_THISNODE), ··· 2072 2125 2073 2126 out_fail: 2074 2127 count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR); 2075 - out_dropref: 2076 2128 ptl = pmd_lock(mm, pmd); 2077 2129 if (pmd_same(*pmd, entry)) { 2078 2130 entry = pmd_modify(entry, vma->vm_page_prot);
-2
mm/page_alloc.c
··· 6197 6197 static void pgdat_init_numabalancing(struct pglist_data *pgdat) 6198 6198 { 6199 6199 spin_lock_init(&pgdat->numabalancing_migrate_lock); 6200 - pgdat->numabalancing_migrate_nr_pages = 0; 6201 - pgdat->numabalancing_migrate_next_window = jiffies; 6202 6200 } 6203 6201 #else 6204 6202 static void pgdat_init_numabalancing(struct pglist_data *pgdat) {}
+39 -3
mm/rmap.c
··· 1362 1362 } 1363 1363 1364 1364 /* 1365 - * We have to assume the worse case ie pmd for invalidation. Note that 1366 - * the page can not be free in this function as call of try_to_unmap() 1367 - * must hold a reference on the page. 1365 + * For THP, we have to assume the worse case ie pmd for invalidation. 1366 + * For hugetlb, it could be much worse if we need to do pud 1367 + * invalidation in the case of pmd sharing. 1368 + * 1369 + * Note that the page can not be free in this function as call of 1370 + * try_to_unmap() must hold a reference on the page. 1368 1371 */ 1369 1372 end = min(vma->vm_end, start + (PAGE_SIZE << compound_order(page))); 1373 + if (PageHuge(page)) { 1374 + /* 1375 + * If sharing is possible, start and end will be adjusted 1376 + * accordingly. 1377 + */ 1378 + adjust_range_if_pmd_sharing_possible(vma, &start, &end); 1379 + } 1370 1380 mmu_notifier_invalidate_range_start(vma->vm_mm, start, end); 1371 1381 1372 1382 while (page_vma_mapped_walk(&pvmw)) { ··· 1419 1409 subpage = page - page_to_pfn(page) + pte_pfn(*pvmw.pte); 1420 1410 address = pvmw.address; 1421 1411 1412 + if (PageHuge(page)) { 1413 + if (huge_pmd_unshare(mm, &address, pvmw.pte)) { 1414 + /* 1415 + * huge_pmd_unshare unmapped an entire PMD 1416 + * page. There is no way of knowing exactly 1417 + * which PMDs may be cached for this mm, so 1418 + * we must flush them all. start/end were 1419 + * already adjusted above to cover this range. 1420 + */ 1421 + flush_cache_range(vma, start, end); 1422 + flush_tlb_range(vma, start, end); 1423 + mmu_notifier_invalidate_range(mm, start, end); 1424 + 1425 + /* 1426 + * The ref count of the PMD page was dropped 1427 + * which is part of the way map counting 1428 + * is done for shared PMDs. Return 'true' 1429 + * here. When there is no other sharing, 1430 + * huge_pmd_unshare returns false and we will 1431 + * unmap the actual page and drop map count 1432 + * to zero. 1433 + */ 1434 + page_vma_mapped_walk_done(&pvmw); 1435 + break; 1436 + } 1437 + } 1422 1438 1423 1439 if (IS_ENABLED(CONFIG_MIGRATION) && 1424 1440 (flags & TTU_MIGRATION) &&
+3 -4
mm/vmscan.c
··· 580 580 struct mem_cgroup *memcg, int priority) 581 581 { 582 582 struct memcg_shrinker_map *map; 583 - unsigned long freed = 0; 584 - int ret, i; 583 + unsigned long ret, freed = 0; 584 + int i; 585 585 586 586 if (!memcg_kmem_enabled() || !mem_cgroup_online(memcg)) 587 587 return 0; ··· 677 677 struct mem_cgroup *memcg, 678 678 int priority) 679 679 { 680 + unsigned long ret, freed = 0; 680 681 struct shrinker *shrinker; 681 - unsigned long freed = 0; 682 - int ret; 683 682 684 683 if (!mem_cgroup_is_root(memcg)) 685 684 return shrink_slab_memcg(gfp_mask, nid, memcg, priority);
+3 -1
mm/vmstat.c
··· 1275 1275 #ifdef CONFIG_SMP 1276 1276 "nr_tlb_remote_flush", 1277 1277 "nr_tlb_remote_flush_received", 1278 + #else 1279 + "", /* nr_tlb_remote_flush */ 1280 + "", /* nr_tlb_remote_flush_received */ 1278 1281 #endif /* CONFIG_SMP */ 1279 1282 "nr_tlb_local_flush_all", 1280 1283 "nr_tlb_local_flush_one", ··· 1286 1283 #ifdef CONFIG_DEBUG_VM_VMACACHE 1287 1284 "vmacache_find_calls", 1288 1285 "vmacache_find_hits", 1289 - "vmacache_full_flushes", 1290 1286 #endif 1291 1287 #ifdef CONFIG_SWAP 1292 1288 "swap_ra",
+2 -5
net/bluetooth/mgmt.c
··· 2434 2434 /* LE address type */ 2435 2435 addr_type = le_addr_type(cp->addr.type); 2436 2436 2437 - hci_remove_irk(hdev, &cp->addr.bdaddr, addr_type); 2438 - 2439 - err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type); 2437 + /* Abort any ongoing SMP pairing. Removes ltk and irk if they exist. */ 2438 + err = smp_cancel_and_remove_pairing(hdev, &cp->addr.bdaddr, addr_type); 2440 2439 if (err < 0) { 2441 2440 err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE, 2442 2441 MGMT_STATUS_NOT_PAIRED, &rp, ··· 2449 2450 goto done; 2450 2451 } 2451 2452 2452 - /* Abort any ongoing SMP pairing */ 2453 - smp_cancel_pairing(conn); 2454 2453 2455 2454 /* Defer clearing up the connection parameters until closing to 2456 2455 * give a chance of keeping them if a repairing happens.
+25 -4
net/bluetooth/smp.c
··· 2422 2422 return ret; 2423 2423 } 2424 2424 2425 - void smp_cancel_pairing(struct hci_conn *hcon) 2425 + int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr, 2426 + u8 addr_type) 2426 2427 { 2427 - struct l2cap_conn *conn = hcon->l2cap_data; 2428 + struct hci_conn *hcon; 2429 + struct l2cap_conn *conn; 2428 2430 struct l2cap_chan *chan; 2429 2431 struct smp_chan *smp; 2432 + int err; 2430 2433 2434 + err = hci_remove_ltk(hdev, bdaddr, addr_type); 2435 + hci_remove_irk(hdev, bdaddr, addr_type); 2436 + 2437 + hcon = hci_conn_hash_lookup_le(hdev, bdaddr, addr_type); 2438 + if (!hcon) 2439 + goto done; 2440 + 2441 + conn = hcon->l2cap_data; 2431 2442 if (!conn) 2432 - return; 2443 + goto done; 2433 2444 2434 2445 chan = conn->smp; 2435 2446 if (!chan) 2436 - return; 2447 + goto done; 2437 2448 2438 2449 l2cap_chan_lock(chan); 2439 2450 2440 2451 smp = chan->data; 2441 2452 if (smp) { 2453 + /* Set keys to NULL to make sure smp_failure() does not try to 2454 + * remove and free already invalidated rcu list entries. */ 2455 + smp->ltk = NULL; 2456 + smp->slave_ltk = NULL; 2457 + smp->remote_irk = NULL; 2458 + 2442 2459 if (test_bit(SMP_FLAG_COMPLETE, &smp->flags)) 2443 2460 smp_failure(conn, 0); 2444 2461 else 2445 2462 smp_failure(conn, SMP_UNSPECIFIED); 2463 + err = 0; 2446 2464 } 2447 2465 2448 2466 l2cap_chan_unlock(chan); 2467 + 2468 + done: 2469 + return err; 2449 2470 } 2450 2471 2451 2472 static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
+2 -1
net/bluetooth/smp.h
··· 181 181 }; 182 182 183 183 /* SMP Commands */ 184 - void smp_cancel_pairing(struct hci_conn *hcon); 184 + int smp_cancel_and_remove_pairing(struct hci_dev *hdev, bdaddr_t *bdaddr, 185 + u8 addr_type); 185 186 bool smp_sufficient_security(struct hci_conn *hcon, u8 sec_level, 186 187 enum smp_key_pref key_pref); 187 188 int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);
+2 -2
net/bpfilter/bpfilter_kern.c
··· 59 59 req.is_set = is_set; 60 60 req.pid = current->pid; 61 61 req.cmd = optname; 62 - req.addr = (long)optval; 62 + req.addr = (long __force __user)optval; 63 63 req.len = optlen; 64 64 mutex_lock(&bpfilter_lock); 65 65 if (!info.pid) ··· 98 98 pr_info("Loaded bpfilter_umh pid %d\n", info.pid); 99 99 100 100 /* health check that usermode process started correctly */ 101 - if (__bpfilter_process_sockopt(NULL, 0, 0, 0, 0) != 0) { 101 + if (__bpfilter_process_sockopt(NULL, 0, NULL, 0, 0) != 0) { 102 102 stop_umh(); 103 103 return -EFAULT; 104 104 }
+2 -1
net/bridge/br_netfilter_hooks.c
··· 835 835 struct sk_buff *skb, 836 836 const struct nf_hook_state *state) 837 837 { 838 - if (skb->nf_bridge && !skb->nf_bridge->in_prerouting) { 838 + if (skb->nf_bridge && !skb->nf_bridge->in_prerouting && 839 + !netif_is_l3_master(skb->dev)) { 839 840 state->okfn(state->net, state->sk, skb); 840 841 return NF_STOLEN; 841 842 }
+8 -1
net/core/ethtool.c
··· 1483 1483 static int ethtool_set_wol(struct net_device *dev, char __user *useraddr) 1484 1484 { 1485 1485 struct ethtool_wolinfo wol; 1486 + int ret; 1486 1487 1487 1488 if (!dev->ethtool_ops->set_wol) 1488 1489 return -EOPNOTSUPP; ··· 1491 1490 if (copy_from_user(&wol, useraddr, sizeof(wol))) 1492 1491 return -EFAULT; 1493 1492 1494 - return dev->ethtool_ops->set_wol(dev, &wol); 1493 + ret = dev->ethtool_ops->set_wol(dev, &wol); 1494 + if (ret) 1495 + return ret; 1496 + 1497 + dev->wol_enabled = !!wol.wolopts; 1498 + 1499 + return 0; 1495 1500 } 1496 1501 1497 1502 static int ethtool_get_eee(struct net_device *dev, char __user *useraddr)
+3 -19
net/core/netpoll.c
··· 135 135 } 136 136 } 137 137 138 - /* 139 - * Check whether delayed processing was scheduled for our NIC. If so, 140 - * we attempt to grab the poll lock and use ->poll() to pump the card. 141 - * If this fails, either we've recursed in ->poll() or it's already 142 - * running on another CPU. 143 - * 144 - * Note: we don't mask interrupts with this lock because we're using 145 - * trylock here and interrupts are already disabled in the softirq 146 - * case. Further, we test the poll_owner to avoid recursion on UP 147 - * systems where the lock doesn't exist. 148 - */ 149 138 static void poll_one_napi(struct napi_struct *napi) 150 139 { 151 - int work = 0; 152 - 153 - /* net_rx_action's ->poll() invocations and our's are 154 - * synchronized by this test which is only made while 155 - * holding the napi->poll_lock. 156 - */ 157 - if (!test_bit(NAPI_STATE_SCHED, &napi->state)) 158 - return; 140 + int work; 159 141 160 142 /* If we set this bit but see that it has already been set, 161 143 * that indicates that napi has been disabled and we need ··· 312 330 /* It is up to the caller to keep npinfo alive. */ 313 331 struct netpoll_info *npinfo; 314 332 333 + rcu_read_lock_bh(); 315 334 lockdep_assert_irqs_disabled(); 316 335 317 336 npinfo = rcu_dereference_bh(np->dev->npinfo); ··· 357 374 skb_queue_tail(&npinfo->txq, skb); 358 375 schedule_delayed_work(&npinfo->tx_work,0); 359 376 } 377 + rcu_read_unlock_bh(); 360 378 } 361 379 EXPORT_SYMBOL(netpoll_send_skb_on_dev); 362 380
+28 -13
net/core/rtnetlink.c
··· 1898 1898 if (tb[IFLA_IF_NETNSID]) { 1899 1899 netnsid = nla_get_s32(tb[IFLA_IF_NETNSID]); 1900 1900 tgt_net = get_target_net(skb->sk, netnsid); 1901 - if (IS_ERR(tgt_net)) { 1902 - tgt_net = net; 1903 - netnsid = -1; 1904 - } 1901 + if (IS_ERR(tgt_net)) 1902 + return PTR_ERR(tgt_net); 1905 1903 } 1906 1904 1907 1905 if (tb[IFLA_EXT_MASK]) ··· 2835 2837 else if (ops->get_num_rx_queues) 2836 2838 num_rx_queues = ops->get_num_rx_queues(); 2837 2839 2840 + if (num_tx_queues < 1 || num_tx_queues > 4096) 2841 + return ERR_PTR(-EINVAL); 2842 + 2843 + if (num_rx_queues < 1 || num_rx_queues > 4096) 2844 + return ERR_PTR(-EINVAL); 2845 + 2838 2846 dev = alloc_netdev_mqs(ops->priv_size, ifname, name_assign_type, 2839 2847 ops->setup, num_tx_queues, num_rx_queues); 2840 2848 if (!dev) ··· 3748 3744 int err = 0; 3749 3745 int fidx = 0; 3750 3746 3751 - err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb, 3752 - IFLA_MAX, ifla_policy, NULL); 3753 - if (err < 0) { 3754 - return -EINVAL; 3755 - } else if (err == 0) { 3756 - if (tb[IFLA_MASTER]) 3757 - br_idx = nla_get_u32(tb[IFLA_MASTER]); 3758 - } 3747 + /* A hack to preserve kernel<->userspace interface. 3748 + * Before Linux v4.12 this code accepted ndmsg since iproute2 v3.3.0. 3749 + * However, ndmsg is shorter than ifinfomsg thus nlmsg_parse() bails. 3750 + * So, check for ndmsg with an optional u32 attribute (not used here). 3751 + * Fortunately these sizes don't conflict with the size of ifinfomsg 3752 + * with an optional attribute. 3753 + */ 3754 + if (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) && 3755 + (nlmsg_len(cb->nlh) != sizeof(struct ndmsg) + 3756 + nla_attr_size(sizeof(u32)))) { 3757 + err = nlmsg_parse(cb->nlh, sizeof(struct ifinfomsg), tb, 3758 + IFLA_MAX, ifla_policy, NULL); 3759 + if (err < 0) { 3760 + return -EINVAL; 3761 + } else if (err == 0) { 3762 + if (tb[IFLA_MASTER]) 3763 + br_idx = nla_get_u32(tb[IFLA_MASTER]); 3764 + } 3759 3765 3760 - brport_idx = ifm->ifi_index; 3766 + brport_idx = ifm->ifi_index; 3767 + } 3761 3768 3762 3769 if (br_idx) { 3763 3770 br_dev = __dev_get_by_index(net, br_idx);
+3 -1
net/dccp/input.c
··· 606 606 if (sk->sk_state == DCCP_LISTEN) { 607 607 if (dh->dccph_type == DCCP_PKT_REQUEST) { 608 608 /* It is possible that we process SYN packets from backlog, 609 - * so we need to make sure to disable BH right there. 609 + * so we need to make sure to disable BH and RCU right there. 610 610 */ 611 + rcu_read_lock(); 611 612 local_bh_disable(); 612 613 acceptable = inet_csk(sk)->icsk_af_ops->conn_request(sk, skb) >= 0; 613 614 local_bh_enable(); 615 + rcu_read_unlock(); 614 616 if (!acceptable) 615 617 return 1; 616 618 consume_skb(skb);
+3 -1
net/dccp/ipv4.c
··· 493 493 494 494 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->ir_loc_addr, 495 495 ireq->ir_rmt_addr); 496 + rcu_read_lock(); 496 497 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, 497 498 ireq->ir_rmt_addr, 498 - ireq_opt_deref(ireq)); 499 + rcu_dereference(ireq->ireq_opt)); 500 + rcu_read_unlock(); 499 501 err = net_xmit_eval(err); 500 502 } 501 503
+4 -1
net/ipv4/inet_connection_sock.c
··· 544 544 struct ip_options_rcu *opt; 545 545 struct rtable *rt; 546 546 547 - opt = ireq_opt_deref(ireq); 547 + rcu_read_lock(); 548 + opt = rcu_dereference(ireq->ireq_opt); 548 549 549 550 flowi4_init_output(fl4, ireq->ir_iif, ireq->ir_mark, 550 551 RT_CONN_FLAGS(sk), RT_SCOPE_UNIVERSE, ··· 559 558 goto no_route; 560 559 if (opt && opt->opt.is_strictroute && rt->rt_uses_gateway) 561 560 goto route_err; 561 + rcu_read_unlock(); 562 562 return &rt->dst; 563 563 564 564 route_err: 565 565 ip_rt_put(rt); 566 566 no_route: 567 + rcu_read_unlock(); 567 568 __IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); 568 569 return NULL; 569 570 }
+1 -2
net/ipv4/ip_sockglue.c
··· 149 149 static void ip_cmsg_recv_dstaddr(struct msghdr *msg, struct sk_buff *skb) 150 150 { 151 151 struct sockaddr_in sin; 152 - const struct iphdr *iph = ip_hdr(skb); 153 152 __be16 *ports; 154 153 int end; 155 154 ··· 163 164 ports = (__be16 *)skb_transport_header(skb); 164 165 165 166 sin.sin_family = AF_INET; 166 - sin.sin_addr.s_addr = iph->daddr; 167 + sin.sin_addr.s_addr = ip_hdr(skb)->daddr; 167 168 sin.sin_port = ports[1]; 168 169 memset(sin.sin_zero, 0, sizeof(sin.sin_zero)); 169 170
+4 -2
net/ipv4/sysctl_net_ipv4.c
··· 48 48 static int ip_ping_group_range_min[] = { 0, 0 }; 49 49 static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX }; 50 50 static int comp_sack_nr_max = 255; 51 + static u32 u32_max_div_HZ = UINT_MAX / HZ; 51 52 52 53 /* obsolete */ 53 54 static int sysctl_tcp_low_latency __read_mostly; ··· 746 745 { 747 746 .procname = "tcp_probe_interval", 748 747 .data = &init_net.ipv4.sysctl_tcp_probe_interval, 749 - .maxlen = sizeof(int), 748 + .maxlen = sizeof(u32), 750 749 .mode = 0644, 751 - .proc_handler = proc_dointvec, 750 + .proc_handler = proc_douintvec_minmax, 751 + .extra2 = &u32_max_div_HZ, 752 752 }, 753 753 { 754 754 .procname = "igmp_link_local_mcast_reports",
+3 -1
net/ipv4/tcp_input.c
··· 6009 6009 if (th->fin) 6010 6010 goto discard; 6011 6011 /* It is possible that we process SYN packets from backlog, 6012 - * so we need to make sure to disable BH right there. 6012 + * so we need to make sure to disable BH and RCU right there. 6013 6013 */ 6014 + rcu_read_lock(); 6014 6015 local_bh_disable(); 6015 6016 acceptable = icsk->icsk_af_ops->conn_request(sk, skb) >= 0; 6016 6017 local_bh_enable(); 6018 + rcu_read_unlock(); 6017 6019 6018 6020 if (!acceptable) 6019 6021 return 1;
+3 -1
net/ipv4/tcp_ipv4.c
··· 943 943 if (skb) { 944 944 __tcp_v4_send_check(skb, ireq->ir_loc_addr, ireq->ir_rmt_addr); 945 945 946 + rcu_read_lock(); 946 947 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr, 947 948 ireq->ir_rmt_addr, 948 - ireq_opt_deref(ireq)); 949 + rcu_dereference(ireq->ireq_opt)); 950 + rcu_read_unlock(); 949 951 err = net_xmit_eval(err); 950 952 } 951 953
+1
net/ipv4/xfrm4_input.c
··· 67 67 68 68 if (xo && (xo->flags & XFRM_GRO)) { 69 69 skb_mac_header_rebuild(skb); 70 + skb_reset_transport_header(skb); 70 71 return 0; 71 72 } 72 73
+1 -3
net/ipv4/xfrm4_mode_transport.c
··· 46 46 static int xfrm4_transport_input(struct xfrm_state *x, struct sk_buff *skb) 47 47 { 48 48 int ihl = skb->data - skb_transport_header(skb); 49 - struct xfrm_offload *xo = xfrm_offload(skb); 50 49 51 50 if (skb->transport_header != skb->network_header) { 52 51 memmove(skb_transport_header(skb), ··· 53 54 skb->network_header = skb->transport_header; 54 55 } 55 56 ip_hdr(skb)->tot_len = htons(skb->len + ihl); 56 - if (!xo || !(xo->flags & XFRM_GRO)) 57 - skb_reset_transport_header(skb); 57 + skb_reset_transport_header(skb); 58 58 return 0; 59 59 } 60 60
+20 -9
net/ipv6/raw.c
··· 651 651 skb->priority = sk->sk_priority; 652 652 skb->mark = sk->sk_mark; 653 653 skb->tstamp = sockc->transmit_time; 654 - skb_dst_set(skb, &rt->dst); 655 - *dstp = NULL; 656 654 657 655 skb_put(skb, length); 658 656 skb_reset_network_header(skb); ··· 663 665 664 666 skb->transport_header = skb->network_header; 665 667 err = memcpy_from_msg(iph, msg, length); 666 - if (err) 667 - goto error_fault; 668 + if (err) { 669 + err = -EFAULT; 670 + kfree_skb(skb); 671 + goto error; 672 + } 673 + 674 + skb_dst_set(skb, &rt->dst); 675 + *dstp = NULL; 668 676 669 677 /* if egress device is enslaved to an L3 master device pass the 670 678 * skb to its handler for processing ··· 679 675 if (unlikely(!skb)) 680 676 return 0; 681 677 678 + /* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev 679 + * in the error path. Since skb has been freed, the dst could 680 + * have been queued for deletion. 681 + */ 682 + rcu_read_lock(); 682 683 IP6_UPD_PO_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); 683 684 err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, sk, skb, 684 685 NULL, rt->dst.dev, dst_output); 685 686 if (err > 0) 686 687 err = net_xmit_errno(err); 687 - if (err) 688 - goto error; 688 + if (err) { 689 + IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); 690 + rcu_read_unlock(); 691 + goto error_check; 692 + } 693 + rcu_read_unlock(); 689 694 out: 690 695 return 0; 691 696 692 - error_fault: 693 - err = -EFAULT; 694 - kfree_skb(skb); 695 697 error: 696 698 IP6_INC_STATS(net, rt->rt6i_idev, IPSTATS_MIB_OUTDISCARDS); 699 + error_check: 697 700 if (err == -ENOBUFS && !np->recverr) 698 701 err = 0; 699 702 return err;
-5
net/ipv6/route.c
··· 4321 4321 if (!nh) 4322 4322 return -ENOMEM; 4323 4323 nh->fib6_info = rt; 4324 - err = ip6_convert_metrics(net, rt, r_cfg); 4325 - if (err) { 4326 - kfree(nh); 4327 - return err; 4328 - } 4329 4324 memcpy(&nh->r_cfg, r_cfg, sizeof(*r_cfg)); 4330 4325 list_add_tail(&nh->next, rt6_nh_list); 4331 4326
+1
net/ipv6/xfrm6_input.c
··· 59 59 60 60 if (xo && (xo->flags & XFRM_GRO)) { 61 61 skb_mac_header_rebuild(skb); 62 + skb_reset_transport_header(skb); 62 63 return -1; 63 64 } 64 65
+1 -3
net/ipv6/xfrm6_mode_transport.c
··· 51 51 static int xfrm6_transport_input(struct xfrm_state *x, struct sk_buff *skb) 52 52 { 53 53 int ihl = skb->data - skb_transport_header(skb); 54 - struct xfrm_offload *xo = xfrm_offload(skb); 55 54 56 55 if (skb->transport_header != skb->network_header) { 57 56 memmove(skb_transport_header(skb), ··· 59 60 } 60 61 ipv6_hdr(skb)->payload_len = htons(skb->len + ihl - 61 62 sizeof(struct ipv6hdr)); 62 - if (!xo || !(xo->flags & XFRM_GRO)) 63 - skb_reset_transport_header(skb); 63 + skb_reset_transport_header(skb); 64 64 return 0; 65 65 } 66 66
+2
net/ipv6/xfrm6_output.c
··· 170 170 171 171 if (toobig && xfrm6_local_dontfrag(skb)) { 172 172 xfrm6_local_rxpmtu(skb, mtu); 173 + kfree_skb(skb); 173 174 return -EMSGSIZE; 174 175 } else if (!skb->ignore_df && toobig && skb->sk) { 175 176 xfrm_local_error(skb, mtu); 177 + kfree_skb(skb); 176 178 return -EMSGSIZE; 177 179 } 178 180
+1 -1
net/mac80211/cfg.c
··· 427 427 case NL80211_IFTYPE_AP: 428 428 case NL80211_IFTYPE_AP_VLAN: 429 429 /* Keys without a station are used for TX only */ 430 - if (key->sta && test_sta_flag(key->sta, WLAN_STA_MFP)) 430 + if (sta && test_sta_flag(sta, WLAN_STA_MFP)) 431 431 key->conf.flags |= IEEE80211_KEY_FLAG_RX_MGMT; 432 432 break; 433 433 case NL80211_IFTYPE_ADHOC:
+2 -1
net/mac80211/iface.c
··· 1756 1756 1757 1757 if (local->ops->wake_tx_queue && 1758 1758 type != NL80211_IFTYPE_AP_VLAN && 1759 - type != NL80211_IFTYPE_MONITOR) 1759 + (type != NL80211_IFTYPE_MONITOR || 1760 + (params->flags & MONITOR_FLAG_ACTIVE))) 1760 1761 txq_size += sizeof(struct txq_info) + 1761 1762 local->hw.txq_data_size; 1762 1763
+2 -1
net/mac80211/mesh.h
··· 217 217 int mesh_rmc_init(struct ieee80211_sub_if_data *sdata); 218 218 void ieee80211s_init(void); 219 219 void ieee80211s_update_metric(struct ieee80211_local *local, 220 - struct sta_info *sta, struct sk_buff *skb); 220 + struct sta_info *sta, 221 + struct ieee80211_tx_status *st); 221 222 void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); 222 223 void ieee80211_mesh_teardown_sdata(struct ieee80211_sub_if_data *sdata); 223 224 int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata);
+3 -6
net/mac80211/mesh_hwmp.c
··· 295 295 } 296 296 297 297 void ieee80211s_update_metric(struct ieee80211_local *local, 298 - struct sta_info *sta, struct sk_buff *skb) 298 + struct sta_info *sta, 299 + struct ieee80211_tx_status *st) 299 300 { 300 - struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); 301 - struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 301 + struct ieee80211_tx_info *txinfo = st->info; 302 302 int failed; 303 - 304 - if (!ieee80211_is_data(hdr->frame_control)) 305 - return; 306 303 307 304 failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK); 308 305
+5 -6
net/mac80211/status.c
··· 479 479 if (!skb) 480 480 return; 481 481 482 - if (dropped) { 483 - dev_kfree_skb_any(skb); 484 - return; 485 - } 486 - 487 482 if (info->flags & IEEE80211_TX_INTFL_NL80211_FRAME_TX) { 488 483 u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie; 489 484 struct ieee80211_sub_if_data *sdata; ··· 501 506 } 502 507 rcu_read_unlock(); 503 508 509 + dev_kfree_skb_any(skb); 510 + } else if (dropped) { 504 511 dev_kfree_skb_any(skb); 505 512 } else { 506 513 /* consumes skb */ ··· 808 811 809 812 rate_control_tx_status(local, sband, status); 810 813 if (ieee80211_vif_is_mesh(&sta->sdata->vif)) 811 - ieee80211s_update_metric(local, sta, skb); 814 + ieee80211s_update_metric(local, sta, status); 812 815 813 816 if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked) 814 817 ieee80211_frame_acked(sta, skb); ··· 969 972 } 970 973 971 974 rate_control_tx_status(local, sband, status); 975 + if (ieee80211_vif_is_mesh(&sta->sdata->vif)) 976 + ieee80211s_update_metric(local, sta, status); 972 977 } 973 978 974 979 if (acked || noack_success) {
+4 -4
net/mac80211/tdls.c
··· 16 16 #include "ieee80211_i.h" 17 17 #include "driver-ops.h" 18 18 #include "rate.h" 19 + #include "wme.h" 19 20 20 21 /* give usermode some time for retries in setting up the TDLS session */ 21 22 #define TDLS_PEER_SETUP_TIMEOUT (15 * HZ) ··· 1011 1010 switch (action_code) { 1012 1011 case WLAN_TDLS_SETUP_REQUEST: 1013 1012 case WLAN_TDLS_SETUP_RESPONSE: 1014 - skb_set_queue_mapping(skb, IEEE80211_AC_BK); 1015 - skb->priority = 2; 1013 + skb->priority = 256 + 2; 1016 1014 break; 1017 1015 default: 1018 - skb_set_queue_mapping(skb, IEEE80211_AC_VI); 1019 - skb->priority = 5; 1016 + skb->priority = 256 + 5; 1020 1017 break; 1021 1018 } 1019 + skb_set_queue_mapping(skb, ieee80211_select_queue(sdata, skb)); 1022 1020 1023 1021 /* 1024 1022 * Set the WLAN_TDLS_TEARDOWN flag to indicate a teardown in progress.
+5 -1
net/mac80211/tx.c
··· 214 214 { 215 215 struct ieee80211_local *local = tx->local; 216 216 struct ieee80211_if_managed *ifmgd; 217 + struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); 217 218 218 219 /* driver doesn't support power save */ 219 220 if (!ieee80211_hw_check(&local->hw, SUPPORTS_PS)) ··· 241 240 242 241 /* dynamic ps is supported only in managed mode */ 243 242 if (tx->sdata->vif.type != NL80211_IFTYPE_STATION) 243 + return TX_CONTINUE; 244 + 245 + if (unlikely(info->flags & IEEE80211_TX_INTFL_OFFCHAN_TX_OK)) 244 246 return TX_CONTINUE; 245 247 246 248 ifmgd = &tx->sdata->u.mgd; ··· 1894 1890 sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; 1895 1891 1896 1892 if (invoke_tx_handlers_early(&tx)) 1897 - return false; 1893 + return true; 1898 1894 1899 1895 if (ieee80211_queue_skb(local, sdata, tx.sta, tx.skb)) 1900 1896 return true;
+2 -2
net/netfilter/nf_conntrack_proto_tcp.c
··· 1213 1213 #define TCP_NLATTR_SIZE ( \ 1214 1214 NLA_ALIGN(NLA_HDRLEN + 1) + \ 1215 1215 NLA_ALIGN(NLA_HDRLEN + 1) + \ 1216 - NLA_ALIGN(NLA_HDRLEN + sizeof(sizeof(struct nf_ct_tcp_flags))) + \ 1217 - NLA_ALIGN(NLA_HDRLEN + sizeof(sizeof(struct nf_ct_tcp_flags)))) 1216 + NLA_ALIGN(NLA_HDRLEN + sizeof(struct nf_ct_tcp_flags)) + \ 1217 + NLA_ALIGN(NLA_HDRLEN + sizeof(struct nf_ct_tcp_flags))) 1218 1218 1219 1219 static int nlattr_to_tcp(struct nlattr *cda[], struct nf_conn *ct) 1220 1220 {
+1 -1
net/netfilter/nft_osf.c
··· 49 49 50 50 priv->dreg = nft_parse_register(tb[NFTA_OSF_DREG]); 51 51 err = nft_validate_register_store(ctx, priv->dreg, NULL, 52 - NFTA_DATA_VALUE, NFT_OSF_MAXGENRELEN); 52 + NFT_DATA_VALUE, NFT_OSF_MAXGENRELEN); 53 53 if (err < 0) 54 54 return err; 55 55
+14 -14
net/netfilter/nft_set_rbtree.c
··· 355 355 356 356 static void nft_rbtree_gc(struct work_struct *work) 357 357 { 358 + struct nft_rbtree_elem *rbe, *rbe_end = NULL, *rbe_prev = NULL; 358 359 struct nft_set_gc_batch *gcb = NULL; 359 - struct rb_node *node, *prev = NULL; 360 - struct nft_rbtree_elem *rbe; 361 360 struct nft_rbtree *priv; 361 + struct rb_node *node; 362 362 struct nft_set *set; 363 - int i; 364 363 365 364 priv = container_of(work, struct nft_rbtree, gc_work.work); 366 365 set = nft_set_container_of(priv); ··· 370 371 rbe = rb_entry(node, struct nft_rbtree_elem, node); 371 372 372 373 if (nft_rbtree_interval_end(rbe)) { 373 - prev = node; 374 + rbe_end = rbe; 374 375 continue; 375 376 } 376 377 if (!nft_set_elem_expired(&rbe->ext)) ··· 378 379 if (nft_set_elem_mark_busy(&rbe->ext)) 379 380 continue; 380 381 382 + if (rbe_prev) { 383 + rb_erase(&rbe_prev->node, &priv->root); 384 + rbe_prev = NULL; 385 + } 381 386 gcb = nft_set_gc_batch_check(set, gcb, GFP_ATOMIC); 382 387 if (!gcb) 383 388 break; 384 389 385 390 atomic_dec(&set->nelems); 386 391 nft_set_gc_batch_add(gcb, rbe); 392 + rbe_prev = rbe; 387 393 388 - if (prev) { 389 - rbe = rb_entry(prev, struct nft_rbtree_elem, node); 394 + if (rbe_end) { 390 395 atomic_dec(&set->nelems); 391 - nft_set_gc_batch_add(gcb, rbe); 392 - prev = NULL; 396 + nft_set_gc_batch_add(gcb, rbe_end); 397 + rb_erase(&rbe_end->node, &priv->root); 398 + rbe_end = NULL; 393 399 } 394 400 node = rb_next(node); 395 401 if (!node) 396 402 break; 397 403 } 398 - if (gcb) { 399 - for (i = 0; i < gcb->head.cnt; i++) { 400 - rbe = gcb->elems[i]; 401 - rb_erase(&rbe->node, &priv->root); 402 - } 403 - } 404 + if (rbe_prev) 405 + rb_erase(&rbe_prev->node, &priv->root); 404 406 write_seqcount_end(&priv->count); 405 407 write_unlock_bh(&priv->lock); 406 408
+2 -2
net/netfilter/xt_socket.c
··· 56 56 struct sk_buff *pskb = (struct sk_buff *)skb; 57 57 struct sock *sk = skb->sk; 58 58 59 - if (!net_eq(xt_net(par), sock_net(sk))) 59 + if (sk && !net_eq(xt_net(par), sock_net(sk))) 60 60 sk = NULL; 61 61 62 62 if (!sk) ··· 117 117 struct sk_buff *pskb = (struct sk_buff *)skb; 118 118 struct sock *sk = skb->sk; 119 119 120 - if (!net_eq(xt_net(par), sock_net(sk))) 120 + if (sk && !net_eq(xt_net(par), sock_net(sk))) 121 121 sk = NULL; 122 122 123 123 if (!sk)
+6 -4
net/openvswitch/conntrack.c
··· 1312 1312 1313 1313 rcu_assign_pointer(help->helper, helper); 1314 1314 info->helper = helper; 1315 + 1316 + if (info->nat) 1317 + request_module("ip_nat_%s", name); 1318 + 1315 1319 return 0; 1316 1320 } 1317 1321 ··· 1628 1624 OVS_NLERR(log, "Failed to allocate conntrack template"); 1629 1625 return -ENOMEM; 1630 1626 } 1631 - 1632 - __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status); 1633 - nf_conntrack_get(&ct_info.ct->ct_general); 1634 - 1635 1627 if (helper) { 1636 1628 err = ovs_ct_add_helper(&ct_info, helper, key, log); 1637 1629 if (err) ··· 1639 1639 if (err) 1640 1640 goto err_free_ct; 1641 1641 1642 + __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status); 1643 + nf_conntrack_get(&ct_info.ct->ct_general); 1642 1644 return 0; 1643 1645 err_free_ct: 1644 1646 __ovs_ct_free_action(&ct_info);
+7 -4
net/packet/af_packet.c
··· 2715 2715 } 2716 2716 } 2717 2717 2718 - if (po->has_vnet_hdr && virtio_net_hdr_to_skb(skb, vnet_hdr, 2719 - vio_le())) { 2720 - tp_len = -EINVAL; 2721 - goto tpacket_error; 2718 + if (po->has_vnet_hdr) { 2719 + if (virtio_net_hdr_to_skb(skb, vnet_hdr, vio_le())) { 2720 + tp_len = -EINVAL; 2721 + goto tpacket_error; 2722 + } 2723 + virtio_net_hdr_set_proto(skb, vnet_hdr); 2722 2724 } 2723 2725 2724 2726 skb->destructor = tpacket_destruct_skb; ··· 2917 2915 if (err) 2918 2916 goto out_free; 2919 2917 len += sizeof(vnet_hdr); 2918 + virtio_net_hdr_set_proto(skb, &vnet_hdr); 2920 2919 } 2921 2920 2922 2921 skb_probe_transport_header(skb, reserve);
+19 -17
net/rxrpc/ar-internal.h
··· 40 40 struct rxrpc_connection; 41 41 42 42 /* 43 - * Mark applied to socket buffers. 43 + * Mark applied to socket buffers in skb->mark. skb->priority is used 44 + * to pass supplementary information. 44 45 */ 45 46 enum rxrpc_skb_mark { 46 - RXRPC_SKB_MARK_DATA, /* data message */ 47 - RXRPC_SKB_MARK_FINAL_ACK, /* final ACK received message */ 48 - RXRPC_SKB_MARK_BUSY, /* server busy message */ 49 - RXRPC_SKB_MARK_REMOTE_ABORT, /* remote abort message */ 50 - RXRPC_SKB_MARK_LOCAL_ABORT, /* local abort message */ 51 - RXRPC_SKB_MARK_NET_ERROR, /* network error message */ 52 - RXRPC_SKB_MARK_LOCAL_ERROR, /* local error message */ 53 - RXRPC_SKB_MARK_NEW_CALL, /* local error message */ 47 + RXRPC_SKB_MARK_REJECT_BUSY, /* Reject with BUSY */ 48 + RXRPC_SKB_MARK_REJECT_ABORT, /* Reject with ABORT (code in skb->priority) */ 54 49 }; 55 50 56 51 /* ··· 288 293 struct hlist_node hash_link; 289 294 struct rxrpc_local *local; 290 295 struct hlist_head error_targets; /* targets for net error distribution */ 291 - struct work_struct error_distributor; 292 296 struct rb_root service_conns; /* Service connections */ 293 297 struct list_head keepalive_link; /* Link in net->peer_keepalive[] */ 294 298 time64_t last_tx_at; /* Last time packet sent here */ ··· 298 304 unsigned int maxdata; /* data size (MTU - hdrsize) */ 299 305 unsigned short hdrsize; /* header size (IP + UDP + RxRPC) */ 300 306 int debug_id; /* debug ID for printks */ 301 - int error_report; /* Net (+0) or local (+1000000) to distribute */ 302 - #define RXRPC_LOCAL_ERROR_OFFSET 1000000 303 307 struct sockaddr_rxrpc srx; /* remote address */ 304 308 305 309 /* calculated RTT cache */ ··· 454 462 u8 security_ix; /* security type */ 455 463 u8 out_clientflag; /* RXRPC_CLIENT_INITIATED if we are client */ 456 464 }; 465 + 466 + static inline bool rxrpc_to_server(const struct rxrpc_skb_priv *sp) 467 + { 468 + return sp->hdr.flags & RXRPC_CLIENT_INITIATED; 469 + } 470 + 471 + static inline bool rxrpc_to_client(const struct rxrpc_skb_priv *sp) 472 + { 473 + return !rxrpc_to_server(sp); 474 + } 457 475 458 476 /* 459 477 * Flags in call->flags. ··· 719 717 int rxrpc_service_prealloc(struct rxrpc_sock *, gfp_t); 720 718 void rxrpc_discard_prealloc(struct rxrpc_sock *); 721 719 struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *, 720 + struct rxrpc_sock *, 721 + struct rxrpc_peer *, 722 722 struct rxrpc_connection *, 723 723 struct sk_buff *); 724 724 void rxrpc_accept_incoming_calls(struct rxrpc_local *); ··· 912 908 913 909 struct rxrpc_connection *rxrpc_alloc_connection(gfp_t); 914 910 struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *, 915 - struct sk_buff *); 911 + struct sk_buff *, 912 + struct rxrpc_peer **); 916 913 void __rxrpc_disconnect_call(struct rxrpc_connection *, struct rxrpc_call *); 917 914 void rxrpc_disconnect_call(struct rxrpc_call *); 918 915 void rxrpc_kill_connection(struct rxrpc_connection *); ··· 1036 1031 * peer_event.c 1037 1032 */ 1038 1033 void rxrpc_error_report(struct sock *); 1039 - void rxrpc_peer_error_distributor(struct work_struct *); 1040 1034 void rxrpc_peer_add_rtt(struct rxrpc_call *, enum rxrpc_rtt_rx_trace, 1041 1035 rxrpc_serial_t, rxrpc_serial_t, ktime_t, ktime_t); 1042 1036 void rxrpc_peer_keepalive_worker(struct work_struct *); ··· 1048 1044 struct rxrpc_peer *rxrpc_lookup_peer(struct rxrpc_local *, 1049 1045 struct sockaddr_rxrpc *, gfp_t); 1050 1046 struct rxrpc_peer *rxrpc_alloc_peer(struct rxrpc_local *, gfp_t); 1051 - struct rxrpc_peer *rxrpc_lookup_incoming_peer(struct rxrpc_local *, 1052 - struct rxrpc_peer *); 1047 + void rxrpc_new_incoming_peer(struct rxrpc_local *, struct rxrpc_peer *); 1053 1048 void rxrpc_destroy_all_peers(struct rxrpc_net *); 1054 1049 struct rxrpc_peer *rxrpc_get_peer(struct rxrpc_peer *); 1055 1050 struct rxrpc_peer *rxrpc_get_peer_maybe(struct rxrpc_peer *); 1056 1051 void rxrpc_put_peer(struct rxrpc_peer *); 1057 - void __rxrpc_queue_peer_error(struct rxrpc_peer *); 1058 1052 1059 1053 /* 1060 1054 * proc.c
+14 -31
net/rxrpc/call_accept.c
··· 249 249 */ 250 250 static struct rxrpc_call *rxrpc_alloc_incoming_call(struct rxrpc_sock *rx, 251 251 struct rxrpc_local *local, 252 + struct rxrpc_peer *peer, 252 253 struct rxrpc_connection *conn, 253 254 struct sk_buff *skb) 254 255 { 255 256 struct rxrpc_backlog *b = rx->backlog; 256 - struct rxrpc_peer *peer, *xpeer; 257 257 struct rxrpc_call *call; 258 258 unsigned short call_head, conn_head, peer_head; 259 259 unsigned short call_tail, conn_tail, peer_tail; ··· 276 276 return NULL; 277 277 278 278 if (!conn) { 279 - /* No connection. We're going to need a peer to start off 280 - * with. If one doesn't yet exist, use a spare from the 281 - * preallocation set. We dump the address into the spare in 282 - * anticipation - and to save on stack space. 283 - */ 284 - xpeer = b->peer_backlog[peer_tail]; 285 - if (rxrpc_extract_addr_from_skb(local, &xpeer->srx, skb) < 0) 286 - return NULL; 287 - 288 - peer = rxrpc_lookup_incoming_peer(local, xpeer); 289 - if (peer == xpeer) { 279 + if (peer && !rxrpc_get_peer_maybe(peer)) 280 + peer = NULL; 281 + if (!peer) { 282 + peer = b->peer_backlog[peer_tail]; 283 + if (rxrpc_extract_addr_from_skb(local, &peer->srx, skb) < 0) 284 + return NULL; 290 285 b->peer_backlog[peer_tail] = NULL; 291 286 smp_store_release(&b->peer_backlog_tail, 292 287 (peer_tail + 1) & 293 288 (RXRPC_BACKLOG_MAX - 1)); 289 + 290 + rxrpc_new_incoming_peer(local, peer); 294 291 } 295 292 296 293 /* Now allocate and set up the connection */ ··· 332 335 * The call is returned with the user access mutex held. 333 336 */ 334 337 struct rxrpc_call *rxrpc_new_incoming_call(struct rxrpc_local *local, 338 + struct rxrpc_sock *rx, 339 + struct rxrpc_peer *peer, 335 340 struct rxrpc_connection *conn, 336 341 struct sk_buff *skb) 337 342 { 338 343 struct rxrpc_skb_priv *sp = rxrpc_skb(skb); 339 - struct rxrpc_sock *rx; 340 344 struct rxrpc_call *call; 341 - u16 service_id = sp->hdr.serviceId; 342 345 343 346 _enter(""); 344 347 345 - /* Get the socket providing the service */ 346 - rx = rcu_dereference(local->service); 347 - if (rx && (service_id == rx->srx.srx_service || 348 - service_id == rx->second_service)) 349 - goto found_service; 350 - 351 - trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, 352 - RX_INVALID_OPERATION, EOPNOTSUPP); 353 - skb->mark = RXRPC_SKB_MARK_LOCAL_ABORT; 354 - skb->priority = RX_INVALID_OPERATION; 355 - _leave(" = NULL [service]"); 356 - return NULL; 357 - 358 - found_service: 359 348 spin_lock(&rx->incoming_lock); 360 349 if (rx->sk.sk_state == RXRPC_SERVER_LISTEN_DISABLED || 361 350 rx->sk.sk_state == RXRPC_CLOSE) { 362 351 trace_rxrpc_abort(0, "CLS", sp->hdr.cid, sp->hdr.callNumber, 363 352 sp->hdr.seq, RX_INVALID_OPERATION, ESHUTDOWN); 364 - skb->mark = RXRPC_SKB_MARK_LOCAL_ABORT; 353 + skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; 365 354 skb->priority = RX_INVALID_OPERATION; 366 355 _leave(" = NULL [close]"); 367 356 call = NULL; 368 357 goto out; 369 358 } 370 359 371 - call = rxrpc_alloc_incoming_call(rx, local, conn, skb); 360 + call = rxrpc_alloc_incoming_call(rx, local, peer, conn, skb); 372 361 if (!call) { 373 - skb->mark = RXRPC_SKB_MARK_BUSY; 362 + skb->mark = RXRPC_SKB_MARK_REJECT_BUSY; 374 363 _leave(" = NULL [busy]"); 375 364 call = NULL; 376 365 goto out;
+1 -1
net/rxrpc/call_object.c
··· 400 400 rcu_assign_pointer(conn->channels[chan].call, call); 401 401 402 402 spin_lock(&conn->params.peer->lock); 403 - hlist_add_head(&call->error_link, &conn->params.peer->error_targets); 403 + hlist_add_head_rcu(&call->error_link, &conn->params.peer->error_targets); 404 404 spin_unlock(&conn->params.peer->lock); 405 405 406 406 _net("CALL incoming %d on CONN %d", call->debug_id, call->conn->debug_id);
+2 -2
net/rxrpc/conn_client.c
··· 710 710 } 711 711 712 712 spin_lock_bh(&call->conn->params.peer->lock); 713 - hlist_add_head(&call->error_link, 714 - &call->conn->params.peer->error_targets); 713 + hlist_add_head_rcu(&call->error_link, 714 + &call->conn->params.peer->error_targets); 715 715 spin_unlock_bh(&call->conn->params.peer->lock); 716 716 717 717 out:
+8 -6
net/rxrpc/conn_object.c
··· 69 69 * If successful, a pointer to the connection is returned, but no ref is taken. 70 70 * NULL is returned if there is no match. 71 71 * 72 + * When searching for a service call, if we find a peer but no connection, we 73 + * return that through *_peer in case we need to create a new service call. 74 + * 72 75 * The caller must be holding the RCU read lock. 73 76 */ 74 77 struct rxrpc_connection *rxrpc_find_connection_rcu(struct rxrpc_local *local, 75 - struct sk_buff *skb) 78 + struct sk_buff *skb, 79 + struct rxrpc_peer **_peer) 76 80 { 77 81 struct rxrpc_connection *conn; 78 82 struct rxrpc_conn_proto k; ··· 89 85 if (rxrpc_extract_addr_from_skb(local, &srx, skb) < 0) 90 86 goto not_found; 91 87 92 - k.epoch = sp->hdr.epoch; 93 - k.cid = sp->hdr.cid & RXRPC_CIDMASK; 94 - 95 88 /* We may have to handle mixing IPv4 and IPv6 */ 96 89 if (srx.transport.family != local->srx.transport.family) { 97 90 pr_warn_ratelimited("AF_RXRPC: Protocol mismatch %u not %u\n", ··· 100 99 k.epoch = sp->hdr.epoch; 101 100 k.cid = sp->hdr.cid & RXRPC_CIDMASK; 102 101 103 - if (sp->hdr.flags & RXRPC_CLIENT_INITIATED) { 102 + if (rxrpc_to_server(sp)) { 104 103 /* We need to look up service connections by the full protocol 105 104 * parameter set. We look up the peer first as an intermediate 106 105 * step and then the connection from the peer's tree. ··· 108 107 peer = rxrpc_lookup_peer_rcu(local, &srx); 109 108 if (!peer) 110 109 goto not_found; 110 + *_peer = peer; 111 111 conn = rxrpc_find_service_conn_rcu(peer, skb); 112 112 if (!conn || atomic_read(&conn->usage) == 0) 113 113 goto not_found; ··· 216 214 call->peer->cong_cwnd = call->cong_cwnd; 217 215 218 216 spin_lock_bh(&conn->params.peer->lock); 219 - hlist_del_init(&call->error_link); 217 + hlist_del_rcu(&call->error_link); 220 218 spin_unlock_bh(&conn->params.peer->lock); 221 219 222 220 if (rxrpc_is_client_call(call))
+64 -26
net/rxrpc/input.c
··· 622 622 if (!skb) 623 623 continue; 624 624 625 + sent_at = skb->tstamp; 626 + smp_rmb(); /* Read timestamp before serial. */ 625 627 sp = rxrpc_skb(skb); 626 628 if (sp->hdr.serial != orig_serial) 627 629 continue; 628 - smp_rmb(); 629 - sent_at = skb->tstamp; 630 630 goto found; 631 631 } 632 + 632 633 return; 633 634 634 635 found: ··· 1125 1124 { 1126 1125 struct rxrpc_connection *conn; 1127 1126 struct rxrpc_channel *chan; 1128 - struct rxrpc_call *call; 1127 + struct rxrpc_call *call = NULL; 1129 1128 struct rxrpc_skb_priv *sp; 1130 1129 struct rxrpc_local *local = udp_sk->sk_user_data; 1130 + struct rxrpc_peer *peer = NULL; 1131 + struct rxrpc_sock *rx = NULL; 1131 1132 struct sk_buff *skb; 1132 1133 unsigned int channel; 1133 - int ret, skew; 1134 + int ret, skew = 0; 1134 1135 1135 1136 _enter("%p", udp_sk); 1136 1137 ··· 1145 1142 _debug("UDP socket error %d", ret); 1146 1143 return; 1147 1144 } 1145 + 1146 + if (skb->tstamp == 0) 1147 + skb->tstamp = ktime_get_real(); 1148 1148 1149 1149 rxrpc_new_skb(skb, rxrpc_skb_rx_received); 1150 1150 ··· 1183 1177 1184 1178 trace_rxrpc_rx_packet(sp); 1185 1179 1186 - _net("Rx RxRPC %s ep=%x call=%x:%x", 1187 - sp->hdr.flags & RXRPC_CLIENT_INITIATED ? "ToServer" : "ToClient", 1188 - sp->hdr.epoch, sp->hdr.cid, sp->hdr.callNumber); 1189 - 1190 - if (sp->hdr.type >= RXRPC_N_PACKET_TYPES || 1191 - !((RXRPC_SUPPORTED_PACKET_TYPES >> sp->hdr.type) & 1)) { 1192 - _proto("Rx Bad Packet Type %u", sp->hdr.type); 1193 - goto bad_message; 1194 - } 1195 - 1196 1180 switch (sp->hdr.type) { 1197 1181 case RXRPC_PACKET_TYPE_VERSION: 1198 - if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED)) 1182 + if (rxrpc_to_client(sp)) 1199 1183 goto discard; 1200 1184 rxrpc_post_packet_to_local(local, skb); 1201 1185 goto out; 1202 1186 1203 1187 case RXRPC_PACKET_TYPE_BUSY: 1204 - if (sp->hdr.flags & RXRPC_CLIENT_INITIATED) 1188 + if (rxrpc_to_server(sp)) 1205 1189 goto discard; 1206 1190 /* Fall through */ 1191 + case RXRPC_PACKET_TYPE_ACK: 1192 + case RXRPC_PACKET_TYPE_ACKALL: 1193 + if (sp->hdr.callNumber == 0) 1194 + goto bad_message; 1195 + /* Fall through */ 1196 + case RXRPC_PACKET_TYPE_ABORT: 1197 + break; 1207 1198 1208 1199 case RXRPC_PACKET_TYPE_DATA: 1209 - if (sp->hdr.callNumber == 0) 1200 + if (sp->hdr.callNumber == 0 || 1201 + sp->hdr.seq == 0) 1210 1202 goto bad_message; 1211 1203 if (sp->hdr.flags & RXRPC_JUMBO_PACKET && 1212 1204 !rxrpc_validate_jumbo(skb)) 1213 1205 goto bad_message; 1206 + break; 1207 + 1208 + case RXRPC_PACKET_TYPE_CHALLENGE: 1209 + if (rxrpc_to_server(sp)) 1210 + goto discard; 1211 + break; 1212 + case RXRPC_PACKET_TYPE_RESPONSE: 1213 + if (rxrpc_to_client(sp)) 1214 + goto discard; 1214 1215 break; 1215 1216 1216 1217 /* Packet types 9-11 should just be ignored. */ ··· 1225 1212 case RXRPC_PACKET_TYPE_10: 1226 1213 case RXRPC_PACKET_TYPE_11: 1227 1214 goto discard; 1215 + 1216 + default: 1217 + _proto("Rx Bad Packet Type %u", sp->hdr.type); 1218 + goto bad_message; 1228 1219 } 1220 + 1221 + if (sp->hdr.serviceId == 0) 1222 + goto bad_message; 1229 1223 1230 1224 rcu_read_lock(); 1231 1225 1232 - conn = rxrpc_find_connection_rcu(local, skb); 1226 + if (rxrpc_to_server(sp)) { 1227 + /* Weed out packets to services we're not offering. Packets 1228 + * that would begin a call are explicitly rejected and the rest 1229 + * are just discarded. 1230 + */ 1231 + rx = rcu_dereference(local->service); 1232 + if (!rx || (sp->hdr.serviceId != rx->srx.srx_service && 1233 + sp->hdr.serviceId != rx->second_service)) { 1234 + if (sp->hdr.type == RXRPC_PACKET_TYPE_DATA && 1235 + sp->hdr.seq == 1) 1236 + goto unsupported_service; 1237 + goto discard_unlock; 1238 + } 1239 + } 1240 + 1241 + conn = rxrpc_find_connection_rcu(local, skb, &peer); 1233 1242 if (conn) { 1234 1243 if (sp->hdr.securityIndex != conn->security_ix) 1235 1244 goto wrong_security; ··· 1315 1280 call = rcu_dereference(chan->call); 1316 1281 1317 1282 if (sp->hdr.callNumber > chan->call_id) { 1318 - if (!(sp->hdr.flags & RXRPC_CLIENT_INITIATED)) { 1283 + if (rxrpc_to_client(sp)) { 1319 1284 rcu_read_unlock(); 1320 1285 goto reject_packet; 1321 1286 } ··· 1332 1297 if (!test_bit(RXRPC_CALL_RX_HEARD, &call->flags)) 1333 1298 set_bit(RXRPC_CALL_RX_HEARD, &call->flags); 1334 1299 } 1335 - } else { 1336 - skew = 0; 1337 - call = NULL; 1338 1300 } 1339 1301 1340 1302 if (!call || atomic_read(&call->usage) == 0) { 1341 - if (!(sp->hdr.type & RXRPC_CLIENT_INITIATED) || 1342 - sp->hdr.callNumber == 0 || 1303 + if (rxrpc_to_client(sp) || 1343 1304 sp->hdr.type != RXRPC_PACKET_TYPE_DATA) 1344 1305 goto bad_message_unlock; 1345 1306 if (sp->hdr.seq != 1) 1346 1307 goto discard_unlock; 1347 - call = rxrpc_new_incoming_call(local, conn, skb); 1308 + call = rxrpc_new_incoming_call(local, rx, peer, conn, skb); 1348 1309 if (!call) { 1349 1310 rcu_read_unlock(); 1350 1311 goto reject_packet; ··· 1371 1340 skb->priority = RXKADINCONSISTENCY; 1372 1341 goto post_abort; 1373 1342 1343 + unsupported_service: 1344 + rcu_read_unlock(); 1345 + trace_rxrpc_abort(0, "INV", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, 1346 + RX_INVALID_OPERATION, EOPNOTSUPP); 1347 + skb->priority = RX_INVALID_OPERATION; 1348 + goto post_abort; 1349 + 1374 1350 reupgrade: 1375 1351 rcu_read_unlock(); 1376 1352 trace_rxrpc_abort(0, "UPG", sp->hdr.cid, sp->hdr.callNumber, sp->hdr.seq, ··· 1392 1354 protocol_error: 1393 1355 skb->priority = RX_PROTOCOL_ERROR; 1394 1356 post_abort: 1395 - skb->mark = RXRPC_SKB_MARK_LOCAL_ABORT; 1357 + skb->mark = RXRPC_SKB_MARK_REJECT_ABORT; 1396 1358 reject_packet: 1397 1359 trace_rxrpc_rx_done(skb->mark, skb->priority); 1398 1360 rxrpc_reject_packet(local, skb);
+26 -14
net/rxrpc/local_object.c
··· 135 135 } 136 136 137 137 switch (local->srx.transport.family) { 138 + case AF_INET6: 139 + /* we want to receive ICMPv6 errors */ 140 + opt = 1; 141 + ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR, 142 + (char *) &opt, sizeof(opt)); 143 + if (ret < 0) { 144 + _debug("setsockopt failed"); 145 + goto error; 146 + } 147 + 148 + /* we want to set the don't fragment bit */ 149 + opt = IPV6_PMTUDISC_DO; 150 + ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER, 151 + (char *) &opt, sizeof(opt)); 152 + if (ret < 0) { 153 + _debug("setsockopt failed"); 154 + goto error; 155 + } 156 + 157 + /* Fall through and set IPv4 options too otherwise we don't get 158 + * errors from IPv4 packets sent through the IPv6 socket. 159 + */ 160 + 138 161 case AF_INET: 139 162 /* we want to receive ICMP errors */ 140 163 opt = 1; ··· 176 153 _debug("setsockopt failed"); 177 154 goto error; 178 155 } 179 - break; 180 156 181 - case AF_INET6: 182 - /* we want to receive ICMP errors */ 157 + /* We want receive timestamps. */ 183 158 opt = 1; 184 - ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_RECVERR, 185 - (char *) &opt, sizeof(opt)); 186 - if (ret < 0) { 187 - _debug("setsockopt failed"); 188 - goto error; 189 - } 190 - 191 - /* we want to set the don't fragment bit */ 192 - opt = IPV6_PMTUDISC_DO; 193 - ret = kernel_setsockopt(local->socket, SOL_IPV6, IPV6_MTU_DISCOVER, 194 - (char *) &opt, sizeof(opt)); 159 + ret = kernel_setsockopt(local->socket, SOL_SOCKET, SO_TIMESTAMPNS, 160 + (char *)&opt, sizeof(opt)); 195 161 if (ret < 0) { 196 162 _debug("setsockopt failed"); 197 163 goto error;
+36 -18
net/rxrpc/output.c
··· 124 124 struct kvec iov[2]; 125 125 rxrpc_serial_t serial; 126 126 rxrpc_seq_t hard_ack, top; 127 - ktime_t now; 128 127 size_t len, n; 129 128 int ret; 130 129 u8 reason; ··· 195 196 /* We need to stick a time in before we send the packet in case 196 197 * the reply gets back before kernel_sendmsg() completes - but 197 198 * asking UDP to send the packet can take a relatively long 198 - * time, so we update the time after, on the assumption that 199 - * the packet transmission is more likely to happen towards the 200 - * end of the kernel_sendmsg() call. 199 + * time. 201 200 */ 202 201 call->ping_time = ktime_get_real(); 203 202 set_bit(RXRPC_CALL_PINGING, &call->flags); ··· 203 206 } 204 207 205 208 ret = kernel_sendmsg(conn->params.local->socket, &msg, iov, 2, len); 206 - now = ktime_get_real(); 207 - if (ping) 208 - call->ping_time = now; 209 209 conn->params.peer->last_tx_at = ktime_get_seconds(); 210 210 if (ret < 0) 211 211 trace_rxrpc_tx_fail(call->debug_id, serial, ret, ··· 357 363 358 364 /* If our RTT cache needs working on, request an ACK. Also request 359 365 * ACKs if a DATA packet appears to have been lost. 366 + * 367 + * However, we mustn't request an ACK on the last reply packet of a 368 + * service call, lest OpenAFS incorrectly send us an ACK with some 369 + * soft-ACKs in it and then never follow up with a proper hard ACK. 360 370 */ 361 - if (!(sp->hdr.flags & RXRPC_LAST_PACKET) && 371 + if ((!(sp->hdr.flags & RXRPC_LAST_PACKET) || 372 + rxrpc_to_server(sp) 373 + ) && 362 374 (test_and_clear_bit(RXRPC_CALL_EV_ACK_LOST, &call->events) || 363 375 retrans || 364 376 call->cong_mode == RXRPC_CALL_SLOW_START || ··· 390 390 goto send_fragmentable; 391 391 392 392 down_read(&conn->params.local->defrag_sem); 393 + 394 + sp->hdr.serial = serial; 395 + smp_wmb(); /* Set serial before timestamp */ 396 + skb->tstamp = ktime_get_real(); 397 + 393 398 /* send the packet by UDP 394 399 * - returns -EMSGSIZE if UDP would have to fragment the packet 395 400 * to go out of the interface ··· 418 413 trace_rxrpc_tx_data(call, sp->hdr.seq, serial, whdr.flags, 419 414 retrans, lost); 420 415 if (ret >= 0) { 421 - ktime_t now = ktime_get_real(); 422 - skb->tstamp = now; 423 - smp_wmb(); 424 - sp->hdr.serial = serial; 425 416 if (whdr.flags & RXRPC_REQUEST_ACK) { 426 - call->peer->rtt_last_req = now; 417 + call->peer->rtt_last_req = skb->tstamp; 427 418 trace_rxrpc_rtt_tx(call, rxrpc_rtt_tx_data, serial); 428 419 if (call->peer->rtt_usage > 1) { 429 420 unsigned long nowj = jiffies, ack_lost_at; ··· 457 456 _debug("send fragment"); 458 457 459 458 down_write(&conn->params.local->defrag_sem); 459 + 460 + sp->hdr.serial = serial; 461 + smp_wmb(); /* Set serial before timestamp */ 462 + skb->tstamp = ktime_get_real(); 460 463 461 464 switch (conn->params.local->srx.transport.family) { 462 465 case AF_INET: ··· 524 519 struct kvec iov[2]; 525 520 size_t size; 526 521 __be32 code; 527 - int ret; 522 + int ret, ioc; 528 523 529 524 _enter("%d", local->debug_id); 530 525 ··· 532 527 iov[0].iov_len = sizeof(whdr); 533 528 iov[1].iov_base = &code; 534 529 iov[1].iov_len = sizeof(code); 535 - size = sizeof(whdr) + sizeof(code); 536 530 537 531 msg.msg_name = &srx.transport; 538 532 msg.msg_control = NULL; ··· 539 535 msg.msg_flags = 0; 540 536 541 537 memset(&whdr, 0, sizeof(whdr)); 542 - whdr.type = RXRPC_PACKET_TYPE_ABORT; 543 538 544 539 while ((skb = skb_dequeue(&local->reject_queue))) { 545 540 rxrpc_see_skb(skb, rxrpc_skb_rx_seen); 546 541 sp = rxrpc_skb(skb); 547 542 543 + switch (skb->mark) { 544 + case RXRPC_SKB_MARK_REJECT_BUSY: 545 + whdr.type = RXRPC_PACKET_TYPE_BUSY; 546 + size = sizeof(whdr); 547 + ioc = 1; 548 + break; 549 + case RXRPC_SKB_MARK_REJECT_ABORT: 550 + whdr.type = RXRPC_PACKET_TYPE_ABORT; 551 + code = htonl(skb->priority); 552 + size = sizeof(whdr) + sizeof(code); 553 + ioc = 2; 554 + break; 555 + default: 556 + rxrpc_free_skb(skb, rxrpc_skb_rx_freed); 557 + continue; 558 + } 559 + 548 560 if (rxrpc_extract_addr_from_skb(local, &srx, skb) == 0) { 549 561 msg.msg_namelen = srx.transport_len; 550 - 551 - code = htonl(skb->priority); 552 562 553 563 whdr.epoch = htonl(sp->hdr.epoch); 554 564 whdr.cid = htonl(sp->hdr.cid);
+11 -35
net/rxrpc/peer_event.c
··· 23 23 #include "ar-internal.h" 24 24 25 25 static void rxrpc_store_error(struct rxrpc_peer *, struct sock_exterr_skb *); 26 + static void rxrpc_distribute_error(struct rxrpc_peer *, int, 27 + enum rxrpc_call_completion); 26 28 27 29 /* 28 30 * Find the peer associated with an ICMP packet. ··· 196 194 rcu_read_unlock(); 197 195 rxrpc_free_skb(skb, rxrpc_skb_rx_freed); 198 196 199 - /* The ref we obtained is passed off to the work item */ 200 - __rxrpc_queue_peer_error(peer); 201 197 _leave(""); 202 198 } 203 199 ··· 205 205 static void rxrpc_store_error(struct rxrpc_peer *peer, 206 206 struct sock_exterr_skb *serr) 207 207 { 208 + enum rxrpc_call_completion compl = RXRPC_CALL_NETWORK_ERROR; 208 209 struct sock_extended_err *ee; 209 210 int err; 210 211 ··· 256 255 case SO_EE_ORIGIN_NONE: 257 256 case SO_EE_ORIGIN_LOCAL: 258 257 _proto("Rx Received local error { error=%d }", err); 259 - err += RXRPC_LOCAL_ERROR_OFFSET; 258 + compl = RXRPC_CALL_LOCAL_ERROR; 260 259 break; 261 260 262 261 case SO_EE_ORIGIN_ICMP6: ··· 265 264 break; 266 265 } 267 266 268 - peer->error_report = err; 267 + rxrpc_distribute_error(peer, err, compl); 269 268 } 270 269 271 270 /* 272 - * Distribute an error that occurred on a peer 271 + * Distribute an error that occurred on a peer. 273 272 */ 274 - void rxrpc_peer_error_distributor(struct work_struct *work) 273 + static void rxrpc_distribute_error(struct rxrpc_peer *peer, int error, 274 + enum rxrpc_call_completion compl) 275 275 { 276 - struct rxrpc_peer *peer = 277 - container_of(work, struct rxrpc_peer, error_distributor); 278 276 struct rxrpc_call *call; 279 - enum rxrpc_call_completion compl; 280 - int error; 281 277 282 - _enter(""); 283 - 284 - error = READ_ONCE(peer->error_report); 285 - if (error < RXRPC_LOCAL_ERROR_OFFSET) { 286 - compl = RXRPC_CALL_NETWORK_ERROR; 287 - } else { 288 - compl = RXRPC_CALL_LOCAL_ERROR; 289 - error -= RXRPC_LOCAL_ERROR_OFFSET; 290 - } 291 - 292 - _debug("ISSUE ERROR %s %d", rxrpc_call_completions[compl], error); 293 - 294 - spin_lock_bh(&peer->lock); 295 - 296 - while (!hlist_empty(&peer->error_targets)) { 297 - call = hlist_entry(peer->error_targets.first, 298 - struct rxrpc_call, error_link); 299 - hlist_del_init(&call->error_link); 278 + hlist_for_each_entry_rcu(call, &peer->error_targets, error_link) { 300 279 rxrpc_see_call(call); 301 - 302 - if (rxrpc_set_call_completion(call, compl, 0, -error)) 280 + if (call->state < RXRPC_CALL_COMPLETE && 281 + rxrpc_set_call_completion(call, compl, 0, -error)) 303 282 rxrpc_notify_socket(call); 304 283 } 305 - 306 - spin_unlock_bh(&peer->lock); 307 - 308 - rxrpc_put_peer(peer); 309 - _leave(""); 310 284 } 311 285 312 286 /*
+11 -41
net/rxrpc/peer_object.c
··· 124 124 struct rxrpc_net *rxnet = local->rxnet; 125 125 126 126 hash_for_each_possible_rcu(rxnet->peer_hash, peer, hash_link, hash_key) { 127 - if (rxrpc_peer_cmp_key(peer, local, srx, hash_key) == 0) { 128 - if (atomic_read(&peer->usage) == 0) 129 - return NULL; 127 + if (rxrpc_peer_cmp_key(peer, local, srx, hash_key) == 0 && 128 + atomic_read(&peer->usage) > 0) 130 129 return peer; 131 - } 132 130 } 133 131 134 132 return NULL; ··· 220 222 atomic_set(&peer->usage, 1); 221 223 peer->local = local; 222 224 INIT_HLIST_HEAD(&peer->error_targets); 223 - INIT_WORK(&peer->error_distributor, 224 - &rxrpc_peer_error_distributor); 225 225 peer->service_conns = RB_ROOT; 226 226 seqlock_init(&peer->service_conn_lock); 227 227 spin_lock_init(&peer->lock); ··· 295 299 } 296 300 297 301 /* 298 - * Set up a new incoming peer. The address is prestored in the preallocated 299 - * peer. 302 + * Set up a new incoming peer. There shouldn't be any other matching peers 303 + * since we've already done a search in the list from the non-reentrant context 304 + * (the data_ready handler) that is the only place we can add new peers. 300 305 */ 301 - struct rxrpc_peer *rxrpc_lookup_incoming_peer(struct rxrpc_local *local, 302 - struct rxrpc_peer *prealloc) 306 + void rxrpc_new_incoming_peer(struct rxrpc_local *local, struct rxrpc_peer *peer) 303 307 { 304 - struct rxrpc_peer *peer; 305 308 struct rxrpc_net *rxnet = local->rxnet; 306 309 unsigned long hash_key; 307 310 308 - hash_key = rxrpc_peer_hash_key(local, &prealloc->srx); 309 - prealloc->local = local; 310 - rxrpc_init_peer(prealloc, hash_key); 311 + hash_key = rxrpc_peer_hash_key(local, &peer->srx); 312 + peer->local = local; 313 + rxrpc_init_peer(peer, hash_key); 311 314 312 315 spin_lock(&rxnet->peer_hash_lock); 313 - 314 - /* Need to check that we aren't racing with someone else */ 315 - peer = __rxrpc_lookup_peer_rcu(local, &prealloc->srx, hash_key); 316 - if (peer && !rxrpc_get_peer_maybe(peer)) 317 - peer = NULL; 318 - if (!peer) { 319 - peer = prealloc; 320 - hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key); 321 - list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new); 322 - } 323 - 316 + hash_add_rcu(rxnet->peer_hash, &peer->hash_link, hash_key); 317 + list_add_tail(&peer->keepalive_link, &rxnet->peer_keepalive_new); 324 318 spin_unlock(&rxnet->peer_hash_lock); 325 - return peer; 326 319 } 327 320 328 321 /* ··· 398 413 peer = NULL; 399 414 } 400 415 return peer; 401 - } 402 - 403 - /* 404 - * Queue a peer record. This passes the caller's ref to the workqueue. 405 - */ 406 - void __rxrpc_queue_peer_error(struct rxrpc_peer *peer) 407 - { 408 - const void *here = __builtin_return_address(0); 409 - int n; 410 - 411 - n = atomic_read(&peer->usage); 412 - if (rxrpc_queue_work(&peer->error_distributor)) 413 - trace_rxrpc_peer(peer, rxrpc_peer_queued_error, n, here); 414 - else 415 - rxrpc_put_peer(peer); 416 416 } 417 417 418 418 /*
-15
net/rxrpc/protocol.h
··· 50 50 #define RXRPC_PACKET_TYPE_10 10 /* Ignored */ 51 51 #define RXRPC_PACKET_TYPE_11 11 /* Ignored */ 52 52 #define RXRPC_PACKET_TYPE_VERSION 13 /* version string request */ 53 - #define RXRPC_N_PACKET_TYPES 14 /* number of packet types (incl type 0) */ 54 53 55 54 uint8_t flags; /* packet flags */ 56 55 #define RXRPC_CLIENT_INITIATED 0x01 /* signifies a packet generated by a client */ ··· 70 71 __be16 serviceId; /* service ID */ 71 72 72 73 } __packed; 73 - 74 - #define RXRPC_SUPPORTED_PACKET_TYPES ( \ 75 - (1 << RXRPC_PACKET_TYPE_DATA) | \ 76 - (1 << RXRPC_PACKET_TYPE_ACK) | \ 77 - (1 << RXRPC_PACKET_TYPE_BUSY) | \ 78 - (1 << RXRPC_PACKET_TYPE_ABORT) | \ 79 - (1 << RXRPC_PACKET_TYPE_ACKALL) | \ 80 - (1 << RXRPC_PACKET_TYPE_CHALLENGE) | \ 81 - (1 << RXRPC_PACKET_TYPE_RESPONSE) | \ 82 - /*(1 << RXRPC_PACKET_TYPE_DEBUG) | */ \ 83 - (1 << RXRPC_PACKET_TYPE_PARAMS) | \ 84 - (1 << RXRPC_PACKET_TYPE_10) | \ 85 - (1 << RXRPC_PACKET_TYPE_11) | \ 86 - (1 << RXRPC_PACKET_TYPE_VERSION)) 87 74 88 75 /*****************************************************************************/ 89 76 /*
+1 -1
net/sched/act_ipt.c
··· 135 135 } 136 136 137 137 td = (struct xt_entry_target *)nla_data(tb[TCA_IPT_TARG]); 138 - if (nla_len(tb[TCA_IPT_TARG]) < td->u.target_size) { 138 + if (nla_len(tb[TCA_IPT_TARG]) != td->u.target_size) { 139 139 if (exists) 140 140 tcf_idr_release(*a, bind); 141 141 else
+20 -4
net/sched/sch_api.c
··· 1311 1311 * Delete/get qdisc. 1312 1312 */ 1313 1313 1314 + const struct nla_policy rtm_tca_policy[TCA_MAX + 1] = { 1315 + [TCA_KIND] = { .type = NLA_STRING }, 1316 + [TCA_OPTIONS] = { .type = NLA_NESTED }, 1317 + [TCA_RATE] = { .type = NLA_BINARY, 1318 + .len = sizeof(struct tc_estimator) }, 1319 + [TCA_STAB] = { .type = NLA_NESTED }, 1320 + [TCA_DUMP_INVISIBLE] = { .type = NLA_FLAG }, 1321 + [TCA_CHAIN] = { .type = NLA_U32 }, 1322 + [TCA_INGRESS_BLOCK] = { .type = NLA_U32 }, 1323 + [TCA_EGRESS_BLOCK] = { .type = NLA_U32 }, 1324 + }; 1325 + 1314 1326 static int tc_get_qdisc(struct sk_buff *skb, struct nlmsghdr *n, 1315 1327 struct netlink_ext_ack *extack) 1316 1328 { ··· 1339 1327 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) 1340 1328 return -EPERM; 1341 1329 1342 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); 1330 + err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, 1331 + extack); 1343 1332 if (err < 0) 1344 1333 return err; 1345 1334 ··· 1424 1411 1425 1412 replay: 1426 1413 /* Reinit, just in case something touches this. */ 1427 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); 1414 + err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, 1415 + extack); 1428 1416 if (err < 0) 1429 1417 return err; 1430 1418 ··· 1659 1645 idx = 0; 1660 1646 ASSERT_RTNL(); 1661 1647 1662 - err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, NULL, NULL); 1648 + err = nlmsg_parse(nlh, sizeof(struct tcmsg), tca, TCA_MAX, 1649 + rtm_tca_policy, NULL); 1663 1650 if (err < 0) 1664 1651 return err; 1665 1652 ··· 1879 1864 !netlink_ns_capable(skb, net->user_ns, CAP_NET_ADMIN)) 1880 1865 return -EPERM; 1881 1866 1882 - err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, NULL, extack); 1867 + err = nlmsg_parse(n, sizeof(*tcm), tca, TCA_MAX, rtm_tca_policy, 1868 + extack); 1883 1869 if (err < 0) 1884 1870 return err; 1885 1871
+1 -1
net/sctp/outqueue.c
··· 1048 1048 if (!ctx->packet || !ctx->packet->has_cookie_echo) 1049 1049 return; 1050 1050 1051 - /* fallthru */ 1051 + /* fall through */ 1052 1052 case SCTP_STATE_ESTABLISHED: 1053 1053 case SCTP_STATE_SHUTDOWN_PENDING: 1054 1054 case SCTP_STATE_SHUTDOWN_RECEIVED:
+7 -5
net/tipc/bearer.c
··· 609 609 610 610 switch (evt) { 611 611 case NETDEV_CHANGE: 612 - if (netif_carrier_ok(dev)) 612 + if (netif_carrier_ok(dev) && netif_oper_up(dev)) { 613 + test_and_set_bit_lock(0, &b->up); 613 614 break; 614 - /* else: fall through */ 615 - case NETDEV_UP: 616 - test_and_set_bit_lock(0, &b->up); 617 - break; 615 + } 616 + /* fall through */ 618 617 case NETDEV_GOING_DOWN: 619 618 clear_bit_unlock(0, &b->up); 620 619 tipc_reset_bearer(net, b); 620 + break; 621 + case NETDEV_UP: 622 + test_and_set_bit_lock(0, &b->up); 621 623 break; 622 624 case NETDEV_CHANGEMTU: 623 625 if (tipc_mtu_bad(dev, 0)) {
+44 -1
net/tipc/link.c
··· 410 410 return l->name; 411 411 } 412 412 413 + u32 tipc_link_state(struct tipc_link *l) 414 + { 415 + return l->state; 416 + } 417 + 413 418 /** 414 419 * tipc_link_create - create a new link 415 420 * @n: pointer to associated node ··· 846 841 l->in_session = false; 847 842 l->session++; 848 843 l->mtu = l->advertised_mtu; 844 + spin_lock_bh(&l->wakeupq.lock); 845 + spin_lock_bh(&l->inputq->lock); 846 + skb_queue_splice_init(&l->wakeupq, l->inputq); 847 + spin_unlock_bh(&l->inputq->lock); 848 + spin_unlock_bh(&l->wakeupq.lock); 849 + 849 850 __skb_queue_purge(&l->transmq); 850 851 __skb_queue_purge(&l->deferdq); 851 - skb_queue_splice_init(&l->wakeupq, l->inputq); 852 852 __skb_queue_purge(&l->backlogq); 853 853 l->backlog[TIPC_LOW_IMPORTANCE].len = 0; 854 854 l->backlog[TIPC_MEDIUM_IMPORTANCE].len = 0; ··· 1390 1380 __skb_queue_tail(xmitq, skb); 1391 1381 } 1392 1382 1383 + void tipc_link_create_dummy_tnl_msg(struct tipc_link *l, 1384 + struct sk_buff_head *xmitq) 1385 + { 1386 + u32 onode = tipc_own_addr(l->net); 1387 + struct tipc_msg *hdr, *ihdr; 1388 + struct sk_buff_head tnlq; 1389 + struct sk_buff *skb; 1390 + u32 dnode = l->addr; 1391 + 1392 + skb_queue_head_init(&tnlq); 1393 + skb = tipc_msg_create(TUNNEL_PROTOCOL, FAILOVER_MSG, 1394 + INT_H_SIZE, BASIC_H_SIZE, 1395 + dnode, onode, 0, 0, 0); 1396 + if (!skb) { 1397 + pr_warn("%sunable to create tunnel packet\n", link_co_err); 1398 + return; 1399 + } 1400 + 1401 + hdr = buf_msg(skb); 1402 + msg_set_msgcnt(hdr, 1); 1403 + msg_set_bearer_id(hdr, l->peer_bearer_id); 1404 + 1405 + ihdr = (struct tipc_msg *)msg_data(hdr); 1406 + tipc_msg_init(onode, ihdr, TIPC_LOW_IMPORTANCE, TIPC_DIRECT_MSG, 1407 + BASIC_H_SIZE, dnode); 1408 + msg_set_errcode(ihdr, TIPC_ERR_NO_PORT); 1409 + __skb_queue_tail(&tnlq, skb); 1410 + tipc_link_xmit(l, &tnlq, xmitq); 1411 + } 1412 + 1393 1413 /* tipc_link_tnl_prepare(): prepare and return a list of tunnel packets 1394 1414 * with contents of the link's transmit and backlog queues. 1395 1415 */ ··· 1515 1475 if (!l->in_session) 1516 1476 return false; 1517 1477 if (session != curr_session) 1478 + return false; 1479 + /* Extra sanity check */ 1480 + if (!link_is_up(l) && msg_ack(hdr)) 1518 1481 return false; 1519 1482 if (!(l->peer_caps & TIPC_LINK_PROTO_SEQNO)) 1520 1483 return true;
+3
net/tipc/link.h
··· 88 88 struct tipc_link **link); 89 89 void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl, 90 90 int mtyp, struct sk_buff_head *xmitq); 91 + void tipc_link_create_dummy_tnl_msg(struct tipc_link *tnl, 92 + struct sk_buff_head *xmitq); 91 93 void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq); 92 94 int tipc_link_fsm_evt(struct tipc_link *l, int evt); 93 95 bool tipc_link_is_up(struct tipc_link *l); ··· 109 107 u16 tipc_link_acked(struct tipc_link *l); 110 108 u32 tipc_link_id(struct tipc_link *l); 111 109 char *tipc_link_name(struct tipc_link *l); 110 + u32 tipc_link_state(struct tipc_link *l); 112 111 char tipc_link_plane(struct tipc_link *l); 113 112 int tipc_link_prio(struct tipc_link *l); 114 113 int tipc_link_window(struct tipc_link *l);
+13 -1
net/tipc/node.c
··· 111 111 int action_flags; 112 112 struct list_head list; 113 113 int state; 114 + bool failover_sent; 114 115 u16 sync_point; 115 116 int link_cnt; 116 117 u16 working_links; ··· 681 680 *slot0 = bearer_id; 682 681 *slot1 = bearer_id; 683 682 tipc_node_fsm_evt(n, SELF_ESTABL_CONTACT_EVT); 683 + n->failover_sent = false; 684 684 n->action_flags |= TIPC_NOTIFY_NODE_UP; 685 685 tipc_link_set_active(nl, true); 686 686 tipc_bcast_add_peer(n->net, nl, xmitq); ··· 913 911 bool reset = true; 914 912 char *if_name; 915 913 unsigned long intv; 914 + u16 session; 916 915 917 916 *dupl_addr = false; 918 917 *respond = false; ··· 1000 997 goto exit; 1001 998 1002 999 if_name = strchr(b->name, ':') + 1; 1000 + get_random_bytes(&session, sizeof(u16)); 1003 1001 if (!tipc_link_create(net, if_name, b->identity, b->tolerance, 1004 1002 b->net_plane, b->mtu, b->priority, 1005 - b->window, mod(tipc_net(net)->random), 1003 + b->window, session, 1006 1004 tipc_own_addr(net), addr, peer_id, 1007 1005 n->capabilities, 1008 1006 tipc_bc_sndlink(n->net), n->bc_entry.link, ··· 1618 1614 __tipc_node_link_down(n, &pb_id, xmitq, &maddr); 1619 1615 tipc_skb_queue_splice_tail_init(tipc_link_inputq(pl), 1620 1616 tipc_link_inputq(l)); 1617 + } 1618 + /* If parallel link was already down, and this happened before 1619 + * the tunnel link came up, FAILOVER was never sent. Ensure that 1620 + * FAILOVER is sent to get peer out of NODE_FAILINGOVER state. 1621 + */ 1622 + if (n->state != NODE_FAILINGOVER && !n->failover_sent) { 1623 + tipc_link_create_dummy_tnl_msg(l, xmitq); 1624 + n->failover_sent = true; 1621 1625 } 1622 1626 /* If pkts arrive out of order, use lowest calculated syncpt */ 1623 1627 if (less(syncpt, n->sync_point))
+3 -1
net/tipc/socket.c
··· 1419 1419 /* Handle implicit connection setup */ 1420 1420 if (unlikely(dest)) { 1421 1421 rc = __tipc_sendmsg(sock, m, dlen); 1422 - if (dlen && (dlen == rc)) 1422 + if (dlen && dlen == rc) { 1423 + tsk->peer_caps = tipc_node_get_capabilities(net, dnode); 1423 1424 tsk->snt_unacked = tsk_inc(tsk, dlen + msg_hdr_sz(hdr)); 1425 + } 1424 1426 return rc; 1425 1427 } 1426 1428
+15 -5
net/wireless/nl80211.c
··· 3756 3756 return false; 3757 3757 3758 3758 /* check availability */ 3759 + ridx = array_index_nospec(ridx, IEEE80211_HT_MCS_MASK_LEN); 3759 3760 if (sband->ht_cap.mcs.rx_mask[ridx] & rbit) 3760 3761 mcs[ridx] |= rbit; 3761 3762 else ··· 10231 10230 struct wireless_dev *wdev = dev->ieee80211_ptr; 10232 10231 s32 last, low, high; 10233 10232 u32 hyst; 10234 - int i, n; 10233 + int i, n, low_index; 10235 10234 int err; 10236 10235 10237 10236 /* RSSI reporting disabled? */ ··· 10268 10267 if (last < wdev->cqm_config->rssi_thresholds[i]) 10269 10268 break; 10270 10269 10271 - low = i > 0 ? 10272 - (wdev->cqm_config->rssi_thresholds[i - 1] - hyst) : S32_MIN; 10273 - high = i < n ? 10274 - (wdev->cqm_config->rssi_thresholds[i] + hyst - 1) : S32_MAX; 10270 + low_index = i - 1; 10271 + if (low_index >= 0) { 10272 + low_index = array_index_nospec(low_index, n); 10273 + low = wdev->cqm_config->rssi_thresholds[low_index] - hyst; 10274 + } else { 10275 + low = S32_MIN; 10276 + } 10277 + if (i < n) { 10278 + i = array_index_nospec(i, n); 10279 + high = wdev->cqm_config->rssi_thresholds[i] + hyst - 1; 10280 + } else { 10281 + high = S32_MAX; 10282 + } 10275 10283 10276 10284 return rdev_set_cqm_rssi_range_config(rdev, dev, low, high); 10277 10285 }
+5 -3
net/wireless/reg.c
··· 2661 2661 { 2662 2662 struct wiphy *wiphy = NULL; 2663 2663 enum reg_request_treatment treatment; 2664 + enum nl80211_reg_initiator initiator = reg_request->initiator; 2664 2665 2665 2666 if (reg_request->wiphy_idx != WIPHY_IDX_INVALID) 2666 2667 wiphy = wiphy_idx_to_wiphy(reg_request->wiphy_idx); 2667 2668 2668 - switch (reg_request->initiator) { 2669 + switch (initiator) { 2669 2670 case NL80211_REGDOM_SET_BY_CORE: 2670 2671 treatment = reg_process_hint_core(reg_request); 2671 2672 break; ··· 2684 2683 treatment = reg_process_hint_country_ie(wiphy, reg_request); 2685 2684 break; 2686 2685 default: 2687 - WARN(1, "invalid initiator %d\n", reg_request->initiator); 2686 + WARN(1, "invalid initiator %d\n", initiator); 2688 2687 goto out_free; 2689 2688 } 2690 2689 ··· 2699 2698 */ 2700 2699 if (treatment == REG_REQ_ALREADY_SET && wiphy && 2701 2700 wiphy->regulatory_flags & REGULATORY_STRICT_REG) { 2702 - wiphy_update_regulatory(wiphy, reg_request->initiator); 2701 + wiphy_update_regulatory(wiphy, initiator); 2703 2702 wiphy_all_share_dfs_chan_state(wiphy); 2704 2703 reg_check_channels(); 2705 2704 } ··· 2868 2867 request->alpha2[0] = alpha2[0]; 2869 2868 request->alpha2[1] = alpha2[1]; 2870 2869 request->initiator = NL80211_REGDOM_SET_BY_CORE; 2870 + request->wiphy_idx = WIPHY_IDX_INVALID; 2871 2871 2872 2872 queue_regulatory_request(request); 2873 2873
+49 -9
net/wireless/scan.c
··· 1058 1058 return NULL; 1059 1059 } 1060 1060 1061 + /* 1062 + * Update RX channel information based on the available frame payload 1063 + * information. This is mainly for the 2.4 GHz band where frames can be received 1064 + * from neighboring channels and the Beacon frames use the DSSS Parameter Set 1065 + * element to indicate the current (transmitting) channel, but this might also 1066 + * be needed on other bands if RX frequency does not match with the actual 1067 + * operating channel of a BSS. 1068 + */ 1061 1069 static struct ieee80211_channel * 1062 1070 cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen, 1063 - struct ieee80211_channel *channel) 1071 + struct ieee80211_channel *channel, 1072 + enum nl80211_bss_scan_width scan_width) 1064 1073 { 1065 1074 const u8 *tmp; 1066 1075 u32 freq; 1067 1076 int channel_number = -1; 1077 + struct ieee80211_channel *alt_channel; 1068 1078 1069 1079 tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen); 1070 1080 if (tmp && tmp[1] == 1) { ··· 1088 1078 } 1089 1079 } 1090 1080 1091 - if (channel_number < 0) 1081 + if (channel_number < 0) { 1082 + /* No channel information in frame payload */ 1092 1083 return channel; 1084 + } 1093 1085 1094 1086 freq = ieee80211_channel_to_frequency(channel_number, channel->band); 1095 - channel = ieee80211_get_channel(wiphy, freq); 1096 - if (!channel) 1087 + alt_channel = ieee80211_get_channel(wiphy, freq); 1088 + if (!alt_channel) { 1089 + if (channel->band == NL80211_BAND_2GHZ) { 1090 + /* 1091 + * Better not allow unexpected channels when that could 1092 + * be going beyond the 1-11 range (e.g., discovering 1093 + * BSS on channel 12 when radio is configured for 1094 + * channel 11. 1095 + */ 1096 + return NULL; 1097 + } 1098 + 1099 + /* No match for the payload channel number - ignore it */ 1100 + return channel; 1101 + } 1102 + 1103 + if (scan_width == NL80211_BSS_CHAN_WIDTH_10 || 1104 + scan_width == NL80211_BSS_CHAN_WIDTH_5) { 1105 + /* 1106 + * Ignore channel number in 5 and 10 MHz channels where there 1107 + * may not be an n:1 or 1:n mapping between frequencies and 1108 + * channel numbers. 1109 + */ 1110 + return channel; 1111 + } 1112 + 1113 + /* 1114 + * Use the channel determined through the payload channel number 1115 + * instead of the RX channel reported by the driver. 1116 + */ 1117 + if (alt_channel->flags & IEEE80211_CHAN_DISABLED) 1097 1118 return NULL; 1098 - if (channel->flags & IEEE80211_CHAN_DISABLED) 1099 - return NULL; 1100 - return channel; 1119 + return alt_channel; 1101 1120 } 1102 1121 1103 1122 /* Returned bss is reference counted and must be cleaned up appropriately. */ ··· 1151 1112 (data->signal < 0 || data->signal > 100))) 1152 1113 return NULL; 1153 1114 1154 - channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan); 1115 + channel = cfg80211_get_bss_channel(wiphy, ie, ielen, data->chan, 1116 + data->scan_width); 1155 1117 if (!channel) 1156 1118 return NULL; 1157 1119 ··· 1250 1210 return NULL; 1251 1211 1252 1212 channel = cfg80211_get_bss_channel(wiphy, mgmt->u.beacon.variable, 1253 - ielen, data->chan); 1213 + ielen, data->chan, data->scan_width); 1254 1214 if (!channel) 1255 1215 return NULL; 1256 1216
+10 -4
net/wireless/wext-compat.c
··· 1278 1278 if (err) 1279 1279 return err; 1280 1280 1281 - if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) 1282 - return -EOPNOTSUPP; 1281 + if (!(sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_BITRATE))) { 1282 + err = -EOPNOTSUPP; 1283 + goto free; 1284 + } 1283 1285 1284 1286 rate->value = 100000 * cfg80211_calculate_bitrate(&sinfo.txrate); 1285 1287 1286 - return 0; 1288 + free: 1289 + cfg80211_sinfo_release_content(&sinfo); 1290 + return err; 1287 1291 } 1288 1292 1289 1293 /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ ··· 1297 1293 struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy); 1298 1294 /* we are under RTNL - globally locked - so can use static structs */ 1299 1295 static struct iw_statistics wstats; 1300 - static struct station_info sinfo; 1296 + static struct station_info sinfo = {}; 1301 1297 u8 bssid[ETH_ALEN]; 1302 1298 1303 1299 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) ··· 1355 1351 wstats.discard.misc = sinfo.rx_dropped_misc; 1356 1352 if (sinfo.filled & BIT_ULL(NL80211_STA_INFO_TX_FAILED)) 1357 1353 wstats.discard.retries = sinfo.tx_failed; 1354 + 1355 + cfg80211_sinfo_release_content(&sinfo); 1358 1356 1359 1357 return &wstats; 1360 1358 }
+1
net/xfrm/xfrm_input.c
··· 458 458 XFRM_INC_STATS(net, LINUX_MIB_XFRMINHDRERROR); 459 459 goto drop; 460 460 } 461 + crypto_done = false; 461 462 } while (!err); 462 463 463 464 err = xfrm_rcv_cb(skb, family, x->type->proto, 0);
+4
net/xfrm/xfrm_output.c
··· 100 100 spin_unlock_bh(&x->lock); 101 101 102 102 skb_dst_force(skb); 103 + if (!skb_dst(skb)) { 104 + XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR); 105 + goto error_nolock; 106 + } 103 107 104 108 if (xfrm_offload(skb)) { 105 109 x->type_offload->encap(x, skb);
+4
net/xfrm/xfrm_policy.c
··· 2491 2491 } 2492 2492 2493 2493 skb_dst_force(skb); 2494 + if (!skb_dst(skb)) { 2495 + XFRM_INC_STATS(net, LINUX_MIB_XFRMFWDHDRERROR); 2496 + return 0; 2497 + } 2494 2498 2495 2499 dst = xfrm_lookup(net, skb_dst(skb), &fl, NULL, XFRM_LOOKUP_QUEUE); 2496 2500 if (IS_ERR(dst)) {
+15
net/xfrm/xfrm_user.c
··· 151 151 err = -EINVAL; 152 152 switch (p->family) { 153 153 case AF_INET: 154 + if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32) 155 + goto out; 156 + 154 157 break; 155 158 156 159 case AF_INET6: 157 160 #if IS_ENABLED(CONFIG_IPV6) 161 + if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128) 162 + goto out; 163 + 158 164 break; 159 165 #else 160 166 err = -EAFNOSUPPORT; ··· 1402 1396 1403 1397 switch (p->sel.family) { 1404 1398 case AF_INET: 1399 + if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32) 1400 + return -EINVAL; 1401 + 1405 1402 break; 1406 1403 1407 1404 case AF_INET6: 1408 1405 #if IS_ENABLED(CONFIG_IPV6) 1406 + if (p->sel.prefixlen_d > 128 || p->sel.prefixlen_s > 128) 1407 + return -EINVAL; 1408 + 1409 1409 break; 1410 1410 #else 1411 1411 return -EAFNOSUPPORT; ··· 1490 1478 1491 1479 if ((ut[i].mode == XFRM_MODE_TRANSPORT) && 1492 1480 (ut[i].family != prev_family)) 1481 + return -EINVAL; 1482 + 1483 + if (ut[i].mode >= XFRM_MODE_MAX) 1493 1484 return -EINVAL; 1494 1485 1495 1486 prev_family = ut[i].family;
+3 -1
sound/hda/hdac_i915.c
··· 145 145 if (!acomp->ops) { 146 146 request_module("i915"); 147 147 /* 10s timeout */ 148 - wait_for_completion_timeout(&bind_complete, 10 * 1000); 148 + wait_for_completion_timeout(&bind_complete, 149 + msecs_to_jiffies(10 * 1000)); 149 150 } 150 151 if (!acomp->ops) { 152 + dev_info(bus->dev, "couldn't bind with audio component\n"); 151 153 snd_hdac_acomp_exit(bus); 152 154 return -ENODEV; 153 155 }
+1
sound/pci/hda/patch_realtek.c
··· 6409 6409 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER), 6410 6410 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE), 6411 6411 SND_PCI_QUIRK(0x1028, 0x075b, "Dell XPS 13 9360", ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE), 6412 + SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME), 6412 6413 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME), 6413 6414 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3), 6414 6415 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
+1
tools/hv/hv_fcopy_daemon.c
··· 234 234 break; 235 235 236 236 default: 237 + error = HV_E_FAIL; 237 238 syslog(LOG_ERR, "Unknown operation: %d", 238 239 buffer.hdr.operation); 239 240
+1 -1
tools/kvm/kvm_stat/kvm_stat
··· 1325 1325 msg = '' 1326 1326 while True: 1327 1327 self.screen.erase() 1328 - self.screen.addstr(0, 0, 'Set update interval (defaults to %fs).' % 1328 + self.screen.addstr(0, 0, 'Set update interval (defaults to %.1fs).' % 1329 1329 DELAY_DEFAULT, curses.A_BOLD) 1330 1330 self.screen.addstr(4, 0, msg) 1331 1331 self.screen.addstr(2, 0, 'Change delay from %.1fs to ' %
+10 -9
tools/testing/selftests/rseq/param_test.c
··· 56 56 printf(fmt, ## __VA_ARGS__); \ 57 57 } while (0) 58 58 59 - #if defined(__x86_64__) || defined(__i386__) 59 + #ifdef __i386__ 60 60 61 61 #define INJECT_ASM_REG "eax" 62 62 63 63 #define RSEQ_INJECT_CLOBBER \ 64 64 , INJECT_ASM_REG 65 - 66 - #ifdef __i386__ 67 65 68 66 #define RSEQ_INJECT_ASM(n) \ 69 67 "mov asm_loop_cnt_" #n ", %%" INJECT_ASM_REG "\n\t" \ ··· 74 76 75 77 #elif defined(__x86_64__) 76 78 79 + #define INJECT_ASM_REG_P "rax" 80 + #define INJECT_ASM_REG "eax" 81 + 82 + #define RSEQ_INJECT_CLOBBER \ 83 + , INJECT_ASM_REG_P \ 84 + , INJECT_ASM_REG 85 + 77 86 #define RSEQ_INJECT_ASM(n) \ 78 - "lea asm_loop_cnt_" #n "(%%rip), %%" INJECT_ASM_REG "\n\t" \ 79 - "mov (%%" INJECT_ASM_REG "), %%" INJECT_ASM_REG "\n\t" \ 87 + "lea asm_loop_cnt_" #n "(%%rip), %%" INJECT_ASM_REG_P "\n\t" \ 88 + "mov (%%" INJECT_ASM_REG_P "), %%" INJECT_ASM_REG "\n\t" \ 80 89 "test %%" INJECT_ASM_REG ",%%" INJECT_ASM_REG "\n\t" \ 81 90 "jz 333f\n\t" \ 82 91 "222:\n\t" \ 83 92 "dec %%" INJECT_ASM_REG "\n\t" \ 84 93 "jnz 222b\n\t" \ 85 94 "333:\n\t" 86 - 87 - #else 88 - #error "Unsupported architecture" 89 - #endif 90 95 91 96 #elif defined(__s390__) 92 97
+172
tools/testing/selftests/x86/test_vdso.c
··· 17 17 #include <errno.h> 18 18 #include <sched.h> 19 19 #include <stdbool.h> 20 + #include <limits.h> 20 21 21 22 #ifndef SYS_getcpu 22 23 # ifdef __x86_64__ ··· 31 30 #define MAPS_LINE_LEN 128 32 31 33 32 int nerrs = 0; 33 + 34 + typedef int (*vgettime_t)(clockid_t, struct timespec *); 35 + 36 + vgettime_t vdso_clock_gettime; 37 + 38 + typedef long (*vgtod_t)(struct timeval *tv, struct timezone *tz); 39 + 40 + vgtod_t vdso_gettimeofday; 34 41 35 42 typedef long (*getcpu_t)(unsigned *, unsigned *, void *); 36 43 ··· 104 95 printf("Warning: failed to find getcpu in vDSO\n"); 105 96 106 97 vgetcpu = (getcpu_t) vsyscall_getcpu(); 98 + 99 + vdso_clock_gettime = (vgettime_t)dlsym(vdso, "__vdso_clock_gettime"); 100 + if (!vdso_clock_gettime) 101 + printf("Warning: failed to find clock_gettime in vDSO\n"); 102 + 103 + vdso_gettimeofday = (vgtod_t)dlsym(vdso, "__vdso_gettimeofday"); 104 + if (!vdso_gettimeofday) 105 + printf("Warning: failed to find gettimeofday in vDSO\n"); 106 + 107 107 } 108 108 109 109 static long sys_getcpu(unsigned * cpu, unsigned * node, 110 110 void* cache) 111 111 { 112 112 return syscall(__NR_getcpu, cpu, node, cache); 113 + } 114 + 115 + static inline int sys_clock_gettime(clockid_t id, struct timespec *ts) 116 + { 117 + return syscall(__NR_clock_gettime, id, ts); 118 + } 119 + 120 + static inline int sys_gettimeofday(struct timeval *tv, struct timezone *tz) 121 + { 122 + return syscall(__NR_gettimeofday, tv, tz); 113 123 } 114 124 115 125 static void test_getcpu(void) ··· 183 155 } 184 156 } 185 157 158 + static bool ts_leq(const struct timespec *a, const struct timespec *b) 159 + { 160 + if (a->tv_sec != b->tv_sec) 161 + return a->tv_sec < b->tv_sec; 162 + else 163 + return a->tv_nsec <= b->tv_nsec; 164 + } 165 + 166 + static bool tv_leq(const struct timeval *a, const struct timeval *b) 167 + { 168 + if (a->tv_sec != b->tv_sec) 169 + return a->tv_sec < b->tv_sec; 170 + else 171 + return a->tv_usec <= b->tv_usec; 172 + } 173 + 174 + static char const * const clocknames[] = { 175 + [0] = "CLOCK_REALTIME", 176 + [1] = "CLOCK_MONOTONIC", 177 + [2] = "CLOCK_PROCESS_CPUTIME_ID", 178 + [3] = "CLOCK_THREAD_CPUTIME_ID", 179 + [4] = "CLOCK_MONOTONIC_RAW", 180 + [5] = "CLOCK_REALTIME_COARSE", 181 + [6] = "CLOCK_MONOTONIC_COARSE", 182 + [7] = "CLOCK_BOOTTIME", 183 + [8] = "CLOCK_REALTIME_ALARM", 184 + [9] = "CLOCK_BOOTTIME_ALARM", 185 + [10] = "CLOCK_SGI_CYCLE", 186 + [11] = "CLOCK_TAI", 187 + }; 188 + 189 + static void test_one_clock_gettime(int clock, const char *name) 190 + { 191 + struct timespec start, vdso, end; 192 + int vdso_ret, end_ret; 193 + 194 + printf("[RUN]\tTesting clock_gettime for clock %s (%d)...\n", name, clock); 195 + 196 + if (sys_clock_gettime(clock, &start) < 0) { 197 + if (errno == EINVAL) { 198 + vdso_ret = vdso_clock_gettime(clock, &vdso); 199 + if (vdso_ret == -EINVAL) { 200 + printf("[OK]\tNo such clock.\n"); 201 + } else { 202 + printf("[FAIL]\tNo such clock, but __vdso_clock_gettime returned %d\n", vdso_ret); 203 + nerrs++; 204 + } 205 + } else { 206 + printf("[WARN]\t clock_gettime(%d) syscall returned error %d\n", clock, errno); 207 + } 208 + return; 209 + } 210 + 211 + vdso_ret = vdso_clock_gettime(clock, &vdso); 212 + end_ret = sys_clock_gettime(clock, &end); 213 + 214 + if (vdso_ret != 0 || end_ret != 0) { 215 + printf("[FAIL]\tvDSO returned %d, syscall errno=%d\n", 216 + vdso_ret, errno); 217 + nerrs++; 218 + return; 219 + } 220 + 221 + printf("\t%llu.%09ld %llu.%09ld %llu.%09ld\n", 222 + (unsigned long long)start.tv_sec, start.tv_nsec, 223 + (unsigned long long)vdso.tv_sec, vdso.tv_nsec, 224 + (unsigned long long)end.tv_sec, end.tv_nsec); 225 + 226 + if (!ts_leq(&start, &vdso) || !ts_leq(&vdso, &end)) { 227 + printf("[FAIL]\tTimes are out of sequence\n"); 228 + nerrs++; 229 + } 230 + } 231 + 232 + static void test_clock_gettime(void) 233 + { 234 + for (int clock = 0; clock < sizeof(clocknames) / sizeof(clocknames[0]); 235 + clock++) { 236 + test_one_clock_gettime(clock, clocknames[clock]); 237 + } 238 + 239 + /* Also test some invalid clock ids */ 240 + test_one_clock_gettime(-1, "invalid"); 241 + test_one_clock_gettime(INT_MIN, "invalid"); 242 + test_one_clock_gettime(INT_MAX, "invalid"); 243 + } 244 + 245 + static void test_gettimeofday(void) 246 + { 247 + struct timeval start, vdso, end; 248 + struct timezone sys_tz, vdso_tz; 249 + int vdso_ret, end_ret; 250 + 251 + if (!vdso_gettimeofday) 252 + return; 253 + 254 + printf("[RUN]\tTesting gettimeofday...\n"); 255 + 256 + if (sys_gettimeofday(&start, &sys_tz) < 0) { 257 + printf("[FAIL]\tsys_gettimeofday failed (%d)\n", errno); 258 + nerrs++; 259 + return; 260 + } 261 + 262 + vdso_ret = vdso_gettimeofday(&vdso, &vdso_tz); 263 + end_ret = sys_gettimeofday(&end, NULL); 264 + 265 + if (vdso_ret != 0 || end_ret != 0) { 266 + printf("[FAIL]\tvDSO returned %d, syscall errno=%d\n", 267 + vdso_ret, errno); 268 + nerrs++; 269 + return; 270 + } 271 + 272 + printf("\t%llu.%06ld %llu.%06ld %llu.%06ld\n", 273 + (unsigned long long)start.tv_sec, start.tv_usec, 274 + (unsigned long long)vdso.tv_sec, vdso.tv_usec, 275 + (unsigned long long)end.tv_sec, end.tv_usec); 276 + 277 + if (!tv_leq(&start, &vdso) || !tv_leq(&vdso, &end)) { 278 + printf("[FAIL]\tTimes are out of sequence\n"); 279 + nerrs++; 280 + } 281 + 282 + if (sys_tz.tz_minuteswest == vdso_tz.tz_minuteswest && 283 + sys_tz.tz_dsttime == vdso_tz.tz_dsttime) { 284 + printf("[OK]\ttimezones match: minuteswest=%d, dsttime=%d\n", 285 + sys_tz.tz_minuteswest, sys_tz.tz_dsttime); 286 + } else { 287 + printf("[FAIL]\ttimezones do not match\n"); 288 + nerrs++; 289 + } 290 + 291 + /* And make sure that passing NULL for tz doesn't crash. */ 292 + vdso_gettimeofday(&vdso, NULL); 293 + } 294 + 186 295 int main(int argc, char **argv) 187 296 { 188 297 fill_function_pointers(); 189 298 299 + test_clock_gettime(); 300 + test_gettimeofday(); 301 + 302 + /* 303 + * Test getcpu() last so that, if something goes wrong setting affinity, 304 + * we still run the other tests. 305 + */ 190 306 test_getcpu(); 191 307 192 308 return nerrs ? 1 : 0;