Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 3 Mar 2019 00:43:15 +0000 (16:43 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 3 Mar 2019 00:43:15 +0000 (16:43 -0800)
Pull ARM SoC fixes from Arnd Bergmann:
 "One more set of simple ARM platform fixes:

   - A boot regression on qualcomm msm8998

   - Gemini display controllers got turned off by accident

   - incorrect reference counting in optee"

* tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
  tee: optee: add missing of_node_put after of_device_is_available
  arm64: dts: qcom: msm8998: Extend TZ reserved memory area
  ARM: dts: gemini: Re-enable display controller

101 files changed:
arch/arm/crypto/sha256-armv4.pl
arch/arm/crypto/sha256-core.S_shipped
arch/arm/crypto/sha512-armv4.pl
arch/arm/crypto/sha512-core.S_shipped
arch/arm64/crypto/chacha-neon-core.S
arch/mips/bcm63xx/dev-enet.c
arch/mips/kernel/cmpxchg.c
arch/mips/kernel/setup.c
arch/mips/lantiq/xway/vmmc.c
arch/mips/net/ebpf_jit.c
arch/x86/include/asm/hyperv-tlfs.h
arch/x86/include/asm/uaccess.h
arch/x86/mm/extable.c
drivers/crypto/ccree/cc_pm.h
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/bochs/bochs_drv.c
drivers/gpu/drm/drm_atomic_helper.c
drivers/iommu/dmar.c
drivers/mmc/core/block.c
drivers/mmc/core/core.c
drivers/mmc/core/queue.c
drivers/mmc/host/cqhci.c
drivers/mmc/host/mmc_spi.c
drivers/mmc/host/renesas_sdhi_sys_dmac.c
drivers/mmc/host/sdhci-esdhc-imx.c
drivers/mmc/host/tmio_mmc.h
drivers/mmc/host/tmio_mmc_core.c
drivers/net/dsa/lantiq_gswip.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/mv88e6xxx/port.c
drivers/net/dsa/mv88e6xxx/port.h
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/microchip/enc28j60.c
drivers/net/ethernet/microchip/lan743x_main.c
drivers/net/geneve.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/phy/dp83867.c
drivers/net/phy/micrel.c
drivers/net/phy/phylink.c
drivers/net/tun.c
drivers/net/xen-netback/hash.c
drivers/net/xen-netback/interface.c
drivers/net/xen-netback/netback.c
drivers/scsi/3w-9xxx.c
drivers/scsi/3w-sas.c
drivers/scsi/aic94xx/aic94xx_init.c
drivers/scsi/bfa/bfad.c
drivers/scsi/csiostor/csio_init.c
drivers/scsi/hisi_sas/hisi_sas_main.c
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c
drivers/scsi/hptiop.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/scsi_lib.c
fs/afs/cell.c
fs/hugetlbfs/inode.c
fs/namespace.c
fs/orangefs/file.c
include/linux/netdevice.h
include/linux/sched.h
include/net/icmp.h
include/net/ip.h
kernel/bpf/syscall.c
kernel/bpf/verifier.c
lib/Kconfig.kasan
mm/hugetlb.c
mm/maccess.c
mm/migrate.c
mm/mmap.c
mm/shmem.c
net/dsa/dsa2.c
net/dsa/port.c
net/ipv4/cipso_ipv4.c
net/ipv4/fib_frontend.c
net/ipv4/icmp.c
net/ipv4/ip_input.c
net/ipv4/ip_options.c
net/ipv4/netlink.c
net/ipv4/route.c
net/ipv6/route.c
net/ipv6/sit.c
net/mpls/af_mpls.c
net/netlabel/netlabel_kapi.c
net/nfc/llcp_commands.c
net/nfc/llcp_core.c
net/sched/act_ipt.c
net/sched/act_skbedit.c
net/sched/act_tunnel_key.c
net/sched/sch_netem.c
net/sctp/chunk.c
net/socket.c
net/tipc/socket.c
scripts/Makefile.kasan
tools/testing/selftests/net/pmtu.sh
tools/testing/selftests/net/udpgro.sh
tools/testing/selftests/net/udpgso_bench_rx.c
virt/kvm/kvm_main.c

index b9ec44060ed313dac5c469e4e6e39e905d0206cc..a03cf4dfb7818d1275ee0d06ecf633b149adf1cd 100644 (file)
@@ -212,10 +212,11 @@ K256:
 .global        sha256_block_data_order
 .type  sha256_block_data_order,%function
 sha256_block_data_order:
+.Lsha256_block_data_order:
 #if __ARM_ARCH__<7
        sub     r3,pc,#8                @ sha256_block_data_order
 #else
-       adr     r3,sha256_block_data_order
+       adr     r3,.Lsha256_block_data_order
 #endif
 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
        ldr     r12,.LOPENSSL_armcap
index 3b58300d611cf4c94f9014901d0a3204acb75f13..054aae0edfce5628715d607fd7d194ac5cc81938 100644 (file)
@@ -93,10 +93,11 @@ K256:
 .global        sha256_block_data_order
 .type  sha256_block_data_order,%function
 sha256_block_data_order:
+.Lsha256_block_data_order:
 #if __ARM_ARCH__<7
        sub     r3,pc,#8                @ sha256_block_data_order
 #else
-       adr     r3,sha256_block_data_order
+       adr     r3,.Lsha256_block_data_order
 #endif
 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
        ldr     r12,.LOPENSSL_armcap
index fb5d15048c0b2d2ea2d8c8c9a2bdbb15a6c14052..788c17b56ecceb5e607382539faec13b8fbc2886 100644 (file)
@@ -274,10 +274,11 @@ WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817)
 .global        sha512_block_data_order
 .type  sha512_block_data_order,%function
 sha512_block_data_order:
+.Lsha512_block_data_order:
 #if __ARM_ARCH__<7
        sub     r3,pc,#8                @ sha512_block_data_order
 #else
-       adr     r3,sha512_block_data_order
+       adr     r3,.Lsha512_block_data_order
 #endif
 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
        ldr     r12,.LOPENSSL_armcap
index b1c334a49cdaa61f019b7367bfa4e20d4ac4a078..710ea309769e71628d1d4a166c834ad92033b658 100644 (file)
@@ -141,10 +141,11 @@ WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817)
 .global        sha512_block_data_order
 .type  sha512_block_data_order,%function
 sha512_block_data_order:
+.Lsha512_block_data_order:
 #if __ARM_ARCH__<7
        sub     r3,pc,#8                @ sha512_block_data_order
 #else
-       adr     r3,sha512_block_data_order
+       adr     r3,.Lsha512_block_data_order
 #endif
 #if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
        ldr     r12,.LOPENSSL_armcap
index 021bb9e9784b271cb670f8c973312e9e2ec14ba4..706c4e10e9e294c7c5de49dbbe7a784ec7ca1458 100644 (file)
@@ -158,8 +158,8 @@ ENTRY(hchacha_block_neon)
        mov             w3, w2
        bl              chacha_permute
 
-       st1             {v0.16b}, [x1], #16
-       st1             {v3.16b}, [x1]
+       st1             {v0.4s}, [x1], #16
+       st1             {v3.4s}, [x1]
 
        ldp             x29, x30, [sp], #16
        ret
@@ -532,6 +532,10 @@ ENTRY(chacha_4block_xor_neon)
        add             v3.4s, v3.4s, v19.4s
          add           a2, a2, w8
          add           a3, a3, w9
+CPU_BE(          rev           a0, a0          )
+CPU_BE(          rev           a1, a1          )
+CPU_BE(          rev           a2, a2          )
+CPU_BE(          rev           a3, a3          )
 
        ld4r            {v24.4s-v27.4s}, [x0], #16
        ld4r            {v28.4s-v31.4s}, [x0]
@@ -552,6 +556,10 @@ ENTRY(chacha_4block_xor_neon)
        add             v7.4s, v7.4s, v23.4s
          add           a6, a6, w8
          add           a7, a7, w9
+CPU_BE(          rev           a4, a4          )
+CPU_BE(          rev           a5, a5          )
+CPU_BE(          rev           a6, a6          )
+CPU_BE(          rev           a7, a7          )
 
        // x8[0-3] += s2[0]
        // x9[0-3] += s2[1]
@@ -569,6 +577,10 @@ ENTRY(chacha_4block_xor_neon)
        add             v11.4s, v11.4s, v27.4s
          add           a10, a10, w8
          add           a11, a11, w9
+CPU_BE(          rev           a8, a8          )
+CPU_BE(          rev           a9, a9          )
+CPU_BE(          rev           a10, a10        )
+CPU_BE(          rev           a11, a11        )
 
        // x12[0-3] += s3[0]
        // x13[0-3] += s3[1]
@@ -586,6 +598,10 @@ ENTRY(chacha_4block_xor_neon)
        add             v15.4s, v15.4s, v31.4s
          add           a14, a14, w8
          add           a15, a15, w9
+CPU_BE(          rev           a12, a12        )
+CPU_BE(          rev           a13, a13        )
+CPU_BE(          rev           a14, a14        )
+CPU_BE(          rev           a15, a15        )
 
        // interleave 32-bit words in state n, n+1
          ldp           w6, w7, [x2], #64
