History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

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.

David S. Miller committed 7 years ago

Commit d96ff262 parents 3a49584 556e2f6101 files · +719 −276Browse files

Unified · Split

101 files
  1. MAINTAINERS +2 −0
  2. Makefile +1 −1
  3. arch/arm/boot/dts/gemini-dlink-dir-685.dts +1 −1
  4. arch/arm/boot/dts/gemini-dlink-dns-313.dts +1 −1
  5. arch/arm/boot/dts/imx6ul.dtsi +4 −4
  6. arch/arm/boot/dts/meson8.dtsi +2 −3
  7. arch/arm/boot/dts/meson8b.dtsi +5 −6
  8. arch/arm/mach-omap2/prm3xxx.c +1 −1
  9. arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi +9 −9
  10. arch/arm64/configs/defconfig +1 −0
  11. arch/csky/kernel/signal.c +5 −0
  12. arch/parisc/kernel/module.c +4 −0
  13. arch/powerpc/include/asm/page.h +7 −0
  14. arch/powerpc/kernel/head_32.S +1 −0
  15. arch/powerpc/kernel/head_booke.h +5 −5
  16. arch/powerpc/kernel/head_fsl_booke.S +1 −1
  17. arch/powerpc/kvm/book3s_hv_builtin.c +1 −0
  18. arch/powerpc/kvm/book3s_hv_rmhandlers.S +13 −2
  19. arch/powerpc/mm/book3s64/mmu_context.c +47 −8
  20. arch/powerpc/mm/mem.c +2 −1
  21. arch/powerpc/platforms/powermac/Kconfig +1 −0
  22. drivers/auxdisplay/cfag12864bfb.c +3 −2
  23. drivers/auxdisplay/ht16k33.c +2 −2
  24. drivers/clk/clk.c +1 −1
  25. drivers/clk/meson/g12a.c +2 −2
  26. drivers/clk/meson/g12a.h +1 −1
  27. drivers/clk/meson/meson8b.c +5 −5
  28. drivers/clk/socfpga/clk-s10.c +2 −2
  29. drivers/clk/tegra/clk-tegra210.c +2 −0
  30. drivers/clk/ti/clkctrl.c +5 −2
  31. drivers/hid/hid-ids.h +3 −0
  32. drivers/hid/hid-logitech-dj.c +3 −1
  33. drivers/hid/hid-multitouch.c +4 −0
  34. drivers/hid/hid-quirks.c +1 −0
  35. drivers/hid/hid-uclogic-core.c +2 −0
  36. drivers/hid/hid-uclogic-params.c +2 −0
  37. drivers/hid/intel-ish-hid/ishtp-fw-loader.c +1 −1
  38. drivers/hid/intel-ish-hid/ishtp-hid-client.c +2 −2
  39. drivers/hid/intel-ish-hid/ishtp/bus.c +14 −1
  40. drivers/iommu/intel-iommu.c +3 −4
  41. drivers/md/dm-init.c +5 −5
  42. drivers/md/dm-log-writes.c +21 −2
  43. drivers/md/dm-table.c +1 −1
  44. drivers/md/dm-verity-target.c +2 −2
  45. drivers/mfd/stmfx.c +6 −6
  46. drivers/mtd/nand/raw/nand_base.c +2 −1
  47. drivers/mtd/spi-nor/spi-nor.c +108 −11
  48. drivers/net/bonding/bond_main.c +1 −1
  49. drivers/net/dsa/microchip/ksz_common.c +3 −3
  50. drivers/net/ethernet/aquantia/atlantic/aq_filters.c +8 −2
  51. drivers/net/ethernet/aquantia/atlantic/aq_nic.c +1 −0
  52. drivers/net/ethernet/aquantia/atlantic/aq_nic.h +1 −0
  53. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +13 −6
  54. drivers/net/ethernet/cadence/macb_main.c +1 −1
  55. drivers/net/ethernet/emulex/benet/be_ethtool.c +22 −6
  56. drivers/net/ethernet/sis/sis900.c +8 −8
  57. drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c +1 −1
  58. drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +14 −8
  59. drivers/net/ppp/ppp_mppe.c +1 −0
  60. drivers/net/team/team.c +1 −1
  61. drivers/net/usb/qmi_wwan.c +1 −1
  62. drivers/net/vrf.c +1 −1
  63. drivers/pci/p2pdma.c +4 −0
  64. drivers/scsi/qedi/qedi_main.c +3 −0
  65. drivers/scsi/qedi/qedi_version.h +3 −3
  66. drivers/scsi/qla2xxx/qla_os.c +1 −1
  67. drivers/scsi/ufs/ufshcd-pltfrm.c +4 −7
  68. fs/afs/callback.c +2 −2
  69. fs/afs/inode.c +19 −12
  70. fs/afs/internal.h +3 −5
  71. fs/afs/volume.c +1 −0
  72. fs/proc/base.c +1 −2
  73. include/dt-bindings/clock/g12a-clkc.h +1 −1
  74. include/linux/intel-ish-client-if.h +1 −0
  75. include/linux/mtd/spi-nor.h +3 −0
  76. include/net/ip6_route.h +2 −2
  77. include/net/route.h +1 −0
  78. include/net/tls.h +0 −15
  79. kernel/fork.c +18 −40
  80. net/bluetooth/6lowpan.c +2 −2
  81. net/bluetooth/hci_conn.c +9 −9
  82. net/bluetooth/l2cap_core.c +28 −5
  83. net/ipv4/ip_output.c +21 −4
  84. net/ipv4/raw.c +1 −1
  85. net/ipv4/route.c +33 −0
  86. net/ipv6/ip6_output.c +1 −1
  87. net/ipv6/route.c +3 −2
  88. net/netfilter/nf_flow_table_ip.c +1 −1
  89. net/packet/af_packet.c +19 −4
  90. net/packet/internal.h +1 −0
  91. net/sched/sch_cbs.c +7 −2
  92. net/sctp/endpointola.c +4 −4
  93. net/smc/af_smc.c +4 −1
  94. net/smc/smc_core.c +3 −0
  95. net/tipc/core.c +6 −6
  96. net/tipc/netlink_compat.c +15 −3
  97. net/tls/tls_main.c +2 −1
  98. samples/pidfd/pidfd-metadata.c +6 −2
  99. tools/testing/selftests/powerpc/mm/.gitignore +2 −1
  100. tools/testing/selftests/powerpc/mm/Makefile +3 −1
  101. tools/testing/selftests/powerpc/mm/large_vm_fork_separation.c +87 −0
