The new route handling in ip_mc_finish_output() from 'net' overlapped with the new support for returning congestion notifications from BPF programs. In order to handle this I had to take the dev_loopback_xmit() calls out of the switch statement. The aquantia driver conflicts were simple overlapping changes.
Unified · Split
| @@ -3131,6 +3131,7 @@ F: arch/arm/mach-bcm/ · 3130 unmodified lines | ||
| 3131 | 3131 | BROADCOM BCM2835 ARM ARCHITECTURE |
| 3132 | 3132 | M: Eric Anholt <eric@anholt.net> |
| 3133 | 3133 | M: Stefan Wahren <wahrenst@gmx.net> |
| 3134 | +L: bcm-kernel-feedback-list@broadcom.com | |
| 3134 | 3135 | L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers) |
| 3135 | 3136 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) |
| 3136 | 3137 | T: git git://github.com/anholt/linux |
| @@ -3160,6 +3161,7 @@ F: arch/arm/boot/dts/bcm953012* · 23 unmodified lines | ||
| 3160 | 3161 | |
| 3161 | 3162 | BROADCOM BCM53573 ARM ARCHITECTURE |
| 3162 | 3163 | M: Rafał Miłecki <rafal@milecki.pl> |
| 3164 | +L: bcm-kernel-feedback-list@broadcom.com | |
| 3163 | 3165 | L: linux-arm-kernel@lists.infradead.org |
| 3164 | 3166 | S: Maintained |
| 3165 | 3167 | F: arch/arm/boot/dts/bcm53573* |
| @@ -2,7 +2,7 @@ · 1 unmodified line | ||
| 2 | 2 | VERSION = 5 |
| 3 | 3 | PATCHLEVEL = 2 |
| 4 | 4 | SUBLEVEL = 0 |
| 5 | −EXTRAVERSION = -rc5 | |
| 5 | +EXTRAVERSION = -rc6 | |
| 6 | 6 | NAME = Golden Lions |
| 7 | 7 | |
| 8 | 8 | # *DOCUMENTATION* |
| @@ -20,7 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | }; |
| 21 | 21 | |
| 22 | 22 | chosen { |
| 23 | − bootargs = "console=ttyS0,19200n8 root=/dev/sda1 rw rootwait"; | |
| 23 | + bootargs = "console=ttyS0,19200n8 root=/dev/sda1 rw rootwait consoleblank=300"; | |
| 24 | 24 | stdout-path = "uart0:19200n8"; |
| 25 | 25 | }; |
| 26 | 26 | |
| @@ -11,7 +11,7 @@ · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | / { |
| 13 | 13 | model = "D-Link DNS-313 1-Bay Network Storage Enclosure"; |
| 14 | − compatible = "dlink,dir-313", "cortina,gemini"; | |
| 14 | + compatible = "dlink,dns-313", "cortina,gemini"; | |
| 15 | 15 | #address-cells = <1>; |
| 16 | 16 | #size-cells = <1>; |
| 17 | 17 | |
| @@ -358,7 +358,7 @@ · 357 unmodified lines | ||
| 358 | 358 | pwm1: pwm@2080000 { |
| 359 | 359 | compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm"; |
| 360 | 360 | reg = <0x02080000 0x4000>; |
| 361 | − interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>; | |
| 361 | + interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>; | |
| 362 | 362 | clocks = <&clks IMX6UL_CLK_PWM1>, |
| 363 | 363 | <&clks IMX6UL_CLK_PWM1>; |
| 364 | 364 | clock-names = "ipg", "per"; |
| @@ -369,7 +369,7 @@ · 4 unmodified lines | ||
| 369 | 369 | pwm2: pwm@2084000 { |
| 370 | 370 | compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm"; |
| 371 | 371 | reg = <0x02084000 0x4000>; |
| 372 | − interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>; | |
| 372 | + interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>; | |
| 373 | 373 | clocks = <&clks IMX6UL_CLK_PWM2>, |
| 374 | 374 | <&clks IMX6UL_CLK_PWM2>; |
| 375 | 375 | clock-names = "ipg", "per"; |
| @@ -380,7 +380,7 @@ · 4 unmodified lines | ||
| 380 | 380 | pwm3: pwm@2088000 { |
| 381 | 381 | compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm"; |
| 382 | 382 | reg = <0x02088000 0x4000>; |
| 383 | − interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>; | |
| 383 | + interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>; | |
| 384 | 384 | clocks = <&clks IMX6UL_CLK_PWM3>, |
| 385 | 385 | <&clks IMX6UL_CLK_PWM3>; |
| 386 | 386 | clock-names = "ipg", "per"; |
| @@ -391,7 +391,7 @@ · 4 unmodified lines | ||
| 391 | 391 | pwm4: pwm@208c000 { |
| 392 | 392 | compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm"; |
| 393 | 393 | reg = <0x0208c000 0x4000>; |
| 394 | − interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>; | |
| 394 | + interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>; | |
| 395 | 395 | clocks = <&clks IMX6UL_CLK_PWM4>, |
| 396 | 396 | <&clks IMX6UL_CLK_PWM4>; |
| 397 | 397 | clock-names = "ipg", "per"; |
| @@ -248,8 +248,8 @@ · 247 unmodified lines | ||
| 248 | 248 | <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>, |
| 249 | 249 | <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>, |
| 250 | 250 | <GIC_SPI 169 IRQ_TYPE_LEVEL_HIGH>, |
| 251 | − <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>, | |
| 252 | − <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>, | |
| 251 | + <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH>, | |
| 252 | + <GIC_SPI 171 IRQ_TYPE_LEVEL_HIGH>, | |
| 253 | 253 | <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>, |
| 254 | 254 | <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>, |
| 255 | 255 | <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>, |
| @@ -264,7 +264,6 @@ · 8 unmodified lines | ||
| 264 | 264 | clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>; |
| 265 | 265 | clock-names = "bus", "core"; |
| 266 | 266 | operating-points-v2 = <&gpu_opp_table>; |
| 267 | − switch-delay = <0xffff>; | |
| 268 | 267 | }; |
| 269 | 268 | }; |
| 270 | 269 | }; /* end of / */ |
| @@ -163,23 +163,23 @@ · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | opp-255000000 { |
| 165 | 165 | opp-hz = /bits/ 64 <255000000>; |
| 166 | − opp-microvolt = <1150000>; | |
| 166 | + opp-microvolt = <1100000>; | |
| 167 | 167 | }; |
| 168 | 168 | opp-364300000 { |
| 169 | 169 | opp-hz = /bits/ 64 <364300000>; |
| 170 | − opp-microvolt = <1150000>; | |
| 170 | + opp-microvolt = <1100000>; | |
| 171 | 171 | }; |
| 172 | 172 | opp-425000000 { |
| 173 | 173 | opp-hz = /bits/ 64 <425000000>; |
| 174 | − opp-microvolt = <1150000>; | |
| 174 | + opp-microvolt = <1100000>; | |
| 175 | 175 | }; |
| 176 | 176 | opp-510000000 { |
| 177 | 177 | opp-hz = /bits/ 64 <510000000>; |
| 178 | − opp-microvolt = <1150000>; | |
| 178 | + opp-microvolt = <1100000>; | |
| 179 | 179 | }; |
| 180 | 180 | opp-637500000 { |
| 181 | 181 | opp-hz = /bits/ 64 <637500000>; |
| 182 | − opp-microvolt = <1150000>; | |
| 182 | + opp-microvolt = <1100000>; | |
| 183 | 183 | turbo-mode; |
| 184 | 184 | }; |
| 185 | 185 | }; |
| @@ -229,7 +229,6 @@ · 43 unmodified lines | ||
| 229 | 229 | clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>; |
| 230 | 230 | clock-names = "bus", "core"; |
| 231 | 231 | operating-points-v2 = <&gpu_opp_table>; |
| 232 | − switch-delay = <0xffff>; | |
| 233 | 232 | }; |
| 234 | 233 | }; |
| 235 | 234 | }; /* end of / */ |
| @@ -430,7 +430,7 @@ static void omap3_prm_reconfigure_io_chain(void) · 429 unmodified lines | ||
| 430 | 430 | * registers, and omap3xxx_prm_reconfigure_io_chain() must be called. |
| 431 | 431 | * No return value. |
| 432 | 432 | */ |
| 433 | −static void __init omap3xxx_prm_enable_io_wakeup(void) | |
| 433 | +static void omap3xxx_prm_enable_io_wakeup(void) | |
| 434 | 434 | { |
| 435 | 435 | if (prm_features & PRM_HAS_IO_WAKEUP) |
| 436 | 436 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, |
| @@ -28,7 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | enable-method = "psci"; |
| 29 | 29 | clocks = <&clockgen 1 0>; |
| 30 | 30 | next-level-cache = <&l2>; |
| 31 | − cpu-idle-states = <&CPU_PH20>; | |
| 31 | + cpu-idle-states = <&CPU_PW20>; | |
| 32 | 32 | }; |
| 33 | 33 | |
| 34 | 34 | cpu1: cpu@1 { |
| @@ -38,7 +38,7 @@ · 3 unmodified lines | ||
| 38 | 38 | enable-method = "psci"; |
| 39 | 39 | clocks = <&clockgen 1 0>; |
| 40 | 40 | next-level-cache = <&l2>; |
| 41 | − cpu-idle-states = <&CPU_PH20>; | |
| 41 | + cpu-idle-states = <&CPU_PW20>; | |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 | l2: l2-cache { |
| @@ -53,13 +53,13 @@ · 8 unmodified lines | ||
| 53 | 53 | */ |
| 54 | 54 | entry-method = "arm,psci"; |
| 55 | 55 | |
| 56 | − CPU_PH20: cpu-ph20 { | |
| 57 | − compatible = "arm,idle-state"; | |
| 58 | − idle-state-name = "PH20"; | |
| 59 | − arm,psci-suspend-param = <0x00010000>; | |
| 60 | − entry-latency-us = <1000>; | |
| 61 | − exit-latency-us = <1000>; | |
| 62 | − min-residency-us = <3000>; | |
| 56 | + CPU_PW20: cpu-pw20 { | |
| 57 | + compatible = "arm,idle-state"; | |
| 58 | + idle-state-name = "PW20"; | |
| 59 | + arm,psci-suspend-param = <0x0>; | |
| 60 | + entry-latency-us = <2000>; | |
| 61 | + exit-latency-us = <2000>; | |
| 62 | + min-residency-us = <6000>; | |
| 63 | 63 | }; |
| 64 | 64 | }; |
| 65 | 65 | |
| @@ -613,6 +613,7 @@ CONFIG_RTC_DRV_TEGRA=y · 612 unmodified lines | ||
| 613 | 613 | CONFIG_RTC_DRV_IMX_SC=m |
| 614 | 614 | CONFIG_RTC_DRV_XGENE=y |
| 615 | 615 | CONFIG_DMADEVICES=y |
| 616 | +CONFIG_FSL_EDMA=y | |
| 616 | 617 | CONFIG_DMA_BCM2835=m |
| 617 | 618 | CONFIG_K3_DMA=y |
| 618 | 619 | CONFIG_MV_XOR=y |
| @@ -39,6 +39,11 @@ static int save_fpu_state(struct sigcontext __user *sc) · 38 unmodified lines | ||
| 39 | 39 | #endif |
| 40 | 40 | |
| 41 | 41 | struct rt_sigframe { |
| 42 | + /* | |
| 43 | + * pad[3] is compatible with the same struct defined in | |
| 44 | + * gcc/libgcc/config/csky/linux-unwind.h | |
| 45 | + */ | |
| 46 | + int pad[3]; | |
| 42 | 47 | struct siginfo info; |
| 43 | 48 | struct ucontext uc; |
| 44 | 49 | }; |
| @@ -786,6 +786,10 @@ int apply_relocate_add(Elf_Shdr *sechdrs, · 785 unmodified lines | ||
| 786 | 786 | /* 32-bit PC relative address */ |
| 787 | 787 | *loc = val - dot - 8 + addend; |
| 788 | 788 | break; |
| 789 | + case R_PARISC_PCREL64: | |
| 790 | + /* 64-bit PC relative address */ | |
| 791 | + *loc64 = val - dot - 8 + addend; | |
| 792 | + break; | |
| 789 | 793 | case R_PARISC_DIR64: |
| 790 | 794 | /* 64-bit effective address */ |
| 791 | 795 | *loc64 = val + addend; |
| @@ -319,6 +319,13 @@ struct vm_area_struct; · 318 unmodified lines | ||
| 319 | 319 | #endif /* __ASSEMBLY__ */ |
| 320 | 320 | #include <asm/slice.h> |
| 321 | 321 | |
| 322 | +/* | |
| 323 | + * Allow 30-bit DMA for very limited Broadcom wifi chips on many powerbooks. | |
| 324 | + */ | |
| 325 | +#ifdef CONFIG_PPC32 | |
| 326 | +#define ARCH_ZONE_DMA_BITS 30 | |
| 327 | +#else | |
| 322 | 328 | #define ARCH_ZONE_DMA_BITS 31 |
| 329 | +#endif | |
| 323 | 330 | |
| 324 | 331 | #endif /* _ASM_POWERPC_PAGE_H */ |
| @@ -752,6 +752,7 @@ __secondary_start: · 751 unmodified lines | ||
| 752 | 752 | stw r0,0(r3) |
| 753 | 753 | |
| 754 | 754 | /* load up the MMU */ |
| 755 | + bl load_segment_registers | |
| 755 | 756 | bl load_up_mmu |
| 756 | 757 | |
| 757 | 758 | /* ptr to phys current thread */ |
| @@ -83,7 +83,7 @@ END_BTB_FLUSH_SECTION · 82 unmodified lines | ||
| 83 | 83 | SAVE_4GPRS(3, r11); \ |
| 84 | 84 | SAVE_2GPRS(7, r11) |
| 85 | 85 | |
| 86 | −.macro SYSCALL_ENTRY trapno intno | |
| 86 | +.macro SYSCALL_ENTRY trapno intno srr1 | |
| 87 | 87 | mfspr r10, SPRN_SPRG_THREAD |
| 88 | 88 | #ifdef CONFIG_KVM_BOOKE_HV |
| 89 | 89 | BEGIN_FTR_SECTION |
| @@ -94,7 +94,7 @@ BEGIN_FTR_SECTION · 4 unmodified lines | ||
| 94 | 94 | mfspr r11, SPRN_SRR1 |
| 95 | 95 | mtocrf 0x80, r11 /* check MSR[GS] without clobbering reg */ |
| 96 | 96 | bf 3, 1975f |
| 97 | − b kvmppc_handler_BOOKE_INTERRUPT_\intno\()_SPRN_SRR1 | |
| 97 | + b kvmppc_handler_\intno\()_\srr1 | |
| 98 | 98 | 1975: |
| 99 | 99 | mr r12, r13 |
| 100 | 100 | lwz r13, THREAD_NORMSAVE(2)(r10) |
| @@ -145,9 +145,9 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) · 44 unmodified lines | ||
| 145 | 145 | tophys(r11,r11) |
| 146 | 146 | addi r11,r11,global_dbcr0@l |
| 147 | 147 | #ifdef CONFIG_SMP |
| 148 | − lwz r9,TASK_CPU(r2) | |
| 149 | − slwi r9,r9,3 | |
| 150 | − add r11,r11,r9 | |
| 148 | + lwz r10, TASK_CPU(r2) | |
| 149 | + slwi r10, r10, 3 | |
| 150 | + add r11, r11, r10 | |
| 151 | 151 | #endif |
| 152 | 152 | lwz r12,0(r11) |
| 153 | 153 | mtspr SPRN_DBCR0,r12 |
| @@ -409,7 +409,7 @@ interrupt_base: · 408 unmodified lines | ||
| 409 | 409 | |
| 410 | 410 | /* System Call Interrupt */ |
| 411 | 411 | START_EXCEPTION(SystemCall) |
| 412 | − SYSCALL_ENTRY 0xc00 SYSCALL | |
| 412 | + SYSCALL_ENTRY 0xc00 BOOKE_INTERRUPT_SYSCALL SPRN_SRR1 | |
| 413 | 413 | |
| 414 | 414 | /* Auxiliary Processor Unavailable Interrupt */ |
| 415 | 415 | EXCEPTION(0x2900, AP_UNAVAIL, AuxillaryProcessorUnavailable, \ |
| @@ -830,6 +830,7 @@ static void flush_guest_tlb(struct kvm *kvm) · 829 unmodified lines | ||
| 830 | 830 | } |
| 831 | 831 | } |
| 832 | 832 | asm volatile("ptesync": : :"memory"); |
| 833 | + asm volatile(PPC_INVALIDATE_ERAT : : :"memory"); | |
| 833 | 834 | } |
| 834 | 835 | |
| 835 | 836 | void kvmppc_check_need_tlb_flush(struct kvm *kvm, int pcpu, |
| @@ -2500,17 +2500,28 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 2499 unmodified lines | ||
| 2500 | 2500 | LOAD_REG_ADDR(r11, dawr_force_enable) |
| 2501 | 2501 | lbz r11, 0(r11) |
| 2502 | 2502 | cmpdi r11, 0 |
| 2503 | + bne 3f | |
| 2503 | 2504 | li r3, H_HARDWARE |
| 2504 | − beqlr | |
| 2505 | + blr | |
| 2506 | +3: | |
| 2505 | 2507 | /* Emulate H_SET_DABR/X on P8 for the sake of compat mode guests */ |
| 2506 | 2508 | rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW |
| 2507 | 2509 | rlwimi r5, r4, 2, DAWRX_WT |
| 2508 | 2510 | clrrdi r4, r4, 3 |
| 2509 | 2511 | std r4, VCPU_DAWR(r3) |
| 2510 | 2512 | std r5, VCPU_DAWRX(r3) |
| 2513 | + /* | |
| 2514 | + * If came in through the real mode hcall handler then it is necessary | |
| 2515 | + * to write the registers since the return path won't. Otherwise it is | |
| 2516 | + * sufficient to store then in the vcpu struct as they will be loaded | |
| 2517 | + * next time the vcpu is run. | |
| 2518 | + */ | |
| 2519 | + mfmsr r6 | |
| 2520 | + andi. r6, r6, MSR_DR /* in real mode? */ | |
| 2521 | + bne 4f | |
| 2511 | 2522 | mtspr SPRN_DAWR, r4 |
| 2512 | 2523 | mtspr SPRN_DAWRX, r5 |
| 2513 | − li r3, 0 | |
| 2524 | +4: li r3, 0 | |
| 2514 | 2525 | blr |
| 2515 | 2526 | |
| 2516 | 2527 | _GLOBAL(kvmppc_h_cede) /* r3 = vcpu pointer, r11 = msr, r13 = paca */ |
| @@ -50,20 +50,52 @@ EXPORT_SYMBOL_GPL(hash__alloc_context_id); · 49 unmodified lines | ||
| 50 | 50 | |
| 51 | 51 | void slb_setup_new_exec(void); |
| 52 | 52 | |
| 53 | +static int realloc_context_ids(mm_context_t *ctx) | |
| 54 | +{ | |
| 55 | + int i, id; | |
| 56 | + | |
| 57 | + /* | |
| 58 | + * id 0 (aka. ctx->id) is special, we always allocate a new one, even if | |
| 59 | + * there wasn't one allocated previously (which happens in the exec | |
| 60 | + * case where ctx is newly allocated). | |
| 61 | + * | |
| 62 | + * We have to be a bit careful here. We must keep the existing ids in | |
| 63 | + * the array, so that we can test if they're non-zero to decide if we | |
| 64 | + * need to allocate a new one. However in case of error we must free the | |
| 65 | + * ids we've allocated but *not* any of the existing ones (or risk a | |
| 66 | + * UAF). That's why we decrement i at the start of the error handling | |
| 67 | + * loop, to skip the id that we just tested but couldn't reallocate. | |
| 68 | + */ | |
| 69 | + for (i = 0; i < ARRAY_SIZE(ctx->extended_id); i++) { | |
| 70 | + if (i == 0 || ctx->extended_id[i]) { | |
| 71 | + id = hash__alloc_context_id(); | |
| 72 | + if (id < 0) | |
| 73 | + goto error; | |
| 74 | + | |
| 75 | + ctx->extended_id[i] = id; | |
| 76 | + } | |
| 77 | + } | |
| 78 | + | |
| 79 | + /* The caller expects us to return id */ | |
| 80 | + return ctx->id; | |
| 81 | + | |
| 82 | +error: | |
| 83 | + for (i--; i >= 0; i--) { | |
| 84 | + if (ctx->extended_id[i]) | |
| 85 | + ida_free(&mmu_context_ida, ctx->extended_id[i]); | |
| 86 | + } | |
| 87 | + | |
| 88 | + return id; | |
| 89 | +} | |
| 90 | + | |
| 53 | 91 | static int hash__init_new_context(struct mm_struct *mm) |
| 54 | 92 | { |
| 55 | 93 | int index; |
| 56 | 94 | |
| 57 | − index = hash__alloc_context_id(); | |
| 58 | − if (index < 0) | |
| 59 | − return index; | |
| 60 | − | |
| 61 | 95 | mm->context.hash_context = kmalloc(sizeof(struct hash_mm_context), |
| 62 | 96 | GFP_KERNEL); |
| 63 | − if (!mm->context.hash_context) { | |
| 64 | − ida_free(&mmu_context_ida, index); | |
| 97 | + if (!mm->context.hash_context) | |
| 65 | 98 | return -ENOMEM; |
| 66 | − } | |
| 67 | 99 | |
| 68 | 100 | /* |
| 69 | 101 | * The old code would re-promote on fork, we don't do that when using |
| @@ -91,13 +123,20 @@ static int hash__init_new_context(struct mm_struct *mm) · 21 unmodified lines | ||
| 91 | 123 | mm->context.hash_context->spt = kmalloc(sizeof(struct subpage_prot_table), |
| 92 | 124 | GFP_KERNEL); |
| 93 | 125 | if (!mm->context.hash_context->spt) { |
| 94 | − ida_free(&mmu_context_ida, index); | |
| 95 | 126 | kfree(mm->context.hash_context); |
| 96 | 127 | return -ENOMEM; |
| 97 | 128 | } |
| 98 | 129 | } |
| 99 | 130 | #endif |
| 131 | + } | |
| 100 | 132 | |
| 133 | + index = realloc_context_ids(&mm->context); | |
| 134 | + if (index < 0) { | |
| 135 | +#ifdef CONFIG_PPC_SUBPAGE_PROT | |
| 136 | + kfree(mm->context.hash_context->spt); | |
| 137 | +#endif | |
| 138 | + kfree(mm->context.hash_context); | |
| 139 | + return index; | |
| 101 | 140 | } |
| 102 | 141 | |
| 103 | 142 | pkey_mm_init(mm); |
| @@ -248,7 +248,8 @@ void __init paging_init(void) · 247 unmodified lines | ||
| 248 | 248 | (long int)((top_of_ram - total_ram) >> 20)); |
| 249 | 249 | |
| 250 | 250 | #ifdef CONFIG_ZONE_DMA |
| 251 | − max_zone_pfns[ZONE_DMA] = min(max_low_pfn, 0x7fffffffUL >> PAGE_SHIFT); | |
| 251 | + max_zone_pfns[ZONE_DMA] = min(max_low_pfn, | |
| 252 | + ((1UL << ARCH_ZONE_DMA_BITS) - 1) >> PAGE_SHIFT); | |
| 252 | 253 | #endif |
| 253 | 254 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; |
| 254 | 255 | #ifdef CONFIG_HIGHMEM |
| @@ -7,6 +7,7 @@ config PPC_PMAC · 6 unmodified lines | ||
| 7 | 7 | select PPC_INDIRECT_PCI if PPC32 |
| 8 | 8 | select PPC_MPC106 if PPC32 |
| 9 | 9 | select PPC_NATIVE |
| 10 | + select ZONE_DMA if PPC32 | |
| 10 | 11 | default y |
| 11 | 12 | |
| 12 | 13 | config PPC_PMAC64 |
| @@ -52,8 +52,9 @@ static const struct fb_var_screeninfo cfag12864bfb_var = { · 51 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | static int cfag12864bfb_mmap(struct fb_info *info, struct vm_area_struct *vma) |
| 54 | 54 | { |
| 55 | − return vm_insert_page(vma, vma->vm_start, | |
| 56 | − virt_to_page(cfag12864b_buffer)); | |
| 55 | + struct page *pages = virt_to_page(cfag12864b_buffer); | |
| 56 | + | |
| 57 | + return vm_map_pages_zero(vma, &pages, 1); | |
| 57 | 58 | } |
| 58 | 59 | |
| 59 | 60 | static struct fb_ops cfag12864bfb_ops = { |
| @@ -223,9 +223,9 @@ static const struct backlight_ops ht16k33_bl_ops = { · 222 unmodified lines | ||
| 223 | 223 | static int ht16k33_mmap(struct fb_info *info, struct vm_area_struct *vma) |
| 224 | 224 | { |
| 225 | 225 | struct ht16k33_priv *priv = info->par; |
| 226 | + struct page *pages = virt_to_page(priv->fbdev.buffer); | |
| 226 | 227 | |
| 227 | − return vm_insert_page(vma, vma->vm_start, | |
| 228 | − virt_to_page(priv->fbdev.buffer)); | |
| 228 | + return vm_map_pages_zero(vma, &pages, 1); | |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | static struct fb_ops ht16k33_fb_ops = { |
| @@ -368,7 +368,7 @@ static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index) · 367 unmodified lines | ||
| 368 | 368 | const char *dev_id = dev ? dev_name(dev) : NULL; |
| 369 | 369 | struct device_node *np = core->of_node; |
| 370 | 370 | |
| 371 | − if (np && index >= 0) | |
| 371 | + if (np && (name || index >= 0)) | |
| 372 | 372 | hw = of_clk_get_hw(np, index, name); |
| 373 | 373 | |
| 374 | 374 | /* |
| @@ -2734,8 +2734,8 @@ static struct clk_hw_onecell_data g12a_hw_onecell_data = { · 2733 unmodified lines | ||
| 2734 | 2734 | [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw, |
| 2735 | 2735 | [CLKID_MALI_1] = &g12a_mali_1.hw, |
| 2736 | 2736 | [CLKID_MALI] = &g12a_mali.hw, |
| 2737 | − [CLKID_MPLL_5OM_DIV] = &g12a_mpll_50m_div.hw, | |
| 2738 | − [CLKID_MPLL_5OM] = &g12a_mpll_50m.hw, | |
| 2737 | + [CLKID_MPLL_50M_DIV] = &g12a_mpll_50m_div.hw, | |
| 2738 | + [CLKID_MPLL_50M] = &g12a_mpll_50m.hw, | |
| 2739 | 2739 | [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw, |
| 2740 | 2740 | [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw, |
| 2741 | 2741 | [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw, |
| @@ -166,7 +166,7 @@ · 165 unmodified lines | ||
| 166 | 166 | #define CLKID_HDMI_DIV 167 |
| 167 | 167 | #define CLKID_MALI_0_DIV 170 |
| 168 | 168 | #define CLKID_MALI_1_DIV 173 |
| 169 | −#define CLKID_MPLL_5OM_DIV 176 | |
| 169 | +#define CLKID_MPLL_50M_DIV 176 | |
| 170 | 170 | #define CLKID_SYS_PLL_DIV16_EN 178 |
| 171 | 171 | #define CLKID_SYS_PLL_DIV16 179 |
| 172 | 172 | #define CLKID_CPU_CLK_DYN0_SEL 180 |
| @@ -1761,7 +1761,7 @@ static struct clk_regmap meson8m2_gp_pll = { · 1760 unmodified lines | ||
| 1761 | 1761 | }, |
| 1762 | 1762 | }; |
| 1763 | 1763 | |
| 1764 | −static const char * const mmeson8b_vpu_0_1_parent_names[] = { | |
| 1764 | +static const char * const meson8b_vpu_0_1_parent_names[] = { | |
| 1765 | 1765 | "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7" |
| 1766 | 1766 | }; |
| 1767 | 1767 | |
| @@ -1778,8 +1778,8 @@ static struct clk_regmap meson8b_vpu_0_sel = { · 10 unmodified lines | ||
| 1778 | 1778 | .hw.init = &(struct clk_init_data){ |
| 1779 | 1779 | .name = "vpu_0_sel", |
| 1780 | 1780 | .ops = &clk_regmap_mux_ops, |
| 1781 | − .parent_names = mmeson8b_vpu_0_1_parent_names, | |
| 1782 | − .num_parents = ARRAY_SIZE(mmeson8b_vpu_0_1_parent_names), | |
| 1781 | + .parent_names = meson8b_vpu_0_1_parent_names, | |
| 1782 | + .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_names), | |
| 1783 | 1783 | .flags = CLK_SET_RATE_PARENT, |
| 1784 | 1784 | }, |
| 1785 | 1785 | }; |
| @@ -1837,8 +1837,8 @@ static struct clk_regmap meson8b_vpu_1_sel = { · 51 unmodified lines | ||
| 1837 | 1837 | .hw.init = &(struct clk_init_data){ |
| 1838 | 1838 | .name = "vpu_1_sel", |
| 1839 | 1839 | .ops = &clk_regmap_mux_ops, |
| 1840 | − .parent_names = mmeson8b_vpu_0_1_parent_names, | |
| 1841 | − .num_parents = ARRAY_SIZE(mmeson8b_vpu_0_1_parent_names), | |
| 1840 | + .parent_names = meson8b_vpu_0_1_parent_names, | |
| 1841 | + .num_parents = ARRAY_SIZE(meson8b_vpu_0_1_parent_names), | |
| 1842 | 1842 | .flags = CLK_SET_RATE_PARENT, |
| 1843 | 1843 | }, |
| 1844 | 1844 | }; |
| @@ -103,9 +103,9 @@ static const struct stratix10_perip_cnt_clock s10_main_perip_cnt_clks[] = { · 102 unmodified lines | ||
| 103 | 103 | { STRATIX10_NOC_CLK, "noc_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux), |
| 104 | 104 | 0, 0, 0, 0x3C, 1}, |
| 105 | 105 | { STRATIX10_EMAC_A_FREE_CLK, "emaca_free_clk", NULL, emaca_free_mux, ARRAY_SIZE(emaca_free_mux), |
| 106 | − 0, 0, 4, 0xB0, 0}, | |
| 106 | + 0, 0, 2, 0xB0, 0}, | |
| 107 | 107 | { STRATIX10_EMAC_B_FREE_CLK, "emacb_free_clk", NULL, emacb_free_mux, ARRAY_SIZE(emacb_free_mux), |
| 108 | − 0, 0, 4, 0xB0, 1}, | |
| 108 | + 0, 0, 2, 0xB0, 1}, | |
| 109 | 109 | { STRATIX10_EMAC_PTP_FREE_CLK, "emac_ptp_free_clk", NULL, emac_ptp_free_mux, |
| 110 | 110 | ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 4, 0xB0, 2}, |
| 111 | 111 | { STRATIX10_GPIO_DB_FREE_CLK, "gpio_db_free_clk", NULL, gpio_db_free_mux, |
| @@ -3366,6 +3366,8 @@ static struct tegra_clk_init_table init_table[] __initdata = { · 3365 unmodified lines | ||
| 3366 | 3366 | { TEGRA210_CLK_I2S3_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, |
| 3367 | 3367 | { TEGRA210_CLK_I2S4_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, |
| 3368 | 3368 | { TEGRA210_CLK_VIMCLK_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 }, |
| 3369 | + { TEGRA210_CLK_HDA, TEGRA210_CLK_PLL_P, 51000000, 0 }, | |
| 3370 | + { TEGRA210_CLK_HDA2CODEC_2X, TEGRA210_CLK_PLL_P, 48000000, 0 }, | |
| 3369 | 3371 | /* This MUST be the last entry. */ |
| 3370 | 3372 | { TEGRA210_CLK_CLK_MAX, TEGRA210_CLK_CLK_MAX, 0, 0 }, |
| 3371 | 3373 | }; |
| @@ -229,6 +229,7 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, · 228 unmodified lines | ||
| 229 | 229 | { |
| 230 | 230 | struct omap_clkctrl_provider *provider = data; |
| 231 | 231 | struct omap_clkctrl_clk *entry; |
| 232 | + bool found = false; | |
| 232 | 233 | |
| 233 | 234 | if (clkspec->args_count != 2) |
| 234 | 235 | return ERR_PTR(-EINVAL); |
| @@ -238,11 +239,13 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, · 3 unmodified lines | ||
| 238 | 239 | |
| 239 | 240 | list_for_each_entry(entry, &provider->clocks, node) { |
| 240 | 241 | if (entry->reg_offset == clkspec->args[0] && |
| 241 | − entry->bit_offset == clkspec->args[1]) | |
| 242 | + entry->bit_offset == clkspec->args[1]) { | |
| 243 | + found = true; | |
| 242 | 244 | break; |
| 245 | + } | |
| 243 | 246 | } |
| 244 | 247 | |
| 245 | − if (!entry) | |
| 248 | + if (!found) | |
| 246 | 249 | return ERR_PTR(-EINVAL); |
| 247 | 250 | |
| 248 | 251 | return entry->clk; |
| @@ -80,6 +80,7 @@ · 79 unmodified lines | ||
| 80 | 80 | #define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220 |
| 81 | 81 | #define HID_DEVICE_ID_ALPS_U1 0x1215 |
| 82 | 82 | #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C |
| 83 | +#define HID_DEVICE_ID_ALPS_1222 0x1222 | |
| 83 | 84 | |
| 84 | 85 | |
| 85 | 86 | #define USB_VENDOR_ID_AMI 0x046b |
| @@ -269,6 +270,7 @@ · 183 unmodified lines | ||
| 269 | 270 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d |
| 270 | 271 | #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618 |
| 271 | 272 | #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE 0x1053 |
| 273 | +#define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2 0x0939 | |
| 272 | 274 | #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123 |
| 273 | 275 | #define USB_DEVICE_ID_ASUS_AK1D 0x1125 |
| 274 | 276 | #define USB_DEVICE_ID_CHICONY_TOSHIBA_WT10A 0x1408 |
| @@ -569,6 +571,7 @@ · 294 unmodified lines | ||
| 569 | 571 | |
| 570 | 572 | #define USB_VENDOR_ID_HUION 0x256c |
| 571 | 573 | #define USB_DEVICE_ID_HUION_TABLET 0x006e |
| 574 | +#define USB_DEVICE_ID_HUION_HS64 0x006d | |
| 572 | 575 | |
| 573 | 576 | #define USB_VENDOR_ID_IBM 0x04b3 |
| 574 | 577 | #define USB_DEVICE_ID_IBM_SCROLLPOINT_III 0x3100 |
| @@ -30,6 +30,7 @@ · 29 unmodified lines | ||
| 30 | 30 | |
| 31 | 31 | #define REPORT_ID_HIDPP_SHORT 0x10 |
| 32 | 32 | #define REPORT_ID_HIDPP_LONG 0x11 |
| 33 | +#define REPORT_ID_HIDPP_VERY_LONG 0x12 | |
| 33 | 34 | |
| 34 | 35 | #define HIDPP_REPORT_SHORT_LENGTH 7 |
| 35 | 36 | #define HIDPP_REPORT_LONG_LENGTH 20 |
| @@ -1242,7 +1243,8 @@ static int logi_dj_ll_raw_request(struct hid_device *hid, · 1206 unmodified lines | ||
| 1242 | 1243 | int ret; |
| 1243 | 1244 | |
| 1244 | 1245 | if ((buf[0] == REPORT_ID_HIDPP_SHORT) || |
| 1245 | − (buf[0] == REPORT_ID_HIDPP_LONG)) { | |
| 1246 | + (buf[0] == REPORT_ID_HIDPP_LONG) || | |
| 1247 | + (buf[0] == REPORT_ID_HIDPP_VERY_LONG)) { | |
| 1246 | 1248 | if (count < 2) |
| 1247 | 1249 | return -EINVAL; |
| 1248 | 1250 | |
| @@ -1776,6 +1776,10 @@ static const struct hid_device_id mt_devices[] = { · 1775 unmodified lines | ||
| 1776 | 1776 | HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, |
| 1777 | 1777 | USB_VENDOR_ID_ALPS_JP, |
| 1778 | 1778 | HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP) }, |
| 1779 | + { .driver_data = MT_CLS_WIN_8_DUAL, | |
| 1780 | + HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, | |
| 1781 | + USB_VENDOR_ID_ALPS_JP, | |
| 1782 | + HID_DEVICE_ID_ALPS_1222) }, | |
| 1779 | 1783 | |
| 1780 | 1784 | /* Lenovo X1 TAB Gen 2 */ |
| 1781 | 1785 | { .driver_data = MT_CLS_WIN_8_DUAL, |
| @@ -42,6 +42,7 @@ static const struct hid_device_id hid_quirks[] = { · 41 unmodified lines | ||
| 42 | 42 | { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM), HID_QUIRK_NOGET }, |
| 43 | 43 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT }, |
| 44 | 44 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE), HID_QUIRK_ALWAYS_POLL }, |
| 45 | + { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2), HID_QUIRK_ALWAYS_POLL }, | |
| 45 | 46 | { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS), HID_QUIRK_MULTI_INPUT }, |
| 46 | 47 | { HID_USB_DEVICE(USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD), HID_QUIRK_BADPAD }, |
| 47 | 48 | { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK), HID_QUIRK_NOGET }, |
| @@ -369,6 +369,8 @@ static const struct hid_device_id uclogic_devices[] = { · 368 unmodified lines | ||
| 369 | 369 | USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) }, |
| 370 | 370 | { HID_USB_DEVICE(USB_VENDOR_ID_HUION, |
| 371 | 371 | USB_DEVICE_ID_HUION_TABLET) }, |
| 372 | + { HID_USB_DEVICE(USB_VENDOR_ID_HUION, | |
| 373 | + USB_DEVICE_ID_HUION_HS64) }, | |
| 372 | 374 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, |
| 373 | 375 | USB_DEVICE_ID_HUION_TABLET) }, |
| 374 | 376 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, |
| @@ -977,6 +977,8 @@ int uclogic_params_init(struct uclogic_params *params, · 976 unmodified lines | ||
| 977 | 977 | /* FALL THROUGH */ |
| 978 | 978 | case VID_PID(USB_VENDOR_ID_HUION, |
| 979 | 979 | USB_DEVICE_ID_HUION_TABLET): |
| 980 | + case VID_PID(USB_VENDOR_ID_HUION, | |
| 981 | + USB_DEVICE_ID_HUION_HS64): | |
| 980 | 982 | case VID_PID(USB_VENDOR_ID_UCLOGIC, |
| 981 | 983 | USB_DEVICE_ID_HUION_TABLET): |
| 982 | 984 | case VID_PID(USB_VENDOR_ID_UCLOGIC, |
| @@ -816,9 +816,9 @@ static int load_fw_from_host(struct ishtp_cl_data *client_data) · 815 unmodified lines | ||
| 816 | 816 | goto end_err_fw_release; |
| 817 | 817 | |
| 818 | 818 | release_firmware(fw); |
| 819 | − kfree(filename); | |
| 820 | 819 | dev_info(cl_data_to_dev(client_data), "ISH firmware %s loaded\n", |
| 821 | 820 | filename); |
| 821 | + kfree(filename); | |
| 822 | 822 | return 0; |
| 823 | 823 | |
| 824 | 824 | end_err_fw_release: |
| @@ -891,7 +891,7 @@ static int hid_ishtp_cl_reset(struct ishtp_cl_device *cl_device) · 890 unmodified lines | ||
| 891 | 891 | */ |
| 892 | 892 | static int hid_ishtp_cl_suspend(struct device *device) |
| 893 | 893 | { |
| 894 | − struct ishtp_cl_device *cl_device = dev_get_drvdata(device); | |
| 894 | + struct ishtp_cl_device *cl_device = ishtp_dev_to_cl_device(device); | |
| 895 | 895 | struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device); |
| 896 | 896 | struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl); |
| 897 | 897 | |
| @@ -912,7 +912,7 @@ static int hid_ishtp_cl_suspend(struct device *device) · 14 unmodified lines | ||
| 912 | 912 | */ |
| 913 | 913 | static int hid_ishtp_cl_resume(struct device *device) |
| 914 | 914 | { |
| 915 | − struct ishtp_cl_device *cl_device = dev_get_drvdata(device); | |
| 915 | + struct ishtp_cl_device *cl_device = ishtp_dev_to_cl_device(device); | |
| 916 | 916 | struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device); |
| 917 | 917 | struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl); |
| 918 | 918 | |
| @@ -471,7 +471,6 @@ static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev, · 470 unmodified lines | ||
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | ishtp_device_ready = true; |
| 474 | − dev_set_drvdata(&device->dev, device); | |
| 475 | 474 | |
| 476 | 475 | return device; |
| 477 | 476 | } |
| @@ -639,6 +638,20 @@ void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device) · 161 unmodified lines | ||
| 639 | 638 | } |
| 640 | 639 | EXPORT_SYMBOL(ishtp_get_drvdata); |
| 641 | 640 | |
| 641 | +/** | |
| 642 | + * ishtp_dev_to_cl_device() - get ishtp_cl_device instance from device instance | |
| 643 | + * @device: device instance | |
| 644 | + * | |
| 645 | + * Get ish_cl_device instance which embeds device instance in it. | |
| 646 | + * | |
| 647 | + * Return: pointer to ishtp_cl_device instance | |
| 648 | + */ | |
| 649 | +struct ishtp_cl_device *ishtp_dev_to_cl_device(struct device *device) | |
| 650 | +{ | |
| 651 | + return to_ishtp_cl_device(device); | |
| 652 | +} | |
| 653 | +EXPORT_SYMBOL(ishtp_dev_to_cl_device); | |
| 654 | + | |
| 642 | 655 | /** |
| 643 | 656 | * ishtp_bus_new_client() - Create a new client |
| 644 | 657 | * @dev: ISHTP device instance |
| @@ -2504,7 +2504,6 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, · 2503 unmodified lines | ||
| 2504 | 2504 | } |
| 2505 | 2505 | } |
| 2506 | 2506 | |
| 2507 | − spin_lock(&iommu->lock); | |
| 2508 | 2507 | spin_lock_irqsave(&device_domain_lock, flags); |
| 2509 | 2508 | if (dev) |
| 2510 | 2509 | found = find_domain(dev); |
| @@ -2520,16 +2519,17 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, · 9 unmodified lines | ||
| 2520 | 2519 | |
| 2521 | 2520 | if (found) { |
| 2522 | 2521 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| 2523 | − spin_unlock(&iommu->lock); | |
| 2524 | 2522 | free_devinfo_mem(info); |
| 2525 | 2523 | /* Caller must free the original domain */ |
| 2526 | 2524 | return found; |
| 2527 | 2525 | } |
| 2528 | 2526 | |
| 2527 | + spin_lock(&iommu->lock); | |
| 2529 | 2528 | ret = domain_attach_iommu(domain, iommu); |
| 2529 | + spin_unlock(&iommu->lock); | |
| 2530 | + | |
| 2530 | 2531 | if (ret) { |
| 2531 | 2532 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| 2532 | − spin_unlock(&iommu->lock); | |
| 2533 | 2533 | free_devinfo_mem(info); |
| 2534 | 2534 | return NULL; |
| 2535 | 2535 | } |
| @@ -2539,7 +2539,6 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, · 3 unmodified lines | ||
| 2539 | 2539 | if (dev) |
| 2540 | 2540 | dev->archdata.iommu = info; |
| 2541 | 2541 | spin_unlock_irqrestore(&device_domain_lock, flags); |
| 2542 | − spin_unlock(&iommu->lock); | |
| 2543 | 2542 | |
| 2544 | 2543 | /* PASID table is mandatory for a PCI device in scalable mode. */ |
| 2545 | 2544 | if (dev && dev_is_pci(dev) && sm_supported(iommu)) { |
| @@ -140,8 +140,8 @@ static char __init *dm_parse_table_entry(struct dm_device *dev, char *str) · 139 unmodified lines | ||
| 140 | 140 | return ERR_PTR(-EINVAL); |
| 141 | 141 | } |
| 142 | 142 | /* target_args */ |
| 143 | − dev->target_args_array[n] = kstrndup(field[3], GFP_KERNEL, | |
| 144 | − DM_MAX_STR_SIZE); | |
| 143 | + dev->target_args_array[n] = kstrndup(field[3], DM_MAX_STR_SIZE, | |
| 144 | + GFP_KERNEL); | |
| 145 | 145 | if (!dev->target_args_array[n]) |
| 146 | 146 | return ERR_PTR(-ENOMEM); |
| 147 | 147 | |
| @@ -272,10 +272,10 @@ static int __init dm_init_init(void) · 124 unmodified lines | ||
| 272 | 272 | return 0; |
| 273 | 273 | |
| 274 | 274 | if (strlen(create) >= DM_MAX_STR_SIZE) { |
| 275 | − DMERR("Argument is too big. Limit is %d\n", DM_MAX_STR_SIZE); | |
| 275 | + DMERR("Argument is too big. Limit is %d", DM_MAX_STR_SIZE); | |
| 276 | 276 | return -EINVAL; |
| 277 | 277 | } |
| 278 | − str = kstrndup(create, GFP_KERNEL, DM_MAX_STR_SIZE); | |
| 278 | + str = kstrndup(create, DM_MAX_STR_SIZE, GFP_KERNEL); | |
| 279 | 279 | if (!str) |
| 280 | 280 | return -ENOMEM; |
| 281 | 281 | |
| @@ -283,7 +283,7 @@ static int __init dm_init_init(void) · 1 unmodified line | ||
| 283 | 283 | if (r) |
| 284 | 284 | goto out; |
| 285 | 285 | |
| 286 | − DMINFO("waiting for all devices to be available before creating mapped devices\n"); | |
| 286 | + DMINFO("waiting for all devices to be available before creating mapped devices"); | |
| 287 | 287 | wait_for_device_probe(); |
| 288 | 288 | |
| 289 | 289 | list_for_each_entry(dev, &devices, list) { |
| @@ -60,6 +60,7 @@ · 59 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | #define WRITE_LOG_VERSION 1ULL |
| 62 | 62 | #define WRITE_LOG_MAGIC 0x6a736677736872ULL |
| 63 | +#define WRITE_LOG_SUPER_SECTOR 0 | |
| 63 | 64 | |
| 64 | 65 | /* |
| 65 | 66 | * The disk format for this is braindead simple. |
| @@ -115,6 +116,7 @@ struct log_writes_c { · 49 unmodified lines | ||
| 115 | 116 | struct list_head logging_blocks; |
| 116 | 117 | wait_queue_head_t wait; |
| 117 | 118 | struct task_struct *log_kthread; |
| 119 | + struct completion super_done; | |
| 118 | 120 | }; |
| 119 | 121 | |
| 120 | 122 | struct pending_block { |
| @@ -180,6 +182,14 @@ static void log_end_io(struct bio *bio) · 59 unmodified lines | ||
| 180 | 182 | bio_put(bio); |
| 181 | 183 | } |
| 182 | 184 | |
| 185 | +static void log_end_super(struct bio *bio) | |
| 186 | +{ | |
| 187 | + struct log_writes_c *lc = bio->bi_private; | |
| 188 | + | |
| 189 | + complete(&lc->super_done); | |
| 190 | + log_end_io(bio); | |
| 191 | +} | |
| 192 | + | |
| 183 | 193 | /* |
| 184 | 194 | * Meant to be called if there is an error, it will free all the pages |
| 185 | 195 | * associated with the block. |
| @@ -215,7 +225,8 @@ static int write_metadata(struct log_writes_c *lc, void *entry, · 29 unmodified lines | ||
| 215 | 225 | bio->bi_iter.bi_size = 0; |
| 216 | 226 | bio->bi_iter.bi_sector = sector; |
| 217 | 227 | bio_set_dev(bio, lc->logdev->bdev); |
| 218 | − bio->bi_end_io = log_end_io; | |
| 228 | + bio->bi_end_io = (sector == WRITE_LOG_SUPER_SECTOR) ? | |
| 229 | + log_end_super : log_end_io; | |
| 219 | 230 | bio->bi_private = lc; |
| 220 | 231 | bio_set_op_attrs(bio, REQ_OP_WRITE, 0); |
| 221 | 232 | |
| @@ -418,11 +429,18 @@ static int log_super(struct log_writes_c *lc) · 196 unmodified lines | ||
| 418 | 429 | super.nr_entries = cpu_to_le64(lc->logged_entries); |
| 419 | 430 | super.sectorsize = cpu_to_le32(lc->sectorsize); |
| 420 | 431 | |
| 421 | − if (write_metadata(lc, &super, sizeof(super), NULL, 0, 0)) { | |
| 432 | + if (write_metadata(lc, &super, sizeof(super), NULL, 0, | |
| 433 | + WRITE_LOG_SUPER_SECTOR)) { | |
| 422 | 434 | DMERR("Couldn't write super"); |
| 423 | 435 | return -1; |
| 424 | 436 | } |
| 425 | 437 | |
| 438 | + /* | |
| 439 | + * Super sector should be writen in-order, otherwise the | |
| 440 | + * nr_entries could be rewritten incorrectly by an old bio. | |
| 441 | + */ | |
| 442 | + wait_for_completion_io(&lc->super_done); | |
| 443 | + | |
| 426 | 444 | return 0; |
| 427 | 445 | } |
| 428 | 446 | |
| @@ -531,6 +549,7 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 102 unmodified lines | ||
| 531 | 549 | INIT_LIST_HEAD(&lc->unflushed_blocks); |
| 532 | 550 | INIT_LIST_HEAD(&lc->logging_blocks); |
| 533 | 551 | init_waitqueue_head(&lc->wait); |
| 552 | + init_completion(&lc->super_done); | |
| 534 | 553 | atomic_set(&lc->io_blocks, 0); |
| 535 | 554 | atomic_set(&lc->pending_blocks, 0); |
| 536 | 555 | |
| @@ -561,7 +561,7 @@ static char **realloc_argv(unsigned *size, char **old_argv) · 560 unmodified lines | ||
| 561 | 561 | gfp = GFP_NOIO; |
| 562 | 562 | } |
| 563 | 563 | argv = kmalloc_array(new_size, sizeof(*argv), gfp); |
| 564 | − if (argv) { | |
| 564 | + if (argv && old_argv) { | |
| 565 | 565 | memcpy(argv, old_argv, *size * sizeof(*argv)); |
| 566 | 566 | *size = new_size; |
| 567 | 567 | } |
| @@ -235,8 +235,8 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type, · 234 unmodified lines | ||
| 235 | 235 | BUG(); |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | − DMERR("%s: %s block %llu is corrupted", v->data_dev->name, type_str, | |
| 239 | − block); | |
| 238 | + DMERR_LIMIT("%s: %s block %llu is corrupted", v->data_dev->name, | |
| 239 | + type_str, block); | |
| 240 | 240 | |
| 241 | 241 | if (v->corrupted_errs == DM_VERITY_MAX_CORRUPTED_ERRS) |
| 242 | 242 | DMERR("%s: reached maximum errors", v->data_dev->name); |
| @@ -204,12 +204,11 @@ static struct irq_chip stmfx_irq_chip = { · 203 unmodified lines | ||
| 204 | 204 | static irqreturn_t stmfx_irq_handler(int irq, void *data) |
| 205 | 205 | { |
| 206 | 206 | struct stmfx *stmfx = data; |
| 207 | − unsigned long n, pending; | |
| 208 | − u32 ack; | |
| 209 | − int ret; | |
| 207 | + unsigned long bits; | |
| 208 | + u32 pending, ack; | |
| 209 | + int n, ret; | |
| 210 | 210 | |
| 211 | − ret = regmap_read(stmfx->map, STMFX_REG_IRQ_PENDING, | |
| 212 | − (u32 *)&pending); | |
| 211 | + ret = regmap_read(stmfx->map, STMFX_REG_IRQ_PENDING, &pending); | |
| 213 | 212 | if (ret) |
| 214 | 213 | return IRQ_NONE; |
| 215 | 214 | |
| @@ -224,7 +223,8 @@ static irqreturn_t stmfx_irq_handler(int irq, void *data) · 8 unmodified lines | ||
| 224 | 223 | return IRQ_NONE; |
| 225 | 224 | } |
| 226 | 225 | |
| 227 | − for_each_set_bit(n, &pending, STMFX_REG_IRQ_SRC_MAX) | |
| 226 | + bits = pending; | |
| 227 | + for_each_set_bit(n, &bits, STMFX_REG_IRQ_SRC_MAX) | |
| 228 | 228 | handle_nested_irq(irq_find_mapping(stmfx->irq_domain, n)); |
| 229 | 229 | |
| 230 | 230 | return IRQ_HANDLED; |
| @@ -4662,7 +4662,6 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type) · 4661 unmodified lines | ||
| 4662 | 4662 | memorg = nanddev_get_memorg(&chip->base); |
| 4663 | 4663 | memorg->planes_per_lun = 1; |
| 4664 | 4664 | memorg->luns_per_target = 1; |
| 4665 | − memorg->ntargets = 1; | |
| 4666 | 4665 | |
| 4667 | 4666 | /* |
| 4668 | 4667 | * Reset the chip, required by some chips (e.g. Micron MT29FxGxxxxx) |
| @@ -5027,6 +5026,8 @@ static int nand_scan_ident(struct nand_chip *chip, unsigned int maxchips, · 358 unmodified lines | ||
| 5027 | 5026 | if (ret) |
| 5028 | 5027 | return ret; |
| 5029 | 5028 | |
| 5029 | + memorg->ntargets = maxchips; | |
| 5030 | + | |
| 5030 | 5031 | /* Read the flash type */ |
| 5031 | 5032 | ret = nand_detect(chip, table); |
| 5032 | 5033 | if (ret) { |
| @@ -1636,6 +1636,95 @@ static int sr2_bit7_quad_enable(struct spi_nor *nor) · 1635 unmodified lines | ||
| 1636 | 1636 | return 0; |
| 1637 | 1637 | } |
| 1638 | 1638 | |
| 1639 | +/** | |
| 1640 | + * spi_nor_clear_sr_bp() - clear the Status Register Block Protection bits. | |
| 1641 | + * @nor: pointer to a 'struct spi_nor' | |
| 1642 | + * | |
| 1643 | + * Read-modify-write function that clears the Block Protection bits from the | |
| 1644 | + * Status Register without affecting other bits. | |
| 1645 | + * | |
| 1646 | + * Return: 0 on success, -errno otherwise. | |
| 1647 | + */ | |
| 1648 | +static int spi_nor_clear_sr_bp(struct spi_nor *nor) | |
| 1649 | +{ | |
| 1650 | + int ret; | |
| 1651 | + u8 mask = SR_BP2 | SR_BP1 | SR_BP0; | |
| 1652 | + | |
| 1653 | + ret = read_sr(nor); | |
| 1654 | + if (ret < 0) { | |
| 1655 | + dev_err(nor->dev, "error while reading status register\n"); | |
| 1656 | + return ret; | |
| 1657 | + } | |
| 1658 | + | |
| 1659 | + write_enable(nor); | |
| 1660 | + | |
| 1661 | + ret = write_sr(nor, ret & ~mask); | |
| 1662 | + if (ret) { | |
| 1663 | + dev_err(nor->dev, "write to status register failed\n"); | |
| 1664 | + return ret; | |
| 1665 | + } | |
| 1666 | + | |
| 1667 | + ret = spi_nor_wait_till_ready(nor); | |
| 1668 | + if (ret) | |
| 1669 | + dev_err(nor->dev, "timeout while writing status register\n"); | |
| 1670 | + return ret; | |
| 1671 | +} | |
| 1672 | + | |
| 1673 | +/** | |
| 1674 | + * spi_nor_spansion_clear_sr_bp() - clear the Status Register Block Protection | |
| 1675 | + * bits on spansion flashes. | |
| 1676 | + * @nor: pointer to a 'struct spi_nor' | |
| 1677 | + * | |
| 1678 | + * Read-modify-write function that clears the Block Protection bits from the | |
| 1679 | + * Status Register without affecting other bits. The function is tightly | |
| 1680 | + * coupled with the spansion_quad_enable() function. Both assume that the Write | |
| 1681 | + * Register with 16 bits, together with the Read Configuration Register (35h) | |
| 1682 | + * instructions are supported. | |
| 1683 | + * | |
| 1684 | + * Return: 0 on success, -errno otherwise. | |
| 1685 | + */ | |
| 1686 | +static int spi_nor_spansion_clear_sr_bp(struct spi_nor *nor) | |
| 1687 | +{ | |
| 1688 | + int ret; | |
| 1689 | + u8 mask = SR_BP2 | SR_BP1 | SR_BP0; | |
| 1690 | + u8 sr_cr[2] = {0}; | |
| 1691 | + | |
| 1692 | + /* Check current Quad Enable bit value. */ | |
| 1693 | + ret = read_cr(nor); | |
| 1694 | + if (ret < 0) { | |
| 1695 | + dev_err(nor->dev, | |
| 1696 | + "error while reading configuration register\n"); | |
| 1697 | + return ret; | |
| 1698 | + } | |
| 1699 | + | |
| 1700 | + /* | |
| 1701 | + * When the configuration register Quad Enable bit is one, only the | |
| 1702 | + * Write Status (01h) command with two data bytes may be used. | |
| 1703 | + */ | |
| 1704 | + if (ret & CR_QUAD_EN_SPAN) { | |
| 1705 | + sr_cr[1] = ret; | |
| 1706 | + | |
| 1707 | + ret = read_sr(nor); | |
| 1708 | + if (ret < 0) { | |
| 1709 | + dev_err(nor->dev, | |
| 1710 | + "error while reading status register\n"); | |
| 1711 | + return ret; | |
| 1712 | + } | |
| 1713 | + sr_cr[0] = ret & ~mask; | |
| 1714 | + | |
| 1715 | + ret = write_sr_cr(nor, sr_cr); | |
| 1716 | + if (ret) | |
| 1717 | + dev_err(nor->dev, "16-bit write register failed\n"); | |
| 1718 | + return ret; | |
| 1719 | + } | |
| 1720 | + | |
| 1721 | + /* | |
| 1722 | + * If the Quad Enable bit is zero, use the Write Status (01h) command | |
| 1723 | + * with one data byte. | |
| 1724 | + */ | |
| 1725 | + return spi_nor_clear_sr_bp(nor); | |
| 1726 | +} | |
| 1727 | + | |
| 1639 | 1728 | /* Used when the "_ext_id" is two bytes at most */ |
| 1640 | 1729 | #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \ |
| 1641 | 1730 | .id = { \ |
| @@ -3660,6 +3749,8 @@ static int spi_nor_init_params(struct spi_nor *nor, · 2018 unmodified lines | ||
| 3660 | 3749 | default: |
| 3661 | 3750 | /* Kept only for backward compatibility purpose. */ |
| 3662 | 3751 | params->quad_enable = spansion_quad_enable; |
| 3752 | + if (nor->clear_sr_bp) | |
| 3753 | + nor->clear_sr_bp = spi_nor_spansion_clear_sr_bp; | |
| 3663 | 3754 | break; |
| 3664 | 3755 | } |
| 3665 | 3756 | |
| @@ -3912,17 +4003,13 @@ static int spi_nor_init(struct spi_nor *nor) · 246 unmodified lines | ||
| 3912 | 4003 | { |
| 3913 | 4004 | int err; |
| 3914 | 4005 | |
| 3915 | − /* | |
| 3916 | − * Atmel, SST, Intel/Numonyx, and others serial NOR tend to power up | |
| 3917 | − * with the software protection bits set | |
| 3918 | − */ | |
| 3919 | − if (JEDEC_MFR(nor->info) == SNOR_MFR_ATMEL || | |
| 3920 | − JEDEC_MFR(nor->info) == SNOR_MFR_INTEL || | |
| 3921 | − JEDEC_MFR(nor->info) == SNOR_MFR_SST || | |
| 3922 | − nor->info->flags & SPI_NOR_HAS_LOCK) { | |
| 3923 | − write_enable(nor); | |
| 3924 | − write_sr(nor, 0); | |
| 3925 | − spi_nor_wait_till_ready(nor); | |
| 4006 | + if (nor->clear_sr_bp) { | |
| 4007 | + err = nor->clear_sr_bp(nor); | |
| 4008 | + if (err) { | |
| 4009 | + dev_err(nor->dev, | |
| 4010 | + "fail to clear block protection bits\n"); | |
| 4011 | + return err; | |
| 4012 | + } | |
| 3926 | 4013 | } |
| 3927 | 4014 | |
| 3928 | 4015 | if (nor->quad_enable) { |
| @@ -4047,6 +4134,16 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, · 118 unmodified lines | ||
| 4047 | 4134 | if (info->flags & SPI_S3AN) |
| 4048 | 4135 | nor->flags |= SNOR_F_READY_XSR_RDY; |
| 4049 | 4136 | |
| 4137 | + /* | |
| 4138 | + * Atmel, SST, Intel/Numonyx, and others serial NOR tend to power up | |
| 4139 | + * with the software protection bits set. | |
| 4140 | + */ | |
| 4141 | + if (JEDEC_MFR(nor->info) == SNOR_MFR_ATMEL || | |
| 4142 | + JEDEC_MFR(nor->info) == SNOR_MFR_INTEL || | |
| 4143 | + JEDEC_MFR(nor->info) == SNOR_MFR_SST || | |
| 4144 | + nor->info->flags & SPI_NOR_HAS_LOCK) | |
| 4145 | + nor->clear_sr_bp = spi_nor_clear_sr_bp; | |
| 4146 | + | |
| 4050 | 4147 | /* Parse the Serial Flash Discoverable Parameters table. */ |
| 4051 | 4148 | ret = spi_nor_init_params(nor, ¶ms); |
| 4052 | 4149 | if (ret) |
| @@ -4304,12 +4304,12 @@ void bond_setup(struct net_device *bond_dev) · 4303 unmodified lines | ||
| 4304 | 4304 | bond_dev->features |= NETIF_F_NETNS_LOCAL; |
| 4305 | 4305 | |
| 4306 | 4306 | bond_dev->hw_features = BOND_VLAN_FEATURES | |
| 4307 | − NETIF_F_HW_VLAN_CTAG_TX | | |
| 4308 | 4307 | NETIF_F_HW_VLAN_CTAG_RX | |
| 4309 | 4308 | NETIF_F_HW_VLAN_CTAG_FILTER; |
| 4310 | 4309 | |
| 4311 | 4310 | bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4; |
| 4312 | 4311 | bond_dev->features |= bond_dev->hw_features; |
| 4312 | + bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; | |
| 4313 | 4313 | } |
| 4314 | 4314 | |
| 4315 | 4315 | /* Destroy a bonding device. |
| @@ -433,9 +433,9 @@ int ksz_switch_register(struct ksz_device *dev, · 432 unmodified lines | ||
| 433 | 433 | return PTR_ERR(dev->reset_gpio); |
| 434 | 434 | |
| 435 | 435 | if (dev->reset_gpio) { |
| 436 | − gpiod_set_value(dev->reset_gpio, 1); | |
| 436 | + gpiod_set_value_cansleep(dev->reset_gpio, 1); | |
| 437 | 437 | mdelay(10); |
| 438 | − gpiod_set_value(dev->reset_gpio, 0); | |
| 438 | + gpiod_set_value_cansleep(dev->reset_gpio, 0); | |
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | mutex_init(&dev->dev_mutex); |
| @@ -485,7 +485,7 @@ void ksz_switch_remove(struct ksz_device *dev) · 43 unmodified lines | ||
| 485 | 485 | dsa_unregister_switch(dev->ds); |
| 486 | 486 | |
| 487 | 487 | if (dev->reset_gpio) |
| 488 | − gpiod_set_value(dev->reset_gpio, 1); | |
| 488 | + gpiod_set_value_cansleep(dev->reset_gpio, 1); | |
| 489 | 489 | |
| 490 | 490 | } |
| 491 | 491 | EXPORT_SYMBOL(ksz_switch_remove); |
| @@ -843,9 +843,14 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic) · 842 unmodified lines | ||
| 843 | 843 | return err; |
| 844 | 844 | |
| 845 | 845 | if (aq_nic->ndev->features & NETIF_F_HW_VLAN_CTAG_FILTER) { |
| 846 | − if (hweight < AQ_VLAN_MAX_FILTERS) | |
| 847 | − err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, true); | |
| 846 | + if (hweight < AQ_VLAN_MAX_FILTERS && hweight > 0) { | |
| 847 | + err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, | |
| 848 | + !(aq_nic->packet_filter & IFF_PROMISC)); | |
| 849 | + aq_nic->aq_nic_cfg.is_vlan_force_promisc = false; | |
| 850 | + } else { | |
| 848 | 851 | /* otherwise left in promiscue mode */ |
| 852 | + aq_nic->aq_nic_cfg.is_vlan_force_promisc = true; | |
| 853 | + } | |
| 849 | 854 | } |
| 850 | 855 | |
| 851 | 856 | return err; |
| @@ -866,6 +871,7 @@ int aq_filters_vlan_offload_off(struct aq_nic_s *aq_nic) · 14 unmodified lines | ||
| 866 | 871 | if (unlikely(!aq_hw_ops->hw_filter_vlan_ctrl)) |
| 867 | 872 | return -EOPNOTSUPP; |
| 868 | 873 | |
| 874 | + aq_nic->aq_nic_cfg.is_vlan_force_promisc = true; | |
| 869 | 875 | err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false); |
| 870 | 876 | if (err) |
| 871 | 877 | return err; |
| @@ -128,6 +128,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self) · 127 unmodified lines | ||
| 128 | 128 | cfg->features = cfg->aq_hw_caps->hw_features; |
| 129 | 129 | cfg->is_vlan_rx_strip = !!(cfg->features & NETIF_F_HW_VLAN_CTAG_RX); |
| 130 | 130 | cfg->is_vlan_tx_insert = !!(cfg->features & NETIF_F_HW_VLAN_CTAG_TX); |
| 131 | + cfg->is_vlan_force_promisc = true; | |
| 131 | 132 | } |
| 132 | 133 | |
| 133 | 134 | static int aq_nic_update_link_status(struct aq_nic_s *self) |
| @@ -37,6 +37,7 @@ struct aq_nic_cfg_s { · 36 unmodified lines | ||
| 37 | 37 | u32 wol; |
| 38 | 38 | u8 is_vlan_rx_strip; |
| 39 | 39 | u8 is_vlan_tx_insert; |
| 40 | + bool is_vlan_force_promisc; | |
| 40 | 41 | u16 is_mc_list_enabled; |
| 41 | 42 | u16 mc_list_count; |
| 42 | 43 | bool is_autoneg; |
| @@ -808,8 +808,15 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, · 807 unmodified lines | ||
| 808 | 808 | unsigned int packet_filter) |
| 809 | 809 | { |
| 810 | 810 | unsigned int i = 0U; |
| 811 | + struct aq_nic_cfg_s *cfg = self->aq_nic_cfg; | |
| 812 | + | |
| 813 | + hw_atl_rpfl2promiscuous_mode_en_set(self, | |
| 814 | + IS_FILTER_ENABLED(IFF_PROMISC)); | |
| 815 | + | |
| 816 | + hw_atl_rpf_vlan_prom_mode_en_set(self, | |
| 817 | + IS_FILTER_ENABLED(IFF_PROMISC) || | |
| 818 | + cfg->is_vlan_force_promisc); | |
| 811 | 819 | |
| 812 | − hw_atl_rpfl2promiscuous_mode_en_set(self, IS_FILTER_ENABLED(IFF_PROMISC)); | |
| 813 | 820 | hw_atl_rpfl2multicast_flr_en_set(self, |
| 814 | 821 | IS_FILTER_ENABLED(IFF_ALLMULTI), 0); |
| 815 | 822 | |
| @@ -818,13 +825,13 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, · 2 unmodified lines | ||
| 818 | 825 | |
| 819 | 826 | hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST)); |
| 820 | 827 | |
| 821 | − self->aq_nic_cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST); | |
| 828 | + cfg->is_mc_list_enabled = IS_FILTER_ENABLED(IFF_MULTICAST); | |
| 822 | 829 | |
| 823 | 830 | for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i) |
| 824 | 831 | hw_atl_rpfl2_uc_flr_en_set(self, |
| 825 | − (self->aq_nic_cfg->is_mc_list_enabled && | |
| 826 | − (i <= self->aq_nic_cfg->mc_list_count)) ? | |
| 827 | − 1U : 0U, i); | |
| 832 | + (cfg->is_mc_list_enabled && | |
| 833 | + (i <= cfg->mc_list_count)) ? | |
| 834 | + 1U : 0U, i); | |
| 828 | 835 | |
| 829 | 836 | return aq_hw_err_from_flags(self); |
| 830 | 837 | } |
| @@ -1116,7 +1123,7 @@ static int hw_atl_b0_hw_vlan_set(struct aq_hw_s *self, · 285 unmodified lines | ||
| 1116 | 1123 | static int hw_atl_b0_hw_vlan_ctrl(struct aq_hw_s *self, bool enable) |
| 1117 | 1124 | { |
| 1118 | 1125 | /* set promisc in case of disabing the vland filter */ |
| 1119 | − hw_atl_rpf_vlan_prom_mode_en_set(self, !!!enable); | |
| 1126 | + hw_atl_rpf_vlan_prom_mode_en_set(self, !enable); | |
| 1120 | 1127 | |
| 1121 | 1128 | return aq_hw_err_from_flags(self); |
| 1122 | 1129 | } |
| @@ -4303,7 +4303,7 @@ static int macb_probe(struct platform_device *pdev) · 4302 unmodified lines | ||
| 4303 | 4303 | if (PTR_ERR(mac) == -EPROBE_DEFER) { |
| 4304 | 4304 | err = -EPROBE_DEFER; |
| 4305 | 4305 | goto err_out_free_netdev; |
| 4306 | − } else if (!IS_ERR(mac)) { | |
| 4306 | + } else if (!IS_ERR_OR_NULL(mac)) { | |
| 4307 | 4307 | ether_addr_copy(bp->dev->dev_addr, mac); |
| 4308 | 4308 | } else { |
| 4309 | 4309 | macb_get_hwaddr(bp); |
| @@ -891,7 +891,7 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test, · 890 unmodified lines | ||
| 891 | 891 | u64 *data) |
| 892 | 892 | { |
| 893 | 893 | struct be_adapter *adapter = netdev_priv(netdev); |
| 894 | − int status; | |
| 894 | + int status, cnt; | |
| 895 | 895 | u8 link_status = 0; |
| 896 | 896 | |
| 897 | 897 | if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) { |
| @@ -902,6 +902,9 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test, · 4 unmodified lines | ||
| 902 | 902 | |
| 903 | 903 | memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); |
| 904 | 904 | |
| 905 | + /* check link status before offline tests */ | |
| 906 | + link_status = netif_carrier_ok(netdev); | |
| 907 | + | |
| 905 | 908 | if (test->flags & ETH_TEST_FL_OFFLINE) { |
| 906 | 909 | if (be_loopback_test(adapter, BE_MAC_LOOPBACK, &data[0]) != 0) |
| 907 | 910 | test->flags |= ETH_TEST_FL_FAILED; |
| @@ -922,13 +925,26 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test, · 14 unmodified lines | ||
| 922 | 925 | test->flags |= ETH_TEST_FL_FAILED; |
| 923 | 926 | } |
| 924 | 927 | |
| 925 | − status = be_cmd_link_status_query(adapter, NULL, &link_status, 0); | |
| 926 | − if (status) { | |
| 927 | − test->flags |= ETH_TEST_FL_FAILED; | |
| 928 | − data[4] = -1; | |
| 929 | − } else if (!link_status) { | |
| 928 | + /* link status was down prior to test */ | |
| 929 | + if (!link_status) { | |
| 930 | 930 | test->flags |= ETH_TEST_FL_FAILED; |
| 931 | 931 | data[4] = 1; |
| 932 | + return; | |
| 933 | + } | |
| 934 | + | |
| 935 | + for (cnt = 10; cnt; cnt--) { | |
| 936 | + status = be_cmd_link_status_query(adapter, NULL, &link_status, | |
| 937 | + 0); | |
| 938 | + if (status) { | |
| 939 | + test->flags |= ETH_TEST_FL_FAILED; | |
| 940 | + data[4] = -1; | |
| 941 | + break; | |
| 942 | + } | |
| 943 | + | |
| 944 | + if (link_status) | |
| 945 | + break; | |
| 946 | + | |
| 947 | + msleep_interruptible(500); | |
| 932 | 948 | } |
| 933 | 949 | } |
| 934 | 950 | |
| @@ -1057,7 +1057,7 @@ sis900_open(struct net_device *net_dev) · 1056 unmodified lines | ||
| 1057 | 1057 | sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); |
| 1058 | 1058 | |
| 1059 | 1059 | /* Enable all known interrupts by setting the interrupt mask. */ |
| 1060 | − sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); | |
| 1060 | + sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC); | |
| 1061 | 1061 | sw32(cr, RxENA | sr32(cr)); |
| 1062 | 1062 | sw32(ier, IE); |
| 1063 | 1063 | |
| @@ -1578,7 +1578,7 @@ static void sis900_tx_timeout(struct net_device *net_dev) · 514 unmodified lines | ||
| 1578 | 1578 | sw32(txdp, sis_priv->tx_ring_dma); |
| 1579 | 1579 | |
| 1580 | 1580 | /* Enable all known interrupts by setting the interrupt mask. */ |
| 1581 | − sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); | |
| 1581 | + sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC); | |
| 1582 | 1582 | } |
| 1583 | 1583 | |
| 1584 | 1584 | /** |
| @@ -1618,7 +1618,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 33 unmodified lines | ||
| 1618 | 1618 | spin_unlock_irqrestore(&sis_priv->lock, flags); |
| 1619 | 1619 | return NETDEV_TX_OK; |
| 1620 | 1620 | } |
| 1621 | − sis_priv->tx_ring[entry].cmdsts = (OWN | skb->len); | |
| 1621 | + sis_priv->tx_ring[entry].cmdsts = (OWN | INTR | skb->len); | |
| 1622 | 1622 | sw32(cr, TxENA | sr32(cr)); |
| 1623 | 1623 | |
| 1624 | 1624 | sis_priv->cur_tx ++; |
| @@ -1674,7 +1674,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance) · 49 unmodified lines | ||
| 1674 | 1674 | do { |
| 1675 | 1675 | status = sr32(isr); |
| 1676 | 1676 | |
| 1677 | − if ((status & (HIBERR|TxURN|TxERR|TxIDLE|RxORN|RxERR|RxOK)) == 0) | |
| 1677 | + if ((status & (HIBERR|TxURN|TxERR|TxIDLE|TxDESC|RxORN|RxERR|RxOK)) == 0) | |
| 1678 | 1678 | /* nothing intresting happened */ |
| 1679 | 1679 | break; |
| 1680 | 1680 | handled = 1; |
| @@ -1684,7 +1684,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance) · 3 unmodified lines | ||
| 1684 | 1684 | /* Rx interrupt */ |
| 1685 | 1685 | sis900_rx(net_dev); |
| 1686 | 1686 | |
| 1687 | − if (status & (TxURN | TxERR | TxIDLE)) | |
| 1687 | + if (status & (TxURN | TxERR | TxIDLE | TxDESC)) | |
| 1688 | 1688 | /* Tx interrupt */ |
| 1689 | 1689 | sis900_finish_xmit(net_dev); |
| 1690 | 1690 | |
| @@ -1896,8 +1896,8 @@ static void sis900_finish_xmit (struct net_device *net_dev) · 205 unmodified lines | ||
| 1896 | 1896 | |
| 1897 | 1897 | if (tx_status & OWN) { |
| 1898 | 1898 | /* The packet is not transmitted yet (owned by hardware) ! |
| 1899 | − * Note: the interrupt is generated only when Tx Machine | |
| 1900 | − * is idle, so this is an almost impossible case */ | |
| 1899 | + * Note: this is an almost impossible condition | |
| 1900 | + * in case of TxDESC ('descriptor interrupt') */ | |
| 1901 | 1901 | break; |
| 1902 | 1902 | } |
| 1903 | 1903 | |
| @@ -2473,7 +2473,7 @@ static int sis900_resume(struct pci_dev *pci_dev) · 569 unmodified lines | ||
| 2473 | 2473 | sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED); |
| 2474 | 2474 | |
| 2475 | 2475 | /* Enable all known interrupts by setting the interrupt mask. */ |
| 2476 | − sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE); | |
| 2476 | + sw32(imr, RxSOVR | RxORN | RxERR | RxOK | TxURN | TxERR | TxIDLE | TxDESC); | |
| 2477 | 2477 | sw32(cr, RxENA | sr32(cr)); |
| 2478 | 2478 | sw32(ier, IE); |
| 2479 | 2479 | |
| @@ -112,7 +112,7 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec, · 111 unmodified lines | ||
| 112 | 112 | * programmed with (2^32 – <new_sec_value>) |
| 113 | 113 | */ |
| 114 | 114 | if (gmac4) |
| 115 | − sec = (100000000ULL - sec); | |
| 115 | + sec = -sec; | |
| 116 | 116 | |
| 117 | 117 | value = readl(ioaddr + PTP_TCR); |
| 118 | 118 | if (value & PTP_TCR_TSCTRLSSR) |
| @@ -2892,12 +2892,15 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 2891 unmodified lines | ||
| 2892 | 2892 | |
| 2893 | 2893 | /* Manage tx mitigation */ |
| 2894 | 2894 | tx_q->tx_count_frames += nfrags + 1; |
| 2895 | − if (priv->tx_coal_frames <= tx_q->tx_count_frames) { | |
| 2895 | + if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) && | |
| 2896 | + !(priv->synopsys_id >= DWMAC_CORE_4_00 && | |
| 2897 | + (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && | |
| 2898 | + priv->hwts_tx_en)) { | |
| 2899 | + stmmac_tx_timer_arm(priv, queue); | |
| 2900 | + } else { | |
| 2901 | + tx_q->tx_count_frames = 0; | |
| 2896 | 2902 | stmmac_set_tx_ic(priv, desc); |
| 2897 | 2903 | priv->xstats.tx_set_ic_bit++; |
| 2898 | − tx_q->tx_count_frames = 0; | |
| 2899 | − } else { | |
| 2900 | − stmmac_tx_timer_arm(priv, queue); | |
| 2901 | 2904 | } |
| 2902 | 2905 | |
| 2903 | 2906 | skb_tx_timestamp(skb); |
| @@ -3111,12 +3114,15 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) · 207 unmodified lines | ||
| 3111 | 3114 | * element in case of no SG. |
| 3112 | 3115 | */ |
| 3113 | 3116 | tx_q->tx_count_frames += nfrags + 1; |
| 3114 | − if (priv->tx_coal_frames <= tx_q->tx_count_frames) { | |
| 3117 | + if (likely(priv->tx_coal_frames > tx_q->tx_count_frames) && | |
| 3118 | + !(priv->synopsys_id >= DWMAC_CORE_4_00 && | |
| 3119 | + (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && | |
| 3120 | + priv->hwts_tx_en)) { | |
| 3121 | + stmmac_tx_timer_arm(priv, queue); | |
| 3122 | + } else { | |
| 3123 | + tx_q->tx_count_frames = 0; | |
| 3115 | 3124 | stmmac_set_tx_ic(priv, desc); |
| 3116 | 3125 | priv->xstats.tx_set_ic_bit++; |
| 3117 | − tx_q->tx_count_frames = 0; | |
| 3118 | − } else { | |
| 3119 | − stmmac_tx_timer_arm(priv, queue); | |
| 3120 | 3126 | } |
| 3121 | 3127 | |
| 3122 | 3128 | skb_tx_timestamp(skb); |
| @@ -63,6 +63,7 @@ MODULE_AUTHOR("Frank Cusack <fcusack@fcusack.com>"); · 62 unmodified lines | ||
| 63 | 63 | MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support"); |
| 64 | 64 | MODULE_LICENSE("Dual BSD/GPL"); |
| 65 | 65 | MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE)); |
| 66 | +MODULE_SOFTDEP("pre: arc4"); | |
| 66 | 67 | MODULE_VERSION("1.0.2"); |
| 67 | 68 | |
| 68 | 69 | static unsigned int |
| @@ -2153,12 +2153,12 @@ static void team_setup(struct net_device *dev) · 2152 unmodified lines | ||
| 2153 | 2153 | dev->features |= NETIF_F_NETNS_LOCAL; |
| 2154 | 2154 | |
| 2155 | 2155 | dev->hw_features = TEAM_VLAN_FEATURES | |
| 2156 | − NETIF_F_HW_VLAN_CTAG_TX | | |
| 2157 | 2156 | NETIF_F_HW_VLAN_CTAG_RX | |
| 2158 | 2157 | NETIF_F_HW_VLAN_CTAG_FILTER; |
| 2159 | 2158 | |
| 2160 | 2159 | dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4; |
| 2161 | 2160 | dev->features |= dev->hw_features; |
| 2161 | + dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX; | |
| 2162 | 2162 | } |
| 2163 | 2163 | |
| 2164 | 2164 | static int team_newlink(struct net *src_net, struct net_device *dev, |
| @@ -1482,7 +1482,7 @@ static int qmi_wwan_probe(struct usb_interface *intf, · 1481 unmodified lines | ||
| 1482 | 1482 | * different. Ignore the current interface if the number of endpoints |
| 1483 | 1483 | * equals the number for the diag interface (two). |
| 1484 | 1484 | */ |
| 1485 | − info = (void *)&id->driver_info; | |
| 1485 | + info = (void *)id->driver_info; | |
| 1486 | 1486 | |
| 1487 | 1487 | if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) { |
| 1488 | 1488 | if (desc->bNumEndpoints == 2) |
| @@ -350,8 +350,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk, · 349 unmodified lines | ||
| 350 | 350 | { |
| 351 | 351 | struct dst_entry *dst = skb_dst(skb); |
| 352 | 352 | struct net_device *dev = dst->dev; |
| 353 | + const struct in6_addr *nexthop; | |
| 353 | 354 | struct neighbour *neigh; |
| 354 | − struct in6_addr *nexthop; | |
| 355 | 355 | int ret; |
| 356 | 356 | |
| 357 | 357 | nf_reset(skb); |
| @@ -18,6 +18,7 @@ · 17 unmodified lines | ||
| 18 | 18 | #include <linux/percpu-refcount.h> |
| 19 | 19 | #include <linux/random.h> |
| 20 | 20 | #include <linux/seq_buf.h> |
| 21 | +#include <linux/iommu.h> | |
| 21 | 22 | |
| 22 | 23 | struct pci_p2pdma { |
| 23 | 24 | struct gen_pool *pool; |
| @@ -299,6 +300,9 @@ static bool root_complex_whitelist(struct pci_dev *dev) · 275 unmodified lines | ||
| 299 | 300 | struct pci_dev *root = pci_get_slot(host->bus, PCI_DEVFN(0, 0)); |
| 300 | 301 | unsigned short vendor, device; |
| 301 | 302 | |
| 303 | + if (iommu_present(dev->dev.bus)) | |
| 304 | + return false; | |
| 305 | + | |
| 302 | 306 | if (!root) |
| 303 | 307 | return false; |
| 304 | 308 | |
| @@ -987,6 +987,9 @@ static int qedi_find_boot_info(struct qedi_ctx *qedi, · 986 unmodified lines | ||
| 987 | 987 | if (!iscsi_is_session_online(cls_sess)) |
| 988 | 988 | continue; |
| 989 | 989 | |
| 990 | + if (!sess->targetname) | |
| 991 | + continue; | |
| 992 | + | |
| 990 | 993 | if (pri_ctrl_flags) { |
| 991 | 994 | if (!strcmp(pri_tgt->iscsi_name, sess->targetname) && |
| 992 | 995 | !strcmp(pri_tgt->ip_addr, ep_ip_addr)) { |
| @@ -4,8 +4,8 @@ · 3 unmodified lines | ||
| 4 | 4 | * Copyright (c) 2016 Cavium Inc. |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | −#define QEDI_MODULE_VERSION "8.33.0.21" | |
| 7 | +#define QEDI_MODULE_VERSION "8.37.0.20" | |
| 8 | 8 | #define QEDI_DRIVER_MAJOR_VER 8 |
| 9 | −#define QEDI_DRIVER_MINOR_VER 33 | |
| 9 | +#define QEDI_DRIVER_MINOR_VER 37 | |
| 10 | 10 | #define QEDI_DRIVER_REV_VER 0 |
| 11 | −#define QEDI_DRIVER_ENG_VER 21 | |
| 11 | +#define QEDI_DRIVER_ENG_VER 20 | |
| @@ -1731,8 +1731,8 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res, · 1730 unmodified lines | ||
| 1731 | 1731 | !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) && |
| 1732 | 1732 | !qla2x00_isp_reg_stat(ha))) { |
| 1733 | 1733 | sp->comp = ∁ |
| 1734 | − rval = ha->isp_ops->abort_command(sp); | |
| 1735 | 1734 | spin_unlock_irqrestore(qp->qp_lock_ptr, *flags); |
| 1735 | + rval = ha->isp_ops->abort_command(sp); | |
| 1736 | 1736 | |
| 1737 | 1737 | switch (rval) { |
| 1738 | 1738 | case QLA_SUCCESS: |
| @@ -430,24 +430,21 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, · 429 unmodified lines | ||
| 430 | 430 | goto dealloc_host; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | − pm_runtime_set_active(&pdev->dev); | |
| 434 | − pm_runtime_enable(&pdev->dev); | |
| 435 | − | |
| 436 | 433 | ufshcd_init_lanes_per_dir(hba); |
| 437 | 434 | |
| 438 | 435 | err = ufshcd_init(hba, mmio_base, irq); |
| 439 | 436 | if (err) { |
| 440 | 437 | dev_err(dev, "Initialization failed\n"); |
| 441 | − goto out_disable_rpm; | |
| 438 | + goto dealloc_host; | |
| 442 | 439 | } |
| 443 | 440 | |
| 444 | 441 | platform_set_drvdata(pdev, hba); |
| 445 | 442 | |
| 443 | + pm_runtime_set_active(&pdev->dev); | |
| 444 | + pm_runtime_enable(&pdev->dev); | |
| 445 | + | |
| 446 | 446 | return 0; |
| 447 | 447 | |
| 448 | −out_disable_rpm: | |
| 449 | − pm_runtime_disable(&pdev->dev); | |
| 450 | − pm_runtime_set_suspended(&pdev->dev); | |
| 451 | 448 | dealloc_host: |
| 452 | 449 | ufshcd_dealloc_host(hba); |
| 453 | 450 | out: |
| @@ -275,9 +275,9 @@ static void afs_break_one_callback(struct afs_server *server, · 274 unmodified lines | ||
| 275 | 275 | struct afs_super_info *as = AFS_FS_S(cbi->sb); |
| 276 | 276 | struct afs_volume *volume = as->volume; |
| 277 | 277 | |
| 278 | − write_lock(&volume->cb_break_lock); | |
| 278 | + write_lock(&volume->cb_v_break_lock); | |
| 279 | 279 | volume->cb_v_break++; |
| 280 | − write_unlock(&volume->cb_break_lock); | |
| 280 | + write_unlock(&volume->cb_v_break_lock); | |
| 281 | 281 | } else { |
| 282 | 282 | data.volume = NULL; |
| 283 | 283 | data.fid = *fid; |
| @@ -55,6 +55,16 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren · 54 unmodified lines | ||
| 55 | 55 | dump_stack(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | +/* | |
| 59 | + * Set the file size and block count. Estimate the number of 512 bytes blocks | |
| 60 | + * used, rounded up to nearest 1K for consistency with other AFS clients. | |
| 61 | + */ | |
| 62 | +static void afs_set_i_size(struct afs_vnode *vnode, u64 size) | |
| 63 | +{ | |
| 64 | + i_size_write(&vnode->vfs_inode, size); | |
| 65 | + vnode->vfs_inode.i_blocks = ((size + 1023) >> 10) << 1; | |
| 66 | +} | |
| 67 | + | |
| 58 | 68 | /* |
| 59 | 69 | * Initialise an inode from the vnode status. |
| 60 | 70 | */ |
| @@ -124,12 +134,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key, · 63 unmodified lines | ||
| 124 | 134 | return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type); |
| 125 | 135 | } |
| 126 | 136 | |
| 127 | − /* | |
| 128 | − * Estimate 512 bytes blocks used, rounded up to nearest 1K | |
| 129 | − * for consistency with other AFS clients. | |
| 130 | − */ | |
| 131 | − inode->i_blocks = ((i_size_read(inode) + 1023) >> 10) << 1; | |
| 132 | − i_size_write(&vnode->vfs_inode, status->size); | |
| 137 | + afs_set_i_size(vnode, status->size); | |
| 133 | 138 | |
| 134 | 139 | vnode->invalid_before = status->data_version; |
| 135 | 140 | inode_set_iversion_raw(&vnode->vfs_inode, status->data_version); |
| @@ -207,11 +212,13 @@ static void afs_apply_status(struct afs_fs_cursor *fc, · 71 unmodified lines | ||
| 207 | 212 | |
| 208 | 213 | if (expected_version && |
| 209 | 214 | *expected_version != status->data_version) { |
| 210 | − kdebug("vnode modified %llx on {%llx:%llu} [exp %llx] %s", | |
| 211 | − (unsigned long long) status->data_version, | |
| 212 | − vnode->fid.vid, vnode->fid.vnode, | |
| 213 | − (unsigned long long) *expected_version, | |
| 214 | − fc->type ? fc->type->name : "???"); | |
| 215 | + if (test_bit(AFS_VNODE_CB_PROMISED, &vnode->flags)) | |
| 216 | + pr_warn("kAFS: vnode modified {%llx:%llu} %llx->%llx %s\n", | |
| 217 | + vnode->fid.vid, vnode->fid.vnode, | |
| 218 | + (unsigned long long)*expected_version, | |
| 219 | + (unsigned long long)status->data_version, | |
| 220 | + fc->type ? fc->type->name : "???"); | |
| 221 | + | |
| 215 | 222 | vnode->invalid_before = status->data_version; |
| 216 | 223 | if (vnode->status.type == AFS_FTYPE_DIR) { |
| 217 | 224 | if (test_and_clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags)) |
| @@ -230,7 +237,7 @@ static void afs_apply_status(struct afs_fs_cursor *fc, · 12 unmodified lines | ||
| 230 | 237 | |
| 231 | 238 | if (data_changed) { |
| 232 | 239 | inode_set_iversion_raw(&vnode->vfs_inode, status->data_version); |
| 233 | − i_size_write(&vnode->vfs_inode, status->size); | |
| 240 | + afs_set_i_size(vnode, status->size); | |
| 234 | 241 | } |
| 235 | 242 | } |
| 236 | 243 | |
| @@ -109,10 +109,8 @@ struct afs_call { · 108 unmodified lines | ||
| 109 | 109 | struct rxrpc_call *rxcall; /* RxRPC call handle */ |
| 110 | 110 | struct key *key; /* security for this call */ |
| 111 | 111 | struct afs_net *net; /* The network namespace */ |
| 112 | − union { | |
| 113 | − struct afs_server *server; | |
| 114 | − struct afs_vlserver *vlserver; | |
| 115 | − }; | |
| 112 | + struct afs_server *server; /* The fileserver record if fs op (pins ref) */ | |
| 113 | + struct afs_vlserver *vlserver; /* The vlserver record if vl op */ | |
| 116 | 114 | struct afs_cb_interest *cbi; /* Callback interest for server used */ |
| 117 | 115 | struct afs_vnode *lvnode; /* vnode being locked */ |
| 118 | 116 | void *request; /* request data (first part) */ |
| @@ -616,7 +614,7 @@ struct afs_volume { · 497 unmodified lines | ||
| 616 | 614 | unsigned int servers_seq; /* Incremented each time ->servers changes */ |
| 617 | 615 | |
| 618 | 616 | unsigned cb_v_break; /* Break-everything counter. */ |
| 619 | − rwlock_t cb_break_lock; | |
| 617 | + rwlock_t cb_v_break_lock; | |
| 620 | 618 | |
| 621 | 619 | afs_voltype_t type; /* type of volume */ |
| 622 | 620 | short error; |
| @@ -43,6 +43,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_fs_context *params, · 42 unmodified lines | ||
| 43 | 43 | atomic_set(&volume->usage, 1); |
| 44 | 44 | INIT_LIST_HEAD(&volume->proc_link); |
| 45 | 45 | rwlock_init(&volume->servers_lock); |
| 46 | + rwlock_init(&volume->cb_v_break_lock); | |
| 46 | 47 | memcpy(volume->name, vldb->name, vldb->name_len + 1); |
| 47 | 48 | |
| 48 | 49 | slist = afs_alloc_server_list(params->cell, params->key, vldb, type_mask); |
| @@ -3077,8 +3077,7 @@ static const struct file_operations proc_tgid_base_operations = { · 3076 unmodified lines | ||
| 3077 | 3077 | |
| 3078 | 3078 | struct pid *tgid_pidfd_to_pid(const struct file *file) |
| 3079 | 3079 | { |
| 3080 | − if (!d_is_dir(file->f_path.dentry) || | |
| 3081 | − (file->f_op != &proc_tgid_base_operations)) | |
| 3080 | + if (file->f_op != &proc_tgid_base_operations) | |
| 3082 | 3081 | return ERR_PTR(-EBADF); |
| 3083 | 3082 | |
| 3084 | 3083 | return proc_pid(file_inode(file)); |
| @@ -130,7 +130,7 @@ · 129 unmodified lines | ||
| 130 | 130 | #define CLKID_MALI_1_SEL 172 |
| 131 | 131 | #define CLKID_MALI_1 174 |
| 132 | 132 | #define CLKID_MALI 175 |
| 133 | −#define CLKID_MPLL_5OM 177 | |
| 133 | +#define CLKID_MPLL_50M 177 | |
| 134 | 134 | #define CLKID_CPU_CLK 187 |
| 135 | 135 | #define CLKID_PCIE_PLL 201 |
| 136 | 136 | #define CLKID_VDEC_1 204 |
| @@ -103,6 +103,7 @@ void ishtp_put_device(struct ishtp_cl_device *cl_dev); · 102 unmodified lines | ||
| 103 | 103 | void ishtp_get_device(struct ishtp_cl_device *cl_dev); |
| 104 | 104 | void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data); |
| 105 | 105 | void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device); |
| 106 | +struct ishtp_cl_device *ishtp_dev_to_cl_device(struct device *dev); | |
| 106 | 107 | int ishtp_register_event_cb(struct ishtp_cl_device *device, |
| 107 | 108 | void (*read_cb)(struct ishtp_cl_device *)); |
| 108 | 109 | struct ishtp_fw_client *ishtp_fw_cl_get_client(struct ishtp_device *dev, |
| @@ -373,6 +373,8 @@ struct flash_info; · 372 unmodified lines | ||
| 373 | 373 | * @flash_unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR |
| 374 | 374 | * @flash_is_locked: [FLASH-SPECIFIC] check if a region of the SPI NOR is |
| 375 | 375 | * @quad_enable: [FLASH-SPECIFIC] enables SPI NOR quad mode |
| 376 | + * @clear_sr_bp: [FLASH-SPECIFIC] clears the Block Protection Bits from | |
| 377 | + * the SPI NOR Status Register. | |
| 376 | 378 | * completely locked |
| 377 | 379 | * @priv: the private data |
| 378 | 380 | */ |
| @@ -410,6 +412,7 @@ struct spi_nor { · 31 unmodified lines | ||
| 410 | 412 | int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len); |
| 411 | 413 | int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len); |
| 412 | 414 | int (*quad_enable)(struct spi_nor *nor); |
| 415 | + int (*clear_sr_bp)(struct spi_nor *nor); | |
| 413 | 416 | |
| 414 | 417 | void *priv; |
| 415 | 418 | }; |
| @@ -281,8 +281,8 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk) · 280 unmodified lines | ||
| 281 | 281 | inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | −static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt, | |
| 285 | − struct in6_addr *daddr) | |
| 284 | +static inline const struct in6_addr *rt6_nexthop(const struct rt6_info *rt, | |
| 285 | + const struct in6_addr *daddr) | |
| 286 | 286 | { |
| 287 | 287 | if (rt->rt6i_flags & RTF_GATEWAY) |
| 288 | 288 | return &rt->rt6i_gateway; |
| @@ -221,6 +221,7 @@ void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); · 220 unmodified lines | ||
| 221 | 221 | struct rtable *rt_dst_alloc(struct net_device *dev, |
| 222 | 222 | unsigned int flags, u16 type, |
| 223 | 223 | bool nopolicy, bool noxfrm, bool will_cache); |
| 224 | +struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt); | |
| 224 | 225 | |
| 225 | 226 | struct in_ifaddr; |
| 226 | 227 | void fib_add_ifaddr(struct in_ifaddr *); |
| @@ -407,21 +407,6 @@ static inline bool tls_is_partially_sent_record(struct tls_context *ctx) · 406 unmodified lines | ||
| 407 | 407 | return !!ctx->partially_sent_record; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | −static inline int tls_complete_pending_work(struct sock *sk, | |
| 411 | − struct tls_context *ctx, | |
| 412 | − int flags, long *timeo) | |
| 413 | −{ | |
| 414 | − int rc = 0; | |
| 415 | − | |
| 416 | − if (unlikely(sk->sk_write_pending)) | |
| 417 | − rc = wait_on_pending_writer(sk, timeo); | |
| 418 | − | |
| 419 | − if (!rc && tls_is_partially_sent_record(ctx)) | |
| 420 | − rc = tls_push_partial_record(sk, ctx, flags); | |
| 421 | − | |
| 422 | − return rc; | |
| 423 | −} | |
| 424 | − | |
| 425 | 410 | static inline bool tls_is_pending_open_record(struct tls_context *tls_ctx) |
| 426 | 411 | { |
| 427 | 412 | return tls_ctx->pending_open_record_frags; |
| @@ -1712,31 +1712,6 @@ const struct file_operations pidfd_fops = { · 1711 unmodified lines | ||
| 1712 | 1712 | #endif |
| 1713 | 1713 | }; |
| 1714 | 1714 | |
| 1715 | −/** | |
| 1716 | − * pidfd_create() - Create a new pid file descriptor. | |
| 1717 | − * | |
| 1718 | − * @pid: struct pid that the pidfd will reference | |
| 1719 | − * | |
| 1720 | − * This creates a new pid file descriptor with the O_CLOEXEC flag set. | |
| 1721 | − * | |
| 1722 | − * Note, that this function can only be called after the fd table has | |
| 1723 | − * been unshared to avoid leaking the pidfd to the new process. | |
| 1724 | − * | |
| 1725 | − * Return: On success, a cloexec pidfd is returned. | |
| 1726 | − * On error, a negative errno number will be returned. | |
| 1727 | − */ | |
| 1728 | −static int pidfd_create(struct pid *pid) | |
| 1729 | −{ | |
| 1730 | − int fd; | |
| 1731 | − | |
| 1732 | − fd = anon_inode_getfd("[pidfd]", &pidfd_fops, get_pid(pid), | |
| 1733 | − O_RDWR | O_CLOEXEC); | |
| 1734 | − if (fd < 0) | |
| 1735 | − put_pid(pid); | |
| 1736 | − | |
| 1737 | − return fd; | |
| 1738 | −} | |
| 1739 | − | |
| 1740 | 1715 | static void __delayed_free_task(struct rcu_head *rhp) |
| 1741 | 1716 | { |
| 1742 | 1717 | struct task_struct *tsk = container_of(rhp, struct task_struct, rcu); |
| @@ -1774,6 +1749,7 @@ static __latent_entropy struct task_struct *copy_process( · 31 unmodified lines | ||
| 1774 | 1749 | int pidfd = -1, retval; |
| 1775 | 1750 | struct task_struct *p; |
| 1776 | 1751 | struct multiprocess_signals delayed; |
| 1752 | + struct file *pidfile = NULL; | |
| 1777 | 1753 | |
| 1778 | 1754 | /* |
| 1779 | 1755 | * Don't allow sharing the root directory with processes in a different |
| @@ -1822,8 +1798,6 @@ static __latent_entropy struct task_struct *copy_process( · 42 unmodified lines | ||
| 1822 | 1798 | } |
| 1823 | 1799 | |
| 1824 | 1800 | if (clone_flags & CLONE_PIDFD) { |
| 1825 | − int reserved; | |
| 1826 | − | |
| 1827 | 1801 | /* |
| 1828 | 1802 | * - CLONE_PARENT_SETTID is useless for pidfds and also |
| 1829 | 1803 | * parent_tidptr is used to return pidfds. |
| @@ -1834,16 +1808,6 @@ static __latent_entropy struct task_struct *copy_process( · 4 unmodified lines | ||
| 1834 | 1808 | if (clone_flags & |
| 1835 | 1809 | (CLONE_DETACHED | CLONE_PARENT_SETTID | CLONE_THREAD)) |
| 1836 | 1810 | return ERR_PTR(-EINVAL); |
| 1837 | − | |
| 1838 | − /* | |
| 1839 | − * Verify that parent_tidptr is sane so we can potentially | |
| 1840 | − * reuse it later. | |
| 1841 | − */ | |
| 1842 | − if (get_user(reserved, parent_tidptr)) | |
| 1843 | − return ERR_PTR(-EFAULT); | |
| 1844 | − | |
| 1845 | − if (reserved != 0) | |
| 1846 | − return ERR_PTR(-EINVAL); | |
| 1847 | 1811 | } |
| 1848 | 1812 | |
| 1849 | 1813 | /* |
| @@ -2058,11 +2022,20 @@ static __latent_entropy struct task_struct *copy_process( · 208 unmodified lines | ||
| 2058 | 2022 | * if the fd table isn't shared). |
| 2059 | 2023 | */ |
| 2060 | 2024 | if (clone_flags & CLONE_PIDFD) { |
| 2061 | − retval = pidfd_create(pid); | |
| 2025 | + retval = get_unused_fd_flags(O_RDWR | O_CLOEXEC); | |
| 2062 | 2026 | if (retval < 0) |
| 2063 | 2027 | goto bad_fork_free_pid; |
| 2064 | 2028 | |
| 2065 | 2029 | pidfd = retval; |
| 2030 | + | |
| 2031 | + pidfile = anon_inode_getfile("[pidfd]", &pidfd_fops, pid, | |
| 2032 | + O_RDWR | O_CLOEXEC); | |
| 2033 | + if (IS_ERR(pidfile)) { | |
| 2034 | + put_unused_fd(pidfd); | |
| 2035 | + goto bad_fork_free_pid; | |
| 2036 | + } | |
| 2037 | + get_pid(pid); /* held by pidfile now */ | |
| 2038 | + | |
| 2066 | 2039 | retval = put_user(pidfd, parent_tidptr); |
| 2067 | 2040 | if (retval) |
| 2068 | 2041 | goto bad_fork_put_pidfd; |
| @@ -2180,6 +2153,9 @@ static __latent_entropy struct task_struct *copy_process( · 111 unmodified lines | ||
| 2180 | 2153 | goto bad_fork_cancel_cgroup; |
| 2181 | 2154 | } |
| 2182 | 2155 | |
| 2156 | + /* past the last point of failure */ | |
| 2157 | + if (pidfile) | |
| 2158 | + fd_install(pidfd, pidfile); | |
| 2183 | 2159 | |
| 2184 | 2160 | init_task_pid_links(p); |
| 2185 | 2161 | if (likely(p->pid)) { |
| @@ -2246,8 +2222,10 @@ bad_fork_cancel_cgroup: · 60 unmodified lines | ||
| 2246 | 2222 | bad_fork_cgroup_threadgroup_change_end: |
| 2247 | 2223 | cgroup_threadgroup_change_end(current); |
| 2248 | 2224 | bad_fork_put_pidfd: |
| 2249 | − if (clone_flags & CLONE_PIDFD) | |
| 2250 | − ksys_close(pidfd); | |
| 2225 | + if (clone_flags & CLONE_PIDFD) { | |
| 2226 | + fput(pidfile); | |
| 2227 | + put_unused_fd(pidfd); | |
| 2228 | + } | |
| 2251 | 2229 | bad_fork_free_pid: |
| 2252 | 2230 | if (pid != &init_struct_pid) |
| 2253 | 2231 | free_pid(pid); |
| @@ -160,10 +160,10 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev, · 159 unmodified lines | ||
| 160 | 160 | struct in6_addr *daddr, |
| 161 | 161 | struct sk_buff *skb) |
| 162 | 162 | { |
| 163 | − struct lowpan_peer *peer; | |
| 164 | − struct in6_addr *nexthop; | |
| 165 | 163 | struct rt6_info *rt = (struct rt6_info *)skb_dst(skb); |
| 166 | 164 | int count = atomic_read(&dev->peer_count); |
| 165 | + const struct in6_addr *nexthop; | |
| 166 | + struct lowpan_peer *peer; | |
| 167 | 167 | |
| 168 | 168 | BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt); |
| 169 | 169 | |
| @@ -1276,14 +1276,6 @@ int hci_conn_check_link_mode(struct hci_conn *conn) · 1275 unmodified lines | ||
| 1276 | 1276 | !test_bit(HCI_CONN_ENCRYPT, &conn->flags)) |
| 1277 | 1277 | return 0; |
| 1278 | 1278 | |
| 1279 | − /* The minimum encryption key size needs to be enforced by the | |
| 1280 | − * host stack before establishing any L2CAP connections. The | |
| 1281 | − * specification in theory allows a minimum of 1, but to align | |
| 1282 | − * BR/EDR and LE transports, a minimum of 7 is chosen. | |
| 1283 | − */ | |
| 1284 | − if (conn->enc_key_size < HCI_MIN_ENC_KEY_SIZE) | |
| 1285 | − return 0; | |
| 1286 | − | |
| 1287 | 1279 | return 1; |
| 1288 | 1280 | } |
| 1289 | 1281 | |
| @@ -1400,8 +1392,16 @@ auth: · 110 unmodified lines | ||
| 1400 | 1392 | return 0; |
| 1401 | 1393 | |
| 1402 | 1394 | encrypt: |
| 1403 | − if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) | |
| 1395 | + if (test_bit(HCI_CONN_ENCRYPT, &conn->flags)) { | |
| 1396 | + /* Ensure that the encryption key size has been read, | |
| 1397 | + * otherwise stall the upper layer responses. | |
| 1398 | + */ | |
| 1399 | + if (!conn->enc_key_size) | |
| 1400 | + return 0; | |
| 1401 | + | |
| 1402 | + /* Nothing else needed, all requirements are met */ | |
| 1404 | 1403 | return 1; |
| 1404 | + } | |
| 1405 | 1405 | |
| 1406 | 1406 | hci_conn_encrypt(conn); |
| 1407 | 1407 | return 0; |
| @@ -1341,6 +1341,21 @@ static void l2cap_request_info(struct l2cap_conn *conn) · 1340 unmodified lines | ||
| 1341 | 1341 | sizeof(req), &req); |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | +static bool l2cap_check_enc_key_size(struct hci_conn *hcon) | |
| 1345 | +{ | |
| 1346 | + /* The minimum encryption key size needs to be enforced by the | |
| 1347 | + * host stack before establishing any L2CAP connections. The | |
| 1348 | + * specification in theory allows a minimum of 1, but to align | |
| 1349 | + * BR/EDR and LE transports, a minimum of 7 is chosen. | |
| 1350 | + * | |
| 1351 | + * This check might also be called for unencrypted connections | |
| 1352 | + * that have no key size requirements. Ensure that the link is | |
| 1353 | + * actually encrypted before enforcing a key size. | |
| 1354 | + */ | |
| 1355 | + return (!test_bit(HCI_CONN_ENCRYPT, &hcon->flags) || | |
| 1356 | + hcon->enc_key_size > HCI_MIN_ENC_KEY_SIZE); | |
| 1357 | +} | |
| 1358 | + | |
| 1344 | 1359 | static void l2cap_do_start(struct l2cap_chan *chan) |
| 1345 | 1360 | { |
| 1346 | 1361 | struct l2cap_conn *conn = chan->conn; |
| @@ -1358,9 +1373,14 @@ static void l2cap_do_start(struct l2cap_chan *chan) · 11 unmodified lines | ||
| 1358 | 1373 | if (!(conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE)) |
| 1359 | 1374 | return; |
| 1360 | 1375 | |
| 1361 | − if (l2cap_chan_check_security(chan, true) && | |
| 1362 | − __l2cap_no_conn_pending(chan)) | |
| 1376 | + if (!l2cap_chan_check_security(chan, true) || | |
| 1377 | + !__l2cap_no_conn_pending(chan)) | |
| 1378 | + return; | |
| 1379 | + | |
| 1380 | + if (l2cap_check_enc_key_size(conn->hcon)) | |
| 1363 | 1381 | l2cap_start_connection(chan); |
| 1382 | + else | |
| 1383 | + __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); | |
| 1364 | 1384 | } |
| 1365 | 1385 | |
| 1366 | 1386 | static inline int l2cap_mode_supported(__u8 mode, __u32 feat_mask) |
| @@ -1439,7 +1459,10 @@ static void l2cap_conn_start(struct l2cap_conn *conn) · 72 unmodified lines | ||
| 1439 | 1459 | continue; |
| 1440 | 1460 | } |
| 1441 | 1461 | |
| 1442 | − l2cap_start_connection(chan); | |
| 1462 | + if (l2cap_check_enc_key_size(conn->hcon)) | |
| 1463 | + l2cap_start_connection(chan); | |
| 1464 | + else | |
| 1465 | + l2cap_chan_close(chan, ECONNREFUSED); | |
| 1443 | 1466 | |
| 1444 | 1467 | } else if (chan->state == BT_CONNECT2) { |
| 1445 | 1468 | struct l2cap_conn_rsp rsp; |
| @@ -7490,7 +7513,7 @@ static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) · 6044 unmodified lines | ||
| 7490 | 7513 | } |
| 7491 | 7514 | |
| 7492 | 7515 | if (chan->state == BT_CONNECT) { |
| 7493 | − if (!status) | |
| 7516 | + if (!status && l2cap_check_enc_key_size(hcon)) | |
| 7494 | 7517 | l2cap_start_connection(chan); |
| 7495 | 7518 | else |
| 7496 | 7519 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); |
| @@ -7499,7 +7522,7 @@ static void l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) · 2 unmodified lines | ||
| 7499 | 7522 | struct l2cap_conn_rsp rsp; |
| 7500 | 7523 | __u16 res, stat; |
| 7501 | 7524 | |
| 7502 | − if (!status) { | |
| 7525 | + if (!status && l2cap_check_enc_key_size(hcon)) { | |
| 7503 | 7526 | if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) { |
| 7504 | 7527 | res = L2CAP_CR_PEND; |
| 7505 | 7528 | stat = L2CAP_CS_AUTHOR_PEND; |
| @@ -327,18 +327,35 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk · 326 unmodified lines | ||
| 327 | 327 | static int ip_mc_finish_output(struct net *net, struct sock *sk, |
| 328 | 328 | struct sk_buff *skb) |
| 329 | 329 | { |
| 330 | − int ret; | |
| 330 | + struct rtable *new_rt; | |
| 331 | + bool do_cn = false; | |
| 332 | + int ret, err; | |
| 331 | 333 | |
| 332 | 334 | ret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb); |
| 333 | 335 | switch (ret) { |
| 334 | − case NET_XMIT_SUCCESS: | |
| 335 | − return dev_loopback_xmit(net, sk, skb); | |
| 336 | 336 | case NET_XMIT_CN: |
| 337 | − return dev_loopback_xmit(net, sk, skb) ? : ret; | |
| 337 | + do_cn = true; | |
| 338 | + /* fall through */ | |
| 339 | + case NET_XMIT_SUCCESS: | |
| 340 | + break; | |
| 338 | 341 | default: |
| 339 | 342 | kfree_skb(skb); |
| 340 | 343 | return ret; |
| 341 | 344 | } |
| 345 | + | |
| 346 | + /* Reset rt_iif so that inet_iif() will return skb->skb_iif. Setting | |
| 347 | + * this to non-zero causes ipi_ifindex in in_pktinfo to be overwritten, | |
| 348 | + * see ipv4_pktinfo_prepare(). | |
| 349 | + */ | |
| 350 | + new_rt = rt_dst_clone(net->loopback_dev, skb_rtable(skb)); | |
| 351 | + if (new_rt) { | |
| 352 | + new_rt->rt_iif = 0; | |
| 353 | + skb_dst_drop(skb); | |
| 354 | + skb_dst_set(skb, &new_rt->dst); | |
| 355 | + } | |
| 356 | + | |
| 357 | + err = dev_loopback_xmit(net, sk, skb); | |
| 358 | + return (do_cn && err) ? ret : err; | |
| 342 | 359 | } |
| 343 | 360 | |
| 344 | 361 | int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb) |
| @@ -197,7 +197,7 @@ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash) · 196 unmodified lines | ||
| 197 | 197 | } |
| 198 | 198 | sk = __raw_v4_lookup(net, sk_next(sk), iph->protocol, |
| 199 | 199 | iph->saddr, iph->daddr, |
| 200 | − skb->dev->ifindex, sdif); | |
| 200 | + dif, sdif); | |
| 201 | 201 | } |
| 202 | 202 | out: |
| 203 | 203 | read_unlock(&raw_v4_hashinfo.lock); |
| @@ -1648,6 +1648,39 @@ struct rtable *rt_dst_alloc(struct net_device *dev, · 1647 unmodified lines | ||
| 1648 | 1648 | } |
| 1649 | 1649 | EXPORT_SYMBOL(rt_dst_alloc); |
| 1650 | 1650 | |
| 1651 | +struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt) | |
| 1652 | +{ | |
| 1653 | + struct rtable *new_rt; | |
| 1654 | + | |
| 1655 | + new_rt = dst_alloc(&ipv4_dst_ops, dev, 1, DST_OBSOLETE_FORCE_CHK, | |
| 1656 | + rt->dst.flags); | |
| 1657 | + | |
| 1658 | + if (new_rt) { | |
| 1659 | + new_rt->rt_genid = rt_genid_ipv4(dev_net(dev)); | |
| 1660 | + new_rt->rt_flags = rt->rt_flags; | |
| 1661 | + new_rt->rt_type = rt->rt_type; | |
| 1662 | + new_rt->rt_is_input = rt->rt_is_input; | |
| 1663 | + new_rt->rt_iif = rt->rt_iif; | |
| 1664 | + new_rt->rt_pmtu = rt->rt_pmtu; | |
| 1665 | + new_rt->rt_mtu_locked = rt->rt_mtu_locked; | |
| 1666 | + new_rt->rt_gw_family = rt->rt_gw_family; | |
| 1667 | + if (rt->rt_gw_family == AF_INET) | |
| 1668 | + new_rt->rt_gw4 = rt->rt_gw4; | |
| 1669 | + else if (rt->rt_gw_family == AF_INET6) | |
| 1670 | + new_rt->rt_gw6 = rt->rt_gw6; | |
| 1671 | + INIT_LIST_HEAD(&new_rt->rt_uncached); | |
| 1672 | + | |
| 1673 | + new_rt->dst.flags |= DST_HOST; | |
| 1674 | + new_rt->dst.input = rt->dst.input; | |
| 1675 | + new_rt->dst.output = rt->dst.output; | |
| 1676 | + new_rt->dst.error = rt->dst.error; | |
| 1677 | + new_rt->dst.lastuse = jiffies; | |
| 1678 | + new_rt->dst.lwtstate = lwtstate_get(rt->dst.lwtstate); | |
| 1679 | + } | |
| 1680 | + return new_rt; | |
| 1681 | +} | |
| 1682 | +EXPORT_SYMBOL(rt_dst_clone); | |
| 1683 | + | |
| 1651 | 1684 | /* called in rcu_read_lock() section */ |
| 1652 | 1685 | int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr, |
| 1653 | 1686 | u8 tos, struct net_device *dev, |
| @@ -59,8 +59,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * · 58 unmodified lines | ||
| 59 | 59 | { |
| 60 | 60 | struct dst_entry *dst = skb_dst(skb); |
| 61 | 61 | struct net_device *dev = dst->dev; |
| 62 | + const struct in6_addr *nexthop; | |
| 62 | 63 | struct neighbour *neigh; |
| 63 | − struct in6_addr *nexthop; | |
| 64 | 64 | int ret; |
| 65 | 65 | |
| 66 | 66 | if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) { |
| @@ -218,7 +218,8 @@ static struct neighbour *ip6_dst_neigh_lookup(const struct dst_entry *dst, · 217 unmodified lines | ||
| 218 | 218 | { |
| 219 | 219 | const struct rt6_info *rt = container_of(dst, struct rt6_info, dst); |
| 220 | 220 | |
| 221 | − return ip6_neigh_lookup(&rt->rt6i_gateway, dst->dev, skb, daddr); | |
| 221 | + return ip6_neigh_lookup(rt6_nexthop(rt, &in6addr_any), | |
| 222 | + dst->dev, skb, daddr); | |
| 222 | 223 | } |
| 223 | 224 | |
| 224 | 225 | static void ip6_confirm_neigh(const struct dst_entry *dst, const void *daddr) |
| @@ -6073,7 +6074,7 @@ static struct ctl_table ipv6_route_table_template[] = { · 5848 unmodified lines | ||
| 6073 | 6074 | .data = &init_net.ipv6.sysctl.skip_notify_on_dev_down, |
| 6074 | 6075 | .maxlen = sizeof(int), |
| 6075 | 6076 | .mode = 0644, |
| 6076 | − .proc_handler = proc_dointvec, | |
| 6077 | + .proc_handler = proc_dointvec_minmax, | |
| 6077 | 6078 | .extra1 = &zero, |
| 6078 | 6079 | .extra2 = &one, |
| 6079 | 6080 | }, |
| @@ -439,9 +439,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, · 438 unmodified lines | ||
| 439 | 439 | struct nf_flowtable *flow_table = priv; |
| 440 | 440 | struct flow_offload_tuple tuple = {}; |
| 441 | 441 | enum flow_offload_tuple_dir dir; |
| 442 | + const struct in6_addr *nexthop; | |
| 442 | 443 | struct flow_offload *flow; |
| 443 | 444 | struct net_device *outdev; |
| 444 | − struct in6_addr *nexthop; | |
| 445 | 445 | struct ipv6hdr *ip6h; |
| 446 | 446 | struct rt6_info *rt; |
| 447 | 447 | |
| @@ -2412,6 +2412,9 @@ static void tpacket_destruct_skb(struct sk_buff *skb) · 2411 unmodified lines | ||
| 2412 | 2412 | |
| 2413 | 2413 | ts = __packet_set_timestamp(po, ph, skb); |
| 2414 | 2414 | __packet_set_status(po, ph, TP_STATUS_AVAILABLE | ts); |
| 2415 | + | |
| 2416 | + if (!packet_read_pending(&po->tx_ring)) | |
| 2417 | + complete(&po->skb_completion); | |
| 2415 | 2418 | } |
| 2416 | 2419 | |
| 2417 | 2420 | sock_wfree(skb); |
| @@ -2596,7 +2599,7 @@ static int tpacket_parse_header(struct packet_sock *po, void *frame, · 178 unmodified lines | ||
| 2596 | 2599 | |
| 2597 | 2600 | static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) |
| 2598 | 2601 | { |
| 2599 | − struct sk_buff *skb; | |
| 2602 | + struct sk_buff *skb = NULL; | |
| 2600 | 2603 | struct net_device *dev; |
| 2601 | 2604 | struct virtio_net_hdr *vnet_hdr = NULL; |
| 2602 | 2605 | struct sockcm_cookie sockc; |
| @@ -2611,6 +2614,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) · 8 unmodified lines | ||
| 2611 | 2614 | int len_sum = 0; |
| 2612 | 2615 | int status = TP_STATUS_AVAILABLE; |
| 2613 | 2616 | int hlen, tlen, copylen = 0; |
| 2617 | + long timeo = 0; | |
| 2614 | 2618 | |
| 2615 | 2619 | mutex_lock(&po->pg_vec_lock); |
| 2616 | 2620 | |
| @@ -2657,12 +2661,21 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) · 40 unmodified lines | ||
| 2657 | 2661 | if ((size_max > dev->mtu + reserve + VLAN_HLEN) && !po->has_vnet_hdr) |
| 2658 | 2662 | size_max = dev->mtu + reserve + VLAN_HLEN; |
| 2659 | 2663 | |
| 2664 | + reinit_completion(&po->skb_completion); | |
| 2665 | + | |
| 2660 | 2666 | do { |
| 2661 | 2667 | ph = packet_current_frame(po, &po->tx_ring, |
| 2662 | 2668 | TP_STATUS_SEND_REQUEST); |
| 2663 | 2669 | if (unlikely(ph == NULL)) { |
| 2664 | − if (need_wait && need_resched()) | |
| 2665 | − schedule(); | |
| 2670 | + if (need_wait && skb) { | |
| 2671 | + timeo = sock_sndtimeo(&po->sk, msg->msg_flags & MSG_DONTWAIT); | |
| 2672 | + timeo = wait_for_completion_interruptible_timeout(&po->skb_completion, timeo); | |
| 2673 | + if (timeo <= 0) { | |
| 2674 | + err = !timeo ? -ETIMEDOUT : -ERESTARTSYS; | |
| 2675 | + goto out_put; | |
| 2676 | + } | |
| 2677 | + } | |
| 2678 | + /* check for additional frames */ | |
| 2666 | 2679 | continue; |
| 2667 | 2680 | } |
| 2668 | 2681 | |
| @@ -3218,6 +3231,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol, · 549 unmodified lines | ||
| 3218 | 3231 | sock_init_data(sock, sk); |
| 3219 | 3232 | |
| 3220 | 3233 | po = pkt_sk(sk); |
| 3234 | + init_completion(&po->skb_completion); | |
| 3221 | 3235 | sk->sk_family = PF_PACKET; |
| 3222 | 3236 | po->num = proto; |
| 3223 | 3237 | po->xmit = dev_queue_xmit; |
| @@ -4327,7 +4341,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 1103 unmodified lines | ||
| 4327 | 4341 | req3->tp_sizeof_priv || |
| 4328 | 4342 | req3->tp_feature_req_word) { |
| 4329 | 4343 | err = -EINVAL; |
| 4330 | − goto out; | |
| 4344 | + goto out_free_pg_vec; | |
| 4331 | 4345 | } |
| 4332 | 4346 | } |
| 4333 | 4347 | break; |
| @@ -4391,6 +4405,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 57 unmodified lines | ||
| 4391 | 4405 | prb_shutdown_retire_blk_timer(po, rb_queue); |
| 4392 | 4406 | } |
| 4393 | 4407 | |
| 4408 | +out_free_pg_vec: | |
| 4394 | 4409 | if (pg_vec) |
| 4395 | 4410 | free_pg_vec(pg_vec, order, req->tp_block_nr); |
| 4396 | 4411 | out: |
| @@ -128,6 +128,7 @@ struct packet_sock { · 127 unmodified lines | ||
| 128 | 128 | unsigned int tp_hdrlen; |
| 129 | 129 | unsigned int tp_reserve; |
| 130 | 130 | unsigned int tp_tstamp; |
| 131 | + struct completion skb_completion; | |
| 131 | 132 | struct net_device __rcu *cached_dev; |
| 132 | 133 | int (*xmit)(struct sk_buff *skb); |
| 133 | 134 | struct packet_type prot_hook ____cacheline_aligned_in_smp; |
| @@ -549,12 +549,17 @@ static struct notifier_block cbs_device_notifier = { · 548 unmodified lines | ||
| 549 | 549 | |
| 550 | 550 | static int __init cbs_module_init(void) |
| 551 | 551 | { |
| 552 | − int err = register_netdevice_notifier(&cbs_device_notifier); | |
| 552 | + int err; | |
| 553 | 553 | |
| 554 | + err = register_netdevice_notifier(&cbs_device_notifier); | |
| 554 | 555 | if (err) |
| 555 | 556 | return err; |
| 556 | 557 | |
| 557 | − return register_qdisc(&cbs_qdisc_ops); | |
| 558 | + err = register_qdisc(&cbs_qdisc_ops); | |
| 559 | + if (err) | |
| 560 | + unregister_netdevice_notifier(&cbs_device_notifier); | |
| 561 | + | |
| 562 | + return err; | |
| 558 | 563 | } |
| 559 | 564 | |
| 560 | 565 | static void __exit cbs_module_exit(void) |
| @@ -118,10 +118,6 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, · 117 unmodified lines | ||
| 118 | 118 | /* Initialize the bind addr area */ |
| 119 | 119 | sctp_bind_addr_init(&ep->base.bind_addr, 0); |
| 120 | 120 | |
| 121 | − /* Remember who we are attached to. */ | |
| 122 | − ep->base.sk = sk; | |
| 123 | − sock_hold(ep->base.sk); | |
| 124 | − | |
| 125 | 121 | /* Create the lists of associations. */ |
| 126 | 122 | INIT_LIST_HEAD(&ep->asocs); |
| 127 | 123 | |
| @@ -154,6 +150,10 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, · 26 unmodified lines | ||
| 154 | 150 | ep->prsctp_enable = net->sctp.prsctp_enable; |
| 155 | 151 | ep->reconf_enable = net->sctp.reconf_enable; |
| 156 | 152 | |
| 153 | + /* Remember who we are attached to. */ | |
| 154 | + ep->base.sk = sk; | |
| 155 | + sock_hold(ep->base.sk); | |
| 156 | + | |
| 157 | 157 | return ep; |
| 158 | 158 | |
| 159 | 159 | nomem_shkey: |
| @@ -2020,7 +2020,7 @@ static int __init smc_init(void) · 2019 unmodified lines | ||
| 2020 | 2020 | |
| 2021 | 2021 | rc = smc_pnet_init(); |
| 2022 | 2022 | if (rc) |
| 2023 | − return rc; | |
| 2023 | + goto out_pernet_subsys; | |
| 2024 | 2024 | |
| 2025 | 2025 | rc = smc_llc_init(); |
| 2026 | 2026 | if (rc) { |
| @@ -2071,6 +2071,9 @@ out_proto: · 44 unmodified lines | ||
| 2071 | 2071 | proto_unregister(&smc_proto); |
| 2072 | 2072 | out_pnet: |
| 2073 | 2073 | smc_pnet_exit(); |
| 2074 | +out_pernet_subsys: | |
| 2075 | + unregister_pernet_subsys(&smc_net_ops); | |
| 2076 | + | |
| 2074 | 2077 | return rc; |
| 2075 | 2078 | } |
| 2076 | 2079 | |
| @@ -652,7 +652,10 @@ create: · 651 unmodified lines | ||
| 652 | 652 | rc = smc_lgr_create(smc, ini); |
| 653 | 653 | if (rc) |
| 654 | 654 | goto out; |
| 655 | + lgr = conn->lgr; | |
| 656 | + write_lock_bh(&lgr->conns_lock); | |
| 655 | 657 | smc_lgr_register_conn(conn); /* add smc conn to lgr */ |
| 658 | + write_unlock_bh(&lgr->conns_lock); | |
| 656 | 659 | } |
| 657 | 660 | conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE; |
| 658 | 661 | conn->local_tx_ctrl.len = SMC_WR_TX_SIZE; |
| @@ -134,7 +134,7 @@ static int __init tipc_init(void) · 133 unmodified lines | ||
| 134 | 134 | if (err) |
| 135 | 135 | goto out_sysctl; |
| 136 | 136 | |
| 137 | − err = register_pernet_subsys(&tipc_net_ops); | |
| 137 | + err = register_pernet_device(&tipc_net_ops); | |
| 138 | 138 | if (err) |
| 139 | 139 | goto out_pernet; |
| 140 | 140 | |
| @@ -142,7 +142,7 @@ static int __init tipc_init(void) · 1 unmodified line | ||
| 142 | 142 | if (err) |
| 143 | 143 | goto out_socket; |
| 144 | 144 | |
| 145 | − err = register_pernet_subsys(&tipc_topsrv_net_ops); | |
| 145 | + err = register_pernet_device(&tipc_topsrv_net_ops); | |
| 146 | 146 | if (err) |
| 147 | 147 | goto out_pernet_topsrv; |
| 148 | 148 | |
| @@ -153,11 +153,11 @@ static int __init tipc_init(void) · 4 unmodified lines | ||
| 153 | 153 | pr_info("Started in single node mode\n"); |
| 154 | 154 | return 0; |
| 155 | 155 | out_bearer: |
| 156 | − unregister_pernet_subsys(&tipc_topsrv_net_ops); | |
| 156 | + unregister_pernet_device(&tipc_topsrv_net_ops); | |
| 157 | 157 | out_pernet_topsrv: |
| 158 | 158 | tipc_socket_stop(); |
| 159 | 159 | out_socket: |
| 160 | − unregister_pernet_subsys(&tipc_net_ops); | |
| 160 | + unregister_pernet_device(&tipc_net_ops); | |
| 161 | 161 | out_pernet: |
| 162 | 162 | tipc_unregister_sysctl(); |
| 163 | 163 | out_sysctl: |
| @@ -172,9 +172,9 @@ out_netlink: · 8 unmodified lines | ||
| 172 | 172 | static void __exit tipc_exit(void) |
| 173 | 173 | { |
| 174 | 174 | tipc_bearer_cleanup(); |
| 175 | − unregister_pernet_subsys(&tipc_topsrv_net_ops); | |
| 175 | + unregister_pernet_device(&tipc_topsrv_net_ops); | |
| 176 | 176 | tipc_socket_stop(); |
| 177 | − unregister_pernet_subsys(&tipc_net_ops); | |
| 177 | + unregister_pernet_device(&tipc_net_ops); | |
| 178 | 178 | tipc_netlink_stop(); |
| 179 | 179 | tipc_netlink_compat_stop(); |
| 180 | 180 | tipc_unregister_sysctl(); |
| @@ -445,7 +445,11 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd, · 444 unmodified lines | ||
| 445 | 445 | if (!bearer) |
| 446 | 446 | return -EMSGSIZE; |
| 447 | 447 | |
| 448 | − len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_BEARER_NAME); | |
| 448 | + len = TLV_GET_DATA_LEN(msg->req); | |
| 449 | + if (len <= 0) | |
| 450 | + return -EINVAL; | |
| 451 | + | |
| 452 | + len = min_t(int, len, TIPC_MAX_BEARER_NAME); | |
| 449 | 453 | if (!string_is_valid(name, len)) |
| 450 | 454 | return -EINVAL; |
| 451 | 455 | |
| @@ -539,7 +543,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, · 87 unmodified lines | ||
| 539 | 543 | |
| 540 | 544 | name = (char *)TLV_DATA(msg->req); |
| 541 | 545 | |
| 542 | − len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); | |
| 546 | + len = TLV_GET_DATA_LEN(msg->req); | |
| 547 | + if (len <= 0) | |
| 548 | + return -EINVAL; | |
| 549 | + | |
| 550 | + len = min_t(int, len, TIPC_MAX_BEARER_NAME); | |
| 543 | 551 | if (!string_is_valid(name, len)) |
| 544 | 552 | return -EINVAL; |
| 545 | 553 | |
| @@ -807,7 +815,11 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd, · 261 unmodified lines | ||
| 807 | 815 | if (!link) |
| 808 | 816 | return -EMSGSIZE; |
| 809 | 817 | |
| 810 | − len = min_t(int, TLV_GET_DATA_LEN(msg->req), TIPC_MAX_LINK_NAME); | |
| 818 | + len = TLV_GET_DATA_LEN(msg->req); | |
| 819 | + if (len <= 0) | |
| 820 | + return -EINVAL; | |
| 821 | + | |
| 822 | + len = min_t(int, len, TIPC_MAX_BEARER_NAME); | |
| 811 | 823 | if (!string_is_valid(name, len)) |
| 812 | 824 | return -EINVAL; |
| 813 | 825 | |
| @@ -279,7 +279,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) · 278 unmodified lines | ||
| 279 | 279 | goto skip_tx_cleanup; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | − if (!tls_complete_pending_work(sk, ctx, 0, &timeo)) | |
| 282 | + if (unlikely(sk->sk_write_pending) && | |
| 283 | + !wait_on_pending_writer(sk, &timeo)) | |
| 283 | 284 | tls_handle_open_record(sk, 0); |
| 284 | 285 | |
| 285 | 286 | /* We need these for tls_sw_fallback handling of other packets */ |
| @@ -83,7 +83,7 @@ static int pidfd_metadata_fd(pid_t pid, int pidfd) · 82 unmodified lines | ||
| 83 | 83 | |
| 84 | 84 | int main(int argc, char *argv[]) |
| 85 | 85 | { |
| 86 | − int pidfd = 0, ret = EXIT_FAILURE; | |
| 86 | + int pidfd = -1, ret = EXIT_FAILURE; | |
| 87 | 87 | char buf[4096] = { 0 }; |
| 88 | 88 | pid_t pid; |
| 89 | 89 | int procfd, statusfd; |
| @@ -91,7 +91,11 @@ int main(int argc, char *argv[]) · 1 unmodified line | ||
| 91 | 91 | |
| 92 | 92 | pid = pidfd_clone(CLONE_PIDFD, &pidfd); |
| 93 | 93 | if (pid < 0) |
| 94 | − exit(ret); | |
| 94 | + err(ret, "CLONE_PIDFD"); | |
| 95 | + if (pidfd == -1) { | |
| 96 | + warnx("CLONE_PIDFD is not supported by the kernel"); | |
| 97 | + goto out; | |
| 98 | + } | |
| 95 | 99 | |
| 96 | 100 | procfd = pidfd_metadata_fd(pid, pidfd); |
| 97 | 101 | close(pidfd); |
| @@ -3,4 +3,5 @@ subpage_prot · 2 unmodified lines | ||
| 3 | 3 | tempfile |
| 4 | 4 | prot_sao |
| 5 | 5 | segv_errors |
| 6 | −wild_bctr | |
| 6 | +wild_bctr | |
| 7 | +large_vm_fork_separation | |
| @@ -2,7 +2,8 @@ · 1 unmodified line | ||
| 2 | 2 | noarg: |
| 3 | 3 | $(MAKE) -C ../ |
| 4 | 4 | |
| 5 | −TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors wild_bctr | |
| 5 | +TEST_GEN_PROGS := hugetlb_vs_thp_test subpage_prot prot_sao segv_errors wild_bctr \ | |
| 6 | + large_vm_fork_separation | |
| 6 | 7 | TEST_GEN_FILES := tempfile |
| 7 | 8 | |
| 8 | 9 | top_srcdir = ../../../../.. |
| @@ -13,6 +14,7 @@ $(TEST_GEN_PROGS): ../harness.c · 4 unmodified lines | ||
| 13 | 14 | $(OUTPUT)/prot_sao: ../utils.c |
| 14 | 15 | |
| 15 | 16 | $(OUTPUT)/wild_bctr: CFLAGS += -m64 |
| 17 | +$(OUTPUT)/large_vm_fork_separation: CFLAGS += -m64 | |
| 16 | 18 | |
| 17 | 19 | $(OUTPUT)/tempfile: |
| 18 | 20 | dd if=/dev/zero of=$@ bs=64k count=1 |
| @@ -0,0 +1,87 @@ | ||
| 1 | +// SPDX-License-Identifier: GPL-2.0+ | |
| 2 | +// | |
| 3 | +// Copyright 2019, Michael Ellerman, IBM Corp. | |
| 4 | +// | |
| 5 | +// Test that allocating memory beyond the memory limit and then forking is | |
| 6 | +// handled correctly, ie. the child is able to access the mappings beyond the | |
| 7 | +// memory limit and the child's writes are not visible to the parent. | |
| 8 | + | |
| 9 | +#include <stdio.h> | |
| 10 | +#include <stdlib.h> | |
| 11 | +#include <sys/mman.h> | |
| 12 | +#include <sys/types.h> | |
| 13 | +#include <sys/wait.h> | |
| 14 | +#include <unistd.h> | |
| 15 | + | |
| 16 | +#include "utils.h" | |
| 17 | + | |
| 18 | + | |
| 19 | +#ifndef MAP_FIXED_NOREPLACE | |
| 20 | +#define MAP_FIXED_NOREPLACE MAP_FIXED // "Should be safe" above 512TB | |
| 21 | +#endif | |
| 22 | + | |
| 23 | + | |
| 24 | +static int test(void) | |
| 25 | +{ | |
| 26 | + int p2c[2], c2p[2], rc, status, c, *p; | |
| 27 | + unsigned long page_size; | |
| 28 | + pid_t pid; | |
| 29 | + | |
| 30 | + page_size = sysconf(_SC_PAGESIZE); | |
| 31 | + SKIP_IF(page_size != 65536); | |
| 32 | + | |
| 33 | + // Create a mapping at 512TB to allocate an extended_id | |
| 34 | + p = mmap((void *)(512ul << 40), page_size, PROT_READ | PROT_WRITE, | |
| 35 | + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE, -1, 0); | |
| 36 | + if (p == MAP_FAILED) { | |
| 37 | + perror("mmap"); | |
| 38 | + printf("Error: couldn't mmap(), confirm kernel has 4TB support?\n"); | |
| 39 | + return 1; | |
| 40 | + } | |
| 41 | + | |
| 42 | + printf("parent writing %p = 1\n", p); | |
| 43 | + *p = 1; | |
| 44 | + | |
| 45 | + FAIL_IF(pipe(p2c) == -1 || pipe(c2p) == -1); | |
| 46 | + | |
| 47 | + pid = fork(); | |
| 48 | + if (pid == 0) { | |
| 49 | + FAIL_IF(read(p2c[0], &c, 1) != 1); | |
| 50 | + | |
| 51 | + pid = getpid(); | |
| 52 | + printf("child writing %p = %d\n", p, pid); | |
| 53 | + *p = pid; | |
| 54 | + | |
| 55 | + FAIL_IF(write(c2p[1], &c, 1) != 1); | |
| 56 | + FAIL_IF(read(p2c[0], &c, 1) != 1); | |
| 57 | + exit(0); | |
| 58 | + } | |
| 59 | + | |
| 60 | + c = 0; | |
| 61 | + FAIL_IF(write(p2c[1], &c, 1) != 1); | |
| 62 | + FAIL_IF(read(c2p[0], &c, 1) != 1); | |
| 63 | + | |
| 64 | + // Prevent compiler optimisation | |
| 65 | + barrier(); | |
| 66 | + | |
| 67 | + rc = 0; | |
| 68 | + printf("parent reading %p = %d\n", p, *p); | |
| 69 | + if (*p != 1) { | |
| 70 | + printf("Error: BUG! parent saw child's write! *p = %d\n", *p); | |
| 71 | + rc = 1; | |
| 72 | + } | |
| 73 | + | |
| 74 | + FAIL_IF(write(p2c[1], &c, 1) != 1); | |
| 75 | + FAIL_IF(waitpid(pid, &status, 0) == -1); | |
| 76 | + FAIL_IF(!WIFEXITED(status) || WEXITSTATUS(status)); | |
| 77 | + | |
| 78 | + if (rc == 0) | |
| 79 | + printf("success: test completed OK\n"); | |
| 80 | + | |
| 81 | + return rc; | |
| 82 | +} | |
| 83 | + | |
| 84 | +int main(void) | |
| 85 | +{ | |
| 86 | + return test_harness(test, "large_vm_fork_separation"); | |
| 87 | +} | |