commit 3904234bd04fa7c40467e5d8b3301893fae16e87
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Aug 11 12:20:49 2019 +0200

    Linux 4.4.189

commit 62dcfbb199c436405fa9be23273e47068db36b0a
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Jul 17 21:18:59 2019 +0200

    x86/speculation/swapgs: Exclude ATOMs from speculation through SWAPGS
    
    commit f36cf386e3fec258a341d446915862eded3e13d8 upstream.
    
    Intel provided the following information:
    
     On all current Atom processors, instructions that use a segment register
     value (e.g. a load or store) will not speculatively execute before the
     last writer of that segment retires. Thus they will not use a
     speculatively written segment value.
    
    That means on ATOMs there is no speculation through SWAPGS, so the SWAPGS
    entry paths can be excluded from the extra LFENCE if PTI is disabled.
    
    Create a separate bug flag for the through SWAPGS speculation and mark all
    out-of-order ATOMs and AMD/HYGON CPUs as not affected. The in-order ATOMs
    are excluded from the whole mitigation mess anyway.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Tyler Hicks <tyhicks@canonical.com>
    Reviewed-by: Josh Poimboeuf <jpoimboe@redhat.com>
    [bwh: Backported to 4.4:
     - There's no whitelist entry (or any support) for Hygon CPUs
     - Adjust context, indentation]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 967858f2f222dd140429c70d855e85dafcc89c29
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Mon Jul 15 11:51:39 2019 -0500

    x86/entry/64: Use JMP instead of JMPQ
    
    commit 64dbc122b20f75183d8822618c24f85144a5a94d upstream.
    
    Somehow the swapgs mitigation entry code patch ended up with a JMPQ
    instruction instead of JMP, where only the short jump is needed.  Some
    assembler versions apparently fail to optimize JMPQ into a two-byte JMP
    when possible, instead always using a 7-byte JMP with relocation.  For
    some reason that makes the entry code explode with a #GP during boot.
    
    Change it back to "JMP" as originally intended.
    
    Fixes: 18ec54fdd6d1 ("x86/speculation: Prepare entry code for Spectre v1 swapgs mitigations")
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    [bwh: Backported to 4.4: adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 73e2c1bd2714f902c5ee290445579b79afc6a0e6
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Mon Jul 8 11:52:26 2019 -0500

    x86/speculation: Enable Spectre v1 swapgs mitigations
    
    commit a2059825986a1c8143fd6698774fa9d83733bb11 upstream.
    
    The previous commit added macro calls in the entry code which mitigate the
    Spectre v1 swapgs issue if the X86_FEATURE_FENCE_SWAPGS_* features are
    enabled.  Enable those features where applicable.
    
    The mitigations may be disabled with "nospectre_v1" or "mitigations=off".
    
    There are different features which can affect the risk of attack:
    
    - When FSGSBASE is enabled, unprivileged users are able to place any
      value in GS, using the wrgsbase instruction.  This means they can
      write a GS value which points to any value in kernel space, which can
      be useful with the following gadget in an interrupt/exception/NMI
      handler:
    
            if (coming from user space)
                    swapgs
            mov %gs:<percpu_offset>, %reg1
            // dependent load or store based on the value of %reg
            // for example: mov %(reg1), %reg2
    
      If an interrupt is coming from user space, and the entry code
      speculatively skips the swapgs (due to user branch mistraining), it
      may speculatively execute the GS-based load and a subsequent dependent
      load or store, exposing the kernel data to an L1 side channel leak.
    
      Note that, on Intel, a similar attack exists in the above gadget when
      coming from kernel space, if the swapgs gets speculatively executed to
      switch back to the user GS.  On AMD, this variant isn't possible
      because swapgs is serializing with respect to future GS-based
      accesses.
    
      NOTE: The FSGSBASE patch set hasn't been merged yet, so the above case
            doesn't exist quite yet.
    
    - When FSGSBASE is disabled, the issue is mitigated somewhat because
      unprivileged users must use prctl(ARCH_SET_GS) to set GS, which
      restricts GS values to user space addresses only.  That means the
      gadget would need an additional step, since the target kernel address
      needs to be read from user space first.  Something like:
    
            if (coming from user space)
                    swapgs
            mov %gs:<percpu_offset>, %reg1
            mov (%reg1), %reg2
            // dependent load or store based on the value of %reg2
            // for example: mov %(reg2), %reg3
    
      It's difficult to audit for this gadget in all the handlers, so while
      there are no known instances of it, it's entirely possible that it
      exists somewhere (or could be introduced in the future).  Without
      tooling to analyze all such code paths, consider it vulnerable.
    
      Effects of SMAP on the !FSGSBASE case:
    
      - If SMAP is enabled, and the CPU reports RDCL_NO (i.e., not
        susceptible to Meltdown), the kernel is prevented from speculatively
        reading user space memory, even L1 cached values.  This effectively
        disables the !FSGSBASE attack vector.
    
      - If SMAP is enabled, but the CPU *is* susceptible to Meltdown, SMAP
        still prevents the kernel from speculatively reading user space
        memory.  But it does *not* prevent the kernel from reading the
        user value from L1, if it has already been cached.  This is probably
        only a small hurdle for an attacker to overcome.
    
    Thanks to Dave Hansen for contributing the speculative_smap() function.
    
    Thanks to Andrew Cooper for providing the inside scoop on whether swapgs
    is serializing on AMD.
    
    [ tglx: Fixed the USER fence decision and polished the comment as suggested
            by Dave Hansen ]
    
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Dave Hansen <dave.hansen@intel.com>
    [bwh: Backported to 4.4:
     - Check for X86_FEATURE_KAISER instead of X86_FEATURE_PTI
     - mitigations= parameter is x86-only here
     - Don't use __ro_after_init
     - Adjust filename, context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e3d8c979c49d6113566acf4b3002073979cd35c3
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Mon Jul 8 11:52:25 2019 -0500

    x86/speculation: Prepare entry code for Spectre v1 swapgs mitigations
    
    commit 18ec54fdd6d18d92025af097cd042a75cf0ea24c upstream.
    
    Spectre v1 isn't only about array bounds checks.  It can affect any
    conditional checks.  The kernel entry code interrupt, exception, and NMI
    handlers all have conditional swapgs checks.  Those may be problematic in
    the context of Spectre v1, as kernel code can speculatively run with a user
    GS.
    
    For example:
    
            if (coming from user space)
                    swapgs
            mov %gs:<percpu_offset>, %reg
            mov (%reg), %reg1
    
    When coming from user space, the CPU can speculatively skip the swapgs, and
    then do a speculative percpu load using the user GS value.  So the user can
    speculatively force a read of any kernel value.  If a gadget exists which
    uses the percpu value as an address in another load/store, then the
    contents of the kernel value may become visible via an L1 side channel
    attack.
    
    A similar attack exists when coming from kernel space.  The CPU can
    speculatively do the swapgs, causing the user GS to get used for the rest
    of the speculative window.
    
    The mitigation is similar to a traditional Spectre v1 mitigation, except:
    
      a) index masking isn't possible; because the index (percpu offset)
         isn't user-controlled; and
    
      b) an lfence is needed in both the "from user" swapgs path and the
         "from kernel" non-swapgs path (because of the two attacks described
         above).
    
    The user entry swapgs paths already have SWITCH_TO_KERNEL_CR3, which has a
    CR3 write when PTI is enabled.  Since CR3 writes are serializing, the
    lfences can be skipped in those cases.
    
    On the other hand, the kernel entry swapgs paths don't depend on PTI.
    
    To avoid unnecessary lfences for the user entry case, create two separate
    features for alternative patching:
    
      X86_FEATURE_FENCE_SWAPGS_USER
      X86_FEATURE_FENCE_SWAPGS_KERNEL
    
    Use these features in entry code to patch in lfences where needed.
    
    The features aren't enabled yet, so there's no functional change.
    
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Reviewed-by: Dave Hansen <dave.hansen@intel.com>
    [bwh: Backported to 4.4:
     - Assign the CPU feature bits from word 7
     - Add FENCE_SWAPGS_KERNEL_ENTRY to NMI entry, since it does not
       use paranoid_entry
     - Include <asm/cpufeatures.h> in calling.h
     - Adjust context]
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3d3e1f49d56f12ff32b8e36f8fbbf8175dcd0496
Author: Wanpeng Li <wanpeng.li@hotmail.com>
Date:   Fri Sep 30 09:01:06 2016 +0800

    x86/entry/64: Fix context tracking state warning when load_gs_index fails
    
    commit 2fa5f04f85730d0c4f49f984b7efeb4f8d5bd1fc upstream.
    
    This warning:
    
     WARNING: CPU: 0 PID: 3331 at arch/x86/entry/common.c:45 enter_from_user_mode+0x32/0x50
     CPU: 0 PID: 3331 Comm: ldt_gdt_64 Not tainted 4.8.0-rc7+ #13
     Call Trace:
      dump_stack+0x99/0xd0
      __warn+0xd1/0xf0
      warn_slowpath_null+0x1d/0x20
      enter_from_user_mode+0x32/0x50
      error_entry+0x6d/0xc0
      ? general_protection+0x12/0x30
      ? native_load_gs_index+0xd/0x20
      ? do_set_thread_area+0x19c/0x1f0
      SyS_set_thread_area+0x24/0x30
      do_int80_syscall_32+0x7c/0x220
      entry_INT80_compat+0x38/0x50
    
    ... can be reproduced by running the GS testcase of the ldt_gdt test unit in
    the x86 selftests.
    
    do_int80_syscall_32() will call enter_form_user_mode() to convert context
    tracking state from user state to kernel state. The load_gs_index() call
    can fail with user gsbase, gsbase will be fixed up and proceed if this
    happen.
    
    However, enter_from_user_mode() will be called again in the fixed up path
    though it is context tracking kernel state currently.
    
    This patch fixes it by just fixing up gsbase and telling lockdep that IRQs
    are off once load_gs_index() failed with user gsbase.
    
    Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
    Acked-by: Andy Lutomirski <luto@kernel.org>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Josh Poimboeuf <jpoimboe@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1475197266-3440-1-git-send-email-wanpeng.li@hotmail.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1bd558b897d024feae8ed908979b3ebc0be53dbd