MAINTAINERS+2−0
@@ -3131,6 +3131,7 @@ F: arch/arm/mach-bcm/ · 3130 unmodified lines
31313131 BROADCOM BCM2835 ARM ARCHITECTURE
31323132 M: Eric Anholt <eric@anholt.net>
31333133 M: Stefan Wahren <wahrenst@gmx.net>
3134+L: bcm-kernel-feedback-list@broadcom.com
31343135 L: linux-rpi-kernel@lists.infradead.org (moderated for non-subscribers)
31353136 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
31363137 T: git git://github.com/anholt/linux
@@ -3160,6 +3161,7 @@ F: arch/arm/boot/dts/bcm953012* · 23 unmodified lines
31603161
31613162 BROADCOM BCM53573 ARM ARCHITECTURE
31623163 M: Rafał Miłecki <rafal@milecki.pl>
3164+L: bcm-kernel-feedback-list@broadcom.com
31633165 L: linux-arm-kernel@lists.infradead.org
31643166 S: Maintained
31653167 F: arch/arm/boot/dts/bcm53573*
Makefile+1−1
@@ -2,7 +2,7 @@ · 1 unmodified line
22 VERSION = 5
33 PATCHLEVEL = 2
44 SUBLEVEL = 0
5−EXTRAVERSION = -rc5
5+EXTRAVERSION = -rc6
66 NAME = Golden Lions
77
88 # *DOCUMENTATION*
arch/arm/boot/dts/gemini-dlink-dir-685.dts+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 };
2121
2222 chosen {
23− bootargs = "console=ttyS0,19200n8 root=/dev/sda1 rw rootwait";
23+ bootargs = "console=ttyS0,19200n8 root=/dev/sda1 rw rootwait consoleblank=300";
2424 stdout-path = "uart0:19200n8";
2525 };
2626
arch/arm/boot/dts/gemini-dlink-dns-313.dts+1−1
@@ -11,7 +11,7 @@ · 10 unmodified lines
1111
1212 / {
1313 model = "D-Link DNS-313 1-Bay Network Storage Enclosure";
14− compatible = "dlink,dir-313", "cortina,gemini";
14+ compatible = "dlink,dns-313", "cortina,gemini";
1515 #address-cells = <1>;
1616 #size-cells = <1>;
1717
arch/arm/boot/dts/imx6ul.dtsi+4−4
@@ -358,7 +358,7 @@ · 357 unmodified lines
358358 pwm1: pwm@2080000 {
359359 compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
360360 reg = <0x02080000 0x4000>;
361− interrupts = <GIC_SPI 115 IRQ_TYPE_LEVEL_HIGH>;
361+ interrupts = <GIC_SPI 83 IRQ_TYPE_LEVEL_HIGH>;
362362 clocks = <&clks IMX6UL_CLK_PWM1>,
363363 <&clks IMX6UL_CLK_PWM1>;
364364 clock-names = "ipg", "per";
@@ -369,7 +369,7 @@ · 4 unmodified lines
369369 pwm2: pwm@2084000 {
370370 compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
371371 reg = <0x02084000 0x4000>;
372− interrupts = <GIC_SPI 116 IRQ_TYPE_LEVEL_HIGH>;
372+ interrupts = <GIC_SPI 84 IRQ_TYPE_LEVEL_HIGH>;
373373 clocks = <&clks IMX6UL_CLK_PWM2>,
374374 <&clks IMX6UL_CLK_PWM2>;
375375 clock-names = "ipg", "per";
@@ -380,7 +380,7 @@ · 4 unmodified lines
380380 pwm3: pwm@2088000 {
381381 compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
382382 reg = <0x02088000 0x4000>;
383− interrupts = <GIC_SPI 117 IRQ_TYPE_LEVEL_HIGH>;
383+ interrupts = <GIC_SPI 85 IRQ_TYPE_LEVEL_HIGH>;
384384 clocks = <&clks IMX6UL_CLK_PWM3>,
385385 <&clks IMX6UL_CLK_PWM3>;
386386 clock-names = "ipg", "per";
@@ -391,7 +391,7 @@ · 4 unmodified lines
391391 pwm4: pwm@208c000 {
392392 compatible = "fsl,imx6ul-pwm", "fsl,imx27-pwm";
393393 reg = <0x0208c000 0x4000>;
394− interrupts = <GIC_SPI 118 IRQ_TYPE_LEVEL_HIGH>;
394+ interrupts = <GIC_SPI 86 IRQ_TYPE_LEVEL_HIGH>;
395395 clocks = <&clks IMX6UL_CLK_PWM4>,
396396 <&clks IMX6UL_CLK_PWM4>;
397397 clock-names = "ipg", "per";
arch/arm/boot/dts/meson8.dtsi+2−3
@@ -248,8 +248,8 @@ · 247 unmodified lines
248248 <GIC_SPI 167 IRQ_TYPE_LEVEL_HIGH>,
249249 <GIC_SPI 168 IRQ_TYPE_LEVEL_HIGH>,
250250 <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>,
253253 <GIC_SPI 172 IRQ_TYPE_LEVEL_HIGH>,
254254 <GIC_SPI 173 IRQ_TYPE_LEVEL_HIGH>,
255255 <GIC_SPI 174 IRQ_TYPE_LEVEL_HIGH>,
@@ -264,7 +264,6 @@ · 8 unmodified lines
264264 clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
265265 clock-names = "bus", "core";
266266 operating-points-v2 = <&gpu_opp_table>;
267− switch-delay = <0xffff>;
268267 };
269268 };
270269 }; /* end of / */
arch/arm/boot/dts/meson8b.dtsi+5−6
@@ -163,23 +163,23 @@ · 162 unmodified lines
163163
164164 opp-255000000 {
165165 opp-hz = /bits/ 64 <255000000>;
166− opp-microvolt = <1150000>;
166+ opp-microvolt = <1100000>;
167167 };
168168 opp-364300000 {
169169 opp-hz = /bits/ 64 <364300000>;
170− opp-microvolt = <1150000>;
170+ opp-microvolt = <1100000>;
171171 };
172172 opp-425000000 {
173173 opp-hz = /bits/ 64 <425000000>;
174− opp-microvolt = <1150000>;
174+ opp-microvolt = <1100000>;
175175 };
176176 opp-510000000 {
177177 opp-hz = /bits/ 64 <510000000>;
178− opp-microvolt = <1150000>;
178+ opp-microvolt = <1100000>;
179179 };
180180 opp-637500000 {
181181 opp-hz = /bits/ 64 <637500000>;
182− opp-microvolt = <1150000>;
182+ opp-microvolt = <1100000>;
183183 turbo-mode;
184184 };
185185 };
@@ -229,7 +229,6 @@ · 43 unmodified lines
229229 clocks = <&clkc CLKID_CLK81>, <&clkc CLKID_MALI>;
230230 clock-names = "bus", "core";
231231 operating-points-v2 = <&gpu_opp_table>;
232− switch-delay = <0xffff>;
233232 };
234233 };
235234 }; /* end of / */
arch/arm/mach-omap2/prm3xxx.c+1−1
@@ -430,7 +430,7 @@ static void omap3_prm_reconfigure_io_chain(void) · 429 unmodified lines
430430 * registers, and omap3xxx_prm_reconfigure_io_chain() must be called.
431431 * No return value.
432432 */
433−static void __init omap3xxx_prm_enable_io_wakeup(void)
433+static void omap3xxx_prm_enable_io_wakeup(void)
434434 {
435435 if (prm_features & PRM_HAS_IO_WAKEUP)
436436 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi+9−9
@@ -28,7 +28,7 @@ · 27 unmodified lines
2828 enable-method = "psci";
2929 clocks = <&clockgen 1 0>;
3030 next-level-cache = <&l2>;
31− cpu-idle-states = <&CPU_PH20>;
31+ cpu-idle-states = <&CPU_PW20>;
3232 };
3333
3434 cpu1: cpu@1 {
@@ -38,7 +38,7 @@ · 3 unmodified lines
3838 enable-method = "psci";
3939 clocks = <&clockgen 1 0>;
4040 next-level-cache = <&l2>;
41− cpu-idle-states = <&CPU_PH20>;
41+ cpu-idle-states = <&CPU_PW20>;
4242 };
4343
4444 l2: l2-cache {
@@ -53,13 +53,13 @@ · 8 unmodified lines
5353 */
5454 entry-method = "arm,psci";
5555
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>;
6363 };
6464 };
6565
arch/arm64/configs/defconfig+1−0
@@ -613,6 +613,7 @@ CONFIG_RTC_DRV_TEGRA=y · 612 unmodified lines
613613 CONFIG_RTC_DRV_IMX_SC=m
614614 CONFIG_RTC_DRV_XGENE=y
615615 CONFIG_DMADEVICES=y
616+CONFIG_FSL_EDMA=y
616617 CONFIG_DMA_BCM2835=m
617618 CONFIG_K3_DMA=y
618619 CONFIG_MV_XOR=y
arch/csky/kernel/signal.c+5−0
@@ -39,6 +39,11 @@ static int save_fpu_state(struct sigcontext __user *sc) · 38 unmodified lines
3939 #endif
4040
4141 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];
4247 struct siginfo info;
4348 struct ucontext uc;
4449 };
arch/parisc/kernel/module.c+4−0
@@ -786,6 +786,10 @@ int apply_relocate_add(Elf_Shdr *sechdrs, · 785 unmodified lines
786786 /* 32-bit PC relative address */
787787 *loc = val - dot - 8 + addend;
788788 break;
789+ case R_PARISC_PCREL64:
790+ /* 64-bit PC relative address */
791+ *loc64 = val - dot - 8 + addend;
792+ break;
789793 case R_PARISC_DIR64:
790794 /* 64-bit effective address */
791795 *loc64 = val + addend;
arch/powerpc/include/asm/page.h+7−0
@@ -319,6 +319,13 @@ struct vm_area_struct; · 318 unmodified lines
319319 #endif /* __ASSEMBLY__ */
320320 #include <asm/slice.h>
321321
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
322328 #define ARCH_ZONE_DMA_BITS 31
329+#endif
323330
324331 #endif /* _ASM_POWERPC_PAGE_H */
arch/powerpc/kernel/head_32.S+1−0
@@ -752,6 +752,7 @@ __secondary_start: · 751 unmodified lines
752752 stw r0,0(r3)
753753
754754 /* load up the MMU */
755+ bl load_segment_registers
755756 bl load_up_mmu
756757
757758 /* ptr to phys current thread */
arch/powerpc/kernel/head_booke.h+5−5
@@ -83,7 +83,7 @@ END_BTB_FLUSH_SECTION · 82 unmodified lines
8383 SAVE_4GPRS(3, r11); \
8484 SAVE_2GPRS(7, r11)
8585
86−.macro SYSCALL_ENTRY trapno intno
86+.macro SYSCALL_ENTRY trapno intno srr1
8787 mfspr r10, SPRN_SPRG_THREAD
8888 #ifdef CONFIG_KVM_BOOKE_HV
8989 BEGIN_FTR_SECTION
@@ -94,7 +94,7 @@ BEGIN_FTR_SECTION · 4 unmodified lines
9494 mfspr r11, SPRN_SRR1
9595 mtocrf 0x80, r11 /* check MSR[GS] without clobbering reg */
9696 bf 3, 1975f
97− b kvmppc_handler_BOOKE_INTERRUPT_\intno\()_SPRN_SRR1
97+ b kvmppc_handler_\intno\()_\srr1
9898 1975:
9999 mr r12, r13
100100 lwz r13, THREAD_NORMSAVE(2)(r10)
@@ -145,9 +145,9 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_EMB_HV) · 44 unmodified lines
145145 tophys(r11,r11)
146146 addi r11,r11,global_dbcr0@l
147147 #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
151151 #endif
152152 lwz r12,0(r11)
153153 mtspr SPRN_DBCR0,r12
arch/powerpc/kernel/head_fsl_booke.S+1−1
@@ -409,7 +409,7 @@ interrupt_base: · 408 unmodified lines
409409
410410 /* System Call Interrupt */
411411 START_EXCEPTION(SystemCall)
412− SYSCALL_ENTRY 0xc00 SYSCALL
412+ SYSCALL_ENTRY 0xc00 BOOKE_INTERRUPT_SYSCALL SPRN_SRR1
413413
414414 /* Auxiliary Processor Unavailable Interrupt */
415415 EXCEPTION(0x2900, AP_UNAVAIL, AuxillaryProcessorUnavailable, \
arch/powerpc/kvm/book3s_hv_builtin.c+1−0
@@ -830,6 +830,7 @@ static void flush_guest_tlb(struct kvm *kvm) · 829 unmodified lines
830830 }
831831 }
832832 asm volatile("ptesync": : :"memory");
833+ asm volatile(PPC_INVALIDATE_ERAT : : :"memory");
833834 }
834835
835836 void kvmppc_check_need_tlb_flush(struct kvm *kvm, int pcpu,
arch/powerpc/kvm/book3s_hv_rmhandlers.S+13−2
@@ -2500,17 +2500,28 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) · 2499 unmodified lines
25002500 LOAD_REG_ADDR(r11, dawr_force_enable)
25012501 lbz r11, 0(r11)
25022502 cmpdi r11, 0
2503+ bne 3f
25032504 li r3, H_HARDWARE
2504− beqlr
2505+ blr
2506+3:
25052507 /* Emulate H_SET_DABR/X on P8 for the sake of compat mode guests */
25062508 rlwimi r5, r4, 5, DAWRX_DR | DAWRX_DW
25072509 rlwimi r5, r4, 2, DAWRX_WT
25082510 clrrdi r4, r4, 3
25092511 std r4, VCPU_DAWR(r3)
25102512 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
25112522 mtspr SPRN_DAWR, r4
25122523 mtspr SPRN_DAWRX, r5
2513− li r3, 0
2524+4: li r3, 0
25142525 blr
25152526
25162527 _GLOBAL(kvmppc_h_cede) /* r3 = vcpu pointer, r11 = msr, r13 = paca */
arch/powerpc/mm/book3s64/mmu_context.c+47−8
@@ -50,20 +50,52 @@ EXPORT_SYMBOL_GPL(hash__alloc_context_id); · 49 unmodified lines
5050
5151 void slb_setup_new_exec(void);
5252
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+
5391 static int hash__init_new_context(struct mm_struct *mm)
5492 {
5593 int index;
5694
57− index = hash__alloc_context_id();
58− if (index < 0)
59− return index;
60−
6195 mm->context.hash_context = kmalloc(sizeof(struct hash_mm_context),
6296 GFP_KERNEL);
63− if (!mm->context.hash_context) {
64− ida_free(&mmu_context_ida, index);
97+ if (!mm->context.hash_context)
6598 return -ENOMEM;
66− }
6799
68100 /*
69101 * 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
91123 mm->context.hash_context->spt = kmalloc(sizeof(struct subpage_prot_table),
92124 GFP_KERNEL);
93125 if (!mm->context.hash_context->spt) {
94− ida_free(&mmu_context_ida, index);
95126 kfree(mm->context.hash_context);
96127 return -ENOMEM;
97128 }
98129 }
99130 #endif
131+ }
100132
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;
101140 }
102141
103142 pkey_mm_init(mm);
arch/powerpc/mm/mem.c+2−1
@@ -248,7 +248,8 @@ void __init paging_init(void) · 247 unmodified lines
248248 (long int)((top_of_ram - total_ram) >> 20));
249249
250250 #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);
252253 #endif
253254 max_zone_pfns[ZONE_NORMAL] = max_low_pfn;
254255 #ifdef CONFIG_HIGHMEM
arch/powerpc/platforms/powermac/Kconfig+1−0
@@ -7,6 +7,7 @@ config PPC_PMAC · 6 unmodified lines
77 select PPC_INDIRECT_PCI if PPC32
88 select PPC_MPC106 if PPC32
99 select PPC_NATIVE
10+ select ZONE_DMA if PPC32
1011 default y
1112
1213 config PPC_PMAC64
drivers/auxdisplay/cfag12864bfb.c+3−2
@@ -52,8 +52,9 @@ static const struct fb_var_screeninfo cfag12864bfb_var = { · 51 unmodified lines
5252
5353 static int cfag12864bfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
5454 {
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);
5758 }
5859
5960 static struct fb_ops cfag12864bfb_ops = {
drivers/auxdisplay/ht16k33.c+2−2
@@ -223,9 +223,9 @@ static const struct backlight_ops ht16k33_bl_ops = { · 222 unmodified lines
223223 static int ht16k33_mmap(struct fb_info *info, struct vm_area_struct *vma)
224224 {
225225 struct ht16k33_priv *priv = info->par;
226+ struct page *pages = virt_to_page(priv->fbdev.buffer);
226227
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);
229229 }
230230
231231 static struct fb_ops ht16k33_fb_ops = {
drivers/clk/clk.c+1−1
@@ -368,7 +368,7 @@ static struct clk_core *clk_core_get(struct clk_core *core, u8 p_index) · 367 unmodified lines
368368 const char *dev_id = dev ? dev_name(dev) : NULL;
369369 struct device_node *np = core->of_node;
370370
371− if (np && index >= 0)
371+ if (np && (name || index >= 0))
372372 hw = of_clk_get_hw(np, index, name);
373373
374374 /*
drivers/clk/meson/g12a.c+2−2
@@ -2734,8 +2734,8 @@ static struct clk_hw_onecell_data g12a_hw_onecell_data = { · 2733 unmodified lines
27342734 [CLKID_MALI_1_DIV] = &g12a_mali_1_div.hw,
27352735 [CLKID_MALI_1] = &g12a_mali_1.hw,
27362736 [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,
27392739 [CLKID_SYS_PLL_DIV16_EN] = &g12a_sys_pll_div16_en.hw,
27402740 [CLKID_SYS_PLL_DIV16] = &g12a_sys_pll_div16.hw,
27412741 [CLKID_CPU_CLK_DYN0_SEL] = &g12a_cpu_clk_premux0.hw,
drivers/clk/meson/g12a.h+1−1
@@ -166,7 +166,7 @@ · 165 unmodified lines
166166 #define CLKID_HDMI_DIV 167
167167 #define CLKID_MALI_0_DIV 170
168168 #define CLKID_MALI_1_DIV 173
169−#define CLKID_MPLL_5OM_DIV 176
169+#define CLKID_MPLL_50M_DIV 176
170170 #define CLKID_SYS_PLL_DIV16_EN 178
171171 #define CLKID_SYS_PLL_DIV16 179
172172 #define CLKID_CPU_CLK_DYN0_SEL 180
drivers/clk/meson/meson8b.c+5−5
@@ -1761,7 +1761,7 @@ static struct clk_regmap meson8m2_gp_pll = { · 1760 unmodified lines
17611761 },
17621762 };
17631763
1764−static const char * const mmeson8b_vpu_0_1_parent_names[] = {
1764+static const char * const meson8b_vpu_0_1_parent_names[] = {
17651765 "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7"
17661766 };
17671767
@@ -1778,8 +1778,8 @@ static struct clk_regmap meson8b_vpu_0_sel = { · 10 unmodified lines
17781778 .hw.init = &(struct clk_init_data){
17791779 .name = "vpu_0_sel",
17801780 .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),
17831783 .flags = CLK_SET_RATE_PARENT,
17841784 },
17851785 };
@@ -1837,8 +1837,8 @@ static struct clk_regmap meson8b_vpu_1_sel = { · 51 unmodified lines
18371837 .hw.init = &(struct clk_init_data){
18381838 .name = "vpu_1_sel",
18391839 .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),
18421842 .flags = CLK_SET_RATE_PARENT,
18431843 },
18441844 };
drivers/clk/socfpga/clk-s10.c+2−2
@@ -103,9 +103,9 @@ static const struct stratix10_perip_cnt_clock s10_main_perip_cnt_clks[] = { · 102 unmodified lines
103103 { STRATIX10_NOC_CLK, "noc_clk", NULL, noc_mux, ARRAY_SIZE(noc_mux),
104104 0, 0, 0, 0x3C, 1},
105105 { 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},
107107 { 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},
109109 { STRATIX10_EMAC_PTP_FREE_CLK, "emac_ptp_free_clk", NULL, emac_ptp_free_mux,
110110 ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 4, 0xB0, 2},
111111 { STRATIX10_GPIO_DB_FREE_CLK, "gpio_db_free_clk", NULL, gpio_db_free_mux,
drivers/clk/tegra/clk-tegra210.c+2−0
@@ -3366,6 +3366,8 @@ static struct tegra_clk_init_table init_table[] __initdata = { · 3365 unmodified lines
33663366 { TEGRA210_CLK_I2S3_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 },
33673367 { TEGRA210_CLK_I2S4_SYNC, TEGRA210_CLK_CLK_MAX, 24576000, 0 },
33683368 { 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 },
33693371 /* This MUST be the last entry. */
33703372 { TEGRA210_CLK_CLK_MAX, TEGRA210_CLK_CLK_MAX, 0, 0 },
33713373 };
drivers/clk/ti/clkctrl.c+5−2
@@ -229,6 +229,7 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, · 228 unmodified lines
229229 {
230230 struct omap_clkctrl_provider *provider = data;
231231 struct omap_clkctrl_clk *entry;
232+ bool found = false;
232233
233234 if (clkspec->args_count != 2)
234235 return ERR_PTR(-EINVAL);
@@ -238,11 +239,13 @@ static struct clk_hw *_ti_omap4_clkctrl_xlate(struct of_phandle_args *clkspec, · 3 unmodified lines
238239
239240 list_for_each_entry(entry, &provider->clocks, node) {
240241 if (entry->reg_offset == clkspec->args[0] &&
241− entry->bit_offset == clkspec->args[1])
242+ entry->bit_offset == clkspec->args[1]) {
243+ found = true;
242244 break;
245+ }
243246 }
244247
245− if (!entry)
248+ if (!found)
246249 return ERR_PTR(-EINVAL);
247250
248251 return entry->clk;
drivers/hid/hid-ids.h+3−0
@@ -80,6 +80,7 @@ · 79 unmodified lines
8080 #define HID_DEVICE_ID_ALPS_U1_DUAL_3BTN_PTP 0x1220
8181 #define HID_DEVICE_ID_ALPS_U1 0x1215
8282 #define HID_DEVICE_ID_ALPS_T4_BTNLESS 0x120C
83+#define HID_DEVICE_ID_ALPS_1222 0x1222
8384
8485
8586 #define USB_VENDOR_ID_AMI 0x046b
@@ -269,6 +270,7 @@ · 183 unmodified lines
269270 #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d
270271 #define USB_DEVICE_ID_CHICONY_WIRELESS 0x0618
271272 #define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE 0x1053
273+#define USB_DEVICE_ID_CHICONY_PIXART_USB_OPTICAL_MOUSE2 0x0939
272274 #define USB_DEVICE_ID_CHICONY_WIRELESS2 0x1123
273275 #define USB_DEVICE_ID_ASUS_AK1D 0x1125
274276 #define USB_DEVICE_ID_CHICONY_TOSHIBA_WT10A 0x1408
@@ -569,6 +571,7 @@ · 294 unmodified lines
569571
570572 #define USB_VENDOR_ID_HUION 0x256c
571573 #define USB_DEVICE_ID_HUION_TABLET 0x006e
574+#define USB_DEVICE_ID_HUION_HS64 0x006d
572575
573576 #define USB_VENDOR_ID_IBM 0x04b3
574577 #define USB_DEVICE_ID_IBM_SCROLLPOINT_III 0x3100
drivers/hid/hid-logitech-dj.c+3−1
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030
3131 #define REPORT_ID_HIDPP_SHORT 0x10
3232 #define REPORT_ID_HIDPP_LONG 0x11
33+#define REPORT_ID_HIDPP_VERY_LONG 0x12
3334
3435 #define HIDPP_REPORT_SHORT_LENGTH 7
3536 #define HIDPP_REPORT_LONG_LENGTH 20
@@ -1242,7 +1243,8 @@ static int logi_dj_ll_raw_request(struct hid_device *hid, · 1206 unmodified lines
12421243 int ret;
12431244
12441245 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)) {
12461248 if (count < 2)
12471249 return -EINVAL;
12481250
drivers/hid/hid-multitouch.c+4−0
@@ -1776,6 +1776,10 @@ static const struct hid_device_id mt_devices[] = { · 1775 unmodified lines
17761776 HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
17771777 USB_VENDOR_ID_ALPS_JP,
17781778 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) },
17791783
17801784 /* Lenovo X1 TAB Gen 2 */
17811785 { .driver_data = MT_CLS_WIN_8_DUAL,
drivers/hid/hid-quirks.c+1−0
@@ -42,6 +42,7 @@ static const struct hid_device_id hid_quirks[] = { · 41 unmodified lines
4242 { HID_USB_DEVICE(USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM), HID_QUIRK_NOGET },
4343 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH), HID_QUIRK_MULTI_INPUT },
4444 { 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 },
4546 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_WIRELESS), HID_QUIRK_MULTI_INPUT },
4647 { HID_USB_DEVICE(USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD), HID_QUIRK_BADPAD },
4748 { HID_USB_DEVICE(USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_3AXIS_5BUTTON_STICK), HID_QUIRK_NOGET },
drivers/hid/hid-uclogic-core.c+2−0
@@ -369,6 +369,8 @@ static const struct hid_device_id uclogic_devices[] = { · 368 unmodified lines
369369 USB_DEVICE_ID_UCLOGIC_TABLET_TWHA60) },
370370 { HID_USB_DEVICE(USB_VENDOR_ID_HUION,
371371 USB_DEVICE_ID_HUION_TABLET) },
372+ { HID_USB_DEVICE(USB_VENDOR_ID_HUION,
373+ USB_DEVICE_ID_HUION_HS64) },
372374 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
373375 USB_DEVICE_ID_HUION_TABLET) },
374376 { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC,
drivers/hid/hid-uclogic-params.c+2−0
@@ -977,6 +977,8 @@ int uclogic_params_init(struct uclogic_params *params, · 976 unmodified lines
977977 /* FALL THROUGH */
978978 case VID_PID(USB_VENDOR_ID_HUION,
979979 USB_DEVICE_ID_HUION_TABLET):
980+ case VID_PID(USB_VENDOR_ID_HUION,
981+ USB_DEVICE_ID_HUION_HS64):
980982 case VID_PID(USB_VENDOR_ID_UCLOGIC,
981983 USB_DEVICE_ID_HUION_TABLET):
982984 case VID_PID(USB_VENDOR_ID_UCLOGIC,
drivers/hid/intel-ish-hid/ishtp-fw-loader.c+1−1
@@ -816,9 +816,9 @@ static int load_fw_from_host(struct ishtp_cl_data *client_data) · 815 unmodified lines
816816 goto end_err_fw_release;
817817
818818 release_firmware(fw);
819− kfree(filename);
820819 dev_info(cl_data_to_dev(client_data), "ISH firmware %s loaded\n",
821820 filename);
821+ kfree(filename);
822822 return 0;
823823
824824 end_err_fw_release:
drivers/hid/intel-ish-hid/ishtp-hid-client.c+2−2
@@ -891,7 +891,7 @@ static int hid_ishtp_cl_reset(struct ishtp_cl_device *cl_device) · 890 unmodified lines
891891 */
892892 static int hid_ishtp_cl_suspend(struct device *device)
893893 {
894− struct ishtp_cl_device *cl_device = dev_get_drvdata(device);
894+ struct ishtp_cl_device *cl_device = ishtp_dev_to_cl_device(device);
895895 struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device);
896896 struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
897897
@@ -912,7 +912,7 @@ static int hid_ishtp_cl_suspend(struct device *device) · 14 unmodified lines
912912 */
913913 static int hid_ishtp_cl_resume(struct device *device)
914914 {
915− struct ishtp_cl_device *cl_device = dev_get_drvdata(device);
915+ struct ishtp_cl_device *cl_device = ishtp_dev_to_cl_device(device);
916916 struct ishtp_cl *hid_ishtp_cl = ishtp_get_drvdata(cl_device);
917917 struct ishtp_cl_data *client_data = ishtp_get_client_data(hid_ishtp_cl);
918918
drivers/hid/intel-ish-hid/ishtp/bus.c+14−1
@@ -471,7 +471,6 @@ static struct ishtp_cl_device *ishtp_bus_add_device(struct ishtp_device *dev, · 470 unmodified lines
471471 }
472472
473473 ishtp_device_ready = true;
474− dev_set_drvdata(&device->dev, device);
475474
476475 return device;
477476 }
@@ -639,6 +638,20 @@ void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device) · 161 unmodified lines
639638 }
640639 EXPORT_SYMBOL(ishtp_get_drvdata);
641640
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+
642655 /**
643656 * ishtp_bus_new_client() - Create a new client
644657 * @dev: ISHTP device instance
drivers/iommu/intel-iommu.c+3−4
@@ -2504,7 +2504,6 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, · 2503 unmodified lines
25042504 }
25052505 }
25062506
2507− spin_lock(&iommu->lock);
25082507 spin_lock_irqsave(&device_domain_lock, flags);
25092508 if (dev)
25102509 found = find_domain(dev);
@@ -2520,16 +2519,17 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, · 9 unmodified lines
25202519
25212520 if (found) {
25222521 spin_unlock_irqrestore(&device_domain_lock, flags);
2523− spin_unlock(&iommu->lock);
25242522 free_devinfo_mem(info);
25252523 /* Caller must free the original domain */
25262524 return found;
25272525 }
25282526
2527+ spin_lock(&iommu->lock);
25292528 ret = domain_attach_iommu(domain, iommu);
2529+ spin_unlock(&iommu->lock);
2530+
25302531 if (ret) {
25312532 spin_unlock_irqrestore(&device_domain_lock, flags);
2532− spin_unlock(&iommu->lock);
25332533 free_devinfo_mem(info);
25342534 return NULL;
25352535 }
@@ -2539,7 +2539,6 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu, · 3 unmodified lines
25392539 if (dev)
25402540 dev->archdata.iommu = info;
25412541 spin_unlock_irqrestore(&device_domain_lock, flags);
2542− spin_unlock(&iommu->lock);
25432542
25442543 /* PASID table is mandatory for a PCI device in scalable mode. */
25452544 if (dev && dev_is_pci(dev) && sm_supported(iommu)) {
drivers/md/dm-init.c+5−5
@@ -140,8 +140,8 @@ static char __init *dm_parse_table_entry(struct dm_device *dev, char *str) · 139 unmodified lines
140140 return ERR_PTR(-EINVAL);
141141 }
142142 /* 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);
145145 if (!dev->target_args_array[n])
146146 return ERR_PTR(-ENOMEM);
147147
@@ -272,10 +272,10 @@ static int __init dm_init_init(void) · 124 unmodified lines
272272 return 0;
273273
274274 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);
276276 return -EINVAL;
277277 }
278− str = kstrndup(create, GFP_KERNEL, DM_MAX_STR_SIZE);
278+ str = kstrndup(create, DM_MAX_STR_SIZE, GFP_KERNEL);
279279 if (!str)
280280 return -ENOMEM;
281281
@@ -283,7 +283,7 @@ static int __init dm_init_init(void) · 1 unmodified line
283283 if (r)
284284 goto out;
285285
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");
287287 wait_for_device_probe();
288288
289289 list_for_each_entry(dev, &devices, list) {
drivers/md/dm-log-writes.c+21−2
@@ -60,6 +60,7 @@ · 59 unmodified lines
6060
6161 #define WRITE_LOG_VERSION 1ULL
6262 #define WRITE_LOG_MAGIC 0x6a736677736872ULL
63+#define WRITE_LOG_SUPER_SECTOR 0
6364
6465 /*
6566 * The disk format for this is braindead simple.
@@ -115,6 +116,7 @@ struct log_writes_c { · 49 unmodified lines
115116 struct list_head logging_blocks;
116117 wait_queue_head_t wait;
117118 struct task_struct *log_kthread;
119+ struct completion super_done;
118120 };
119121
120122 struct pending_block {
@@ -180,6 +182,14 @@ static void log_end_io(struct bio *bio) · 59 unmodified lines
180182 bio_put(bio);
181183 }
182184
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+
183193 /*
184194 * Meant to be called if there is an error, it will free all the pages
185195 * associated with the block.
@@ -215,7 +225,8 @@ static int write_metadata(struct log_writes_c *lc, void *entry, · 29 unmodified lines
215225 bio->bi_iter.bi_size = 0;
216226 bio->bi_iter.bi_sector = sector;
217227 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;
219230 bio->bi_private = lc;
220231 bio_set_op_attrs(bio, REQ_OP_WRITE, 0);
221232
@@ -418,11 +429,18 @@ static int log_super(struct log_writes_c *lc) · 196 unmodified lines
418429 super.nr_entries = cpu_to_le64(lc->logged_entries);
419430 super.sectorsize = cpu_to_le32(lc->sectorsize);
420431
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)) {
422434 DMERR("Couldn't write super");
423435 return -1;
424436 }
425437
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+
426444 return 0;
427445 }
428446
@@ -531,6 +549,7 @@ static int log_writes_ctr(struct dm_target *ti, unsigned int argc, char **argv) · 102 unmodified lines
531549 INIT_LIST_HEAD(&lc->unflushed_blocks);
532550 INIT_LIST_HEAD(&lc->logging_blocks);
533551 init_waitqueue_head(&lc->wait);
552+ init_completion(&lc->super_done);
534553 atomic_set(&lc->io_blocks, 0);
535554 atomic_set(&lc->pending_blocks, 0);
536555
drivers/md/dm-table.c+1−1
@@ -561,7 +561,7 @@ static char **realloc_argv(unsigned *size, char **old_argv) · 560 unmodified lines
561561 gfp = GFP_NOIO;
562562 }
563563 argv = kmalloc_array(new_size, sizeof(*argv), gfp);
564− if (argv) {
564+ if (argv && old_argv) {
565565 memcpy(argv, old_argv, *size * sizeof(*argv));
566566 *size = new_size;
567567 }
drivers/md/dm-verity-target.c+2−2
@@ -235,8 +235,8 @@ static int verity_handle_err(struct dm_verity *v, enum verity_block_type type, · 234 unmodified lines
235235 BUG();
236236 }
237237
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);
240240
241241 if (v->corrupted_errs == DM_VERITY_MAX_CORRUPTED_ERRS)
242242 DMERR("%s: reached maximum errors", v->data_dev->name);
drivers/mfd/stmfx.c+6−6
@@ -204,12 +204,11 @@ static struct irq_chip stmfx_irq_chip = { · 203 unmodified lines
204204 static irqreturn_t stmfx_irq_handler(int irq, void *data)
205205 {
206206 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;
210210
211− ret = regmap_read(stmfx->map, STMFX_REG_IRQ_PENDING,
212− (u32 *)&pending);
211+ ret = regmap_read(stmfx->map, STMFX_REG_IRQ_PENDING, &pending);
213212 if (ret)
214213 return IRQ_NONE;
215214
@@ -224,7 +223,8 @@ static irqreturn_t stmfx_irq_handler(int irq, void *data) · 8 unmodified lines
224223 return IRQ_NONE;
225224 }
226225
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)
228228 handle_nested_irq(irq_find_mapping(stmfx->irq_domain, n));
229229
230230 return IRQ_HANDLED;
drivers/mtd/nand/raw/nand_base.c+2−1
@@ -4662,7 +4662,6 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type) · 4661 unmodified lines
46624662 memorg = nanddev_get_memorg(&chip->base);
46634663 memorg->planes_per_lun = 1;
46644664 memorg->luns_per_target = 1;
4665− memorg->ntargets = 1;
46664665
46674666 /*
46684667 * 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
50275026 if (ret)
50285027 return ret;
50295028
5029+ memorg->ntargets = maxchips;
5030+
50305031 /* Read the flash type */
50315032 ret = nand_detect(chip, table);
50325033 if (ret) {
drivers/mtd/spi-nor/spi-nor.c+108−11
@@ -1636,6 +1636,95 @@ static int sr2_bit7_quad_enable(struct spi_nor *nor) · 1635 unmodified lines
16361636 return 0;
16371637 }
16381638
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+
16391728 /* Used when the "_ext_id" is two bytes at most */
16401729 #define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags) \
16411730 .id = { \
@@ -3660,6 +3749,8 @@ static int spi_nor_init_params(struct spi_nor *nor, · 2018 unmodified lines
36603749 default:
36613750 /* Kept only for backward compatibility purpose. */
36623751 params->quad_enable = spansion_quad_enable;
3752+ if (nor->clear_sr_bp)
3753+ nor->clear_sr_bp = spi_nor_spansion_clear_sr_bp;
36633754 break;
36643755 }
36653756
@@ -3912,17 +4003,13 @@ static int spi_nor_init(struct spi_nor *nor) · 246 unmodified lines
39124003 {
39134004 int err;
39144005
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+ }
39264013 }
39274014
39284015 if (nor->quad_enable) {
@@ -4047,6 +4134,16 @@ int spi_nor_scan(struct spi_nor *nor, const char *name, · 118 unmodified lines
40474134 if (info->flags & SPI_S3AN)
40484135 nor->flags |= SNOR_F_READY_XSR_RDY;
40494136
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+
40504147 /* Parse the Serial Flash Discoverable Parameters table. */
40514148 ret = spi_nor_init_params(nor, &params);
40524149 if (ret)
drivers/net/bonding/bond_main.c+1−1
@@ -4304,12 +4304,12 @@ void bond_setup(struct net_device *bond_dev) · 4303 unmodified lines
43044304 bond_dev->features |= NETIF_F_NETNS_LOCAL;
43054305
43064306 bond_dev->hw_features = BOND_VLAN_FEATURES |
4307− NETIF_F_HW_VLAN_CTAG_TX |
43084307 NETIF_F_HW_VLAN_CTAG_RX |
43094308 NETIF_F_HW_VLAN_CTAG_FILTER;
43104309
43114310 bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
43124311 bond_dev->features |= bond_dev->hw_features;
4312+ bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
43134313 }
43144314
43154315 /* Destroy a bonding device.
drivers/net/dsa/microchip/ksz_common.c+3−3
@@ -433,9 +433,9 @@ int ksz_switch_register(struct ksz_device *dev, · 432 unmodified lines
433433 return PTR_ERR(dev->reset_gpio);
434434
435435 if (dev->reset_gpio) {
436− gpiod_set_value(dev->reset_gpio, 1);
436+ gpiod_set_value_cansleep(dev->reset_gpio, 1);
437437 mdelay(10);
438− gpiod_set_value(dev->reset_gpio, 0);
438+ gpiod_set_value_cansleep(dev->reset_gpio, 0);
439439 }
440440
441441 mutex_init(&dev->dev_mutex);
@@ -485,7 +485,7 @@ void ksz_switch_remove(struct ksz_device *dev) · 43 unmodified lines
485485 dsa_unregister_switch(dev->ds);
486486
487487 if (dev->reset_gpio)
488− gpiod_set_value(dev->reset_gpio, 1);
488+ gpiod_set_value_cansleep(dev->reset_gpio, 1);
489489
490490 }
491491 EXPORT_SYMBOL(ksz_switch_remove);
drivers/net/ethernet/aquantia/atlantic/aq_filters.c+8−2
@@ -843,9 +843,14 @@ int aq_filters_vlans_update(struct aq_nic_s *aq_nic) · 842 unmodified lines
843843 return err;
844844
845845 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 {
848851 /* otherwise left in promiscue mode */
852+ aq_nic->aq_nic_cfg.is_vlan_force_promisc = true;
853+ }
849854 }
850855
851856 return err;
@@ -866,6 +871,7 @@ int aq_filters_vlan_offload_off(struct aq_nic_s *aq_nic) · 14 unmodified lines
866871 if (unlikely(!aq_hw_ops->hw_filter_vlan_ctrl))
867872 return -EOPNOTSUPP;
868873
874+ aq_nic->aq_nic_cfg.is_vlan_force_promisc = true;
869875 err = aq_hw_ops->hw_filter_vlan_ctrl(aq_hw, false);
870876 if (err)
871877 return err;
drivers/net/ethernet/aquantia/atlantic/aq_nic.c+1−0
@@ -128,6 +128,7 @@ void aq_nic_cfg_start(struct aq_nic_s *self) · 127 unmodified lines
128128 cfg->features = cfg->aq_hw_caps->hw_features;
129129 cfg->is_vlan_rx_strip = !!(cfg->features & NETIF_F_HW_VLAN_CTAG_RX);
130130 cfg->is_vlan_tx_insert = !!(cfg->features & NETIF_F_HW_VLAN_CTAG_TX);
131+ cfg->is_vlan_force_promisc = true;
131132 }
132133
133134 static int aq_nic_update_link_status(struct aq_nic_s *self)
drivers/net/ethernet/aquantia/atlantic/aq_nic.h+1−0
@@ -37,6 +37,7 @@ struct aq_nic_cfg_s { · 36 unmodified lines
3737 u32 wol;
3838 u8 is_vlan_rx_strip;
3939 u8 is_vlan_tx_insert;
40+ bool is_vlan_force_promisc;
4041 u16 is_mc_list_enabled;
4142 u16 mc_list_count;
4243 bool is_autoneg;
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c+13−6
@@ -808,8 +808,15 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, · 807 unmodified lines
808808 unsigned int packet_filter)
809809 {
810810 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);
811819
812− hw_atl_rpfl2promiscuous_mode_en_set(self, IS_FILTER_ENABLED(IFF_PROMISC));
813820 hw_atl_rpfl2multicast_flr_en_set(self,
814821 IS_FILTER_ENABLED(IFF_ALLMULTI), 0);
815822
@@ -818,13 +825,13 @@ static int hw_atl_b0_hw_packet_filter_set(struct aq_hw_s *self, · 2 unmodified lines
818825
819826 hw_atl_rpfl2broadcast_en_set(self, IS_FILTER_ENABLED(IFF_BROADCAST));
820827
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);
822829
823830 for (i = HW_ATL_B0_MAC_MIN; i < HW_ATL_B0_MAC_MAX; ++i)
824831 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);
828835
829836 return aq_hw_err_from_flags(self);
830837 }
@@ -1116,7 +1123,7 @@ static int hw_atl_b0_hw_vlan_set(struct aq_hw_s *self, · 285 unmodified lines
11161123 static int hw_atl_b0_hw_vlan_ctrl(struct aq_hw_s *self, bool enable)
11171124 {
11181125 /* 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);
11201127
11211128 return aq_hw_err_from_flags(self);
11221129 }
drivers/net/ethernet/cadence/macb_main.c+1−1
@@ -4303,7 +4303,7 @@ static int macb_probe(struct platform_device *pdev) · 4302 unmodified lines
43034303 if (PTR_ERR(mac) == -EPROBE_DEFER) {
43044304 err = -EPROBE_DEFER;
43054305 goto err_out_free_netdev;
4306− } else if (!IS_ERR(mac)) {
4306+ } else if (!IS_ERR_OR_NULL(mac)) {
43074307 ether_addr_copy(bp->dev->dev_addr, mac);
43084308 } else {
43094309 macb_get_hwaddr(bp);
drivers/net/ethernet/emulex/benet/be_ethtool.c+22−6
@@ -891,7 +891,7 @@ static void be_self_test(struct net_device *netdev, struct ethtool_test *test, · 890 unmodified lines
891891 u64 *data)
892892 {
893893 struct be_adapter *adapter = netdev_priv(netdev);
894− int status;
894+ int status, cnt;
895895 u8 link_status = 0;
896896
897897 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
902902
903903 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
904904
905+ /* check link status before offline tests */
906+ link_status = netif_carrier_ok(netdev);
907+
905908 if (test->flags & ETH_TEST_FL_OFFLINE) {
906909 if (be_loopback_test(adapter, BE_MAC_LOOPBACK, &data[0]) != 0)
907910 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
922925 test->flags |= ETH_TEST_FL_FAILED;
923926 }
924927
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) {
930930 test->flags |= ETH_TEST_FL_FAILED;
931931 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);
932948 }
933949 }
934950
drivers/net/ethernet/sis/sis900.c+8−8
@@ -1057,7 +1057,7 @@ sis900_open(struct net_device *net_dev) · 1056 unmodified lines
10571057 sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED);
10581058
10591059 /* 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);
10611061 sw32(cr, RxENA | sr32(cr));
10621062 sw32(ier, IE);
10631063
@@ -1578,7 +1578,7 @@ static void sis900_tx_timeout(struct net_device *net_dev) · 514 unmodified lines
15781578 sw32(txdp, sis_priv->tx_ring_dma);
15791579
15801580 /* 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);
15821582 }
15831583
15841584 /**
@@ -1618,7 +1618,7 @@ sis900_start_xmit(struct sk_buff *skb, struct net_device *net_dev) · 33 unmodified lines
16181618 spin_unlock_irqrestore(&sis_priv->lock, flags);
16191619 return NETDEV_TX_OK;
16201620 }
1621− sis_priv->tx_ring[entry].cmdsts = (OWN | skb->len);
1621+ sis_priv->tx_ring[entry].cmdsts = (OWN | INTR | skb->len);
16221622 sw32(cr, TxENA | sr32(cr));
16231623
16241624 sis_priv->cur_tx ++;
@@ -1674,7 +1674,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance) · 49 unmodified lines
16741674 do {
16751675 status = sr32(isr);
16761676
1677− if ((status & (HIBERR|TxURN|TxERR|TxIDLE|RxORN|RxERR|RxOK)) == 0)
1677+ if ((status & (HIBERR|TxURN|TxERR|TxIDLE|TxDESC|RxORN|RxERR|RxOK)) == 0)
16781678 /* nothing intresting happened */
16791679 break;
16801680 handled = 1;
@@ -1684,7 +1684,7 @@ static irqreturn_t sis900_interrupt(int irq, void *dev_instance) · 3 unmodified lines
16841684 /* Rx interrupt */
16851685 sis900_rx(net_dev);
16861686
1687− if (status & (TxURN | TxERR | TxIDLE))
1687+ if (status & (TxURN | TxERR | TxIDLE | TxDESC))
16881688 /* Tx interrupt */
16891689 sis900_finish_xmit(net_dev);
16901690
@@ -1896,8 +1896,8 @@ static void sis900_finish_xmit (struct net_device *net_dev) · 205 unmodified lines
18961896
18971897 if (tx_status & OWN) {
18981898 /* 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') */
19011901 break;
19021902 }
19031903
@@ -2473,7 +2473,7 @@ static int sis900_resume(struct pci_dev *pci_dev) · 569 unmodified lines
24732473 sis900_set_mode(sis_priv, HW_SPEED_10_MBPS, FDX_CAPABLE_HALF_SELECTED);
24742474
24752475 /* 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);
24772477 sw32(cr, RxENA | sr32(cr));
24782478 sw32(ier, IE);
24792479
drivers/net/ethernet/stmicro/stmmac/stmmac_hwtstamp.c+1−1
@@ -112,7 +112,7 @@ static int adjust_systime(void __iomem *ioaddr, u32 sec, u32 nsec, · 111 unmodified lines
112112 * programmed with (2^32 – <new_sec_value>)
113113 */
114114 if (gmac4)
115− sec = (100000000ULL - sec);
115+ sec = -sec;
116116
117117 value = readl(ioaddr + PTP_TCR);
118118 if (value & PTP_TCR_TSCTRLSSR)
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c+14−8
@@ -2892,12 +2892,15 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) · 2891 unmodified lines
28922892
28932893 /* Manage tx mitigation */
28942894 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;
28962902 stmmac_set_tx_ic(priv, desc);
28972903 priv->xstats.tx_set_ic_bit++;
2898− tx_q->tx_count_frames = 0;
2899− } else {
2900− stmmac_tx_timer_arm(priv, queue);
29012904 }
29022905
29032906 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
31113114 * element in case of no SG.
31123115 */
31133116 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;
31153124 stmmac_set_tx_ic(priv, desc);
31163125 priv->xstats.tx_set_ic_bit++;
3117− tx_q->tx_count_frames = 0;
3118− } else {
3119− stmmac_tx_timer_arm(priv, queue);
31203126 }
31213127
31223128 skb_tx_timestamp(skb);
drivers/net/ppp/ppp_mppe.c+1−0
@@ -63,6 +63,7 @@ MODULE_AUTHOR("Frank Cusack <fcusack@fcusack.com>"); · 62 unmodified lines
6363 MODULE_DESCRIPTION("Point-to-Point Protocol Microsoft Point-to-Point Encryption support");
6464 MODULE_LICENSE("Dual BSD/GPL");
6565 MODULE_ALIAS("ppp-compress-" __stringify(CI_MPPE));
66+MODULE_SOFTDEP("pre: arc4");
6667 MODULE_VERSION("1.0.2");
6768
6869 static unsigned int
drivers/net/team/team.c+1−1
@@ -2153,12 +2153,12 @@ static void team_setup(struct net_device *dev) · 2152 unmodified lines
21532153 dev->features |= NETIF_F_NETNS_LOCAL;
21542154
21552155 dev->hw_features = TEAM_VLAN_FEATURES |
2156− NETIF_F_HW_VLAN_CTAG_TX |
21572156 NETIF_F_HW_VLAN_CTAG_RX |
21582157 NETIF_F_HW_VLAN_CTAG_FILTER;
21592158
21602159 dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
21612160 dev->features |= dev->hw_features;
2161+ dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
21622162 }
21632163
21642164 static int team_newlink(struct net *src_net, struct net_device *dev,
drivers/net/usb/qmi_wwan.c+1−1
@@ -1482,7 +1482,7 @@ static int qmi_wwan_probe(struct usb_interface *intf, · 1481 unmodified lines
14821482 * different. Ignore the current interface if the number of endpoints
14831483 * equals the number for the diag interface (two).
14841484 */
1485− info = (void *)&id->driver_info;
1485+ info = (void *)id->driver_info;
14861486
14871487 if (info->data & QMI_WWAN_QUIRK_QUECTEL_DYNCFG) {
14881488 if (desc->bNumEndpoints == 2)
drivers/net/vrf.c+1−1
@@ -350,8 +350,8 @@ static int vrf_finish_output6(struct net *net, struct sock *sk, · 349 unmodified lines
350350 {
351351 struct dst_entry *dst = skb_dst(skb);
352352 struct net_device *dev = dst->dev;
353+ const struct in6_addr *nexthop;
353354 struct neighbour *neigh;
354− struct in6_addr *nexthop;
355355 int ret;
356356
357357 nf_reset(skb);
drivers/pci/p2pdma.c+4−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #include <linux/percpu-refcount.h>
1919 #include <linux/random.h>
2020 #include <linux/seq_buf.h>
21+#include <linux/iommu.h>
2122
2223 struct pci_p2pdma {
2324 struct gen_pool *pool;
@@ -299,6 +300,9 @@ static bool root_complex_whitelist(struct pci_dev *dev) · 275 unmodified lines
299300 struct pci_dev *root = pci_get_slot(host->bus, PCI_DEVFN(0, 0));
300301 unsigned short vendor, device;
301302
303+ if (iommu_present(dev->dev.bus))
304+ return false;
305+
302306 if (!root)
303307 return false;
304308
drivers/scsi/qedi/qedi_main.c+3−0
@@ -987,6 +987,9 @@ static int qedi_find_boot_info(struct qedi_ctx *qedi, · 986 unmodified lines
987987 if (!iscsi_is_session_online(cls_sess))
988988 continue;
989989
990+ if (!sess->targetname)
991+ continue;
992+
990993 if (pri_ctrl_flags) {
991994 if (!strcmp(pri_tgt->iscsi_name, sess->targetname) &&
992995 !strcmp(pri_tgt->ip_addr, ep_ip_addr)) {
drivers/scsi/qedi/qedi_version.h+3−3
@@ -4,8 +4,8 @@ · 3 unmodified lines
44 * Copyright (c) 2016 Cavium Inc.
55 */
66
7−#define QEDI_MODULE_VERSION "8.33.0.21"
7+#define QEDI_MODULE_VERSION "8.37.0.20"
88 #define QEDI_DRIVER_MAJOR_VER 8
9−#define QEDI_DRIVER_MINOR_VER 33
9+#define QEDI_DRIVER_MINOR_VER 37
1010 #define QEDI_DRIVER_REV_VER 0
11−#define QEDI_DRIVER_ENG_VER 21
11+#define QEDI_DRIVER_ENG_VER 20
drivers/scsi/qla2xxx/qla_os.c+1−1
@@ -1731,8 +1731,8 @@ static void qla2x00_abort_srb(struct qla_qpair *qp, srb_t *sp, const int res, · 1730 unmodified lines
17311731 !test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) &&
17321732 !qla2x00_isp_reg_stat(ha))) {
17331733 sp->comp = &comp;
1734− rval = ha->isp_ops->abort_command(sp);
17351734 spin_unlock_irqrestore(qp->qp_lock_ptr, *flags);
1735+ rval = ha->isp_ops->abort_command(sp);
17361736
17371737 switch (rval) {
17381738 case QLA_SUCCESS:
drivers/scsi/ufs/ufshcd-pltfrm.c+4−7
@@ -430,24 +430,21 @@ int ufshcd_pltfrm_init(struct platform_device *pdev, · 429 unmodified lines
430430 goto dealloc_host;
431431 }
432432
433− pm_runtime_set_active(&pdev->dev);
434− pm_runtime_enable(&pdev->dev);
435−
436433 ufshcd_init_lanes_per_dir(hba);
437434
438435 err = ufshcd_init(hba, mmio_base, irq);
439436 if (err) {
440437 dev_err(dev, "Initialization failed\n");
441− goto out_disable_rpm;
438+ goto dealloc_host;
442439 }
443440
444441 platform_set_drvdata(pdev, hba);
445442
443+ pm_runtime_set_active(&pdev->dev);
444+ pm_runtime_enable(&pdev->dev);
445+
446446 return 0;
447447
448−out_disable_rpm:
449− pm_runtime_disable(&pdev->dev);
450− pm_runtime_set_suspended(&pdev->dev);
451448 dealloc_host:
452449 ufshcd_dealloc_host(hba);
453450 out:
fs/afs/callback.c+2−2
@@ -275,9 +275,9 @@ static void afs_break_one_callback(struct afs_server *server, · 274 unmodified lines
275275 struct afs_super_info *as = AFS_FS_S(cbi->sb);
276276 struct afs_volume *volume = as->volume;
277277
278− write_lock(&volume->cb_break_lock);
278+ write_lock(&volume->cb_v_break_lock);
279279 volume->cb_v_break++;
280− write_unlock(&volume->cb_break_lock);
280+ write_unlock(&volume->cb_v_break_lock);
281281 } else {
282282 data.volume = NULL;
283283 data.fid = *fid;
fs/afs/inode.c+19−12
@@ -55,6 +55,16 @@ static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *paren · 54 unmodified lines
5555 dump_stack();
5656 }
5757
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+
5868 /*
5969 * Initialise an inode from the vnode status.
6070 */
@@ -124,12 +134,7 @@ static int afs_inode_init_from_status(struct afs_vnode *vnode, struct key *key, · 63 unmodified lines
124134 return afs_protocol_error(NULL, -EBADMSG, afs_eproto_file_type);
125135 }
126136
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);
133138
134139 vnode->invalid_before = status->data_version;
135140 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
207212
208213 if (expected_version &&
209214 *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+
215222 vnode->invalid_before = status->data_version;
216223 if (vnode->status.type == AFS_FTYPE_DIR) {
217224 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
230237
231238 if (data_changed) {
232239 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);
234241 }
235242 }
236243
fs/afs/internal.h+3−5
@@ -109,10 +109,8 @@ struct afs_call { · 108 unmodified lines
109109 struct rxrpc_call *rxcall; /* RxRPC call handle */
110110 struct key *key; /* security for this call */
111111 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 */
116114 struct afs_cb_interest *cbi; /* Callback interest for server used */
117115 struct afs_vnode *lvnode; /* vnode being locked */
118116 void *request; /* request data (first part) */
@@ -616,7 +614,7 @@ struct afs_volume { · 497 unmodified lines
616614 unsigned int servers_seq; /* Incremented each time ->servers changes */
617615
618616 unsigned cb_v_break; /* Break-everything counter. */
619− rwlock_t cb_break_lock;
617+ rwlock_t cb_v_break_lock;
620618
621619 afs_voltype_t type; /* type of volume */
622620 short error;
fs/afs/volume.c+1−0
@@ -43,6 +43,7 @@ static struct afs_volume *afs_alloc_volume(struct afs_fs_context *params, · 42 unmodified lines
4343 atomic_set(&volume->usage, 1);
4444 INIT_LIST_HEAD(&volume->proc_link);
4545 rwlock_init(&volume->servers_lock);
46+ rwlock_init(&volume->cb_v_break_lock);
4647 memcpy(volume->name, vldb->name, vldb->name_len + 1);
4748
4849 slist = afs_alloc_server_list(params->cell, params->key, vldb, type_mask);
fs/proc/base.c+1−2
@@ -3077,8 +3077,7 @@ static const struct file_operations proc_tgid_base_operations = { · 3076 unmodified lines
30773077
30783078 struct pid *tgid_pidfd_to_pid(const struct file *file)
30793079 {
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)
30823081 return ERR_PTR(-EBADF);
30833082
30843083 return proc_pid(file_inode(file));
include/dt-bindings/clock/g12a-clkc.h+1−1
@@ -130,7 +130,7 @@ · 129 unmodified lines
130130 #define CLKID_MALI_1_SEL 172
131131 #define CLKID_MALI_1 174
132132 #define CLKID_MALI 175
133−#define CLKID_MPLL_5OM 177
133+#define CLKID_MPLL_50M 177
134134 #define CLKID_CPU_CLK 187
135135 #define CLKID_PCIE_PLL 201
136136 #define CLKID_VDEC_1 204
include/linux/intel-ish-client-if.h+1−0
@@ -103,6 +103,7 @@ void ishtp_put_device(struct ishtp_cl_device *cl_dev); · 102 unmodified lines
103103 void ishtp_get_device(struct ishtp_cl_device *cl_dev);
104104 void ishtp_set_drvdata(struct ishtp_cl_device *cl_device, void *data);
105105 void *ishtp_get_drvdata(struct ishtp_cl_device *cl_device);
106+struct ishtp_cl_device *ishtp_dev_to_cl_device(struct device *dev);
106107 int ishtp_register_event_cb(struct ishtp_cl_device *device,
107108 void (*read_cb)(struct ishtp_cl_device *));
108109 struct ishtp_fw_client *ishtp_fw_cl_get_client(struct ishtp_device *dev,
include/linux/mtd/spi-nor.h+3−0
@@ -373,6 +373,8 @@ struct flash_info; · 372 unmodified lines
373373 * @flash_unlock: [FLASH-SPECIFIC] unlock a region of the SPI NOR
374374 * @flash_is_locked: [FLASH-SPECIFIC] check if a region of the SPI NOR is
375375 * @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.
376378 * completely locked
377379 * @priv: the private data
378380 */
@@ -410,6 +412,7 @@ struct spi_nor { · 31 unmodified lines
410412 int (*flash_unlock)(struct spi_nor *nor, loff_t ofs, uint64_t len);
411413 int (*flash_is_locked)(struct spi_nor *nor, loff_t ofs, uint64_t len);
412414 int (*quad_enable)(struct spi_nor *nor);
415+ int (*clear_sr_bp)(struct spi_nor *nor);
413416
414417 void *priv;
415418 };
include/net/ip6_route.h+2−2
@@ -281,8 +281,8 @@ static inline bool ip6_sk_ignore_df(const struct sock *sk) · 280 unmodified lines
281281 inet6_sk(sk)->pmtudisc == IPV6_PMTUDISC_OMIT;
282282 }
283283
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)
286286 {
287287 if (rt->rt6i_flags & RTF_GATEWAY)
288288 return &rt->rt6i_gateway;
include/net/route.h+1−0
@@ -221,6 +221,7 @@ void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); · 220 unmodified lines
221221 struct rtable *rt_dst_alloc(struct net_device *dev,
222222 unsigned int flags, u16 type,
223223 bool nopolicy, bool noxfrm, bool will_cache);
224+struct rtable *rt_dst_clone(struct net_device *dev, struct rtable *rt);
224225
225226 struct in_ifaddr;
226227 void fib_add_ifaddr(struct in_ifaddr *);
include/net/tls.h+0−15
@@ -407,21 +407,6 @@ static inline bool tls_is_partially_sent_record(struct tls_context *ctx) · 406 unmodified lines
407407 return !!ctx->partially_sent_record;
408408 }
409409
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−
425410 static inline bool tls_is_pending_open_record(struct tls_context *tls_ctx)
426411 {
427412 return tls_ctx->pending_open_record_frags;
kernel/fork.c+18−40
@@ -1712,31 +1712,6 @@ const struct file_operations pidfd_fops = { · 1711 unmodified lines
17121712 #endif
17131713 };
17141714
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−
17401715 static void __delayed_free_task(struct rcu_head *rhp)
17411716 {
17421717 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
17741749 int pidfd = -1, retval;
17751750 struct task_struct *p;
17761751 struct multiprocess_signals delayed;
1752+ struct file *pidfile = NULL;
17771753
17781754 /*
17791755 * 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
18221798 }
18231799
18241800 if (clone_flags & CLONE_PIDFD) {
1825− int reserved;
1826−
18271801 /*
18281802 * - CLONE_PARENT_SETTID is useless for pidfds and also
18291803 * parent_tidptr is used to return pidfds.
@@ -1834,16 +1808,6 @@ static __latent_entropy struct task_struct *copy_process( · 4 unmodified lines
18341808 if (clone_flags &
18351809 (CLONE_DETACHED | CLONE_PARENT_SETTID | CLONE_THREAD))
18361810 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);
18471811 }
18481812
18491813 /*
@@ -2058,11 +2022,20 @@ static __latent_entropy struct task_struct *copy_process( · 208 unmodified lines
20582022 * if the fd table isn't shared).
20592023 */
20602024 if (clone_flags & CLONE_PIDFD) {
2061− retval = pidfd_create(pid);
2025+ retval = get_unused_fd_flags(O_RDWR | O_CLOEXEC);
20622026 if (retval < 0)
20632027 goto bad_fork_free_pid;
20642028
20652029 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+
20662039 retval = put_user(pidfd, parent_tidptr);
20672040 if (retval)
20682041 goto bad_fork_put_pidfd;
@@ -2180,6 +2153,9 @@ static __latent_entropy struct task_struct *copy_process( · 111 unmodified lines
21802153 goto bad_fork_cancel_cgroup;
21812154 }
21822155
2156+ /* past the last point of failure */
2157+ if (pidfile)
2158+ fd_install(pidfd, pidfile);
21832159
21842160 init_task_pid_links(p);
21852161 if (likely(p->pid)) {
@@ -2246,8 +2222,10 @@ bad_fork_cancel_cgroup: · 60 unmodified lines
22462222 bad_fork_cgroup_threadgroup_change_end:
22472223 cgroup_threadgroup_change_end(current);
22482224 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+ }
22512229 bad_fork_free_pid:
22522230 if (pid != &init_struct_pid)
22532231 free_pid(pid);
net/bluetooth/6lowpan.c+2−2
@@ -160,10 +160,10 @@ static inline struct lowpan_peer *peer_lookup_dst(struct lowpan_btle_dev *dev, · 159 unmodified lines
160160 struct in6_addr *daddr,
161161 struct sk_buff *skb)
162162 {
163− struct lowpan_peer *peer;
164− struct in6_addr *nexthop;
165163 struct rt6_info *rt = (struct rt6_info *)skb_dst(skb);
166164 int count = atomic_read(&dev->peer_count);
165+ const struct in6_addr *nexthop;
166+ struct lowpan_peer *peer;
167167
168168 BT_DBG("peers %d addr %pI6c rt %p", count, daddr, rt);
169169
net/bluetooth/hci_conn.c+9−9
@@ -1276,14 +1276,6 @@ int hci_conn_check_link_mode(struct hci_conn *conn) · 1275 unmodified lines
12761276 !test_bit(HCI_CONN_ENCRYPT, &conn->flags))
12771277 return 0;
12781278
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−
12871279 return 1;
12881280 }
12891281
@@ -1400,8 +1392,16 @@ auth: · 110 unmodified lines
14001392 return 0;
14011393
14021394 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 */
14041403 return 1;
1404+ }
14051405
14061406 hci_conn_encrypt(conn);
14071407 return 0;
net/bluetooth/l2cap_core.c+28−5
@@ -1341,6 +1341,21 @@ static void l2cap_request_info(struct l2cap_conn *conn) · 1340 unmodified lines
13411341 sizeof(req), &req);
13421342 }
13431343
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+
13441359 static void l2cap_do_start(struct l2cap_chan *chan)
13451360 {
13461361 struct l2cap_conn *conn = chan->conn;
@@ -1358,9 +1373,14 @@ static void l2cap_do_start(struct l2cap_chan *chan) · 11 unmodified lines
13581373 if (!(conn->info_state & L2CAP_INFO_FEAT_MASK_REQ_DONE))
13591374 return;
13601375
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))
13631381 l2cap_start_connection(chan);
1382+ else
1383+ __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
13641384 }
13651385
13661386 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
14391459 continue;
14401460 }
14411461
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);
14431466
14441467 } else if (chan->state == BT_CONNECT2) {
14451468 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
74907513 }
74917514
74927515 if (chan->state == BT_CONNECT) {
7493− if (!status)
7516+ if (!status && l2cap_check_enc_key_size(hcon))
74947517 l2cap_start_connection(chan);
74957518 else
74967519 __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
74997522 struct l2cap_conn_rsp rsp;
75007523 __u16 res, stat;
75017524
7502− if (!status) {
7525+ if (!status && l2cap_check_enc_key_size(hcon)) {
75037526 if (test_bit(FLAG_DEFER_SETUP, &chan->flags)) {
75047527 res = L2CAP_CR_PEND;
75057528 stat = L2CAP_CS_AUTHOR_PEND;
net/ipv4/ip_output.c+21−4
@@ -327,18 +327,35 @@ static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *sk · 326 unmodified lines
327327 static int ip_mc_finish_output(struct net *net, struct sock *sk,
328328 struct sk_buff *skb)
329329 {
330− int ret;
330+ struct rtable *new_rt;
331+ bool do_cn = false;
332+ int ret, err;
331333
332334 ret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb);
333335 switch (ret) {
334− case NET_XMIT_SUCCESS:
335− return dev_loopback_xmit(net, sk, skb);
336336 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;
338341 default:
339342 kfree_skb(skb);
340343 return ret;
341344 }
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;
342359 }
343360
344361 int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb)
net/ipv4/raw.c+1−1
@@ -197,7 +197,7 @@ static int raw_v4_input(struct sk_buff *skb, const struct iphdr *iph, int hash) · 196 unmodified lines
197197 }
198198 sk = __raw_v4_lookup(net, sk_next(sk), iph->protocol,
199199 iph->saddr, iph->daddr,
200− skb->dev->ifindex, sdif);
200+ dif, sdif);
201201 }
202202 out:
203203 read_unlock(&raw_v4_hashinfo.lock);
net/ipv4/route.c+33−0
@@ -1648,6 +1648,39 @@ struct rtable *rt_dst_alloc(struct net_device *dev, · 1647 unmodified lines
16481648 }
16491649 EXPORT_SYMBOL(rt_dst_alloc);
16501650
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+
16511684 /* called in rcu_read_lock() section */
16521685 int ip_mc_validate_source(struct sk_buff *skb, __be32 daddr, __be32 saddr,
16531686 u8 tos, struct net_device *dev,
net/ipv6/ip6_output.c+1−1
@@ -59,8 +59,8 @@ static int ip6_finish_output2(struct net *net, struct sock *sk, struct sk_buff * · 58 unmodified lines
5959 {
6060 struct dst_entry *dst = skb_dst(skb);
6161 struct net_device *dev = dst->dev;
62+ const struct in6_addr *nexthop;
6263 struct neighbour *neigh;
63− struct in6_addr *nexthop;
6464 int ret;
6565
6666 if (ipv6_addr_is_multicast(&ipv6_hdr(skb)->daddr)) {
net/ipv6/route.c+3−2
@@ -218,7 +218,8 @@ static struct neighbour *ip6_dst_neigh_lookup(const struct dst_entry *dst, · 217 unmodified lines
218218 {
219219 const struct rt6_info *rt = container_of(dst, struct rt6_info, dst);
220220
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);
222223 }
223224
224225 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
60736074 .data = &init_net.ipv6.sysctl.skip_notify_on_dev_down,
60746075 .maxlen = sizeof(int),
60756076 .mode = 0644,
6076− .proc_handler = proc_dointvec,
6077+ .proc_handler = proc_dointvec_minmax,
60776078 .extra1 = &zero,
60786079 .extra2 = &one,
60796080 },
net/netfilter/nf_flow_table_ip.c+1−1
@@ -439,9 +439,9 @@ nf_flow_offload_ipv6_hook(void *priv, struct sk_buff *skb, · 438 unmodified lines
439439 struct nf_flowtable *flow_table = priv;
440440 struct flow_offload_tuple tuple = {};
441441 enum flow_offload_tuple_dir dir;
442+ const struct in6_addr *nexthop;
442443 struct flow_offload *flow;
443444 struct net_device *outdev;
444− struct in6_addr *nexthop;
445445 struct ipv6hdr *ip6h;
446446 struct rt6_info *rt;
447447
net/packet/af_packet.c+19−4
@@ -2412,6 +2412,9 @@ static void tpacket_destruct_skb(struct sk_buff *skb) · 2411 unmodified lines
24122412
24132413 ts = __packet_set_timestamp(po, ph, skb);
24142414 __packet_set_status(po, ph, TP_STATUS_AVAILABLE | ts);
2415+
2416+ if (!packet_read_pending(&po->tx_ring))
2417+ complete(&po->skb_completion);
24152418 }
24162419
24172420 sock_wfree(skb);
@@ -2596,7 +2599,7 @@ static int tpacket_parse_header(struct packet_sock *po, void *frame, · 178 unmodified lines
25962599
25972600 static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
25982601 {
2599− struct sk_buff *skb;
2602+ struct sk_buff *skb = NULL;
26002603 struct net_device *dev;
26012604 struct virtio_net_hdr *vnet_hdr = NULL;
26022605 struct sockcm_cookie sockc;
@@ -2611,6 +2614,7 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) · 8 unmodified lines
26112614 int len_sum = 0;
26122615 int status = TP_STATUS_AVAILABLE;
26132616 int hlen, tlen, copylen = 0;
2617+ long timeo = 0;
26142618
26152619 mutex_lock(&po->pg_vec_lock);
26162620
@@ -2657,12 +2661,21 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg) · 40 unmodified lines
26572661 if ((size_max > dev->mtu + reserve + VLAN_HLEN) && !po->has_vnet_hdr)
26582662 size_max = dev->mtu + reserve + VLAN_HLEN;
26592663
2664+ reinit_completion(&po->skb_completion);
2665+
26602666 do {
26612667 ph = packet_current_frame(po, &po->tx_ring,
26622668 TP_STATUS_SEND_REQUEST);
26632669 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 */
26662679 continue;
26672680 }
26682681
@@ -3218,6 +3231,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol, · 549 unmodified lines
32183231 sock_init_data(sock, sk);
32193232
32203233 po = pkt_sk(sk);
3234+ init_completion(&po->skb_completion);
32213235 sk->sk_family = PF_PACKET;
32223236 po->num = proto;
32233237 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
43274341 req3->tp_sizeof_priv ||
43284342 req3->tp_feature_req_word) {
43294343 err = -EINVAL;
4330− goto out;
4344+ goto out_free_pg_vec;
43314345 }
43324346 }
43334347 break;
@@ -4391,6 +4405,7 @@ static int packet_set_ring(struct sock *sk, union tpacket_req_u *req_u, · 57 unmodified lines
43914405 prb_shutdown_retire_blk_timer(po, rb_queue);
43924406 }
43934407
4408+out_free_pg_vec:
43944409 if (pg_vec)
43954410 free_pg_vec(pg_vec, order, req->tp_block_nr);
43964411 out:
net/packet/internal.h+1−0
@@ -128,6 +128,7 @@ struct packet_sock { · 127 unmodified lines
128128 unsigned int tp_hdrlen;
129129 unsigned int tp_reserve;
130130 unsigned int tp_tstamp;
131+ struct completion skb_completion;
131132 struct net_device __rcu *cached_dev;
132133 int (*xmit)(struct sk_buff *skb);
133134 struct packet_type prot_hook ____cacheline_aligned_in_smp;
net/sched/sch_cbs.c+7−2
@@ -549,12 +549,17 @@ static struct notifier_block cbs_device_notifier = { · 548 unmodified lines
549549
550550 static int __init cbs_module_init(void)
551551 {
552− int err = register_netdevice_notifier(&cbs_device_notifier);
552+ int err;
553553
554+ err = register_netdevice_notifier(&cbs_device_notifier);
554555 if (err)
555556 return err;
556557
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;
558563 }
559564
560565 static void __exit cbs_module_exit(void)
net/sctp/endpointola.c+4−4
@@ -118,10 +118,6 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, · 117 unmodified lines
118118 /* Initialize the bind addr area */
119119 sctp_bind_addr_init(&ep->base.bind_addr, 0);
120120
121− /* Remember who we are attached to. */
122− ep->base.sk = sk;
123− sock_hold(ep->base.sk);
124−
125121 /* Create the lists of associations. */
126122 INIT_LIST_HEAD(&ep->asocs);
127123
@@ -154,6 +150,10 @@ static struct sctp_endpoint *sctp_endpoint_init(struct sctp_endpoint *ep, · 26 unmodified lines
154150 ep->prsctp_enable = net->sctp.prsctp_enable;
155151 ep->reconf_enable = net->sctp.reconf_enable;
156152
153+ /* Remember who we are attached to. */
154+ ep->base.sk = sk;
155+ sock_hold(ep->base.sk);
156+
157157 return ep;
158158
159159 nomem_shkey:
net/smc/af_smc.c+4−1
@@ -2020,7 +2020,7 @@ static int __init smc_init(void) · 2019 unmodified lines
20202020
20212021 rc = smc_pnet_init();
20222022 if (rc)
2023− return rc;
2023+ goto out_pernet_subsys;
20242024
20252025 rc = smc_llc_init();
20262026 if (rc) {
@@ -2071,6 +2071,9 @@ out_proto: · 44 unmodified lines
20712071 proto_unregister(&smc_proto);
20722072 out_pnet:
20732073 smc_pnet_exit();
2074+out_pernet_subsys:
2075+ unregister_pernet_subsys(&smc_net_ops);
2076+
20742077 return rc;
20752078 }
20762079
net/smc/smc_core.c+3−0
@@ -652,7 +652,10 @@ create: · 651 unmodified lines
652652 rc = smc_lgr_create(smc, ini);
653653 if (rc)
654654 goto out;
655+ lgr = conn->lgr;
656+ write_lock_bh(&lgr->conns_lock);
655657 smc_lgr_register_conn(conn); /* add smc conn to lgr */
658+ write_unlock_bh(&lgr->conns_lock);
656659 }
657660 conn->local_tx_ctrl.common.type = SMC_CDC_MSG_TYPE;
658661 conn->local_tx_ctrl.len = SMC_WR_TX_SIZE;
net/tipc/core.c+6−6
@@ -134,7 +134,7 @@ static int __init tipc_init(void) · 133 unmodified lines
134134 if (err)
135135 goto out_sysctl;
136136
137− err = register_pernet_subsys(&tipc_net_ops);
137+ err = register_pernet_device(&tipc_net_ops);
138138 if (err)
139139 goto out_pernet;
140140
@@ -142,7 +142,7 @@ static int __init tipc_init(void) · 1 unmodified line
142142 if (err)
143143 goto out_socket;
144144
145− err = register_pernet_subsys(&tipc_topsrv_net_ops);
145+ err = register_pernet_device(&tipc_topsrv_net_ops);
146146 if (err)
147147 goto out_pernet_topsrv;
148148
@@ -153,11 +153,11 @@ static int __init tipc_init(void) · 4 unmodified lines
153153 pr_info("Started in single node mode\n");
154154 return 0;
155155 out_bearer:
156− unregister_pernet_subsys(&tipc_topsrv_net_ops);
156+ unregister_pernet_device(&tipc_topsrv_net_ops);
157157 out_pernet_topsrv:
158158 tipc_socket_stop();
159159 out_socket:
160− unregister_pernet_subsys(&tipc_net_ops);
160+ unregister_pernet_device(&tipc_net_ops);
161161 out_pernet:
162162 tipc_unregister_sysctl();
163163 out_sysctl:
@@ -172,9 +172,9 @@ out_netlink: · 8 unmodified lines
172172 static void __exit tipc_exit(void)
173173 {
174174 tipc_bearer_cleanup();
175− unregister_pernet_subsys(&tipc_topsrv_net_ops);
175+ unregister_pernet_device(&tipc_topsrv_net_ops);
176176 tipc_socket_stop();
177− unregister_pernet_subsys(&tipc_net_ops);
177+ unregister_pernet_device(&tipc_net_ops);
178178 tipc_netlink_stop();
179179 tipc_netlink_compat_stop();
180180 tipc_unregister_sysctl();
net/tipc/netlink_compat.c+15−3
@@ -445,7 +445,11 @@ static int tipc_nl_compat_bearer_disable(struct tipc_nl_compat_cmd_doit *cmd, · 444 unmodified lines
445445 if (!bearer)
446446 return -EMSGSIZE;
447447
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);
449453 if (!string_is_valid(name, len))
450454 return -EINVAL;
451455
@@ -539,7 +543,11 @@ static int tipc_nl_compat_link_stat_dump(struct tipc_nl_compat_msg *msg, · 87 unmodified lines
539543
540544 name = (char *)TLV_DATA(msg->req);
541545
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);
543551 if (!string_is_valid(name, len))
544552 return -EINVAL;
545553
@@ -807,7 +815,11 @@ static int tipc_nl_compat_link_reset_stats(struct tipc_nl_compat_cmd_doit *cmd, · 261 unmodified lines
807815 if (!link)
808816 return -EMSGSIZE;
809817
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);
811823 if (!string_is_valid(name, len))
812824 return -EINVAL;
813825
net/tls/tls_main.c+2−1
@@ -279,7 +279,8 @@ static void tls_sk_proto_close(struct sock *sk, long timeout) · 278 unmodified lines
279279 goto skip_tx_cleanup;
280280 }
281281
282− if (!tls_complete_pending_work(sk, ctx, 0, &timeo))
282+ if (unlikely(sk->sk_write_pending) &&
283+ !wait_on_pending_writer(sk, &timeo))
283284 tls_handle_open_record(sk, 0);
284285
285286 /* We need these for tls_sw_fallback handling of other packets */
samples/pidfd/pidfd-metadata.c+6−2
@@ -83,7 +83,7 @@ static int pidfd_metadata_fd(pid_t pid, int pidfd) · 82 unmodified lines
8383
8484 int main(int argc, char *argv[])
8585 {
86− int pidfd = 0, ret = EXIT_FAILURE;
86+ int pidfd = -1, ret = EXIT_FAILURE;
8787 char buf[4096] = { 0 };
8888 pid_t pid;
8989 int procfd, statusfd;
@@ -91,7 +91,11 @@ int main(int argc, char *argv[]) · 1 unmodified line
9191
9292 pid = pidfd_clone(CLONE_PIDFD, &pidfd);
9393 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+ }
9599
96100 procfd = pidfd_metadata_fd(pid, pidfd);
97101 close(pidfd);
tools/testing/selftests/powerpc/mm/.gitignore+2−1
@@ -3,4 +3,5 @@ subpage_prot · 2 unmodified lines
33 tempfile
44 prot_sao
55 segv_errors
6−wild_bctr
6+wild_bctr
7+large_vm_fork_separation
tools/testing/selftests/powerpc/mm/Makefile+3−1
@@ -2,7 +2,8 @@ · 1 unmodified line
22 noarg:
33 $(MAKE) -C ../
44
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
67 TEST_GEN_FILES := tempfile
78
89 top_srcdir = ../../../../..
@@ -13,6 +14,7 @@ $(TEST_GEN_PROGS): ../harness.c · 4 unmodified lines
1314 $(OUTPUT)/prot_sao: ../utils.c
1415
1516 $(OUTPUT)/wild_bctr: CFLAGS += -m64
17+$(OUTPUT)/large_vm_fork_separation: CFLAGS += -m64
1618
1719 $(OUTPUT)/tempfile:
1820 dd if=/dev/zero of=$@ bs=64k count=1
tools/testing/selftests/powerpc/mm/large_vm_fork_separation.c+87−0
@@ -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+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t