index 07b4c65a88a43708467626b410baf79936bac203..8e73d65f348064792e5a1515ddcd7809b12da2c8 100644 (file)
@@ -70,6 +70,8 @@ static struct platform_device bcm63xx_enet_shared_device = {
 
 static int shared_device_registered;
 
+static u64 enet_dmamask = DMA_BIT_MASK(32);
+
 static struct resource enet0_res[] = {
        {
                .start          = -1, /* filled at runtime */
@@ -99,6 +101,8 @@ static struct platform_device bcm63xx_enet0_device = {
        .resource       = enet0_res,
        .dev            = {
                .platform_data = &enet0_pd,
+               .dma_mask = &enet_dmamask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
        },
 };
 
@@ -131,6 +135,8 @@ static struct platform_device bcm63xx_enet1_device = {
        .resource       = enet1_res,
        .dev            = {
                .platform_data = &enet1_pd,
+               .dma_mask = &enet_dmamask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
        },
 };
 
@@ -157,6 +163,8 @@ static struct platform_device bcm63xx_enetsw_device = {
        .resource       = enetsw_res,
        .dev            = {
                .platform_data = &enetsw_pd,
+               .dma_mask = &enet_dmamask,
+               .coherent_dma_mask = DMA_BIT_MASK(32),
        },
 };
 
index 0b9535bc2c53d0c450a0c02beb24691d356614e2..6b2a4a902a981c7365cb05abc94744cfc6648741 100644 (file)
@@ -54,10 +54,9 @@ unsigned long __xchg_small(volatile void *ptr, unsigned long val, unsigned int s
 unsigned long __cmpxchg_small(volatile void *ptr, unsigned long old,
                              unsigned long new, unsigned int size)
 {
-       u32 mask, old32, new32, load32;
+       u32 mask, old32, new32, load32, load;
        volatile u32 *ptr32;
        unsigned int shift;
-       u8 load;
 
        /* Check that ptr is naturally aligned */
        WARN_ON((unsigned long)ptr & (size - 1));
index 8c6c48ed786a1527c22ba5b46bcdad70029e5865..d2e5a5ad0e6f5e4b90e5f1a20c7942f40a1c735d 100644 (file)
@@ -384,7 +384,8 @@ static void __init bootmem_init(void)
        init_initrd();
        reserved_end = (unsigned long) PFN_UP(__pa_symbol(&_end));
 
-       memblock_reserve(PHYS_OFFSET, reserved_end << PAGE_SHIFT);
+       memblock_reserve(PHYS_OFFSET,
+                        (reserved_end << PAGE_SHIFT) - PHYS_OFFSET);
 
        /*
         * max_low_pfn is not a number of pages. The number of pages
index 577ec81b557dcfa2d4805ed39cbcaffb1f7052d1..3deab9a777185a634b095ebb2c8297f32fbaf90c 100644 (file)
@@ -31,8 +31,8 @@ static int vmmc_probe(struct platform_device *pdev)
        dma_addr_t dma;
 
        cp1_base =
-               (void *) CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE,
-                                                   &dma, GFP_ATOMIC));
+               (void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE,
+                                                   &dma, GFP_KERNEL));
 
        gpio_count = of_gpio_count(pdev->dev.of_node);
        while (gpio_count > 0) {
index 76e9bf88d3b9198f6b1e8baaf8aa620bd1755959..0effd3cba9a731907920c6f47a1b52321ac7225f 100644 (file)
@@ -1819,7 +1819,7 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
 
        /* Update the icache */
        flush_icache_range((unsigned long)ctx.target,
-                          (unsigned long)(ctx.target + ctx.idx * sizeof(u32)));
+                          (unsigned long)&ctx.target[ctx.idx]);
 
        if (bpf_jit_enable > 1)
                /* Dump JIT code */
index 705dafc2d11ab5bb9ddf3b249e0a69dae31a966e..2bdbbbcfa393fd6b2df936029917d20dc4ae8e84 100644 (file)
@@ -841,7 +841,7 @@ union hv_gpa_page_range {
  * count is equal with how many entries of union hv_gpa_page_range can
  * be populated into the input parameter page.
  */
-#define HV_MAX_FLUSH_REP_COUNT (PAGE_SIZE - 2 * sizeof(u64) /  \
+#define HV_MAX_FLUSH_REP_COUNT ((PAGE_SIZE - 2 * sizeof(u64)) /        \
                                sizeof(union hv_gpa_page_range))
 
 struct hv_guest_mapping_flush_list {
index 780f2b42c8efe76b5d78291d4b633dd26b6e5c64..c1334aaaa78d32dbab9a38b45deb51d3b1487576 100644 (file)
@@ -284,7 +284,7 @@ do {                                                                        \
                __put_user_goto(x, ptr, "l", "k", "ir", label);         \
                break;                                                  \
        case 8:                                                         \
-               __put_user_goto_u64((__typeof__(*ptr))(x), ptr, label); \
+               __put_user_goto_u64(x, ptr, label);                     \
                break;                                                  \
        default:                                                        \
                __put_user_bad();                                       \
@@ -431,8 +431,10 @@ do {                                                                       \
 ({                                                             \
        __label__ __pu_label;                                   \
        int __pu_err = -EFAULT;                                 \
+       __typeof__(*(ptr)) __pu_val;                            \
+       __pu_val = x;                                           \
        __uaccess_begin();                                      \
-       __put_user_size((x), (ptr), (size), __pu_label);        \
+       __put_user_size(__pu_val, (ptr), (size), __pu_label);   \
        __pu_err = 0;                                           \
 __pu_label:                                                    \
        __uaccess_end();                                        \
index 6521134057e8f9ef34dbfaf8a0a4e46672a32d3c..856fa409c536408bf6b92039f3c88eeaa8ae53e6 100644 (file)
@@ -117,67 +117,11 @@ __visible bool ex_handler_fprestore(const struct exception_table_entry *fixup,
 }
 EXPORT_SYMBOL_GPL(ex_handler_fprestore);
 
-/* Helper to check whether a uaccess fault indicates a kernel bug. */
-static bool bogus_uaccess(struct pt_regs *regs, int trapnr,
-                         unsigned long fault_addr)
-{
-       /* This is the normal case: #PF with a fault address in userspace. */
-       if (trapnr == X86_TRAP_PF && fault_addr < TASK_SIZE_MAX)
-               return false;
-
-       /*
-        * This code can be reached for machine checks, but only if the #MC
-        * handler has already decided that it looks like a candidate for fixup.
-        * This e.g. happens when attempting to access userspace memory which
-        * the CPU can't access because of uncorrectable bad memory.
-        */
-       if (trapnr == X86_TRAP_MC)
-               return false;
-
-       /*
-        * There are two remaining exception types we might encounter here:
-        *  - #PF for faulting accesses to kernel addresses
-        *  - #GP for faulting accesses to noncanonical addresses
-        * Complain about anything else.
-        */
-       if (trapnr != X86_TRAP_PF && trapnr != X86_TRAP_GP) {
-               WARN(1, "unexpected trap %d in uaccess\n", trapnr);
-               return false;
-       }
-
-       /*
-        * This is a faulting memory access in kernel space, on a kernel
-        * address, in a usercopy function. This can e.g. be caused by improper
-        * use of helpers like __put_user and by improper attempts to access
-        * userspace addresses in KERNEL_DS regions.
-        * The one (semi-)legitimate exception are probe_kernel_{read,write}(),
-        * which can be invoked from places like kgdb, /dev/mem (for reading)
-        * and privileged BPF code (for reading).
-        * The probe_kernel_*() functions set the kernel_uaccess_faults_ok flag
-        * to tell us that faulting on kernel addresses, and even noncanonical
-        * addresses, in a userspace accessor does not necessarily imply a
-        * kernel bug, root might just be doing weird stuff.
-        */
-       if (current->kernel_uaccess_faults_ok)
-               return false;
-
-       /* This is bad. Refuse the fixup so that we go into die(). */
-       if (trapnr == X86_TRAP_PF) {
-               pr_emerg("BUG: pagefault on kernel address 0x%lx in non-whitelisted uaccess\n",
-                        fault_addr);
-       } else {
-               pr_emerg("BUG: GPF in non-whitelisted uaccess (non-canonical address?)\n");
-       }
-       return true;
-}
-
 __visible bool ex_handler_uaccess(const struct exception_table_entry *fixup,
                                  struct pt_regs *regs, int trapnr,
                                  unsigned long error_code,
                                  unsigned long fault_addr)
 {
-       if (bogus_uaccess(regs, trapnr, fault_addr))
-               return false;
        regs->ip = ex_fixup_addr(fixup);
        return true;
 }
@@ -188,8 +132,6 @@ __visible bool ex_handler_ext(const struct exception_table_entry *fixup,
                              unsigned long error_code,
                              unsigned long fault_addr)
 {
-       if (bogus_uaccess(regs, trapnr, fault_addr))
-               return false;
        /* Special hack for uaccess_err */
        current->thread.uaccess_err = 1;
        regs->ip = ex_fixup_addr(fixup);
index f6262435702094effeb6356bf5636728ffb06fd2..907a6db4d6c036fe1c5433d5bda095d157e166b0 100644 (file)
@@ -30,7 +30,7 @@ static inline int cc_pm_init(struct cc_drvdata *drvdata)
        return 0;
 }
 
-static void cc_pm_go(struct cc_drvdata *drvdata) {}
+static inline void cc_pm_go(struct cc_drvdata *drvdata) {}
 
 static inline void cc_pm_fini(struct cc_drvdata *drvdata) {}
 
index aadd0fa42e430d02bfb386152f5510fc332183e3..3aa42c64484af5bd665b0f1b82fe1db9e170aa39 100644 (file)
@@ -405,6 +405,7 @@ struct amdgpu_crtc {
        struct amdgpu_flip_work *pflip_works;
        enum amdgpu_flip_status pflip_status;
        int deferred_flip_completion;
+       u64 last_flip_vblank;
        /* pll sharing */
        struct amdgpu_atom_ss ss;
        bool ss_enabled;
index 5296b8f3e0ab369377a5d7c3cad8014dbead02b9..636d14a609525732b1c4ef3fca4d772e2bafb253 100644 (file)
@@ -303,12 +303,11 @@ static void dm_pflip_high_irq(void *interrupt_params)
                return;
        }
 
+       /* Update to correct count(s) if racing with vblank irq */
+       amdgpu_crtc->last_flip_vblank = drm_crtc_accurate_vblank_count(&amdgpu_crtc->base);
 
        /* wake up userspace */
        if (amdgpu_crtc->event) {
-               /* Update to correct count(s) if racing with vblank irq */
-               drm_crtc_accurate_vblank_count(&amdgpu_crtc->base);
-
                drm_crtc_send_vblank_event(&amdgpu_crtc->base, amdgpu_crtc->event);
 
                /* page flip completed. clean up */
@@ -4828,6 +4827,8 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                        to_dm_crtc_state(drm_atomic_get_old_crtc_state(state, pcrtc));
        int planes_count = 0;
        unsigned long flags;
+       u64 last_flip_vblank;
+       bool vrr_active = acrtc_state->freesync_config.state == VRR_STATE_ACTIVE_VARIABLE;
 
        /* update planes when needed */
        for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) {
@@ -4859,6 +4860,16 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                        /* In commit tail framework this cannot happen */
                        WARN_ON(1);
                }
+
+               /* For variable refresh rate mode only:
+                * Get vblank of last completed flip to avoid > 1 vrr flips per
+                * video frame by use of throttling, but allow flip programming
+                * anywhere in the possibly large variable vrr vblank interval
+                * for fine-grained flip timing control and more opportunity to
+                * avoid stutter on late submission of amdgpu_dm_do_flip() calls.
+                */
+               last_flip_vblank = acrtc_attach->last_flip_vblank;
+
                spin_unlock_irqrestore(&crtc->dev->event_lock, flags);
 
                if (!pflip_needed || plane->type == DRM_PLANE_TYPE_OVERLAY) {
@@ -4882,10 +4893,18 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state,
                        if (plane->type == DRM_PLANE_TYPE_PRIMARY)
                                drm_crtc_vblank_get(crtc);
 
+                       /* Use old throttling in non-vrr fixed refresh rate mode
+                        * to keep flip scheduling based on target vblank counts
+                        * working in a backwards compatible way, e.g., clients
+                        * using GLX_OML_sync_control extension.
+                        */
+                       if (!vrr_active)
+                               last_flip_vblank = drm_crtc_vblank_count(crtc);
+
                        amdgpu_dm_do_flip(
                                crtc,
                                fb,
-                               (uint32_t)drm_crtc_vblank_count(crtc) + *wait_for_vblank,
+                               (uint32_t) last_flip_vblank + *wait_for_vblank,
                                dc_state);
                }
 
index f3dd66ae990aebc8a9518127f74d63c1ee98b252..aa35007262cdb995f4ddba8392ca6da20b100a9a 100644 (file)
@@ -154,6 +154,10 @@ static int bochs_pci_probe(struct pci_dev *pdev,
        if (IS_ERR(dev))
                return PTR_ERR(dev);
 
+       ret = pci_enable_device(pdev);
+       if (ret)
+               goto err_free_dev;
+
        dev->pdev = pdev;
        pci_set_drvdata(pdev, dev);
 
index 54e2ae614dccb4e94187df67abfebf776962f2a6..f4290f6b0c38304b86cd84478fa60f6bcbe302e5 100644 (file)
@@ -1602,6 +1602,15 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
            old_plane_state->crtc != new_plane_state->crtc)
                return -EINVAL;
 
+       /*
+        * FIXME: Since prepare_fb and cleanup_fb are always called on
+        * the new_plane_state for async updates we need to block framebuffer
+        * changes. This prevents use of a fb that's been cleaned up and
+        * double cleanups from occuring.
+        */
+       if (old_plane_state->fb != new_plane_state->fb)
+               return -EINVAL;
+
        funcs = plane->helper_private;
        if (!funcs->atomic_async_update)
                return -EINVAL;
index dc9f14811e0f4d9ed3a12936501274ad55789a55..58dc70bffd5b87ec682984e3a9e8842b5dcfb68d 100644 (file)
@@ -144,7 +144,7 @@ dmar_alloc_pci_notify_info(struct pci_dev *dev, unsigned long event)
                for (tmp = dev; tmp; tmp = tmp->bus->self)
                        level++;
 
-       size = sizeof(*info) + level * sizeof(struct acpi_dmar_pci_path);
+       size = sizeof(*info) + level * sizeof(info->path[0]);
        if (size <= sizeof(dmar_pci_notify_info_buf)) {
                info = (struct dmar_pci_notify_info *)dmar_pci_notify_info_buf;
        } else {
index 14f3fdb8c6bb7aad30d3b9f1337afcb1f6e34f7e..9ce8eb51a60fd1d377107fc8264ca16e8b32e493 100644 (file)
@@ -2380,12 +2380,6 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
        snprintf(md->disk->disk_name, sizeof(md->disk->disk_name),
                 "mmcblk%u%s", card->host->index, subname ? subname : "");
 
-       if (mmc_card_mmc(card))
-               blk_queue_logical_block_size(md->queue.queue,
-                                            card->ext_csd.data_sector_size);
-       else
-               blk_queue_logical_block_size(md->queue.queue, 512);
-
        set_capacity(md->disk, size);
 
        if (mmc_host_cmd23(card->host)) {
index 5bd58b95d318ea2b86b4a784244bbbf65a3dfca2..b27a1e6202331f3692db7db58f20e1f5bed04f29 100644 (file)
@@ -95,7 +95,7 @@ static void mmc_should_fail_request(struct mmc_host *host,
        if (!data)
                return;
 
-       if (cmd->error || data->error ||
+       if ((cmd && cmd->error) || data->error ||
            !should_fail(&host->fail_mmc_request, data->blksz * data->blocks))
                return;
 
index 35cc138b096d95bf37ec186fa13c8ebe0a84dc7c..15a45ec6518d75c3fd8e602c313ebe77d3aa7376 100644 (file)
@@ -355,6 +355,7 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
 {
        struct mmc_host *host = card->host;
        u64 limit = BLK_BOUNCE_HIGH;
+       unsigned block_size = 512;
 
        if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
                limit = (u64)dma_max_pfn(mmc_dev(host)) << PAGE_SHIFT;
@@ -368,7 +369,13 @@ static void mmc_setup_queue(struct mmc_queue *mq, struct mmc_card *card)
        blk_queue_max_hw_sectors(mq->queue,
                min(host->max_blk_count, host->max_req_size / 512));
        blk_queue_max_segments(mq->queue, host->max_segs);
-       blk_queue_max_segment_size(mq->queue, host->max_seg_size);
+
+       if (mmc_card_mmc(card))
+               block_size = card->ext_csd.data_sector_size;
+
+       blk_queue_logical_block_size(mq->queue, block_size);
+       blk_queue_max_segment_size(mq->queue,
+                       round_down(host->max_seg_size, block_size));
 
        INIT_WORK(&mq->recovery_work, mmc_mq_recovery_handler);
        INIT_WORK(&mq->complete_work, mmc_blk_mq_complete_work);
index 159270e947cf62965a932edf9eb1d3a478ac89db..a8af682a9182160e1e9074f1714dd33f5ee39cdd 100644 (file)
@@ -201,7 +201,7 @@ static int cqhci_host_alloc_tdl(struct cqhci_host *cq_host)
        cq_host->desc_size = cq_host->slot_sz * cq_host->num_slots;
 
        cq_host->data_size = cq_host->trans_desc_len * cq_host->mmc->max_segs *
-               (cq_host->num_slots - 1);
+               cq_host->mmc->cqe_qdepth;
 
        pr_debug("%s: cqhci: desc_size: %zu data_sz: %zu slot-sz: %d\n",
                 mmc_hostname(cq_host->mmc), cq_host->desc_size, cq_host->data_size,
@@ -217,12 +217,21 @@ static int cqhci_host_alloc_tdl(struct cqhci_host *cq_host)
                                                 cq_host->desc_size,
                                                 &cq_host->desc_dma_base,
                                                 GFP_KERNEL);
+       if (!cq_host->desc_base)
+               return -ENOMEM;
+
        cq_host->trans_desc_base = dmam_alloc_coherent(mmc_dev(cq_host->mmc),
                                              cq_host->data_size,
                                              &cq_host->trans_desc_dma_base,
                                              GFP_KERNEL);
-       if (!cq_host->desc_base || !cq_host->trans_desc_base)
+       if (!cq_host->trans_desc_base) {
+               dmam_free_coherent(mmc_dev(cq_host->mmc), cq_host->desc_size,
+                                  cq_host->desc_base,
+                                  cq_host->desc_dma_base);
+               cq_host->desc_base = NULL;
+               cq_host->desc_dma_base = 0;
                return -ENOMEM;
+       }
 
        pr_debug("%s: cqhci: desc-base: 0x%p trans-base: 0x%p\n desc_dma 0x%llx trans_dma: 0x%llx\n",
                 mmc_hostname(cq_host->mmc), cq_host->desc_base, cq_host->trans_desc_base,
index 10ba46b728e82279d66aea48792388145383bbee..8ade14fb2148dbcf8a8fa8087fdbb8dfbd1842ca 100644 (file)
@@ -1450,6 +1450,7 @@ static int mmc_spi_probe(struct spi_device *spi)
                mmc->caps &= ~MMC_CAP_NEEDS_POLL;
                mmc_gpiod_request_cd_irq(mmc);
        }
+       mmc_detect_change(mmc, 0);
 
        /* Index 1 is write protect/read only */
        status = mmc_gpiod_request_ro(mmc, NULL, 1, false, 0, NULL);
index 8471160316e073c5fee142b3393ea57c9d9f4e0a..02cd878e209f4bd009b1d40b801a4b3433efdcde 100644 (file)
@@ -65,6 +65,7 @@ static const struct renesas_sdhi_of_data of_rcar_gen2_compatible = {
        .scc_offset     = 0x0300,
        .taps           = rcar_gen2_scc_taps,
        .taps_num       = ARRAY_SIZE(rcar_gen2_scc_taps),
+       .max_blk_count  = 0xffffffff,
 };
 
 /* Definitions for sampling clocks */
index d0d319398a547827a5a7a5053f3f12f802402f61..00d41b312c79af466a63241311f17103a98e781d 100644 (file)
@@ -1095,11 +1095,12 @@ static void sdhci_esdhc_imx_hwinit(struct sdhci_host *host)
                writel(readl(host->ioaddr + SDHCI_HOST_CONTROL)
                        | ESDHC_BURST_LEN_EN_INCR,
                        host->ioaddr + SDHCI_HOST_CONTROL);
+
                /*
-               * erratum ESDHC_FLAG_ERR004536 fix for MX6Q TO1.2 and MX6DL
-               * TO1.1, it's harmless for MX6SL
-               */
-               writel(readl(host->ioaddr + 0x6c) BIT(7),
+                * erratum ESDHC_FLAG_ERR004536 fix for MX6Q TO1.2 and MX6DL
+                * TO1.1, it's harmless for MX6SL
+                */
+               writel(readl(host->ioaddr + 0x6c) & ~BIT(7),
                        host->ioaddr + 0x6c);
 
                /* disable DLL_CTRL delay line settings */
index c03529e3f01a13905dd6fbb9bbbfcb35c31de93c..2adb0d24360fbb1bd2e81e9d67e261a960249d19 100644 (file)
@@ -277,6 +277,11 @@ static inline void sd_ctrl_write32_as_16_and_16(struct tmio_mmc_host *host,
        iowrite16(val >> 16, host->ctl + ((addr + 2) << host->bus_shift));
 }
 
+static inline void sd_ctrl_write32(struct tmio_mmc_host *host, int addr, u32 val)
+{
+       iowrite32(val, host->ctl + (addr << host->bus_shift));
+}
+
 static inline void sd_ctrl_write32_rep(struct tmio_mmc_host *host, int addr,
                                       const u32 *buf, int count)
 {
index 085a0fab769c02a64f6570a73bdc2363b9fac99a..f7a6f005899a351ace1b5b3ecf8c8dca702e157e 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/regulator/consumer.h>
 #include <linux/mmc/sdio.h>
 #include <linux/scatterlist.h>
+#include <linux/sizes.h>
 #include <linux/spinlock.h>
 #include <linux/swiotlb.h>
 #include <linux/workqueue.h>
@@ -629,7 +630,7 @@ static bool __tmio_mmc_sdcard_irq(struct tmio_mmc_host *host, int ireg,
        return false;
 }
 
-static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
+static bool __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
 {
        struct mmc_host *mmc = host->mmc;
        struct tmio_mmc_data *pdata = host->pdata;
@@ -637,7 +638,7 @@ static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
        unsigned int sdio_status;
 
        if (!(pdata->flags & TMIO_MMC_SDIO_IRQ))
-               return;
+               return false;
 
        status = sd_ctrl_read16(host, CTL_SDIO_STATUS);
        ireg = status & TMIO_SDIO_MASK_ALL & ~host->sdio_irq_mask;
@@ -650,6 +651,8 @@ static void __tmio_mmc_sdio_irq(struct tmio_mmc_host *host)
 
        if (mmc->caps & MMC_CAP_SDIO_IRQ && ireg & TMIO_SDIO_STAT_IOIRQ)
                mmc_signal_sdio_irq(mmc);
+
+       return ireg;
 }
 
 irqreturn_t tmio_mmc_irq(int irq, void *devid)
@@ -668,9 +671,10 @@ irqreturn_t tmio_mmc_irq(int irq, void *devid)
        if (__tmio_mmc_sdcard_irq(host, ireg, status))
                return IRQ_HANDLED;
 
-       __tmio_mmc_sdio_irq(host);
+       if (__tmio_mmc_sdio_irq(host))
+               return IRQ_HANDLED;
 
-       return IRQ_HANDLED;
+       return IRQ_NONE;
 }
 EXPORT_SYMBOL_GPL(tmio_mmc_irq);
 
@@ -700,7 +704,10 @@ static int tmio_mmc_start_data(struct tmio_mmc_host *host,
 
        /* Set transfer length / blocksize */
        sd_ctrl_write16(host, CTL_SD_XFER_LEN, data->blksz);
-       sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks);
+       if (host->mmc->max_blk_count >= SZ_64K)
+               sd_ctrl_write32(host, CTL_XFER_BLK_COUNT, data->blocks);
+       else
+               sd_ctrl_write16(host, CTL_XFER_BLK_COUNT, data->blocks);
 
        tmio_mmc_start_dma(host, data);
 
index 693a67f45bef1c74a3a412a915965372ff67b479..ddc1f9ca8ebcaa95751e4732e5d64f1dd83c32af 100644 (file)
@@ -1162,6 +1162,12 @@ static struct platform_driver gswip_driver = {
 
 module_platform_driver(gswip_driver);
 
+MODULE_FIRMWARE("lantiq/xrx300_phy11g_a21.bin");
+MODULE_FIRMWARE("lantiq/xrx300_phy22f_a21.bin");
+MODULE_FIRMWARE("lantiq/xrx200_phy11g_a14.bin");
+MODULE_FIRMWARE("lantiq/xrx200_phy11g_a22.bin");
+MODULE_FIRMWARE("lantiq/xrx200_phy22f_a14.bin");
+MODULE_FIRMWARE("lantiq/xrx200_phy22f_a22.bin");
 MODULE_AUTHOR("Hauke Mehrtens <hauke@hauke-m.de>");
 MODULE_DESCRIPTION("Lantiq / Intel GSWIP driver");
 MODULE_LICENSE("GPL v2");
index 12fd7ce3f1ffdb7cdd9875af49468ff729a82c7a..7e3c00bd9532a1051483f9e264f8c1538536870d 100644 (file)
@@ -896,7 +896,7 @@ static uint64_t _mv88e6xxx_get_ethtool_stat(struct mv88e6xxx_chip *chip,
        default:
                return U64_MAX;
        }
-       value = (((u64)high) << 16) | low;
+       value = (((u64)high) << 32) | low;
        return value;
 }
 
@@ -3093,7 +3093,7 @@ static const struct mv88e6xxx_ops mv88e6161_ops = {
        .port_disable_pri_override = mv88e6xxx_port_disable_pri_override,
        .port_link_state = mv88e6352_port_link_state,
        .port_get_cmode = mv88e6185_port_get_cmode,
-       .stats_snapshot = mv88e6320_g1_stats_snapshot,
+       .stats_snapshot = mv88e6xxx_g1_stats_snapshot,
        .stats_set_histogram = mv88e6095_g1_stats_set_histogram,
        .stats_get_sset_count = mv88e6095_stats_get_sset_count,
        .stats_get_strings = mv88e6095_stats_get_strings,
@@ -4595,6 +4595,14 @@ static int mv88e6xxx_smi_init(struct mv88e6xxx_chip *chip,
        return 0;
 }
 
+static void mv88e6xxx_ports_cmode_init(struct mv88e6xxx_chip *chip)
+{
+       int i;
+
+       for (i = 0; i < mv88e6xxx_num_ports(chip); i++)
+               chip->ports[i].cmode = MV88E6XXX_PORT_STS_CMODE_INVALID;
+}
+
 static enum dsa_tag_protocol mv88e6xxx_get_tag_protocol(struct dsa_switch *ds,
                                                        int port)
 {
@@ -4631,6 +4639,8 @@ static const char *mv88e6xxx_drv_probe(struct device *dsa_dev,
        if (err)
                goto free;
 
+       mv88e6xxx_ports_cmode_init(chip);
+
        mutex_lock(&chip->reg_lock);
        err = mv88e6xxx_switch_reset(chip);
        mutex_unlock(&chip->reg_lock);
index ebd26b6a93e6b6084545e2649daa40c9621da47d..79ab51e69aee4df28059df4371694fc4b4ca401d 100644 (file)
@@ -398,6 +398,10 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
                cmode = 0;
        }
 
+       /* cmode doesn't change, nothing to do for us */
+       if (cmode == chip->ports[port].cmode)
+               return 0;
+
        lane = mv88e6390x_serdes_get_lane(chip, port);
        if (lane < 0)
                return lane;
@@ -408,7 +412,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
                        return err;
        }
 
-       err = mv88e6390_serdes_power(chip, port, false);
+       err = mv88e6390x_serdes_power(chip, port, false);
        if (err)
                return err;
 
@@ -424,7 +428,7 @@ int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
                if (err)
                        return err;
 
-               err = mv88e6390_serdes_power(chip, port, true);
+               err = mv88e6390x_serdes_power(chip, port, true);
                if (err)
                        return err;
 
index e583641de758e816c321e980c81266a5b5d696c3..4aadf321edb7e5703afbea8be817cd7126ddda5c 100644 (file)
@@ -52,6 +52,7 @@
 #define MV88E6185_PORT_STS_CMODE_1000BASE_X    0x0005
 #define MV88E6185_PORT_STS_CMODE_PHY           0x0006
 #define MV88E6185_PORT_STS_CMODE_DISABLED      0x0007
+#define MV88E6XXX_PORT_STS_CMODE_INVALID       0xff
 
 /* Offset 0x01: MAC (or PCS or Physical) Control Register */
 #define MV88E6XXX_PORT_MAC_CTL                         0x01
index b58ca7cb8e9d4eef80055cfdba3dab08db4127ad..fbba300c1d01c1005e2ebb7ae3ddadca25821884 100644 (file)
@@ -275,6 +275,9 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self,
 
 static int hw_atl_b0_hw_init_tx_path(struct aq_hw_s *self)
 {
+       /* Tx TC/Queue number config */
+       hw_atl_rpb_tps_tx_tc_mode_set(self, 1U);
+
        hw_atl_thm_lso_tcp_flag_of_first_pkt_set(self, 0x0FF6U);
        hw_atl_thm_lso_tcp_flag_of_middle_pkt_set(self, 0x0FF6U);
        hw_atl_thm_lso_tcp_flag_of_last_pkt_set(self, 0x0F7FU);
index 939f77e2e1178b4c0cf01d97c5197b8128edbed2..8ac7a67b15c1f690276d37db3d29cc57c5ba3ce2 100644 (file)
@@ -1274,6 +1274,15 @@ void hw_atl_tpb_tx_buff_en_set(struct aq_hw_s *aq_hw, u32 tx_buff_en)
                            HW_ATL_TPB_TX_BUF_EN_SHIFT, tx_buff_en);
 }
 
+void hw_atl_rpb_tps_tx_tc_mode_set(struct aq_hw_s *aq_hw,
+                                  u32 tx_traf_class_mode)
+{
+       aq_hw_write_reg_bit(aq_hw, HW_ATL_TPB_TX_TC_MODE_ADDR,
+                       HW_ATL_TPB_TX_TC_MODE_MSK,
+                       HW_ATL_TPB_TX_TC_MODE_SHIFT,
+                       tx_traf_class_mode);
+}
+
 void hw_atl_tpb_tx_buff_hi_threshold_per_tc_set(struct aq_hw_s *aq_hw,
                                                u32 tx_buff_hi_threshold_per_tc,
                                         u32 buffer)
index 03c570d115fe4b1991eee11d4af33555f75f9f48..f529540bfd7e71f176d91f76598d5caf1aa51dac 100644 (file)
@@ -605,6 +605,10 @@ void hw_atl_thm_lso_tcp_flag_of_middle_pkt_set(struct aq_hw_s *aq_hw,
 
 /* tpb */
 
+/* set TX Traffic Class Mode */
+void hw_atl_rpb_tps_tx_tc_mode_set(struct aq_hw_s *aq_hw,
+                                  u32 tx_traf_class_mode);
+
 /* set tx buffer enable */
 void hw_atl_tpb_tx_buff_en_set(struct aq_hw_s *aq_hw, u32 tx_buff_en);
 
index 8470d92db81237a06fd2c6076eb347177018c782..e91ffce005f12fd8e085416fa1d977062ae99bcf 100644 (file)
 /* default value of bitfield tx_buf_en */
 #define HW_ATL_TPB_TX_BUF_EN_DEFAULT 0x0
 
+/* register address for bitfield tx_tc_mode */
+#define HW_ATL_TPB_TX_TC_MODE_ADDR 0x00007900
+/* bitmask for bitfield tx_tc_mode */
+#define HW_ATL_TPB_TX_TC_MODE_MSK 0x00000100
+/* inverted bitmask for bitfield tx_tc_mode */
+#define HW_ATL_TPB_TX_TC_MODE_MSKN 0xFFFFFEFF
+/* lower bit position of bitfield tx_tc_mode */
+#define HW_ATL_TPB_TX_TC_MODE_SHIFT 8
+/* width of bitfield tx_tc_mode */
+#define HW_ATL_TPB_TX_TC_MODE_WIDTH 1
+/* default value of bitfield tx_tc_mode */
+#define HW_ATL_TPB_TX_TC_MODE_DEFAULT 0x0
+
 /* tx tx{b}_hi_thresh[c:0] bitfield definitions
  * preprocessor definitions for the bitfield "tx{b}_hi_thresh[c:0]".
  * parameter: buffer {b} | stride size 0x10 | range [0, 7]
index d95730c6e0f20a9b1bd5987796bf790e1ea8ac32..803f7990d32b304f7516beaab2a3ed133fa6ca32 100644 (file)
@@ -500,6 +500,12 @@ normal_tx:
        }
 
        length >>= 9;
+       if (unlikely(length >= ARRAY_SIZE(bnxt_lhint_arr))) {
+               dev_warn_ratelimited(&pdev->dev, "Dropped oversize %d bytes TX packet.\n",
+                                    skb->len);
+               i = 0;
+               goto tx_dma_error;
+       }
        flags |= bnxt_lhint_arr[length];
        txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
 
index f6ecfa778660f81293420e2301ebbd3f320b6891..8f72587b5a2cbb9c79b8d0377d779650eccb7446 100644 (file)
@@ -1681,5 +1681,5 @@ MODULE_DESCRIPTION(DRV_NAME " ethernet driver");
 MODULE_AUTHOR("Claudio Lanconelli <lanconelli.claudio@eptar.com>");
 MODULE_LICENSE("GPL");
 module_param_named(debug, debug.msg_enable, int, 0);
-MODULE_PARM_DESC(debug, "Debug verbosity level (0=none, ..., ffff=all)");
+MODULE_PARM_DESC(debug, "Debug verbosity level in amount of bits set (0=none, ..., 31=all)");
 MODULE_ALIAS("spi:" DRV_NAME);
index 310807ef328bd5b59f72f9d202227fbe21b3f413..4d1b4a24907fde3c43bf7fa9774b7632f550c928 100644 (file)
@@ -1400,7 +1400,8 @@ static int lan743x_tx_frame_start(struct lan743x_tx *tx,
 }
 
 static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
-                                    unsigned int frame_length)
+                                    unsigned int frame_length,
+                                    int nr_frags)
 {
        /* called only from within lan743x_tx_xmit_frame.
         * assuming tx->ring_lock has already been acquired.
@@ -1410,6 +1411,10 @@ static void lan743x_tx_frame_add_lso(struct lan743x_tx *tx,
 
        /* wrap up previous descriptor */
        tx->frame_data0 |= TX_DESC_DATA0_EXT_;
+       if (nr_frags <= 0) {
+               tx->frame_data0 |= TX_DESC_DATA0_LS_;
+               tx->frame_data0 |= TX_DESC_DATA0_IOC_;
+       }
        tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
        tx_descriptor->data0 = tx->frame_data0;
 
@@ -1514,8 +1519,11 @@ static void lan743x_tx_frame_end(struct lan743x_tx *tx,
        u32 tx_tail_flags = 0;
 
        /* wrap up previous descriptor */
-       tx->frame_data0 |= TX_DESC_DATA0_LS_;
-       tx->frame_data0 |= TX_DESC_DATA0_IOC_;
+       if ((tx->frame_data0 & TX_DESC_DATA0_DTYPE_MASK_) ==
+           TX_DESC_DATA0_DTYPE_DATA_) {
+               tx->frame_data0 |= TX_DESC_DATA0_LS_;
+               tx->frame_data0 |= TX_DESC_DATA0_IOC_;
+       }
 
        tx_descriptor = &tx->ring_cpu_ptr[tx->frame_tail];
        buffer_info = &tx->buffer_info[tx->frame_tail];
@@ -1600,7 +1608,7 @@ static netdev_tx_t lan743x_tx_xmit_frame(struct lan743x_tx *tx,
        }
 
        if (gso)
-               lan743x_tx_frame_add_lso(tx, frame_length);
+               lan743x_tx_frame_add_lso(tx, frame_length, nr_frags);
 
        if (nr_frags <= 0)
                goto finish;
index 3377ac66a34748bf03c5875410f808562794ed18..5583d993480d2c11ed17afa189385627dcbad17b 100644 (file)
@@ -692,15 +692,20 @@ out:
 static int geneve_open(struct net_device *dev)
 {
        struct geneve_dev *geneve = netdev_priv(dev);
-       bool ipv6 = !!(geneve->info.mode & IP_TUNNEL_INFO_IPV6);
        bool metadata = geneve->collect_md;
+       bool ipv4, ipv6;
        int ret = 0;
 
+       ipv6 = geneve->info.mode & IP_TUNNEL_INFO_IPV6 || metadata;
+       ipv4 = !ipv6 || metadata;
 #if IS_ENABLED(CONFIG_IPV6)
-       if (ipv6 || metadata)
+       if (ipv6) {
                ret = geneve_sock_add(geneve, true);
+               if (ret < 0 && ret != -EAFNOSUPPORT)
+                       ipv4 = false;
+       }
 #endif
-       if (!ret && (!ipv6 || metadata))
+       if (ipv4)
                ret = geneve_sock_add(geneve, false);
        if (ret < 0)
                geneve_sock_release(geneve);
index 256adbd044f5ea138154c0a9126aacdaf1aafcb4..cf4897043e833618b5f5d6d452914ddbeff0e00d 100644 (file)
@@ -744,6 +744,14 @@ void netvsc_linkstatus_callback(struct net_device *net,
        schedule_delayed_work(&ndev_ctx->dwork, 0);
 }
 
+static void netvsc_comp_ipcsum(struct sk_buff *skb)
+{
+       struct iphdr *iph = (struct iphdr *)skb->data;
+
+       iph->check = 0;
+       iph->check = ip_fast_csum(iph, iph->ihl);
+}
+
 static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
                                             struct netvsc_channel *nvchan)
 {
@@ -770,9 +778,17 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
        /* skb is already created with CHECKSUM_NONE */
        skb_checksum_none_assert(skb);
 
-       /*
-        * In Linux, the IP checksum is always checked.
-        * Do L4 checksum offload if enabled and present.
+       /* Incoming packets may have IP header checksum verified by the host.
+        * They may not have IP header checksum computed after coalescing.
+        * We compute it here if the flags are set, because on Linux, the IP
+        * checksum is always checked.
+        */
+       if (csum_info && csum_info->receive.ip_checksum_value_invalid &&
+           csum_info->receive.ip_checksum_succeeded &&
+           skb->protocol == htons(ETH_P_IP))
+               netvsc_comp_ipcsum(skb);
+
+       /* Do L4 checksum offload if enabled and present.
         */
        if (csum_info && (net->features & NETIF_F_RXCSUM)) {
                if (csum_info->receive.tcp_checksum_succeeded ||
index da6a67d47ce99e21d7034c004b7b5306778cbe79..56fa3606cb9cb2db6e43e13a40f3401d5396823a 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/phy.h>
+#include <linux/delay.h>
 
 #include <dt-bindings/net/ti-dp83867.h>
 
@@ -325,6 +326,8 @@ static int dp83867_phy_reset(struct phy_device *phydev)
        if (err < 0)
                return err;
 
+       usleep_range(10, 20);
+
        return dp83867_config_init(phydev);
 }
 
index b1f959935f50ceba9d23850e01d56f4f16d28e63..b7df0295a3ca380f74c831f3f8f1d9ed9d93b100 100644 (file)
@@ -344,6 +344,17 @@ static int ksz8041_config_aneg(struct phy_device *phydev)
        return genphy_config_aneg(phydev);
 }
 
+static int ksz8061_config_init(struct phy_device *phydev)
+{
+       int ret;
+
+       ret = phy_write_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_DEVID1, 0xB61A);
+       if (ret)
+               return ret;
+
+       return kszphy_config_init(phydev);
+}
+
 static int ksz9021_load_values_from_of(struct phy_device *phydev,
                                       const struct device_node *of_node,
                                       u16 reg,
@@ -1040,7 +1051,7 @@ static struct phy_driver ksphy_driver[] = {
        .name           = "Micrel KSZ8061",
        .phy_id_mask    = MICREL_PHY_ID_MASK,
        .features       = PHY_BASIC_FEATURES,
-       .config_init    = kszphy_config_init,
+       .config_init    = ksz8061_config_init,
        .ack_interrupt  = kszphy_ack_interrupt,
        .config_intr    = kszphy_config_intr,
        .suspend        = genphy_suspend,
index 938803237d7fa54ed70e7118bfe4d5b2dfbf0c47..85987aac31c48f4349fe8bd977cbf05e1def87b7 100644 (file)
@@ -320,6 +320,10 @@ static int phylink_get_mac_state(struct phylink *pl, struct phylink_link_state *
        linkmode_zero(state->lp_advertising);
        state->interface = pl->link_config.interface;
        state->an_enabled = pl->link_config.an_enabled;
+       state->speed = SPEED_UNKNOWN;
+       state->duplex = DUPLEX_UNKNOWN;
+       state->pause = MLO_PAUSE_NONE;
+       state->an_complete = 0;
        state->link = 1;
 
        return pl->ops->mac_link_state(ndev, state);
index fed298c0cb393e126243c84b44006b94192a1c5e..53f4f37b0ffd3e92bc742b0ee42948c5bdab0b1e 100644 (file)
@@ -2167,9 +2167,9 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
        }
 
        add_wait_queue(&tfile->wq.wait, &wait);
-       current->state = TASK_INTERRUPTIBLE;
 
        while (1) {
+               set_current_state(TASK_INTERRUPTIBLE);
                ptr = ptr_ring_consume(&tfile->tx_ring);
                if (ptr)
                        break;
@@ -2185,7 +2185,7 @@ static void *tun_ring_recv(struct tun_file *tfile, int noblock, int *err)
                schedule();
        }
 
-       current->state = TASK_RUNNING;
+       __set_current_state(TASK_RUNNING);
        remove_wait_queue(&tfile->wq.wait, &wait);
 
 out:
index 0ccb021f1e78687d7c7a9814a05369aafe7c6508..10d580c3dea3f06b53d4bdbff22f693a237e741d 100644 (file)
@@ -454,6 +454,8 @@ void xenvif_init_hash(struct xenvif *vif)
        if (xenvif_hash_cache_size == 0)
                return;
 
+       BUG_ON(vif->hash.cache.count);
+
        spin_lock_init(&vif->hash.cache.lock);
        INIT_LIST_HEAD(&vif->hash.cache.list);
 }
index 182d6770f1027120b5cd7165e4b7eea7c8297299..6da12518e6934ce20ec6a1becfdbbef07f430822 100644 (file)
@@ -153,6 +153,13 @@ static u16 xenvif_select_queue(struct net_device *dev, struct sk_buff *skb,
 {
        struct xenvif *vif = netdev_priv(dev);
        unsigned int size = vif->hash.size;
+       unsigned int num_queues;
+
+       /* If queues are not set up internally - always return 0
+        * as the packet going to be dropped anyway */
+       num_queues = READ_ONCE(vif->num_queues);
+       if (num_queues < 1)
+               return 0;
 
        if (vif->hash.alg == XEN_NETIF_CTRL_HASH_ALGORITHM_NONE)
                return fallback(dev, skb, NULL) % dev->real_num_tx_queues;
index 80aae3a32c2a3ad90d0ca8c98a37e666de1bd4a6..f09948b009dd00ca79670daf7da5e27028cc047a 100644 (file)
@@ -1072,11 +1072,6 @@ static int xenvif_handle_frag_list(struct xenvif_queue *queue, struct sk_buff *s
                skb_frag_size_set(&frags[i], len);
        }
 
-       /* Copied all the bits from the frag list -- free it. */
-       skb_frag_list_init(skb);
-       xenvif_skb_zerocopy_prepare(queue, nskb);
-       kfree_skb(nskb);
-
        /* Release all the original (foreign) frags. */
        for (f = 0; f < skb_shinfo(skb)->nr_frags; f++)
                skb_frag_unref(skb, f);
@@ -1145,6 +1140,8 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)
                xenvif_fill_frags(queue, skb);
 
                if (unlikely(skb_has_frag_list(skb))) {
+                       struct sk_buff *nskb = skb_shinfo(skb)->frag_list;
+                       xenvif_skb_zerocopy_prepare(queue, nskb);
                        if (xenvif_handle_frag_list(queue, skb)) {
                                if (net_ratelimit())
                                        netdev_err(queue->vif->dev,
@@ -1153,6 +1150,9 @@ static int xenvif_tx_submit(struct xenvif_queue *queue)
                                kfree_skb(skb);
                                continue;
                        }
+                       /* Copied all the bits from the frag list -- free it. */
+                       skb_frag_list_init(skb);
+                       kfree_skb(nskb);
                }
 
                skb->dev      = queue->vif->dev;
index a3c20e3a8b7cb967f8eefa16097214f42bebfa34..3337b1e80412b045b3609eb794e6d22da784c271 100644 (file)
@@ -2009,7 +2009,7 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
        struct Scsi_Host *host = NULL;
        TW_Device_Extension *tw_dev;
        unsigned long mem_addr, mem_len;
-       int retval = -ENODEV;
+       int retval;
 
        retval = pci_enable_device(pdev);
        if (retval) {
@@ -2020,8 +2020,10 @@ static int twa_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
        pci_set_master(pdev);
        pci_try_set_mwi(pdev);
 
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
+       retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (retval)
+               retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       if (retval) {
                TW_PRINTK(host, TW_DRIVER, 0x23, "Failed to set dma mask");
                retval = -ENODEV;
                goto out_disable_device;
@@ -2240,8 +2242,10 @@ static int twa_resume(struct pci_dev *pdev)
        pci_set_master(pdev);
        pci_try_set_mwi(pdev);
 
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
+       retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (retval)
+               retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       if (retval) {
                TW_PRINTK(host, TW_DRIVER, 0x40, "Failed to set dma mask during resume");
                retval = -ENODEV;
                goto out_disable_device;
index cd096104bcec18d2f25eea1e64effe560ea38c29..dda6fa8577093d6302f35fbd9fd7a9c51eeed115 100644 (file)
@@ -1573,8 +1573,10 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
        pci_set_master(pdev);
        pci_try_set_mwi(pdev);
 
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
+       retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (retval)
+               retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       if (retval) {
                TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
                retval = -ENODEV;
                goto out_disable_device;
@@ -1805,8 +1807,10 @@ static int twl_resume(struct pci_dev *pdev)
        pci_set_master(pdev);
        pci_try_set_mwi(pdev);
 
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
+       retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (retval)
+               retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       if (retval) {
                TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
                retval = -ENODEV;
                goto out_disable_device;
index 07efcb9b5b943109bea84daf60fc223263b8d376..bbdae67774f064526cd7e4eafcc6a8c7aeab35c3 100644 (file)
@@ -769,9 +769,11 @@ static int asd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
        if (err)
                goto Err_remove;
 
-       err = -ENODEV;
-       if (dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32))) {
+       err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(64));
+       if (err)
+               err = dma_set_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
+       if (err) {
+               err = -ENODEV;
                asd_printk("no suitable DMA mask for %s\n", pci_name(dev));
                goto Err_remove;
        }
index 42a0caf6740da3fd0af1e933e79616e30460a37e..88880a66a18929f5c039ace1999c531a7a3e396d 100644 (file)
@@ -727,7 +727,7 @@ bfad_init_timer(struct bfad_s *bfad)
 int
 bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
 {
-       int             rc = -ENODEV;
+       int rc = -ENODEV;
 
        if (pci_enable_device(pdev)) {
                printk(KERN_ERR "pci_enable_device fail %p\n", pdev);
@@ -739,8 +739,12 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
 
        pci_set_master(pdev);
 
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
+       rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (rc)
+               rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+
+       if (rc) {
+               rc = -ENODEV;
                printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
                goto out_release_region;
        }
@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
 {
        struct bfad_s *bfad = pci_get_drvdata(pdev);
        u8 byte;
+       int rc;
 
        dev_printk(KERN_ERR, &pdev->dev,
                   "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags);
@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
        pci_save_state(pdev);
        pci_set_master(pdev);
 
-       if (dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(32)))
+       rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));
+       if (rc)
+               rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,
+                                              DMA_BIT_MASK(32));
+       if (rc)
                goto out_disable_device;
 
        if (restart_bfa(bfad) == -1)
index cf629380a9813a41d20486f33d17b9ff5490c81a..616b25bf7941b1b6afa080c30f9a195d40986d44 100644 (file)
@@ -210,8 +210,11 @@ csio_pci_init(struct pci_dev *pdev, int *bars)
        pci_set_master(pdev);
        pci_try_set_mwi(pdev);
 
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
+       rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (rv)
+               rv = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       if (rv) {
+               rv = -ENODEV;
                dev_err(&pdev->dev, "No suitable DMA available.\n");
                goto err_release_regions;
        }
index eed7fc5b3389f8291c7f04d3b425f0944c580228..bc17fa0d837555af82f04bee2b7bad6372caf8a3 100644 (file)
@@ -2323,6 +2323,7 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
        struct Scsi_Host *shost;
        struct hisi_hba *hisi_hba;
        struct device *dev = &pdev->dev;
+       int error;
 
        shost = scsi_host_alloc(hw->sht, sizeof(*hisi_hba));
        if (!shost) {
@@ -2343,8 +2344,11 @@ static struct Scsi_Host *hisi_sas_shost_alloc(struct platform_device *pdev,
        if (hisi_sas_get_fw_info(hisi_hba) < 0)
                goto err_out;
 
-       if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) &&
-           dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32))) {
+       error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
+       if (error)
+               error = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
+
+       if (error) {
                dev_err(dev, "No usable DMA addressing method\n");
                goto err_out;
        }
index c92b3822c40823fa283711746a8f4da9a527f539..e0570fd8466ed865030d5b509926d06cf1ec3594 100644 (file)
@@ -2447,10 +2447,12 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        if (rc)
                goto err_out_disable_device;
 
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
+       rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (rc)
+               rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       if (rc) {
                dev_err(dev, "No usable DMA addressing method\n");
-               rc = -EIO;
+               rc = -ENODEV;
                goto err_out_regions;
        }
 
index 3eedfd4f8f5790e6e658741abc76efa987bb34f0..251c084a6ff04d677e16db4245331d6265305cf2 100644 (file)
@@ -1292,6 +1292,7 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
        dma_addr_t start_phy;
        void *start_virt;
        u32 offset, i, req_size;
+       int rc;
 
        dprintk("hptiop_probe(%p)\n", pcidev);
 
@@ -1308,9 +1309,12 @@ static int hptiop_probe(struct pci_dev *pcidev, const struct pci_device_id *id)
 
        /* Enable 64bit DMA if possible */
        iop_ops = (struct hptiop_adapter_ops *)id->driver_data;
-       if (dma_set_mask(&pcidev->dev,
-                        DMA_BIT_MASK(iop_ops->hw_dma_bit_mask)) ||
-           dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32))) {
+       rc = dma_set_mask(&pcidev->dev,
+                         DMA_BIT_MASK(iop_ops->hw_dma_bit_mask));
+       if (rc)
+               rc = dma_set_mask(&pcidev->dev, DMA_BIT_MASK(32));
+
+       if (rc) {
                printk(KERN_ERR "hptiop: fail to set dma_mask\n");
                goto disable_pci_device;
        }
index bede11e163499641716c664e56d9e8a32d7de849..e1129260ed18175da0a944d4e257e2b9a684e036 100644 (file)
@@ -7361,15 +7361,18 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
        unsigned long bar0map_len, bar2map_len;
        int i, hbq_count;
        void *ptr;
-       int error = -ENODEV;
+       int error;
 
        if (!pdev)
-               return error;
+               return -ENODEV;
 
        /* Set the device DMA mask size */
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
+       error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (error)
+               error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       if (error)
                return error;
+       error = -ENODEV;
 
        /* Get the bus address of Bar0 and Bar2 and the number of bytes
         * required by each mapping.
@@ -9742,11 +9745,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
        uint32_t if_type;
 
        if (!pdev)
-               return error;
+               return -ENODEV;
 
        /* Set the device DMA mask size */
-       if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
-           dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))
+       error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+       if (error)
+               error = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
+       if (error)
                return error;
 
        /*
index f8d51c3d5582ca40a6a671468aab306285f5ff23..a6828391d6b3777873782221c98885c4b8f41885 100644 (file)
@@ -2598,7 +2598,6 @@ void scsi_device_resume(struct scsi_device *sdev)
         * device deleted during suspend)
         */
        mutex_lock(&sdev->state_mutex);
-       WARN_ON_ONCE(!sdev->quiesced_by);
        sdev->quiesced_by = NULL;
        blk_clear_pm_only(sdev->request_queue);
        if (sdev->sdev_state == SDEV_QUIESCE)
index cf445dbd5f2e05d4c716dadb3123fb397537d4e6..9de46116c7492a712ede0c8a241eea71ef94230b 100644 (file)
@@ -173,6 +173,7 @@ static struct afs_cell *afs_alloc_cell(struct afs_net *net,
 
                rcu_assign_pointer(cell->vl_servers, vllist);
                cell->dns_expiry = TIME64_MAX;
+               __clear_bit(AFS_CELL_FL_NO_LOOKUP_YET, &cell->flags);
        } else {
                cell->dns_expiry = ktime_get_real_seconds();
        }
index 32920a10100e23fc60f53cf36c882278ae972cee..a7fa037b876b7fa32afcc891345cd44f0315b4f9 100644 (file)
@@ -859,6 +859,18 @@ static int hugetlbfs_migrate_page(struct address_space *mapping,
        rc = migrate_huge_page_move_mapping(mapping, newpage, page);
        if (rc != MIGRATEPAGE_SUCCESS)
                return rc;
+
+       /*
+        * page_private is subpool pointer in hugetlb pages.  Transfer to
+        * new page.  PagePrivate is not associated with page_private for
+        * hugetlb pages and can not be set here as only page_huge_active
+        * pages can be migrated.
+        */
+       if (page_private(page)) {
+               set_page_private(newpage, page_private(page));
+               set_page_private(page, 0);
+       }
+
        if (mode != MIGRATE_SYNC_NO_COPY)
                migrate_page_copy(newpage, page);
        else
index a677b59efd74e25f52fd3db3e610c6c5193fb171..678ef175d63ae7f4b81efc595e4dd82b2c4b8741 100644 (file)
@@ -2698,7 +2698,6 @@ static long exact_copy_from_user(void *to, const void __user * from,
        if (!access_ok(from, n))
                return n;
 
-       current->kernel_uaccess_faults_ok++;
        while (n) {
                if (__get_user(c, f)) {
                        memset(t, 0, n);
@@ -2708,7 +2707,6 @@ static long exact_copy_from_user(void *to, const void __user * from,
                f++;
                n--;
        }
-       current->kernel_uaccess_faults_ok--;
        return n;
 }
 
index a5a2fe76568fbbfe3e4c720979457291d5d7dcdb..b094d3d79354af2196285404d5093cc02e169046 100644 (file)
@@ -398,8 +398,6 @@ static ssize_t orangefs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter
        loff_t pos = iocb->ki_pos;
        ssize_t rc = 0;
 
-       BUG_ON(iocb->private);
-
        gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_read_iter\n");
 
        orangefs_stats.reads++;
@@ -416,8 +414,6 @@ static ssize_t orangefs_file_write_iter(struct kiocb *iocb, struct iov_iter *ite
        loff_t pos;
        ssize_t rc;
 
-       BUG_ON(iocb->private);
-
        gossip_debug(GOSSIP_FILE_DEBUG, "orangefs_file_write_iter\n");
 
        inode_lock(file->f_mapping->host);
index 86dbb3e29139591d046602003cd7cb115f8b7e1a..848b54b7ec9146eac22265d56de2c44de2671d4b 100644 (file)
@@ -3861,7 +3861,7 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
        if (debug_value == 0)   /* no output */
                return 0;
        /* set low N bits */
-       return (1 << debug_value) - 1;
+       return (1U << debug_value) - 1;
 }
 
 static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
index bba3afb4e9bf8a782200246ebe8d019be5c7b700..f9b43c989577fdf50da7147ee28a7b0a8c4e24ad 100644 (file)
@@ -739,12 +739,6 @@ struct task_struct {
        unsigned                        use_memdelay:1;
 #endif
 
-       /*
-        * May usercopy functions fault on kernel addresses?
-        * This is not just a single bit because this can potentially nest.
-        */
-       unsigned int                    kernel_uaccess_faults_ok;
-
        unsigned long                   atomic_flags; /* Flags requiring atomic access. */
 
        struct restart_block            restart_block;
index 6ac3a5bd0117cda508f379c001351e20c63ef727..e0f709d26dde4eb7547d43d3ec2bf8f83bfb249d 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <net/inet_sock.h>
 #include <net/snmp.h>
+#include <net/ip.h>
 
 struct icmp_err {
   int          errno;
@@ -39,7 +40,13 @@ struct net_proto_family;
 struct sk_buff;
 struct net;
 
-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
+void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
+                const struct ip_options *opt);
+static inline void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
+{
+       __icmp_send(skb_in, type, code, info, &IPCB(skb_in)->opt);
+}
+
 int icmp_rcv(struct sk_buff *skb);
 int icmp_err(struct sk_buff *skb, u32 info);
 int icmp_init(void);
index 8866bfce61214b6af1c3c59b4885c8c39e8e0e90..be3cad9c2e4c37b282e5c2d0e2ef5f05a79b7438 100644 (file)
@@ -667,6 +667,8 @@ static inline int ip_options_echo(struct net *net, struct ip_options *dopt,
 }
 
 void ip_options_fragment(struct sk_buff *skb);
+int __ip_options_compile(struct net *net, struct ip_options *opt,
+                        struct sk_buff *skb, __be32 *info);
 int ip_options_compile(struct net *net, struct ip_options *opt,
                       struct sk_buff *skb);
 int ip_options_get(struct net *net, struct ip_options_rcu **optp,
@@ -716,7 +718,7 @@ extern int sysctl_icmp_msgs_burst;
 int ip_misc_proc_init(void);
 #endif
 
-int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
+int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,
                                struct netlink_ext_ack *extack);
 
 #endif /* _IP_H */
index 8577bb7f8be6739f143667af19f916b04de01126..84470d1480aa4c4cfc4a5df70e4849d426bf922b 100644 (file)
@@ -559,12 +559,12 @@ static int map_create(union bpf_attr *attr)
        err = bpf_map_new_fd(map, f_flags);
        if (err < 0) {
                /* failed to allocate fd.
-                * bpf_map_put() is needed because the above
+                * bpf_map_put_with_uref() is needed because the above
                 * bpf_map_alloc_id() has published the map
                 * to the userspace and the userspace may
                 * have refcnt-ed it through BPF_MAP_GET_FD_BY_ID.
                 */
-               bpf_map_put(map);
+               bpf_map_put_with_uref(map);
                return err;
        }
 
@@ -1986,7 +1986,7 @@ static int bpf_map_get_fd_by_id(const union bpf_attr *attr)
 
        fd = bpf_map_new_fd(map, f_flags);
        if (fd < 0)
-               bpf_map_put(map);
+               bpf_map_put_with_uref(map);
 
        return fd;
 }
index 8f295b7902970c719017c06d3259c5faf257b32a..5fcce2f4209dd403d0571c41b5a458516f5e773e 100644 (file)
@@ -6920,7 +6920,8 @@ static int fixup_bpf_calls(struct bpf_verifier_env *env)
                        u32 off_reg;
 
                        aux = &env->insn_aux_data[i + delta];
-                       if (!aux->alu_state)
+                       if (!aux->alu_state ||
+                           aux->alu_state == BPF_ALU_NON_POINTER)
                                continue;
 
                        isneg = aux->alu_state & BPF_ALU_NEG_VALUE;
index d8c474b6691e92c6a2d26519c5f59cb4b4d04afc..9737059ec58bb213fff5f80b0d34d39395c49904 100644 (file)
@@ -113,6 +113,28 @@ config KASAN_INLINE
 
 endchoice
 
+config KASAN_STACK_ENABLE
+       bool "Enable stack instrumentation (unsafe)" if CC_IS_CLANG && !COMPILE_TEST
+       default !(CLANG_VERSION < 90000)
+       depends on KASAN
+       help
+         The LLVM stack address sanitizer has a know problem that
+         causes excessive stack usage in a lot of functions, see
+         https://bugs.llvm.org/show_bug.cgi?id=38809
+         Disabling asan-stack makes it safe to run kernels build
+         with clang-8 with KASAN enabled, though it loses some of
+         the functionality.
+         This feature is always disabled when compile-testing with clang-8
+         or earlier to avoid cluttering the output in stack overflow
+         warnings, but clang-8 users can still enable it for builds without
+         CONFIG_COMPILE_TEST.  On gcc and later clang versions it is
+         assumed to always be safe to use and enabled by default.
+
+config KASAN_STACK
+       int
+       default 1 if KASAN_STACK_ENABLE || CC_IS_GCC
+       default 0
+
 config KASAN_S390_4_LEVEL_PAGING
        bool "KASan: use 4-level paging"
        depends on KASAN && S390
index afef61656c1e1ac7bdaf6eb5babf9d040ed51805..8dfdffc34a99bcb099742fd9614196fd3e1f685f 100644 (file)
@@ -3624,7 +3624,6 @@ retry_avoidcopy:
        copy_user_huge_page(new_page, old_page, address, vma,
                            pages_per_huge_page(h));
        __SetPageUptodate(new_page);
-       set_page_huge_active(new_page);
 
        mmu_notifier_range_init(&range, mm, haddr, haddr + huge_page_size(h));
        mmu_notifier_invalidate_range_start(&range);
@@ -3645,6 +3644,7 @@ retry_avoidcopy:
                                make_huge_pte(vma, new_page, 1));
                page_remove_rmap(old_page, true);
                hugepage_add_new_anon_rmap(new_page, vma, haddr);
+               set_page_huge_active(new_page);
                /* Make the old page be freed below */
                new_page = old_page;
        }
@@ -3729,6 +3729,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
        pte_t new_pte;
        spinlock_t *ptl;
        unsigned long haddr = address & huge_page_mask(h);
+       bool new_page = false;
 
        /*
         * Currently, we are forced to kill the process in the event the
@@ -3790,7 +3791,7 @@ retry:
                }
                clear_huge_page(page, address, pages_per_huge_page(h));
                __SetPageUptodate(page);
-               set_page_huge_active(page);
+               new_page = true;
 
                if (vma->vm_flags & VM_MAYSHARE) {
                        int err = huge_add_to_page_cache(page, mapping, idx);
@@ -3861,6 +3862,15 @@ retry:
        }
 
        spin_unlock(ptl);
+
+       /*
+        * Only make newly allocated pages active.  Existing pages found
+        * in the pagecache could be !page_huge_active() if they have been
+        * isolated for migration.
+        */
+       if (new_page)
+               set_page_huge_active(page);
+
        unlock_page(page);
 out:
        return ret;
@@ -4095,7 +4105,6 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
         * the set_pte_at() write.
         */
        __SetPageUptodate(page);
-       set_page_huge_active(page);
 
        mapping = dst_vma->vm_file->f_mapping;
        idx = vma_hugecache_offset(h, dst_vma, dst_addr);
@@ -4163,6 +4172,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm,
        update_mmu_cache(dst_vma, dst_addr, dst_pte);
 
        spin_unlock(ptl);
+       set_page_huge_active(page);
        if (vm_shared)
                unlock_page(page);
        ret = 0;
index f3416632e5a4137c960434c9a59f92a79e0e0204..ec00be51a24fd6a9639897fafeea3abd45b9d3f4 100644 (file)
@@ -30,10 +30,8 @@ long __probe_kernel_read(void *dst, const void *src, size_t size)
 
        set_fs(KERNEL_DS);
        pagefault_disable();
-       current->kernel_uaccess_faults_ok++;
        ret = __copy_from_user_inatomic(dst,
                        (__force const void __user *)src, size);
-       current->kernel_uaccess_faults_ok--;
        pagefault_enable();
        set_fs(old_fs);
 
@@ -60,9 +58,7 @@ long __probe_kernel_write(void *dst, const void *src, size_t size)
 
        set_fs(KERNEL_DS);
        pagefault_disable();
-       current->kernel_uaccess_faults_ok++;
        ret = __copy_to_user_inatomic((__force void __user *)dst, src, size);
-       current->kernel_uaccess_faults_ok--;
        pagefault_enable();
        set_fs(old_fs);
 
@@ -98,13 +94,11 @@ long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count)
 
        set_fs(KERNEL_DS);
        pagefault_disable();
-       current->kernel_uaccess_faults_ok++;
 
        do {
                ret = __get_user(*dst++, (const char __user __force *)src++);
        } while (dst[-1] && ret == 0 && src - unsafe_addr < count);
 
-       current->kernel_uaccess_faults_ok--;
        dst[-1] = '\0';
        pagefault_enable();
        set_fs(old_fs);
index d4fd680be3b0facd6ca1730612b74372a77a196a..181f5d2718a9b1c31be22dd76758d4693e002e03 100644 (file)
@@ -1315,6 +1315,16 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
                lock_page(hpage);
        }
 
+       /*
+        * Check for pages which are in the process of being freed.  Without
+        * page_mapping() set, hugetlbfs specific move page routine will not
+        * be called and we could leak usage counts for subpools.
+        */
+       if (page_private(hpage) && !page_mapping(hpage)) {
+               rc = -EBUSY;
+               goto out_unlock;
+       }
+
        if (PageAnon(hpage))
                anon_vma = page_get_anon_vma(hpage);
 
@@ -1345,6 +1355,7 @@ put_anon:
                put_new_page = NULL;
        }
 
+out_unlock:
        unlock_page(hpage);
 out:
        if (rc != -EAGAIN)
index f901065c4c64cf63b455497fb993e7c4eacfc184..fc1809b1bed67bcf4e473bc609dcad5072f38b88 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2426,12 +2426,11 @@ int expand_downwards(struct vm_area_struct *vma,
 {
        struct mm_struct *mm = vma->vm_mm;
        struct vm_area_struct *prev;
-       int error;
+       int error = 0;
 
        address &= PAGE_MASK;
-       error = security_mmap_addr(address);
-       if (error)
-               return error;
+       if (address < mmap_min_addr)
+               return -EPERM;
 
        /* Enforce stack_guard_gap */
        prev = vma->vm_prev;
index 0905215fb0165779599c1a1452ae5e41619a765e..2c012eee133d1f13dc3fe8b7112278dfc02e8ceb 100644 (file)
@@ -2848,7 +2848,7 @@ static int shmem_create(struct inode *dir, struct dentry *dentry, umode_t mode,
 static int shmem_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
 {
        struct inode *inode = d_inode(old_dentry);
-       int ret;
+       int ret = 0;
 
        /*
         * No ordinary (disk based) filesystem counts links as inodes;
index a1917025e155bab3c96f9995594667c1383562f3..410f19148106a92b9e9eafabfc4bd6efb3c9c22a 100644 (file)
@@ -612,8 +612,8 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds,
 {
        struct device_node *ports, *port;
        struct dsa_port *dp;
+       int err = 0;
        u32 reg;
-       int err;
 
        ports = of_get_child_by_name(dn, "ports");
        if (!ports) {
@@ -624,19 +624,23 @@ static int dsa_switch_parse_ports_of(struct dsa_switch *ds,
        for_each_available_child_of_node(ports, port) {
                err = of_property_read_u32(port, "reg", &reg);
                if (err)
-                       return err;
+                       goto out_put_node;
 
-               if (reg >= ds->num_ports)
-                       return -EINVAL;
+               if (reg >= ds->num_ports) {
+                       err = -EINVAL;
+                       goto out_put_node;
+               }
 
                dp = &ds->ports[reg];
 
                err = dsa_port_parse_of(dp, port);
                if (err)
-                       return err;
+                       goto out_put_node;
        }
 
-       return 0;
+out_put_node:
+       of_node_put(ports);
+       return err;
 }
 
 static int dsa_switch_parse_member_of(struct dsa_switch *ds,
index 2a2a878b5ce333f7caa775ebc876259d79f5d0e9..c2261697ee83e0b1b5e937c2ab87ab40cc1b3d2e 100644 (file)
@@ -292,6 +292,7 @@ static struct phy_device *dsa_port_get_phy_device(struct dsa_port *dp)
                return ERR_PTR(-EPROBE_DEFER);
        }
 
+       of_node_put(phy_dn);
        return phydev;
 }
 
index 777fa3b7fb13d9f73a71eee2162ce472c1097b92..f0165c5f376b398950db7696e813c94b19034068 100644 (file)
@@ -667,7 +667,8 @@ static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level)
        case CIPSO_V4_MAP_PASS:
                return 0;
        case CIPSO_V4_MAP_TRANS:
-               if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL)
+               if ((level < doi_def->map.std->lvl.cipso_size) &&
+                   (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL))
                        return 0;
                break;
        }
@@ -1735,13 +1736,26 @@ validate_return:
  */
 void cipso_v4_error(struct sk_buff *skb, int error, u32 gateway)
 {
+       unsigned char optbuf[sizeof(struct ip_options) + 40];
+       struct ip_options *opt = (struct ip_options *)optbuf;
+
        if (ip_hdr(skb)->protocol == IPPROTO_ICMP || error != -EACCES)
                return;
 
+       /*
+        * We might be called above the IP layer,
+        * so we can not use icmp_send and IPCB here.
+        */
+
+       memset(opt, 0, sizeof(struct ip_options));
+       opt->optlen = ip_hdr(skb)->ihl*4 - sizeof(struct iphdr);
+       if (__ip_options_compile(dev_net(skb->dev), opt, skb, NULL))
+               return;
+
        if (gateway)
-               icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0);
+               __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_NET_ANO, 0, opt);
        else
-               icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0);
+               __icmp_send(skb, ICMP_DEST_UNREACH, ICMP_HOST_ANO, 0, opt);
 }
 
 /**
index fe4f6a62423834a79705e0c01cd1329d9da4f836..ed14ec2455847f2f104cb33fcd6a64cd37b87b40 100644 (file)
@@ -710,6 +710,10 @@ static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
                case RTA_GATEWAY:
                        cfg->fc_gw = nla_get_be32(attr);
                        break;
+               case RTA_VIA:
+                       NL_SET_ERR_MSG(extack, "IPv4 does not support RTA_VIA attribute");
+                       err = -EINVAL;
+                       goto errout;
                case RTA_PRIORITY:
                        cfg->fc_priority = nla_get_u32(attr);
                        break;
index 065997f414e61e22a31e663f89bd642800cf72b4..3f24414150e27f2096ced754fab5c2766660a040 100644 (file)
@@ -570,7 +570,8 @@ relookup_failed:
  *                     MUST reply to only the first fragment.
  */
 
-void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
+void __icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info,
+                const struct ip_options *opt)
 {
        struct iphdr *iph;
        int room;
@@ -691,7 +692,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
                                          iph->tos;
        mark = IP4_REPLY_MARK(net, skb_in->mark);
 
-       if (ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in))
+       if (__ip_options_echo(net, &icmp_param.replyopts.opt.opt, skb_in, opt))
                goto out_unlock;
 
 
@@ -742,7 +743,7 @@ out_bh_enable:
        local_bh_enable();
 out:;
 }
-EXPORT_SYMBOL(icmp_send);
+EXPORT_SYMBOL(__icmp_send);
 
 
 static void icmp_socket_deliver(struct sk_buff *skb, u32 info)
index 51d8efba6de21c13712d35c6ee37c6a13f6fd5e9..1f4737b77067210df8bb049ebdb7da96222ee9f4 100644 (file)
@@ -307,11 +307,10 @@ drop:
 }
 
 static int ip_rcv_finish_core(struct net *net, struct sock *sk,
-                             struct sk_buff *skb)
+                             struct sk_buff *skb, struct net_device *dev)
 {
        const struct iphdr *iph = ip_hdr(skb);
        int (*edemux)(struct sk_buff *skb);
-       struct net_device *dev = skb->dev;
        struct rtable *rt;
        int err;
 
@@ -400,6 +399,7 @@ drop_error:
 
 static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
 {
+       struct net_device *dev = skb->dev;
        int ret;
 
        /* if ingress device is enslaved to an L3 master device pass the
@@ -409,7 +409,7 @@ static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
        if (!skb)
                return NET_RX_SUCCESS;
 
-       ret = ip_rcv_finish_core(net, sk, skb);
+       ret = ip_rcv_finish_core(net, sk, skb, dev);
        if (ret != NET_RX_DROP)
                ret = dst_input(skb);
        return ret;
@@ -545,6 +545,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
 
        INIT_LIST_HEAD(&sublist);
        list_for_each_entry_safe(skb, next, head, list) {
+               struct net_device *dev = skb->dev;
                struct dst_entry *dst;
 
                skb_list_del_init(skb);
@@ -554,7 +555,7 @@ static void ip_list_rcv_finish(struct net *net, struct sock *sk,
                skb = l3mdev_ip_rcv(skb);
                if (!skb)
                        continue;
-               if (ip_rcv_finish_core(net, sk, skb) == NET_RX_DROP)
+               if (ip_rcv_finish_core(net, sk, skb, dev) == NET_RX_DROP)
                        continue;
 
                dst = skb_dst(skb);
index ed194d46c00e3292cd741a07cd8954ccdc5a1fd6..32a35043c9f590314b7fa354d5e948b59e665214 100644 (file)
@@ -251,8 +251,9 @@ static void spec_dst_fill(__be32 *spec_dst, struct sk_buff *skb)
  * If opt == NULL, then skb->data should point to IP header.
  */
 
-int ip_options_compile(struct net *net,
-                      struct ip_options *opt, struct sk_buff *skb)
+int __ip_options_compile(struct net *net,
+                        struct ip_options *opt, struct sk_buff *skb,
+                        __be32 *info)
 {
        __be32 spec_dst = htonl(INADDR_ANY);
        unsigned char *pp_ptr = NULL;
@@ -468,11 +469,22 @@ eol:
                return 0;
 
 error:
-       if (skb) {
-               icmp_send(skb, ICMP_PARAMETERPROB, 0, htonl((pp_ptr-iph)<<24));
-       }
+       if (info)
+               *info = htonl((pp_ptr-iph)<<24);
        return -EINVAL;
 }
+
+int ip_options_compile(struct net *net,
+                      struct ip_options *opt, struct sk_buff *skb)
+{
+       int ret;
+       __be32 info;
+
+       ret = __ip_options_compile(net, opt, skb, &info);
+       if (ret != 0 && skb)
+               icmp_send(skb, ICMP_PARAMETERPROB, 0, info);
+       return ret;
+}
 EXPORT_SYMBOL(ip_options_compile);
 
 /*
index f86bb4f066095a16a0d951a4103c7cd5cee6f683..d8e3a1fb8e8267a12cd484263403d6c7b27e3010 100644 (file)
@@ -3,9 +3,10 @@
 #include <linux/types.h>
 #include <net/net_namespace.h>
 #include <net/netlink.h>
+#include <linux/in6.h>
 #include <net/ip.h>
 
-int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
+int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,
                                struct netlink_ext_ack *extack)
 {
        *ip_proto = nla_get_u8(attr);
@@ -13,11 +14,19 @@ int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto,
        switch (*ip_proto) {
        case IPPROTO_TCP:
        case IPPROTO_UDP:
+               return 0;
        case IPPROTO_ICMP:
+               if (family != AF_INET)
+                       break;
+               return 0;
+#if IS_ENABLED(CONFIG_IPV6)
+       case IPPROTO_ICMPV6:
+               if (family != AF_INET6)
+                       break;
                return 0;
-       default:
-               NL_SET_ERR_MSG(extack, "Unsupported ip proto");
-               return -EOPNOTSUPP;
+#endif
        }
+       NL_SET_ERR_MSG(extack, "Unsupported ip proto");
+       return -EOPNOTSUPP;
 }
 EXPORT_SYMBOL_GPL(rtm_getroute_parse_ip_proto);
index 5163b64f8fb3e31a8ebb3a0f3d49aad0191d2197..7bb9128c836345d41e74cca4747547459f06ec96 100644 (file)
@@ -2803,7 +2803,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 
        if (tb[RTA_IP_PROTO]) {
                err = rtm_getroute_parse_ip_proto(tb[RTA_IP_PROTO],
-                                                 &ip_proto, extack);
+                                                 &ip_proto, AF_INET, extack);
                if (err)
                        return err;
        }
index ce15dc4ccbfa0cc14233b1fe7842479726ffed5a..8dad1d690b78967a04f0cee0fdabdf42e2340ca8 100644 (file)
@@ -4182,6 +4182,10 @@ static int rtm_to_fib6_config(struct sk_buff *skb, struct nlmsghdr *nlh,
                cfg->fc_gateway = nla_get_in6_addr(tb[RTA_GATEWAY]);
                cfg->fc_flags |= RTF_GATEWAY;
        }
+       if (tb[RTA_VIA]) {
+               NL_SET_ERR_MSG(extack, "IPv6 does not support RTA_VIA attribute");
+               goto errout;
+       }
 
        if (tb[RTA_DST]) {
                int plen = (rtm->rtm_dst_len + 7) >> 3;
@@ -4889,7 +4893,8 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr *nlh,
 
        if (tb[RTA_IP_PROTO]) {
                err = rtm_getroute_parse_ip_proto(tb[RTA_IP_PROTO],
-                                                 &fl6.flowi6_proto, extack);
+                                                 &fl6.flowi6_proto, AF_INET6,
+                                                 extack);
                if (err)
                        goto errout;
        }
index e8a1dabef803e5583b0fb3bd70d75a48dad46e9c..09e440e8dfaecd290608918e7d2046793effc92d 100644 (file)
@@ -1873,6 +1873,7 @@ static int __net_init sit_init_net(struct net *net)
 
 err_reg_dev:
        ipip6_dev_free(sitn->fb_tunnel_dev);
+       free_netdev(sitn->fb_tunnel_dev);
 err_alloc_dev:
        return err;
 }
index 7d55d4c04088710cf0471959927f861dacdfbb10..fa763e2e50ec22f04eb0a35a7726551315787ca1 100644 (file)
@@ -1838,6 +1838,9 @@ static int rtm_to_route_config(struct sk_buff *skb,
                                goto errout;
                        break;
                }
+               case RTA_GATEWAY:
+                       NL_SET_ERR_MSG(extack, "MPLS does not support RTA_GATEWAY attribute");
+                       goto errout;
                case RTA_VIA:
                {
                        if (nla_get_via(nla, &cfg->rc_via_alen,
index ea7c67050792c9093c28b397e5ae164a570a0e33..ee3e5b6471a69ec0100ea9099dc2e8be24a4b024 100644 (file)
@@ -903,7 +903,8 @@ int netlbl_bitmap_walk(const unsigned char *bitmap, u32 bitmap_len,
                    (state == 0 && (byte & bitmask) == 0))
                        return bit_spot;
 
-               bit_spot++;
+               if (++bit_spot >= bitmap_len)
+                       return -1;
                bitmask >>= 1;
                if (bitmask == 0) {
                        byte = bitmap[++byte_offset];
index 6a196e438b6c03d4c86e0a8a78af1c496a7e599b..d1fc019e932e0c92caccab7d2ef3dc43e12880f0 100644 (file)
@@ -419,6 +419,10 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
                                                      sock->service_name,
                                                      sock->service_name_len,
                                                      &service_name_tlv_length);
+               if (!service_name_tlv) {
+                       err = -ENOMEM;
+                       goto error_tlv;
+               }
                size += service_name_tlv_length;
        }
 
@@ -429,9 +433,17 @@ int nfc_llcp_send_connect(struct nfc_llcp_sock *sock)
 
        miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
                                      &miux_tlv_length);
+       if (!miux_tlv) {
+               err = -ENOMEM;
+               goto error_tlv;
+       }
        size += miux_tlv_length;
 
        rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length);
+       if (!rw_tlv) {
+               err = -ENOMEM;
+               goto error_tlv;
+       }
        size += rw_tlv_length;
 
        pr_debug("SKB size %d SN length %zu\n", size, sock->service_name_len);
@@ -484,9 +496,17 @@ int nfc_llcp_send_cc(struct nfc_llcp_sock *sock)
 
        miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&miux, 0,
                                      &miux_tlv_length);
+       if (!miux_tlv) {
+               err = -ENOMEM;
+               goto error_tlv;
+       }
        size += miux_tlv_length;
 
        rw_tlv = nfc_llcp_build_tlv(LLCP_TLV_RW, &rw, 0, &rw_tlv_length);
+       if (!rw_tlv) {
+               err = -ENOMEM;
+               goto error_tlv;
+       }
        size += rw_tlv_length;
 
        skb = llcp_allocate_pdu(sock, LLCP_PDU_CC, size);
index ef4026a23e802eba74c3269617b8aeb4f68e97ca..4fa015208aab1c5e59e291cb55dd8e296c02eeca 100644 (file)
@@ -532,10 +532,10 @@ static u8 nfc_llcp_reserve_sdp_ssap(struct nfc_llcp_local *local)
 
 static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
 {
-       u8 *gb_cur, *version_tlv, version, version_length;
-       u8 *lto_tlv, lto_length;
-       u8 *wks_tlv, wks_length;
-       u8 *miux_tlv, miux_length;
+       u8 *gb_cur, version, version_length;
+       u8 lto_length, wks_length, miux_length;
+       u8 *version_tlv = NULL, *lto_tlv = NULL,
+          *wks_tlv = NULL, *miux_tlv = NULL;
        __be16 wks = cpu_to_be16(local->local_wks);
        u8 gb_len = 0;
        int ret = 0;
@@ -543,17 +543,33 @@ static int nfc_llcp_build_gb(struct nfc_llcp_local *local)
        version = LLCP_VERSION_11;
        version_tlv = nfc_llcp_build_tlv(LLCP_TLV_VERSION, &version,
                                         1, &version_length);
+       if (!version_tlv) {
+               ret = -ENOMEM;
+               goto out;
+       }
        gb_len += version_length;
 
        lto_tlv = nfc_llcp_build_tlv(LLCP_TLV_LTO, &local->lto, 1, &lto_length);
+       if (!lto_tlv) {
+               ret = -ENOMEM;
+               goto out;
+       }
        gb_len += lto_length;
 
        pr_debug("Local wks 0x%lx\n", local->local_wks);
        wks_tlv = nfc_llcp_build_tlv(LLCP_TLV_WKS, (u8 *)&wks, 2, &wks_length);
+       if (!wks_tlv) {
+               ret = -ENOMEM;
+               goto out;
+       }
        gb_len += wks_length;
 
        miux_tlv = nfc_llcp_build_tlv(LLCP_TLV_MIUX, (u8 *)&local->miux, 0,
                                      &miux_length);
+       if (!miux_tlv) {
+               ret = -ENOMEM;
+               goto out;
+       }
        gb_len += miux_length;
 
        gb_len += ARRAY_SIZE(llcp_magic);
index 8af6c11d2482ac53e6520691c85ff291a4704a81..faa1addf89b3b1c32ce493bc16d62ee60671533a 100644 (file)
@@ -199,8 +199,7 @@ err3:
 err2:
        kfree(tname);
 err1:
-       if (ret == ACT_P_CREATED)
-               tcf_idr_release(*a, bind);
+       tcf_idr_release(*a, bind);
        return err;
 }
 
index 64dba3708fce2e096872061bd4405344a957be4b..cfceed28c3331e466782150c7656efda759ef097 100644 (file)
@@ -189,8 +189,7 @@ static int tcf_skbedit_init(struct net *net, struct nlattr *nla,
 
        params_new = kzalloc(sizeof(*params_new), GFP_KERNEL);
        if (unlikely(!params_new)) {
-               if (ret == ACT_P_CREATED)
-                       tcf_idr_release(*a, bind);
+               tcf_idr_release(*a, bind);
                return -ENOMEM;
        }
 
index 8b43fe0130f73039e3f1802701df910e079fc4ba..3f943de9a2c975df258e5eb6ae5688b016f0b5d6 100644 (file)
@@ -377,7 +377,8 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
        return ret;
 
 release_tun_meta:
-       dst_release(&metadata->dst);
+       if (metadata)
+               dst_release(&metadata->dst);
 
 err_out:
        if (exists)
index 75046ec7214449c631c38eaab5e4a51644cfa0e5..cc9d8133afcdb7fe1b6b4c35f9d96d636ea11035 100644 (file)
@@ -447,6 +447,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
        int nb = 0;
        int count = 1;
        int rc = NET_XMIT_SUCCESS;
+       int rc_drop = NET_XMIT_DROP;
 
        /* Do not fool qdisc_drop_all() */
        skb->prev = NULL;
@@ -486,6 +487,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
                q->duplicate = 0;
                rootq->enqueue(skb2, rootq, to_free);
                q->duplicate = dupsave;
+               rc_drop = NET_XMIT_SUCCESS;
        }
 
        /*
@@ -498,7 +500,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
                if (skb_is_gso(skb)) {
                        segs = netem_segment(skb, sch, to_free);
                        if (!segs)
-                               return NET_XMIT_DROP;
+                               return rc_drop;
                } else {
                        segs = skb;
                }
@@ -521,8 +523,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
                        1<<(prandom_u32() % 8);
        }
 
-       if (unlikely(sch->q.qlen >= sch->limit))
-               return qdisc_drop_all(skb, sch, to_free);
+       if (unlikely(sch->q.qlen >= sch->limit)) {
+               qdisc_drop_all(skb, sch, to_free);
+               return rc_drop;
+       }
 
        qdisc_qstats_backlog_inc(sch, skb);
 
index 64bef313d43643757140ffa850724423fd801cd5..5cb7c1ff97e92e3ec586f2f23b480f5236f34296 100644 (file)
@@ -192,7 +192,7 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
        if (unlikely(!max_data)) {
                max_data = sctp_min_frag_point(sctp_sk(asoc->base.sk),
                                               sctp_datachk_len(&asoc->stream));
-               pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum (%Zu)",
+               pr_warn_ratelimited("%s: asoc:%p frag_point is zero, forcing max_data to default minimum (%zu)",
                                    __func__, asoc, max_data);
        }
 
index d80d87a395ea99c58624feb204c896e697140bfa..320f51b22b1903c95f5d5c25127f9785a8162f53 100644 (file)
@@ -577,6 +577,7 @@ static void __sock_release(struct socket *sock, struct inode *inode)
                if (inode)
                        inode_lock(inode);
                sock->ops->release(sock);
+               sock->sk = NULL;
                if (inode)
                        inode_unlock(inode);
                sock->ops = NULL;
index 684f2125fc6b6ed45fd47cf6fff0c2d3ec971cab..70343ac448b182eec10b648372dc9109ffe78ce1 100644 (file)
@@ -379,11 +379,13 @@ static int tipc_sk_sock_err(struct socket *sock, long *timeout)
 
 #define tipc_wait_for_cond(sock_, timeo_, condition_)                         \
 ({                                                                             \
+       DEFINE_WAIT_FUNC(wait_, woken_wake_function);                          \
        struct sock *sk_;                                                      \
        int rc_;                                                               \
                                                                               \
        while ((rc_ = !(condition_))) {                                        \
-               DEFINE_WAIT_FUNC(wait_, woken_wake_function);                  \
+               /* coupled with smp_wmb() in tipc_sk_proto_rcv() */            \
+               smp_rmb();                                                     \
                sk_ = (sock_)->sk;                                             \
                rc_ = tipc_sk_sock_err((sock_), timeo_);                       \
                if (rc_)                                                       \
@@ -1983,6 +1985,8 @@ static void tipc_sk_proto_rcv(struct sock *sk,
                return;
        case SOCK_WAKEUP:
                tipc_dest_del(&tsk->cong_links, msg_orignode(hdr), 0);
+               /* coupled with smp_rmb() in tipc_wait_for_cond() */
+               smp_wmb();
                tsk->cong_link_cnt--;
                wakeup = true;
                break;
index 25c259df8ffab1b108994ac12d78b35f97b65403..6deabedc67fc891484be732b7591d4301bf156e0 100644 (file)
@@ -26,7 +26,7 @@ else
        CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \
         $(call cc-param,asan-globals=1) \
         $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \
-        $(call cc-param,asan-stack=1) \
+        $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \
         $(call cc-param,asan-use-after-scope=1) \
         $(call cc-param,asan-instrument-allocas=1)
 endif
index e2c94e47707cb3e3af50b539db2cc66d9fc88890..912b2dc50be3d8ee88f51a41e8c440524ecddc4a 100755 (executable)
 #      and check that configured MTU is used on link creation and changes, and
 #      that MTU is properly calculated instead when MTU is not configured from
 #      userspace
+#
+# - cleanup_ipv4_exception
+#      Similar to pmtu_ipv4_vxlan4_exception, but explicitly generate PMTU
+#      exceptions on multiple CPUs and check that the veth device tear-down
+#      happens in a timely manner
+#
+# - cleanup_ipv6_exception
+#      Same as above, but use IPv6 transport from A to B
+
 
 # Kselftest framework requirement - SKIP code is 4.
 ksft_skip=4
@@ -135,7 +144,9 @@ tests="
        pmtu_vti6_default_mtu           vti6: default MTU assignment
        pmtu_vti4_link_add_mtu          vti4: MTU setting on link creation
        pmtu_vti6_link_add_mtu          vti6: MTU setting on link creation
-       pmtu_vti6_link_change_mtu       vti6: MTU changes on link changes"
+       pmtu_vti6_link_change_mtu       vti6: MTU changes on link changes
+       cleanup_ipv4_exception          ipv4: cleanup of cached exceptions
+       cleanup_ipv6_exception          ipv6: cleanup of cached exceptions"
 
 NS_A="ns-$(mktemp -u XXXXXX)"
 NS_B="ns-$(mktemp -u XXXXXX)"
@@ -263,8 +274,6 @@ setup_fou_or_gue() {
 
        ${ns_a} ip link set ${encap}_a up
        ${ns_b} ip link set ${encap}_b up
-
-       sleep 1
 }
 
 setup_fou44() {
@@ -302,6 +311,10 @@ setup_gue66() {
 setup_namespaces() {
        for n in ${NS_A} ${NS_B} ${NS_R1} ${NS_R2}; do
                ip netns add ${n} || return 1
+
+               # Disable DAD, so that we don't have to wait to use the
+               # configured IPv6 addresses
+               ip netns exec ${n} sysctl -q net/ipv6/conf/default/accept_dad=0
        done
 }
 
@@ -337,8 +350,6 @@ setup_vti() {
 
        ${ns_a} ip link set vti${proto}_a up
        ${ns_b} ip link set vti${proto}_b up
-
-       sleep 1
 }
 
 setup_vti4() {
@@ -375,8 +386,6 @@ setup_vxlan_or_geneve() {
 
        ${ns_a} ip link set ${type}_a up
        ${ns_b} ip link set ${type}_b up
-
-       sleep 1
 }
 
 setup_geneve4() {
@@ -588,8 +597,8 @@ test_pmtu_ipvX() {
        mtu "${ns_b}"  veth_B-R2 1500
 
        # Create route exceptions
-       ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1800 ${dst1} > /dev/null
-       ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1800 ${dst2} > /dev/null
+       ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst1} > /dev/null
+       ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1800 ${dst2} > /dev/null
 
        # Check that exceptions have been created with the correct PMTU
        pmtu_1="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst1})"
@@ -621,7 +630,7 @@ test_pmtu_ipvX() {
        # Decrease remote MTU on path via R2, get new exception
        mtu "${ns_r2}" veth_R2-B 400
        mtu "${ns_b}"  veth_B-R2 400
-       ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1400 ${dst2} > /dev/null
+       ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1400 ${dst2} > /dev/null
        pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"
        check_pmtu_value "lock 552" "${pmtu_2}" "exceeding MTU, with MTU < min_pmtu" || return 1
 
@@ -638,7 +647,7 @@ test_pmtu_ipvX() {
        check_pmtu_value "1500" "${pmtu_2}" "increasing local MTU" || return 1
 
        # Get new exception
-       ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s 1400 ${dst2} > /dev/null
+       ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s 1400 ${dst2} > /dev/null
        pmtu_2="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst2})"
        check_pmtu_value "lock 552" "${pmtu_2}" "exceeding MTU, with MTU < min_pmtu" || return 1
 }
@@ -687,7 +696,7 @@ test_pmtu_ipvX_over_vxlanY_or_geneveY_exception() {
 
        mtu "${ns_a}" ${type}_a $((${ll_mtu} + 1000))
        mtu "${ns_b}" ${type}_b $((${ll_mtu} + 1000))
-       ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
+       ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
 
        # Check that exception was created
        pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
@@ -767,7 +776,7 @@ test_pmtu_ipvX_over_fouY_or_gueY() {
 
        mtu "${ns_a}" ${encap}_a $((${ll_mtu} + 1000))
        mtu "${ns_b}" ${encap}_b $((${ll_mtu} + 1000))
-       ${ns_a} ${ping} -q -M want -i 0.1 -w 2 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
+       ${ns_a} ${ping} -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${dst} > /dev/null
 
        # Check that exception was created
        pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${dst})"
@@ -825,13 +834,13 @@ test_pmtu_vti4_exception() {
 
        # Send DF packet without exceeding link layer MTU, check that no
        # exception is created
-       ${ns_a} ping -q -M want -i 0.1 -w 2 -s ${ping_payload} ${tunnel4_b_addr} > /dev/null
+       ${ns_a} ping -q -M want -i 0.1 -w 1 -s ${ping_payload} ${tunnel4_b_addr} > /dev/null
        pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"
        check_pmtu_value "" "${pmtu}" "sending packet smaller than PMTU (IP payload length ${esp_payload_rfc4106})" || return 1
 
        # Now exceed link layer MTU by one byte, check that exception is created
        # with the right PMTU value
-       ${ns_a} ping -q -M want -i 0.1 -w 2 -s $((ping_payload + 1)) ${tunnel4_b_addr} > /dev/null
+       ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((ping_payload + 1)) ${tunnel4_b_addr} > /dev/null
        pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel4_b_addr})"
        check_pmtu_value "${esp_payload_rfc4106}" "${pmtu}" "exceeding PMTU (IP payload length $((esp_payload_rfc4106 + 1)))"
 }
@@ -847,7 +856,7 @@ test_pmtu_vti6_exception() {
        mtu "${ns_b}" veth_b 4000
        mtu "${ns_a}" vti6_a 5000
        mtu "${ns_b}" vti6_b 5000
-       ${ns_a} ${ping6} -q -i 0.1 -w 2 -s 60000 ${tunnel6_b_addr} > /dev/null
+       ${ns_a} ${ping6} -q -i 0.1 -w 1 -s 60000 ${tunnel6_b_addr} > /dev/null
 
        # Check that exception was created
        pmtu="$(route_get_dst_pmtu_from_exception "${ns_a}" ${tunnel6_b_addr})"
@@ -1008,6 +1017,61 @@ test_pmtu_vti6_link_change_mtu() {
        return ${fail}
 }
 
+check_command() {
+       cmd=${1}
+
+       if ! which ${cmd} > /dev/null 2>&1; then
+               err "  missing required command: '${cmd}'"
+               return 1
+       fi
+       return 0
+}
+
+test_cleanup_vxlanX_exception() {
+       outer="${1}"
+       encap="vxlan"
+       ll_mtu=4000
+
+       check_command taskset || return 2
+       cpu_list=$(grep -m 2 processor /proc/cpuinfo | cut -d ' ' -f 2)
+
+       setup namespaces routing ${encap}${outer} || return 2
+       trace "${ns_a}" ${encap}_a   "${ns_b}"  ${encap}_b \
+             "${ns_a}" veth_A-R1    "${ns_r1}" veth_R1-A \
+             "${ns_b}" veth_B-R1    "${ns_r1}" veth_R1-B
+
+       # Create route exception by exceeding link layer MTU
+       mtu "${ns_a}"  veth_A-R1 $((${ll_mtu} + 1000))
+       mtu "${ns_r1}" veth_R1-A $((${ll_mtu} + 1000))
+       mtu "${ns_b}"  veth_B-R1 ${ll_mtu}
+       mtu "${ns_r1}" veth_R1-B ${ll_mtu}
+
+       mtu "${ns_a}" ${encap}_a $((${ll_mtu} + 1000))
+       mtu "${ns_b}" ${encap}_b $((${ll_mtu} + 1000))
+
+       # Fill exception cache for multiple CPUs (2)
+       # we can always use inner IPv4 for that
+       for cpu in ${cpu_list}; do
+               taskset --cpu-list ${cpu} ${ns_a} ping -q -M want -i 0.1 -w 1 -s $((${ll_mtu} + 500)) ${tunnel4_b_addr} > /dev/null
+       done
+
+       ${ns_a} ip link del dev veth_A-R1 &
+       iplink_pid=$!
+       sleep 1
+       if [ "$(cat /proc/${iplink_pid}/cmdline 2>/dev/null | tr -d '\0')" = "iplinkdeldevveth_A-R1" ]; then
+               err "  can't delete veth device in a timely manner, PMTU dst likely leaked"
+               return 1
+       fi
+}
+
+test_cleanup_ipv6_exception() {
+       test_cleanup_vxlanX_exception 6
+}
+
+test_cleanup_ipv4_exception() {
+       test_cleanup_vxlanX_exception 4
+}
+
 usage() {
        echo
        echo "$0 [OPTIONS] [TEST]..."
index aeac53a99aebba9d5e9033e68744f880b5f8b04c..ac2a30be9b325a4b68a1c1ce74d1fdfabb5b64be 100755 (executable)
@@ -37,7 +37,7 @@ run_one() {
 
        cfg_veth
 
-       ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} && \
+       ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} && \
                echo "ok" || \
                echo "failed" &
 
@@ -81,7 +81,7 @@ run_one_nat() {
        # will land on the 'plain' one
        ip netns exec "${PEER_NS}" ./udpgso_bench_rx -G ${family} -b ${addr1} -n 0 &
        pid=$!
-       ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${family} -b ${addr2%/*} ${rx_args} && \
+       ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${family} -b ${addr2%/*} ${rx_args} && \
                echo "ok" || \
                echo "failed"&
 
@@ -99,8 +99,8 @@ run_one_2sock() {
 
        cfg_veth
 
-       ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} -p 12345 &
-       ip netns exec "${PEER_NS}" ./udpgso_bench_rx ${rx_args} && \
+       ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 1000 -R 10 ${rx_args} -p 12345 &
+       ip netns exec "${PEER_NS}" ./udpgso_bench_rx -C 2000 -R 10 ${rx_args} && \
                echo "ok" || \
                echo "failed" &
 
index 0c960f673324072430a5258da15b3eefa03b1d46..db3d4a8b5a4c4f61bd1176dc1cbaa8d3fc7168b0 100644 (file)
@@ -45,6 +45,8 @@ static int  cfg_alen          = sizeof(struct sockaddr_in6);
 static int  cfg_expected_pkt_nr;
 static int  cfg_expected_pkt_len;
 static int  cfg_expected_gso_size;
+static int  cfg_connect_timeout_ms;
+static int  cfg_rcv_timeout_ms;
 static struct sockaddr_storage cfg_bind_addr;
 
 static bool interrupted;
@@ -87,7 +89,7 @@ static unsigned long gettimeofday_ms(void)
        return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
 }
 
-static void do_poll(int fd)
+static void do_poll(int fd, int timeout_ms)
 {
        struct pollfd pfd;
        int ret;
@@ -102,8 +104,16 @@ static void do_poll(int fd)
                        break;
                if (ret == -1)
                        error(1, errno, "poll");
-               if (ret == 0)
-                       continue;
+               if (ret == 0) {
+                       if (!timeout_ms)
+                               continue;
+
+                       timeout_ms -= 10;
+                       if (timeout_ms <= 0) {
+                               interrupted = true;
+                               break;
+                       }
+               }
                if (pfd.revents != POLLIN)
                        error(1, errno, "poll: 0x%x expected 0x%x\n",
                                        pfd.revents, POLLIN);
@@ -134,7 +144,7 @@ static int do_socket(bool do_tcp)
                if (listen(accept_fd, 1))
                        error(1, errno, "listen");
 
-               do_poll(accept_fd);
+               do_poll(accept_fd, cfg_connect_timeout_ms);
                if (interrupted)
                        exit(0);
 
@@ -273,7 +283,9 @@ static void do_flush_udp(int fd)
 
 static void usage(const char *filepath)
 {
-       error(1, 0, "Usage: %s [-Grtv] [-b addr] [-p port] [-l pktlen] [-n packetnr] [-S gsosize]", filepath);
+       error(1, 0, "Usage: %s [-C connect_timeout] [-Grtv] [-b addr] [-p port]"
+             " [-l pktlen] [-n packetnr] [-R rcv_timeout] [-S gsosize]",
+             filepath);
 }
 
 static void parse_opts(int argc, char **argv)
@@ -282,7 +294,7 @@ static void parse_opts(int argc, char **argv)
 
        /* bind to any by default */
        setup_sockaddr(PF_INET6, "::", &cfg_bind_addr);
-       while ((c = getopt(argc, argv, "4b:Gl:n:p:rS:tv")) != -1) {
+       while ((c = getopt(argc, argv, "4b:C:Gl:n:p:rR:S:tv")) != -1) {
                switch (c) {
                case '4':
                        cfg_family = PF_INET;
@@ -292,6 +304,9 @@ static void parse_opts(int argc, char **argv)
                case 'b':
                        setup_sockaddr(cfg_family, optarg, &cfg_bind_addr);
                        break;
+               case 'C':
+                       cfg_connect_timeout_ms = strtoul(optarg, NULL, 0);
+                       break;
                case 'G':
                        cfg_gro_segment = true;
                        break;
@@ -307,6 +322,9 @@ static void parse_opts(int argc, char **argv)
                case 'r':
                        cfg_read_all = true;
                        break;
+               case 'R':
+                       cfg_rcv_timeout_ms = strtoul(optarg, NULL, 0);
+                       break;
                case 'S':
                        cfg_expected_gso_size = strtol(optarg, NULL, 0);
                        break;
@@ -329,8 +347,9 @@ static void parse_opts(int argc, char **argv)
 
 static void do_recv(void)
 {
+       int timeout_ms = cfg_tcp ? cfg_rcv_timeout_ms : cfg_connect_timeout_ms;
        unsigned long tnow, treport;
-       int fd, loop = 0;
+       int fd;
 
        fd = do_socket(cfg_tcp);
 
@@ -342,12 +361,7 @@ static void do_recv(void)
 
        treport = gettimeofday_ms() + 1000;
        do {
-               /* force termination after the second poll(); this cope both
-                * with sender slower than receiver and missing packet errors
-                */
-               if (cfg_expected_pkt_nr && loop++)
-                       interrupted = true;
-               do_poll(fd);
+               do_poll(fd, timeout_ms);
 
                if (cfg_tcp)
                        do_flush_tcp(fd);
@@ -365,6 +379,8 @@ static void do_recv(void)
                        treport = tnow + 1000;
                }
 
+               timeout_ms = cfg_rcv_timeout_ms;
+
        } while (!interrupted);
 
        if (cfg_expected_pkt_nr && (packets != cfg_expected_pkt_nr))
index 585845203db89e5d2bc90722fd75bfcf595671d9..076bc38963bf68d36733e4674a1f433a974de047 100644 (file)
@@ -4044,7 +4044,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm)
        }
        add_uevent_var(env, "PID=%d", kvm->userspace_pid);
 
-       if (kvm->debugfs_dentry) {
+       if (!IS_ERR_OR_NULL(kvm->debugfs_dentry)) {
                char *tmp, *p = kmalloc(PATH_MAX, GFP_KERNEL);
 
                if (p) {