Author: Ben Hutchings <ben@decadent.org.uk>
Date:   Thu Aug 8 20:03:32 2019 +0100

    x86: cpufeatures: Sort feature word 7
    
    This will make it clearer which bits are allocated, in case we need to
    assign more feature bits for later backports.
    
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 68522ac3edad11b18ee5d1c91b95d508e21b5c3e
Author: Lukas Wunner <lukas@wunner.de>
Date:   Wed Jul 3 12:29:31 2019 +0200

    spi: bcm2835: Fix 3-wire mode if DMA is enabled
    
    commit 8d8bef50365847134b51c1ec46786bc2873e4e47 upstream.
    
    Commit 6935224da248 ("spi: bcm2835: enable support of 3-wire mode")
    added 3-wire support to the BCM2835 SPI driver by setting the REN bit
    (Read Enable) in the CS register when receiving data.  The REN bit puts
    the transmitter in high-impedance state.  The driver recognizes that
    data is to be received by checking whether the rx_buf of a transfer is
    non-NULL.
    
    Commit 3ecd37edaa2a ("spi: bcm2835: enable dma modes for transfers
    meeting certain conditions") subsequently broke 3-wire support because
    it set the SPI_MASTER_MUST_RX flag which causes spi_map_msg() to replace
    rx_buf with a dummy buffer if it is NULL.  As a result, rx_buf is
    *always* non-NULL if DMA is enabled.
    
    Reinstate 3-wire support by not only checking whether rx_buf is non-NULL,
    but also checking that it is not the dummy buffer.
    
    Fixes: 3ecd37edaa2a ("spi: bcm2835: enable dma modes for transfers meeting certain conditions")
    Reported-by: Nuno Sá <nuno.sa@analog.com>
    Signed-off-by: Lukas Wunner <lukas@wunner.de>
    Cc: stable@vger.kernel.org # v4.2+
    Cc: Martin Sperl <kernel@martin.sperl.org>
    Acked-by: Stefan Wahren <wahrenst@gmx.net>
    Link: https://lore.kernel.org/r/328318841455e505370ef8ecad97b646c033dc8a.1562148527.git.lukas@wunner.de
    Signed-off-by: Mark Brown <broonie@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e6ea77dd5a6a72583453e8703583ce0ef538aea4
Author: xiao jin <jin.xiao@intel.com>
Date:   Mon Jul 30 14:11:12 2018 +0800

    block: blk_init_allocated_queue() set q->fq as NULL in the fail case
    
    commit 54648cf1ec2d7f4b6a71767799c45676a138ca24 upstream.
    
    We find the memory use-after-free issue in __blk_drain_queue()
    on the kernel 4.14. After read the latest kernel 4.18-rc6 we
    think it has the same problem.
    
    Memory is allocated for q->fq in the blk_init_allocated_queue().
    If the elevator init function called with error return, it will
    run into the fail case to free the q->fq.
    
    Then the __blk_drain_queue() uses the same memory after the free
    of the q->fq, it will lead to the unpredictable event.
    
    The patch is to set q->fq as NULL in the fail case of
    blk_init_allocated_queue().
    
    Fixes: commit 7c94e1c157a2 ("block: introduce blk_flush_queue to drive flush machinery")
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Ming Lei <ming.lei@redhat.com>
    Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
    Signed-off-by: xiao jin <jin.xiao@intel.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    [groeck: backport to v4.4.y/v4.9.y (context change)]
    Signed-off-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Alessio Balsini <balsini@android.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bf60393dbd4660154e0a61a297654a0065b58a90
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Jul 30 21:25:20 2019 +0200

    compat_ioctl: pppoe: fix PPPOEIOCSFWD handling
    
    [ Upstream commit 055d88242a6046a1ceac3167290f054c72571cd9 ]
    
    Support for handling the PPPOEIOCSFWD ioctl in compat mode was added in
    linux-2.5.69 along with hundreds of other commands, but was always broken
    sincen only the structure is compatible, but the command number is not,
    due to the size being sizeof(size_t), or at first sizeof(sizeof((struct
    sockaddr_pppox)), which is different on 64-bit architectures.
    
    Guillaume Nault adds:
    
      And the implementation was broken until 2016 (see 29e73269aa4d ("pppoe:
      fix reference counting in PPPoE proxy")), and nobody ever noticed. I
      should probably have removed this ioctl entirely instead of fixing it.
      Clearly, it has never been used.
    
    Fix it by adding a compat_ioctl handler for all pppoe variants that
    translates the command number and then calls the regular ioctl function.
    
    All other ioctl commands handled by pppoe are compatible between 32-bit
    and 64-bit, and require compat_ptr() conversion.
    
    This should apply to all stable kernels.
    
    Acked-by: Guillaume Nault <g.nault@alphalink.fr>
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2a0b2bd53e46cd5c4b2318a7a18de9a786c188a9
Author: Sudarsana Reddy Kalluru <skalluru@marvell.com>
Date:   Tue Jul 23 19:32:41 2019 -0700

    bnx2x: Disable multi-cos feature.
    
    [ Upstream commit d1f0b5dce8fda09a7f5f04c1878f181d548e42f5 ]
    
    Commit 3968d38917eb ("bnx2x: Fix Multi-Cos.") which enabled multi-cos
    feature after prolonged time in driver added some regression causing
    numerous issues (sudden reboots, tx timeout etc.) reported by customers.
    We plan to backout this commit and submit proper fix once we have root
    cause of issues reported with this feature enabled.
    
    Fixes: 3968d38917eb ("bnx2x: Fix Multi-Cos.")
    Signed-off-by: Sudarsana Reddy Kalluru <skalluru@marvell.com>
    Signed-off-by: Manish Chopra <manishc@marvell.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7d0c33578f8824b40829203d0a9d1c0b54e66df3
Author: Mark Zhang <markz@mellanox.com>
Date:   Tue Jul 9 05:37:12 2019 +0300

    net/mlx5: Use reversed order when unregister devices
    
    [ Upstream commit 08aa5e7da6bce1a1963f63cf32c2e7ad434ad578 ]
    
    When lag is active, which is controlled by the bonded mlx5e netdev, mlx5
    interface unregestering must happen in the reverse order where rdma is
    unregistered (unloaded) first, to guarantee all references to the lag
    context in hardware is removed, then remove mlx5e netdev interface which
    will cleanup the lag context from hardware.
    
    Without this fix during destroy of LAG interface, we observed following
    errors:
     * mlx5_cmd_check:752:(pid 12556): DESTROY_LAG(0x843) op_mod(0x0) failed,
       status bad parameter(0x3), syndrome (0xe4ac33)
     * mlx5_cmd_check:752:(pid 12556): DESTROY_LAG(0x843) op_mod(0x0) failed,
       status bad parameter(0x3), syndrome (0xa5aee8).
    
    Fixes: a31208b1e11d ("net/mlx5_core: New init and exit flow for mlx5_core")
    Reviewed-by: Parav Pandit <parav@mellanox.com>
    Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
    Signed-off-by: Mark Zhang <markz@mellanox.com>
    Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4c641342d70c413421a4175895fdbb44c3de53da
Author: Jia-Ju Bai <baijiaju1990@gmail.com>
Date:   Mon Jul 29 16:24:33 2019 +0800

    net: sched: Fix a possible null-pointer dereference in dequeue_func()
    
    [ Upstream commit 051c7b39be4a91f6b7d8c4548444e4b850f1f56c ]
    
    In dequeue_func(), there is an if statement on line 74 to check whether
    skb is NULL:
        if (skb)
    
    When skb is NULL, it is used on line 77:
        prefetch(&skb->end);
    
    Thus, a possible null-pointer dereference may occur.
    
    To fix this bug, skb->end is used when skb is not NULL.
    
    This bug is found by a static analysis tool STCheck written by us.
    
    Fixes: 76e3cc126bb2 ("codel: Controlled Delay AQM")
    Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
    Reviewed-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 6eded45da9faabd59ef3f4fff5ea61f6d2c7cea2
Author: Taras Kondratiuk <takondra@cisco.com>
Date:   Mon Jul 29 22:15:07 2019 +0000

    tipc: compat: allow tipc commands without arguments
    
    [ Upstream commit 4da5f0018eef4c0de31675b670c80e82e13e99d1 ]
    
    Commit 2753ca5d9009 ("tipc: fix uninit-value in tipc_nl_compat_doit")
    broke older tipc tools that use compat interface (e.g. tipc-config from
    tipcutils package):
    
    % tipc-config -p
    operation not supported
    
    The commit started to reject TIPC netlink compat messages that do not
    have attributes. It is too restrictive because some of such messages are
    valid (they don't need any arguments):
    
    % grep 'tx none' include/uapi/linux/tipc_config.h
    #define  TIPC_CMD_NOOP              0x0000    /* tx none, rx none */
    #define  TIPC_CMD_GET_MEDIA_NAMES   0x0002    /* tx none, rx media_name(s) */
    #define  TIPC_CMD_GET_BEARER_NAMES  0x0003    /* tx none, rx bearer_name(s) */
    #define  TIPC_CMD_SHOW_PORTS        0x0006    /* tx none, rx ultra_string */
    #define  TIPC_CMD_GET_REMOTE_MNG    0x4003    /* tx none, rx unsigned */
    #define  TIPC_CMD_GET_MAX_PORTS     0x4004    /* tx none, rx unsigned */
    #define  TIPC_CMD_GET_NETID         0x400B    /* tx none, rx unsigned */
    #define  TIPC_CMD_NOT_NET_ADMIN     0xC001    /* tx none, rx none */
    
    This patch relaxes the original fix and rejects messages without
    arguments only if such arguments are expected by a command (reg_type is
    non zero).
    
    Fixes: 2753ca5d9009 ("tipc: fix uninit-value in tipc_nl_compat_doit")
    Cc: stable@vger.kernel.org
    Signed-off-by: Taras Kondratiuk <takondra@cisco.com>
    Acked-by: Ying Xue <ying.xue@windriver.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 985fcc107a31c764345dc807d6f2e3d9e72265a1
Author: Jiri Pirko <jiri@mellanox.com>
Date:   Sun Jul 28 14:56:36 2019 +0200

    net: fix ifindex collision during namespace removal
    
    [ Upstream commit 55b40dbf0e76b4bfb9d8b3a16a0208640a9a45df ]
    
    Commit aca51397d014 ("netns: Fix arbitrary net_device-s corruptions
    on net_ns stop.") introduced a possibility to hit a BUG in case device
    is returning back to init_net and two following conditions are met:
    1) dev->ifindex value is used in a name of another "dev%d"
       device in init_net.
    2) dev->name is used by another device in init_net.
    
    Under real life circumstances this is hard to get. Therefore this has
    been present happily for over 10 years. To reproduce:
    
    $ ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 86:89:3f:86:61:29 brd ff:ff:ff:ff:ff:ff
    3: enp0s2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
    $ ip netns add ns1
    $ ip -n ns1 link add dummy1ns1 type dummy
    $ ip -n ns1 link add dummy2ns1 type dummy
    $ ip link set enp0s2 netns ns1
    $ ip -n ns1 link set enp0s2 name dummy0
    [  100.858894] virtio_net virtio0 dummy0: renamed from enp0s2
    $ ip link add dev4 type dummy
    $ ip -n ns1 a
    1: lo: <LOOPBACK> mtu 65536 qdisc noop state DOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    2: dummy1ns1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 16:63:4c:38:3e:ff brd ff:ff:ff:ff:ff:ff
    3: dummy2ns1: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether aa:9e:86:dd:6b:5d brd ff:ff:ff:ff:ff:ff
    4: dummy0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
    $ ip a
    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
        inet 127.0.0.1/8 scope host lo
           valid_lft forever preferred_lft forever
        inet6 ::1/128 scope host
           valid_lft forever preferred_lft forever
    2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 86:89:3f:86:61:29 brd ff:ff:ff:ff:ff:ff
    4: dev4: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
        link/ether 5a:e1:4a:b6:ec:f8 brd ff:ff:ff:ff:ff:ff
    $ ip netns del ns1
    [  158.717795] default_device_exit: failed to move dummy0 to init_net: -17
    [  158.719316] ------------[ cut here ]------------
    [  158.720591] kernel BUG at net/core/dev.c:9824!
    [  158.722260] invalid opcode: 0000 [#1] SMP KASAN PTI
    [  158.723728] CPU: 0 PID: 56 Comm: kworker/u2:1 Not tainted 5.3.0-rc1+ #18
    [  158.725422] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-2.fc30 04/01/2014
    [  158.727508] Workqueue: netns cleanup_net
    [  158.728915] RIP: 0010:default_device_exit.cold+0x1d/0x1f
    [  158.730683] Code: 84 e8 18 c9 3e fe 0f 0b e9 70 90 ff ff e8 36 e4 52 fe 89 d9 4c 89 e2 48 c7 c6 80 d6 25 84 48 c7 c7 20 c0 25 84 e8 f4 c8 3e
    [  158.736854] RSP: 0018:ffff8880347e7b90 EFLAGS: 00010282
    [  158.738752] RAX: 000000000000003b RBX: 00000000ffffffef RCX: 0000000000000000
    [  158.741369] RDX: 0000000000000000 RSI: ffffffff8128013d RDI: ffffed10068fcf64
    [  158.743418] RBP: ffff888033550170 R08: 000000000000003b R09: fffffbfff0b94b9c
    [  158.745626] R10: fffffbfff0b94b9b R11: ffffffff85ca5cdf R12: ffff888032f28000
    [  158.748405] R13: dffffc0000000000 R14: ffff8880335501b8 R15: 1ffff110068fcf72
    [  158.750638] FS:  0000000000000000(0000) GS:ffff888036000000(0000) knlGS:0000000000000000
    [  158.752944] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  158.755245] CR2: 00007fe8b45d21d0 CR3: 00000000340b4005 CR4: 0000000000360ef0
    [  158.757654] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [  158.760012] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    [  158.762758] Call Trace:
    [  158.763882]  ? dev_change_net_namespace+0xbb0/0xbb0
    [  158.766148]  ? devlink_nl_cmd_set_doit+0x520/0x520
    [  158.768034]  ? dev_change_net_namespace+0xbb0/0xbb0
    [  158.769870]  ops_exit_list.isra.0+0xa8/0x150
    [  158.771544]  cleanup_net+0x446/0x8f0
    [  158.772945]  ? unregister_pernet_operations+0x4a0/0x4a0
    [  158.775294]  process_one_work+0xa1a/0x1740
    [  158.776896]  ? pwq_dec_nr_in_flight+0x310/0x310
    [  158.779143]  ? do_raw_spin_lock+0x11b/0x280
    [  158.780848]  worker_thread+0x9e/0x1060
    [  158.782500]  ? process_one_work+0x1740/0x1740
    [  158.784454]  kthread+0x31b/0x420
    [  158.786082]  ? __kthread_create_on_node+0x3f0/0x3f0
    [  158.788286]  ret_from_fork+0x3a/0x50
    [  158.789871] ---[ end trace defd6c657c71f936 ]---
    [  158.792273] RIP: 0010:default_device_exit.cold+0x1d/0x1f
    [  158.795478] Code: 84 e8 18 c9 3e fe 0f 0b e9 70 90 ff ff e8 36 e4 52 fe 89 d9 4c 89 e2 48 c7 c6 80 d6 25 84 48 c7 c7 20 c0 25 84 e8 f4 c8 3e
    [  158.804854] RSP: 0018:ffff8880347e7b90 EFLAGS: 00010282
    [  158.807865] RAX: 000000000000003b RBX: 00000000ffffffef RCX: 0000000000000000
    [  158.811794] RDX: 0000000000000000 RSI: ffffffff8128013d RDI: ffffed10068fcf64
    [  158.816652] RBP: ffff888033550170 R08: 000000000000003b R09: fffffbfff0b94b9c
    [  158.820930] R10: fffffbfff0b94b9b R11: ffffffff85ca5cdf R12: ffff888032f28000
    [  158.825113] R13: dffffc0000000000 R14: ffff8880335501b8 R15: 1ffff110068fcf72
    [  158.829899] FS:  0000000000000000(0000) GS:ffff888036000000(0000) knlGS:0000000000000000
    [  158.834923] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  158.838164] CR2: 00007fe8b45d21d0 CR3: 00000000340b4005 CR4: 0000000000360ef0
    [  158.841917] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    [  158.845149] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    
    Fix this by checking if a device with the same name exists in init_net
    and fallback to original code - dev%d to allocate name - in case it does.
    
    This was found using syzkaller.
    
    Fixes: aca51397d014 ("netns: Fix arbitrary net_device-s corruptions on net_ns stop.")
    Signed-off-by: Jiri Pirko <jiri@mellanox.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8db1305d7457370cd66a776f3c34572aee7243d1
Author: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Date:   Mon Jul 29 12:28:41 2019 +0300

    net: bridge: delete local fdb on device init failure
    
    [ Upstream commit d7bae09fa008c6c9a489580db0a5a12063b97f97 ]
    
    On initialization failure we have to delete the local fdb which was
    inserted due to the default pvid creation. This problem has been present
    since the inception of default_pvid. Note that currently there are 2 cases:
    1) in br_dev_init() when br_multicast_init() fails
    2) if register_netdevice() fails after calling ndo_init()
    
    This patch takes care of both since br_vlan_flush() is called on both
    occasions. Also the new fdb delete would be a no-op on normal bridge
    device destruction since the local fdb would've been already flushed by
    br_dev_delete(). This is not an issue for ports since nbp_vlan_init() is
    called last when adding a port thus nothing can fail after it.
    
    Reported-by: syzbot+88533dc8b582309bf3ee@syzkaller.appspotmail.com
    Fixes: 5be5a2df40f0 ("bridge: Add filtering support for default_pvid")
    Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit eee434d29e93f65711bdb1887674e7325f793806
Author: Gustavo A. R. Silva <gustavo@embeddedor.com>
Date:   Tue Jul 30 22:21:41 2019 -0500

    atm: iphase: Fix Spectre v1 vulnerability
    
    [ Upstream commit ea443e5e98b5b74e317ef3d26bcaea54931ccdee ]
    
    board is controlled by user-space, hence leading to a potential
    exploitation of the Spectre variant 1 vulnerability.
    
    This issue was detected with the help of Smatch:
    
    drivers/atm/iphase.c:2765 ia_ioctl() warn: potential spectre issue 'ia_dev' [r] (local cap)
    drivers/atm/iphase.c:2774 ia_ioctl() warn: possible spectre second half.  'iadev'
    drivers/atm/iphase.c:2782 ia_ioctl() warn: possible spectre second half.  'iadev'
    drivers/atm/iphase.c:2816 ia_ioctl() warn: possible spectre second half.  'iadev'
    drivers/atm/iphase.c:2823 ia_ioctl() warn: possible spectre second half.  'iadev'
    drivers/atm/iphase.c:2830 ia_ioctl() warn: potential spectre issue '_ia_dev' [r] (local cap)
    drivers/atm/iphase.c:2845 ia_ioctl() warn: possible spectre second half.  'iadev'
    drivers/atm/iphase.c:2856 ia_ioctl() warn: possible spectre second half.  'iadev'
    
    Fix this by sanitizing board before using it to index ia_dev and _ia_dev
    
    Notice that given that speculation windows are large, the policy is
    to kill the speculation on the first load and not worry if it can be
    completed with a dependent load/store [1].
    
    [1] https://lore.kernel.org/lkml/20180423164740.GY17484@dhcp22.suse.cz/
    
    Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5917ca48053447dac0e13c51ed7d4e2471a1cbc9
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Aug 6 17:09:14 2019 +0200

    tcp: be more careful in tcp_fragment()
    
    [ Upstream commit b617158dc096709d8600c53b6052144d12b89fab ]
    
    Some applications set tiny SO_SNDBUF values and expect
    TCP to just work. Recent patches to address CVE-2019-11478
    broke them in case of losses, since retransmits might
    be prevented.
    
    We should allow these flows to make progress.
    
    This patch allows the first and last skb in retransmit queue
    to be split even if memory limits are hit.
    
    It also adds the some room due to the fact that tcp_sendmsg()
    and tcp_sendpage() might overshoot sk_wmem_queued by about one full
    TSO skb (64KB size). Note this allowance was already present
    in stable backports for kernels < 4.15
    
    Note for < 4.15 backports :
     tcp_rtx_queue_tail() will probably look like :
    
    static inline struct sk_buff *tcp_rtx_queue_tail(const struct sock *sk)
    {
            struct sk_buff *skb = tcp_send_head(sk);
    
            return skb ? tcp_write_queue_prev(sk, skb) : tcp_write_queue_tail(sk);
    }
    
    Fixes: f070ef2ac667 ("tcp: tcp_fragment() should apply sane memory limits")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: Andrew Prout <aprout@ll.mit.edu>
    Tested-by: Andrew Prout <aprout@ll.mit.edu>
    Tested-by: Jonathan Lemon <jonathan.lemon@gmail.com>
    Tested-by: Michal Kubecek <mkubecek@suse.cz>
    Acked-by: Neal Cardwell <ncardwell@google.com>
    Acked-by: Yuchung Cheng <ycheng@google.com>
    Acked-by: Christoph Paasch <cpaasch@apple.com>
    Cc: Jonathan Looney <jtl@netflix.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit c333492aaa9b95f59472900c4435efb0cf2af146
Author: Sebastian Parschauer <s.parschauer@gmx.de>
Date:   Wed Jul 24 20:40:03 2019 +0200

    HID: Add quirk for HP X1200 PIXART OEM mouse
    
    commit 49869d2ea9eecc105a10724c1abf035151a3c4e2 upstream.
    
    The PixArt OEM mice are known for disconnecting every minute in
    runlevel 1 or 3 if they are not always polled. So add quirk
    ALWAYS_POLL for this one as well.
    
    Jonathan Teh (@jonathan-teh) reported and tested the quirk.
    Reference: https://github.com/sriemer/fix-linux-mouse/issues/15
    
    Signed-off-by: Sebastian Parschauer <s.parschauer@gmx.de>
    CC: stable@vger.kernel.org
    Signed-off-by: Jiri Kosina <jkosina@suse.cz>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 68e3b4e85ababf838bca52076c3b5cd78f5d0f1f
Author: Phil Turnbull <phil.turnbull@oracle.com>
Date:   Tue May 3 16:39:19 2016 -0400

    netfilter: nfnetlink_acct: validate NFACCT_QUOTA parameter
    
    [ Upstream commit eda3fc50daa93b08774a18d51883c5a5d8d85e15 ]
    
    If a quota bit is set in NFACCT_FLAGS but the NFACCT_QUOTA parameter is
    missing then a NULL pointer dereference is triggered. CAP_NET_ADMIN is
    required to trigger the bug.
    
    Signed-off-by: Phil Turnbull <phil.turnbull@oracle.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ebb9ffd10a3849d8d87ad311921462dea3a582ec
Author: Will Deacon <will@kernel.org>
Date:   Mon Aug 5 18:13:08 2019 +0100

    arm64: cpufeature: Fix feature comparison for CTR_EL0.{CWG,ERG}
    
    commit 147b9635e6347104b91f48ca9dca61eb0fbf2a54 upstream.
    
    If CTR_EL0.{CWG,ERG} are 0b0000 then they must be interpreted to have
    their architecturally maximum values, which defeats the use of
    FTR_HIGHER_SAFE when sanitising CPU ID registers on heterogeneous
    machines.
    
    Introduce FTR_HIGHER_OR_ZERO_SAFE so that these fields effectively
    saturate at zero.
    
    Fixes: 3c739b571084 ("arm64: Keep track of CPU feature registers")
    Cc: <stable@vger.kernel.org> # 4.4.y only
    Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
    Acked-by: Mark Rutland <mark.rutland@arm.com>
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 375dddef573abace1fd1449bf471e47975235c71
Author: Will Deacon <will.deacon@arm.com>
Date:   Mon Aug 5 18:13:07 2019 +0100

    arm64: cpufeature: Fix CTR_EL0 field definitions
    
    commit be68a8aaf925aaf35574260bf820bb09d2f9e07f upstream.
    
    Our field definitions for CTR_EL0 suffer from a number of problems:
    
      - The IDC and DIC fields are missing, which causes us to enable CTR
        trapping on CPUs with either of these returning non-zero values.
    
      - The ERG is FTR_LOWER_SAFE, whereas it should be treated like CWG as
        FTR_HIGHER_SAFE so that applications can use it to avoid false sharing.
    
      - [nit] A RES1 field is described as "RAO"
    
    This patch updates the CTR_EL0 field definitions to fix these issues.
    
    Cc: <stable@vger.kernel.org> # 4.4.y only
    Cc: Shanker Donthineni <shankerd@codeaurora.org>
    Signed-off-by: Will Deacon <will.deacon@arm.com>
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>