commit 5893f4c3fb784f48c020d2637c129a45da7be39e
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Sun Jul 8 15:30:53 2018 +0200

    Linux 4.14.54

commit 88b01cac4add369bf3f0401a1da7a9bd6bf19305
Author: Damien Thébault <damien.thebault@vitec.com>
Date:   Thu May 31 07:04:01 2018 +0000

    net: dsa: b53: Add BCM5389 support
    
    [ Upstream commit a95691bc54af1ac4b12c354f91e9cabf1cb068df ]
    
    This patch adds support for the BCM5389 switch connected through MDIO.
    
    Signed-off-by: Damien Thébault <damien.thebault@vitec.com>
    Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 28b64cc7a8462cdfffc171ca583179f6c1c36b65
Author: Finn Thain <fthain@telegraphics.com.au>
Date:   Wed May 30 13:03:51 2018 +1000

    net/sonic: Use dma_mapping_error()
    
    [ Upstream commit 26de0b76d9ba3200f09c6cb9d9618bda338be5f7 ]
    
    With CONFIG_DMA_API_DEBUG=y, calling sonic_open() produces the
    message, "DMA-API: device driver failed to check map error".
    Add the missing dma_mapping_error() call.
    
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
    Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4888ced6b749aa51355b4614af25e2eec0818f62
Author: João Paulo Rechi Vita <jprvita@endlessm.com>
Date:   Tue May 22 14:30:15 2018 -0700

    platform/x86: asus-wmi: Fix NULL pointer dereference
    
    [ Upstream commit 32ffd6e8d1f6cef94bedca15dfcdebdeb590499d ]
    
    Do not perform the rfkill cleanup routine when
    (asus->driver->wlan_ctrl_by_user && ashs_present()) is true, since
    nothing is registered with the rfkill subsystem in that case. Doing so
    leads to the following kernel NULL pointer dereference:
    
      BUG: unable to handle kernel NULL pointer dereference at           (null)
      IP: [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
      PGD 1a3aa8067
      PUD 1a3b3d067
      PMD 0
    
      Oops: 0002 [#1] PREEMPT SMP
      Modules linked in: bnep ccm binfmt_misc uvcvideo videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_core hid_a4tech videodev x86_pkg_temp_thermal intel_powerclamp coretemp ath3k btusb btrtl btintel bluetooth kvm_intel snd_hda_codec_hdmi kvm snd_hda_codec_realtek snd_hda_codec_generic irqbypass crc32c_intel arc4 i915 snd_hda_intel snd_hda_codec ath9k ath9k_common ath9k_hw ath i2c_algo_bit snd_hwdep mac80211 ghash_clmulni_intel snd_hda_core snd_pcm snd_timer cfg80211 ehci_pci xhci_pci drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops drm xhci_hcd ehci_hcd asus_nb_wmi(-) asus_wmi sparse_keymap r8169 rfkill mxm_wmi serio_raw snd mii mei_me lpc_ich i2c_i801 video soundcore mei i2c_smbus wmi i2c_core mfd_core
      CPU: 3 PID: 3275 Comm: modprobe Not tainted 4.9.34-gentoo #34
      Hardware name: ASUSTeK COMPUTER INC. K56CM/K56CM, BIOS K56CM.206 08/21/2012
      task: ffff8801a639ba00 task.stack: ffffc900014cc000
      RIP: 0010:[<ffffffff816c7348>]  [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
      RSP: 0018:ffffc900014cfce0  EFLAGS: 00010282
      RAX: 0000000000000000 RBX: ffff8801a54315b0 RCX: 00000000c0000100
      RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8801a54315b4
      RBP: ffffc900014cfd30 R08: 0000000000000000 R09: 0000000000000002
      R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801a54315b4
      R13: ffff8801a639ba00 R14: 00000000ffffffff R15: ffff8801a54315b8
      FS:  00007faa254fb700(0000) GS:ffff8801aef80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000000 CR3: 00000001a3b1b000 CR4: 00000000001406e0
      Stack:
       ffff8801a54315b8 0000000000000000 ffffffff814733ae ffffc900014cfd28
       ffffffff8146a28c ffff8801a54315b0 0000000000000000 ffff8801a54315b0
       ffff8801a66f3820 0000000000000000 ffffc900014cfd48 ffffffff816c73e7
      Call Trace:
       [<ffffffff814733ae>] ? acpi_ut_release_mutex+0x5d/0x61
       [<ffffffff8146a28c>] ? acpi_ns_get_node+0x49/0x52
       [<ffffffff816c73e7>] mutex_lock+0x17/0x30
       [<ffffffffa00a3bb4>] asus_rfkill_hotplug+0x24/0x1a0 [asus_wmi]
       [<ffffffffa00a4421>] asus_wmi_rfkill_exit+0x61/0x150 [asus_wmi]
       [<ffffffffa00a49f1>] asus_wmi_remove+0x61/0xb0 [asus_wmi]
       [<ffffffff814a5128>] platform_drv_remove+0x28/0x40
       [<ffffffff814a2901>] __device_release_driver+0xa1/0x160
       [<ffffffff814a29e3>] device_release_driver+0x23/0x30
       [<ffffffff814a1ffd>] bus_remove_device+0xfd/0x170
       [<ffffffff8149e5a9>] device_del+0x139/0x270
       [<ffffffff814a5028>] platform_device_del+0x28/0x90
       [<ffffffff814a50a2>] platform_device_unregister+0x12/0x30
       [<ffffffffa00a4209>] asus_wmi_unregister_driver+0x19/0x30 [asus_wmi]
       [<ffffffffa00da0ea>] asus_nb_wmi_exit+0x10/0xf26 [asus_nb_wmi]
       [<ffffffff8110c692>] SyS_delete_module+0x192/0x270
       [<ffffffff810022b2>] ? exit_to_usermode_loop+0x92/0xa0
       [<ffffffff816ca560>] entry_SYSCALL_64_fastpath+0x13/0x94
      Code: e8 5e 30 00 00 8b 03 83 f8 01 0f 84 93 00 00 00 48 8b 43 10 4c 8d 7b 08 48 89 63 10 41 be ff ff ff ff 4c 89 3c 24 48 89 44 24 08 <48> 89 20 4c 89 6c 24 10 eb 1d 4c 89 e7 49 c7 45 08 02 00 00 00
      RIP  [<ffffffff816c7348>] __mutex_lock_slowpath+0x98/0x120
       RSP <ffffc900014cfce0>
      CR2: 0000000000000000
      ---[ end trace 8d484233fa7cb512 ]---
      note: modprobe[3275] exited with preempt_count 2
    
    https://bugzilla.kernel.org/show_bug.cgi?id=196467
    
    Reported-by: red.f0xyz@gmail.com
    Signed-off-by: João Paulo Rechi Vita <jprvita@endlessm.com>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0d5e04e239ad5b18c4099ef942843bf510af1122
Author: Paul Burton <paul.burton@mips.com>
Date:   Sat May 26 08:46:47 2018 -0700

    sched/core: Require cpu_active() in select_task_rq(), for user tasks
    
    [ Upstream commit 7af443ee1697607541c6346c87385adab2214743 ]
    
    select_task_rq() is used in a few paths to select the CPU upon which a
    thread should be run - for example it is used by try_to_wake_up() & by
    fork or exec balancing. As-is it allows use of any online CPU that is
    present in the task's cpus_allowed mask.
    
    This presents a problem because there is a period whilst CPUs are
    brought online where a CPU is marked online, but is not yet fully
    initialized - ie. the period where CPUHP_AP_ONLINE_IDLE <= state <
    CPUHP_ONLINE. Usually we don't run any user tasks during this window,
    but there are corner cases where this can happen. An example observed
    is:
    
      - Some user task A, running on CPU X, forks to create task B.
    
      - sched_fork() calls __set_task_cpu() with cpu=X, setting task B's
        task_struct::cpu field to X.
    
      - CPU X is offlined.
    
      - Task A, currently somewhere between the __set_task_cpu() in
        copy_process() and the call to wake_up_new_task(), is migrated to
        CPU Y by migrate_tasks() when CPU X is offlined.
    
      - CPU X is onlined, but still in the CPUHP_AP_ONLINE_IDLE state. The
        scheduler is now active on CPU X, but there are no user tasks on
        the runqueue.
    
      - Task A runs on CPU Y & reaches wake_up_new_task(). This calls
        select_task_rq() with cpu=X, taken from task B's task_struct,
        and select_task_rq() allows CPU X to be returned.
    
      - Task A enqueues task B on CPU X's runqueue, via activate_task() &
        enqueue_task().
    
      - CPU X now has a user task on its runqueue before it has reached the
        CPUHP_ONLINE state.
    
    In most cases, the user tasks that schedule on the newly onlined CPU
    have no idea that anything went wrong, but one case observed to be
    problematic is if the task goes on to invoke the sched_setaffinity
    syscall. The newly onlined CPU reaches the CPUHP_AP_ONLINE_IDLE state
    before the CPU that brought it online calls stop_machine_unpark(). This
    means that for a portion of the window of time between
    CPUHP_AP_ONLINE_IDLE & CPUHP_ONLINE the newly onlined CPU's struct
    cpu_stopper has its enabled field set to false. If a user thread is
    executed on the CPU during this window and it invokes sched_setaffinity
    with a CPU mask that does not include the CPU it's running on, then when
    __set_cpus_allowed_ptr() calls stop_one_cpu() intending to invoke
    migration_cpu_stop() and perform the actual migration away from the CPU
    it will simply return -ENOENT rather than calling migration_cpu_stop().
    We then return from the sched_setaffinity syscall back to the user task
    that is now running on a CPU which it just asked not to run on, and
    which is not present in its cpus_allowed mask.
    
    This patch resolves the problem by having select_task_rq() enforce that
    user tasks run on CPUs that are active - the same requirement that
    select_fallback_rq() already enforces. This should ensure that newly
    onlined CPUs reach the CPUHP_AP_ACTIVE state before being able to
    schedule user tasks, and also implies that bringup_wait_for_ap() will
    have called stop_machine_unpark() which resolves the sched_setaffinity
    issue above.
    
    I haven't yet investigated them, but it may be of interest to review
    whether any of the actions performed by hotplug states between
    CPUHP_AP_ONLINE_IDLE & CPUHP_AP_ACTIVE could have similar unintended
    effects on user tasks that might schedule before they are reached, which
    might widen the scope of the problem from just affecting the behaviour
    of sched_setaffinity.
    
    Signed-off-by: Paul Burton <paul.burton@mips.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    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/20180526154648.11635-2-paul.burton@mips.com
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e4c55e0e6a754d21ea3d2e528e384b546192b9a1
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Tue Jul 25 18:58:21 2017 +0200

    sched/core: Fix rules for running on online && !active CPUs
    
    [ Upstream commit 175f0e25abeaa2218d431141ce19cf1de70fa82d ]
    
    As already enforced by the WARN() in __set_cpus_allowed_ptr(), the rules
    for running on an online && !active CPU are stricter than just being a
    kthread, you need to be a per-cpu kthread.
    
    If you're not strictly per-CPU, you have better CPUs to run on and
    don't need the partially booted one to get your work done.
    
    The exception is to allow smpboot threads to bootstrap the CPU itself
    and get kernel 'services' initialized before we allow userspace on it.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Tejun Heo <tj@kernel.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Fixes: 955dbdf4ce87 ("sched: Allow migrating kthreads into online but inactive CPUs")
    Link: http://lkml.kernel.org/r/20170725165821.cejhb7v2s3kecems@hirez.programming.kicks-ass.net
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 93b84462eadf0ebbf72abddfcf75d46ac9b59730
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Wed May 30 19:43:53 2018 -0700

    fs: clear writeback errors in inode_init_always
    
    [ Upstream commit 829bc787c1a0403e4d886296dd4d90c5f9c1744a ]
    
    In inode_init_always(), we clear the inode mapping flags, which clears
    any retained error (AS_EIO, AS_ENOSPC) bits.  Unfortunately, we do not
    also clear wb_err, which means that old mapping errors can leak through
    to new inodes.
    
    This is crucial for the XFS inode allocation path because we recycle old
    in-core inodes and we do not want error state from an old file to leak
    into the new file.  This bug was discovered by running generic/036 and
    generic/047 in a loop and noticing that the EIOs generated by the
    collision of direct and buffered writes in generic/036 would survive the
    remount between 036 and 047, and get reported to the fsyncs (on
    different files!) in generic/047.
    
    Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: Brian Foster <bfoster@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ae14c044587eceb1775c03e0be9e4e547d262aa2
Author: YueHaibing <yuehaibing@huawei.com>
Date:   Fri May 11 19:21:42 2018 +0800

    perf bpf: Fix NULL return handling in bpf__prepare_load()
    
    [ Upstream commit ab4e32ff5aa797eaea551dbb67946e2fcb56cc7e ]
    
    bpf_object__open()/bpf_object__open_buffer can return error pointer or
    NULL, check the return values with IS_ERR_OR_NULL() in bpf__prepare_load
    and bpf__prepare_load_buffer
    
    Signed-off-by: YueHaibing <yuehaibing@huawei.com>
    Acked-by: Daniel Borkmann <daniel@iogearbox.net>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: netdev@vger.kernel.org
    Link: https://lkml.kernel.org/n/tip-psf4xwc09n62al2cb9s33v9h@git.kernel.org
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit be5af6bec31a5c22f61de1be848c3fd0e6e3a2f8
Author: Thomas Richter <tmricht@linux.ibm.com>
Date:   Mon May 28 09:36:57 2018 +0200

    perf test: "Session topology" dumps core on s390
    
    [ Upstream commit d121109100bda84bbbb199dab97f9d56432ab235 ]
    
    The "perf test Session topology" entry fails with core dump on s390. The root
    cause is a NULL pointer dereference in function check_cpu_topology() line 76
    (or line 82 without -v).
    
    The session->header.env.cpu variable is NULL because on s390 function
    process_cpu_topology() returns with error:
    
        socket_id number is too big.
        You may need to upgrade the perf tool.
    
    and releases the env.cpu variable via zfree() and sets it to NULL.
    
    Here is the gdb output:
    (gdb) n
    76                      pr_debug("CPU %d, core %d, socket %d\n", i,
    (gdb) n
    
    Program received signal SIGSEGV, Segmentation fault.
    0x00000000010f4d9e in check_cpu_topology (path=0x3ffffffd6c8
            "/tmp/perf-test-J6CHMa", map=0x14a1740) at tests/topology.c:76
    76  pr_debug("CPU %d, core %d, socket %d\n", i,
    (gdb)
    
    Make sure the env.cpu variable is not used when its NULL.
    Test for NULL pointer and return TEST_SKIP if so.
    
    Output before:
    
      [root@p23lp27 perf]# ./perf test -F 39
      39: Session topology  :Segmentation fault (core dumped)
      [root@p23lp27 perf]#
    
    Output after:
    
      [root@p23lp27 perf]# ./perf test -vF 39
      39: Session topology                                      :
      --- start ---
      templ file: /tmp/perf-test-Ajx59D
      socket_id number is too big.You may need to upgrade the perf tool.
      ---- end ----
      Session topology: Skip
      [root@p23lp27 perf]#
    
    Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
    Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
    Cc: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
    Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Link: http://lkml.kernel.org/r/20180528073657.11743-1-tmricht@linux.ibm.com
    Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d689ad5c91af0843aceef7975d7ca9356c84a335
Author: Josh Hill <josh@joshuajhill.com>
Date:   Sun May 27 20:10:41 2018 -0400

    net: qmi_wwan: Add Netgear Aircard 779S
    
    [ Upstream commit 2415f3bd059fe050eb98aedf93664d000ceb4e92 ]
    
    Add support for Netgear Aircard 779S
    
    Signed-off-by: Josh Hill <josh@joshuajhill.com>
    Acked-by: Bjørn Mork <bjorn@mork.no>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d20dcd2f11357f2b0f52a243e4737c129240475d
Author: Ivan Bornyakov <brnkv.i1@gmail.com>
Date:   Fri May 25 20:49:52 2018 +0300

    atm: zatm: fix memcmp casting
    
    [ Upstream commit f9c6442a8f0b1dde9e755eb4ff6fa22bcce4eabc ]
    
    memcmp() returns int, but eprom_try_esi() cast it to unsigned char. One
    can lose significant bits and get 0 from non-0 value returned by the
    memcmp().
    
    Signed-off-by: Ivan Bornyakov <brnkv.i1@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3ee6bd9411a60f90b5adeea5440cbac302c3e9d0
Author: Hao Wei Tee <angelsl@in04.sg>
Date:   Tue May 29 10:25:17 2018 +0300

    iwlwifi: pcie: compare with number of IRQs requested for, not number of CPUs
    
    [ Upstream commit ab1068d6866e28bf6427ceaea681a381e5870a4a ]
    
    When there are 16 or more logical CPUs, we request for
    `IWL_MAX_RX_HW_QUEUES` (16) IRQs only as we limit to that number of
    IRQs, but later on we compare the number of IRQs returned to
    nr_online_cpus+2 instead of max_irqs, the latter being what we
    actually asked for. This ends up setting num_rx_queues to 17 which
    causes lots of out-of-bounds array accesses later on.
    
    Compare to max_irqs instead, and also add an assertion in case
    num_rx_queues > IWM_MAX_RX_HW_QUEUES.
    
    This fixes https://bugzilla.kernel.org/show_bug.cgi?id=199551
    
    Fixes: 2e5d4a8f61dc ("iwlwifi: pcie: Add new configuration to enable MSIX")
    Signed-off-by: Hao Wei Tee <angelsl@in04.sg>
    Tested-by: Sara Sharon <sara.sharon@intel.com>
    Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
    Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4abab5dca7237e89f62069587f64feebc56dc105
Author: Julian Anastasov <ja@ssi.bg>
Date:   Sat May 19 18:22:35 2018 +0300

    ipvs: fix buffer overflow with sync daemon and service
    
    [ Upstream commit 52f96757905bbf0edef47f3ee6c7c784e7f8ff8a ]
    
    syzkaller reports for buffer overflow for interface name
    when starting sync daemons [1]
    
    What we do is that we copy user structure into larger stack
    buffer but later we search NUL past the stack buffer.
    The same happens for sched_name when adding/editing virtual server.
    
    We are restricted by IP_VS_SCHEDNAME_MAXLEN and IP_VS_IFNAME_MAXLEN
    being used as size in include/uapi/linux/ip_vs.h, so they
    include the space for NUL.
    
    As using strlcpy is wrong for unsafe source, replace it with
    strscpy and add checks to return EINVAL if source string is not
    NUL-terminated. The incomplete strlcpy fix comes from 2.6.13.
    
    For the netlink interface reduce the len parameter for
    IPVS_DAEMON_ATTR_MCAST_IFN and IPVS_SVC_ATTR_SCHED_NAME,
    so that we get proper EINVAL.
    
    [1]
    kernel BUG at lib/string.c:1052!
    invalid opcode: 0000 [#1] SMP KASAN
    Dumping ftrace buffer:
        (ftrace buffer empty)
    Modules linked in:
    CPU: 1 PID: 373 Comm: syz-executor936 Not tainted 4.17.0-rc4+ #45
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
    Google 01/01/2011
    RIP: 0010:fortify_panic+0x13/0x20 lib/string.c:1051
    RSP: 0018:ffff8801c976f800 EFLAGS: 00010282
    RAX: 0000000000000022 RBX: 0000000000000040 RCX: 0000000000000000
    RDX: 0000000000000022 RSI: ffffffff8160f6f1 RDI: ffffed00392edef6
    RBP: ffff8801c976f800 R08: ffff8801cf4c62c0 R09: ffffed003b5e4fb0
    R10: ffffed003b5e4fb0 R11: ffff8801daf27d87 R12: ffff8801c976fa20
    R13: ffff8801c976fae4 R14: ffff8801c976fae0 R15: 000000000000048b
    FS:  00007fd99f75e700(0000) GS:ffff8801daf00000(0000)
    knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00000000200001c0 CR3: 00000001d6843000 CR4: 00000000001406e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
      strlen include/linux/string.h:270 [inline]
      strlcpy include/linux/string.h:293 [inline]
      do_ip_vs_set_ctl+0x31c/0x1d00 net/netfilter/ipvs/ip_vs_ctl.c:2388
      nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
      nf_setsockopt+0x7d/0xd0 net/netfilter/nf_sockopt.c:115
      ip_setsockopt+0xd8/0xf0 net/ipv4/ip_sockglue.c:1253
      udp_setsockopt+0x62/0xa0 net/ipv4/udp.c:2487
      ipv6_setsockopt+0x149/0x170 net/ipv6/ipv6_sockglue.c:917
      tcp_setsockopt+0x93/0xe0 net/ipv4/tcp.c:3057
      sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:3046
      __sys_setsockopt+0x1bd/0x390 net/socket.c:1903
      __do_sys_setsockopt net/socket.c:1914 [inline]
      __se_sys_setsockopt net/socket.c:1911 [inline]
      __x64_sys_setsockopt+0xbe/0x150 net/socket.c:1911
      do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
      entry_SYSCALL_64_after_hwframe+0x49/0xbe
    RIP: 0033:0x447369
    RSP: 002b:00007fd99f75dda8 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
    RAX: ffffffffffffffda RBX: 00000000006e39e4 RCX: 0000000000447369
    RDX: 000000000000048b RSI: 0000000000000000 RDI: 0000000000000003
    RBP: 0000000000000000 R08: 0000000000000018 R09: 0000000000000000
    R10: 00000000200001c0 R11: 0000000000000246 R12: 00000000006e39e0
    R13: 75a1ff93f0896195 R14: 6f745f3168746576 R15: 0000000000000001
    Code: 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 0f 0b 48 89 df e8 d2 8f 48 fa eb
    de 55 48 89 fe 48 c7 c7 60 65 64 88 48 89 e5 e8 91 dd f3 f9 <0f> 0b 90 90
    90 90 90 90 90 90 90 90 90 55 48 89 e5 41 57 41 56
    RIP: fortify_panic+0x13/0x20 lib/string.c:1051 RSP: ffff8801c976f800
    
    Reported-and-tested-by: syzbot+aac887f77319868646df@syzkaller.appspotmail.com
    Fixes: e4ff67513096 ("ipvs: add sync_maxlen parameter for the sync daemon")
    Fixes: 4da62fc70d7c ("[IPVS]: Fix for overflows")
    Signed-off-by: Julian Anastasov <ja@ssi.bg>
    Acked-by: Simon Horman <horms+renesas@verge.net.au>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 27aa533f24e9951aff62b3b6a14c1feed8cbf624
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Wed May 16 22:58:33 2018 +0200

    netfilter: nft_limit: fix packet ratelimiting
    
    [ Upstream commit 3e0f64b7dd3149f75e8652ff1df56cffeedc8fc1 ]
    
    Credit calculations for the packet ratelimiting are not correct, as per
    the applied ratelimit of 25/second and burst 8, a total of 33 packets
    should have been accepted.  This is true in iptables(33) but not in
    nftables (~65). For packet ratelimiting, use:
    
            div_u64(limit->nsecs, limit->rate) * limit->burst;
    
    to calculate credit, just like in iptables' xt_limit does.
    
    Moreover, use default burst in iptables, users are expecting similar
    behaviour.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 510e1e8020a8a1b7cf53a84f18a7d03757daba55
Author: Sebastian Ott <sebott@linux.ibm.com>
Date:   Tue May 15 14:05:13 2018 +0200

    s390/dasd: use blk_mq_rq_from_pdu for per request data
    
    [ Upstream commit f0f59a2fab8e52b9d582b39da39f22230ca80aee ]
    
    Dasd uses completion_data from struct request to store per request
    private data - this is problematic since this member is part of a
    union which is also used by IO schedulers.
    Let the block layer maintain space for per request data behind each
    struct request.
    
    Fixes crashes on block layer timeouts like this one:
    
    Unable to handle kernel pointer dereference in virtual kernel address space
    Failing address: 0000000000000000 TEID: 0000000000000483
    Fault in home space mode while using kernel ASCE.
    AS:0000000001308007 R3:00000000fffc8007 S:00000000fffcc000 P:000000000000013d
    Oops: 0004 ilc:2 [#1] PREEMPT SMP
    Modules linked in: [...]
    CPU: 0 PID: 1480 Comm: kworker/0:2H Not tainted 4.17.0-rc4-00046-gaa3bcd43b5af #203
    Hardware name: IBM 3906 M02 702 (LPAR)
    Workqueue: kblockd blk_mq_timeout_work
    Krnl PSW : 0000000067ac406b 00000000b6960308 (do_raw_spin_trylock+0x30/0x78)
               R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:2 PM:0 RI:0 EA:3
    Krnl GPRS: 0000000000000c00 0000000000000000 0000000000000000 0000000000000001
               0000000000b9d3c8 0000000000000000 0000000000000001 00000000cf9639d8
               0000000000000000 0700000000000000 0000000000000000 000000000099f09e
               0000000000000000 000000000076e9d0 000000006247bb08 000000006247bae0
    Krnl Code: 00000000001c159c: b90400c2           lgr     %r12,%r2
               00000000001c15a0: a7180000           lhi     %r1,0
              #00000000001c15a4: 583003a4           l       %r3,932
              >00000000001c15a8: ba132000           cs      %r1,%r3,0(%r2)
               00000000001c15ac: a7180001           lhi     %r1,1
               00000000001c15b0: a784000b           brc     8,1c15c6
               00000000001c15b4: c0e5004e72aa       brasl   %r14,b8fb08
               00000000001c15ba: 1812               lr      %r1,%r2
    Call Trace:
    ([<0700000000000000>] 0x700000000000000)
     [<0000000000b9d3d2>] _raw_spin_lock_irqsave+0x7a/0xb8
     [<000000000099f09e>] dasd_times_out+0x46/0x278
     [<000000000076ea6e>] blk_mq_terminate_expired+0x9e/0x108
     [<000000000077497a>] bt_for_each+0x102/0x130
     [<0000000000774e54>] blk_mq_queue_tag_busy_iter+0x74/0xd8
     [<000000000076fea0>] blk_mq_timeout_work+0x260/0x320
     [<0000000000169dd4>] process_one_work+0x3bc/0x708
     [<000000000016a382>] worker_thread+0x262/0x408
     [<00000000001723a8>] kthread+0x160/0x178
     [<0000000000b9e73a>] kernel_thread_starter+0x6/0xc
     [<0000000000b9e734>] kernel_thread_starter+0x0/0xc
    INFO: lockdep is turned off.
    Last Breaking-Event-Address:
     [<0000000000b9d3cc>] _raw_spin_lock_irqsave+0x74/0xb8
    
    Kernel panic - not syncing: Fatal exception: panic_on_oops
    
    Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
    Reviewed-by: Stefan Haberland <sth@linux.ibm.com>
    Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit db73501ebc3ad56b94aa5adb7365a9a4d5313523
Author: Paolo Abeni <pabeni@redhat.com>
Date:   Fri Apr 27 10:45:31 2018 +0200

    netfilter: ebtables: handle string from userspace with care
    
    [ Upstream commit 94c752f99954797da583a84c4907ff19e92550a4 ]
    
    strlcpy() can't be safely used on a user-space provided string,
    as it can try to read beyond the buffer's end, if the latter is
    not NULL terminated.
    
    Leveraging the above, syzbot has been able to trigger the following
    splat:
    
    BUG: KASAN: stack-out-of-bounds in strlcpy include/linux/string.h:300
    [inline]
    BUG: KASAN: stack-out-of-bounds in compat_mtw_from_user
    net/bridge/netfilter/ebtables.c:1957 [inline]
    BUG: KASAN: stack-out-of-bounds in ebt_size_mwt
    net/bridge/netfilter/ebtables.c:2059 [inline]
    BUG: KASAN: stack-out-of-bounds in size_entry_mwt
    net/bridge/netfilter/ebtables.c:2155 [inline]
    BUG: KASAN: stack-out-of-bounds in compat_copy_entries+0x96c/0x14a0
    net/bridge/netfilter/ebtables.c:2194
    Write of size 33 at addr ffff8801b0abf888 by task syz-executor0/4504
    
    CPU: 0 PID: 4504 Comm: syz-executor0 Not tainted 4.17.0-rc2+ #40
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
    Google 01/01/2011
    Call Trace:
      __dump_stack lib/dump_stack.c:77 [inline]
      dump_stack+0x1b9/0x294 lib/dump_stack.c:113
      print_address_description+0x6c/0x20b mm/kasan/report.c:256
      kasan_report_error mm/kasan/report.c:354 [inline]
      kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
      check_memory_region_inline mm/kasan/kasan.c:260 [inline]
      check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
      memcpy+0x37/0x50 mm/kasan/kasan.c:303
      strlcpy include/linux/string.h:300 [inline]
      compat_mtw_from_user net/bridge/netfilter/ebtables.c:1957 [inline]
      ebt_size_mwt net/bridge/netfilter/ebtables.c:2059 [inline]
      size_entry_mwt net/bridge/netfilter/ebtables.c:2155 [inline]
      compat_copy_entries+0x96c/0x14a0 net/bridge/netfilter/ebtables.c:2194
      compat_do_replace+0x483/0x900 net/bridge/netfilter/ebtables.c:2285
      compat_do_ebt_set_ctl+0x2ac/0x324 net/bridge/netfilter/ebtables.c:2367
      compat_nf_sockopt net/netfilter/nf_sockopt.c:144 [inline]
      compat_nf_setsockopt+0x9b/0x140 net/netfilter/nf_sockopt.c:156
      compat_ip_setsockopt+0xff/0x140 net/ipv4/ip_sockglue.c:1279
      inet_csk_compat_setsockopt+0x97/0x120 net/ipv4/inet_connection_sock.c:1041
      compat_tcp_setsockopt+0x49/0x80 net/ipv4/tcp.c:2901
      compat_sock_common_setsockopt+0xb4/0x150 net/core/sock.c:3050
      __compat_sys_setsockopt+0x1ab/0x7c0 net/compat.c:403
      __do_compat_sys_setsockopt net/compat.c:416 [inline]
      __se_compat_sys_setsockopt net/compat.c:413 [inline]
      __ia32_compat_sys_setsockopt+0xbd/0x150 net/compat.c:413
      do_syscall_32_irqs_on arch/x86/entry/common.c:323 [inline]
      do_fast_syscall_32+0x345/0xf9b arch/x86/entry/common.c:394
      entry_SYSENTER_compat+0x70/0x7f arch/x86/entry/entry_64_compat.S:139
    RIP: 0023:0xf7fb3cb9
    RSP: 002b:00000000fff0c26c EFLAGS: 00000282 ORIG_RAX: 000000000000016e
    RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000000000
    RDX: 0000000000000080 RSI: 0000000020000300 RDI: 00000000000005f4
    RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
    R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
    
    The buggy address belongs to the page:
    page:ffffea0006c2afc0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
    flags: 0x2fffc0000000000()
    raw: 02fffc0000000000 0000000000000000 0000000000000000 00000000ffffffff
    raw: 0000000000000000 ffffea0006c20101 0000000000000000 0000000000000000
    page dumped because: kasan: bad access detected
    
    Fix the issue replacing the unsafe function with strscpy() and
    taking care of possible errors.
    
    Fixes: 81e675c227ec ("netfilter: ebtables: add CONFIG_COMPAT support")
    Reported-and-tested-by: syzbot+4e42a04e0bc33cb6c087@syzkaller.appspotmail.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e36bc9930d85f4ae29b67eb71bc66ae49e217b71
Author: David Howells <dhowells@redhat.com>
Date:   Wed May 16 21:25:46 2018 +0100

    afs: Fix directory permissions check
    
    [ Upstream commit 378831e4daec75fbba6d3612bcf3b4dd00ddbf08 ]
    
    Doing faccessat("/afs/some/directory", 0) triggers a BUG in the permissions
    check code.
    
    Fix this by just removing the BUG section.  If no permissions are asked
    for, just return okay if the file exists.
    
    Also:
    
     (1) Split up the directory check so that it has separate if-statements
         rather than if-else-if (e.g. checking for MAY_EXEC shouldn't skip the
         check for MAY_READ and MAY_WRITE).
    
     (2) Check for MAY_CHDIR as MAY_EXEC.
    
    Without the main fix, the following BUG may occur:
    
     kernel BUG at fs/afs/security.c:386!
     invalid opcode: 0000 [#1] SMP PTI
     ...
     RIP: 0010:afs_permission+0x19d/0x1a0 [kafs]
     ...
     Call Trace:
      ? inode_permission+0xbe/0x180
      ? do_faccessat+0xdc/0x270
      ? do_syscall_64+0x60/0x1f0
      ? entry_SYSCALL_64_after_hwframe+0x49/0xbe
    
    Fixes: 00d3b7a4533e ("[AFS]: Add security support.")
    Reported-by: Jonathan Billings <jsbillings@jsbillings.org>
    Signed-off-by: David Howells <dhowells@redhat.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4cf1fbcdef7f04605333a1786f619122c135c0fe
Author: Eric Dumazet <edumazet@google.com>
Date:   Sat May 12 02:49:30 2018 -0700

    xfrm6: avoid potential infinite loop in _decode_session6()
    
    [ Upstream commit d9f92772e8ec388d070752ee8f187ef8fa18621f ]
    
    syzbot found a way to trigger an infinitie loop by overflowing
    @offset variable that has been forced to use u16 for some very
    obscure reason in the past.
    
    We probably want to look at NEXTHDR_FRAGMENT handling which looks
    wrong, in a separate patch.
    
    In net-next, we shall try to use skb_header_pointer() instead of
    pskb_may_pull().
    
    watchdog: BUG: soft lockup - CPU#1 stuck for 134s! [syz-executor738:4553]
    Modules linked in:
    irq event stamp: 13885653
    hardirqs last  enabled at (13885652): [<ffffffff878009d5>] restore_regs_and_return_to_kernel+0x0/0x2b
    hardirqs last disabled at (13885653): [<ffffffff87800905>] interrupt_entry+0xb5/0xf0 arch/x86/entry/entry_64.S:625
    softirqs last  enabled at (13614028): [<ffffffff84df0809>] tun_napi_alloc_frags drivers/net/tun.c:1478 [inline]
    softirqs last  enabled at (13614028): [<ffffffff84df0809>] tun_get_user+0x1dd9/0x4290 drivers/net/tun.c:1825
    softirqs last disabled at (13614032): [<ffffffff84df1b6f>] tun_get_user+0x313f/0x4290 drivers/net/tun.c:1942
    CPU: 1 PID: 4553 Comm: syz-executor738 Not tainted 4.17.0-rc3+ #40
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    RIP: 0010:check_kcov_mode kernel/kcov.c:67 [inline]
    RIP: 0010:__sanitizer_cov_trace_pc+0x20/0x50 kernel/kcov.c:101
    RSP: 0018:ffff8801d8cfe250 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13
    RAX: ffff8801d88a8080 RBX: ffff8801d7389e40 RCX: 0000000000000006
    RDX: 0000000000000000 RSI: ffffffff868da4ad RDI: ffff8801c8a53277
    RBP: ffff8801d8cfe250 R08: ffff8801d88a8080 R09: ffff8801d8cfe3e8
    R10: ffffed003b19fc87 R11: ffff8801d8cfe43f R12: ffff8801c8a5327f
    R13: 0000000000000000 R14: ffff8801c8a4e5fe R15: ffff8801d8cfe3e8
    FS:  0000000000d88940(0000) GS:ffff8801daf00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: ffffffffff600400 CR3: 00000001acab3000 CR4: 00000000001406e0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     _decode_session6+0xc1d/0x14f0 net/ipv6/xfrm6_policy.c:150
     __xfrm_decode_session+0x71/0x140 net/xfrm/xfrm_policy.c:2368
     xfrm_decode_session_reverse include/net/xfrm.h:1213 [inline]
     icmpv6_route_lookup+0x395/0x6e0 net/ipv6/icmp.c:372
     icmp6_send+0x1982/0x2da0 net/ipv6/icmp.c:551
     icmpv6_send+0x17a/0x300 net/ipv6/ip6_icmp.c:43
     ip6_input_finish+0x14e1/0x1a30 net/ipv6/ip6_input.c:305
     NF_HOOK include/linux/netfilter.h:288 [inline]
     ip6_input+0xe1/0x5e0 net/ipv6/ip6_input.c:327
     dst_input include/net/dst.h:450 [inline]
     ip6_rcv_finish+0x29c/0xa10 net/ipv6/ip6_input.c:71
     NF_HOOK include/linux/netfilter.h:288 [inline]
     ipv6_rcv+0xeb8/0x2040 net/ipv6/ip6_input.c:208
     __netif_receive_skb_core+0x2468/0x3650 net/core/dev.c:4646
     __netif_receive_skb+0x2c/0x1e0 net/core/dev.c:4711
     netif_receive_skb_internal+0x126/0x7b0 net/core/dev.c:4785
     napi_frags_finish net/core/dev.c:5226 [inline]
     napi_gro_frags+0x631/0xc40 net/core/dev.c:5299
     tun_get_user+0x3168/0x4290 drivers/net/tun.c:1951
     tun_chr_write_iter+0xb9/0x154 drivers/net/tun.c:1996
     call_write_iter include/linux/fs.h:1784 [inline]
     do_iter_readv_writev+0x859/0xa50 fs/read_write.c:680
     do_iter_write+0x185/0x5f0 fs/read_write.c:959
     vfs_writev+0x1c7/0x330 fs/read_write.c:1004
     do_writev+0x112/0x2f0 fs/read_write.c:1039
     __do_sys_writev fs/read_write.c:1112 [inline]
     __se_sys_writev fs/read_write.c:1109 [inline]
     __x64_sys_writev+0x75/0xb0 fs/read_write.c:1109
     do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
     entry_SYSCALL_64_after_hwframe+0x49/0xbe
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Steffen Klassert <steffen.klassert@secunet.com>
    Cc: Nicolas Dichtel <nicolas.dichtel@6wind.com>
    Reported-by: syzbot+0053c8...@syzkaller.appspotmail.com
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 693d06dffb436ae22c899e0ffd7c28064dd8ec32
Author: Abhishek Sahu <absahu@codeaurora.org>
Date:   Wed Jun 13 14:32:36 2018 +0530

    mtd: rawnand: fix return value check for bad block status
    
    commit e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 upstream.
    
    Positive return value from read_oob() is making false BAD
    blocks. For some of the NAND controllers, OOB bytes will be
    protected with ECC and read_oob() will return number of bitflips.
    If there is any bitflip in ECC protected OOB bytes for BAD block
    status page, then that block is getting treated as BAD.
    
    Fixes: c120e75e0e7d ("mtd: nand: use read_oob() instead of cmdfunc() for bad block check")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
    Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
    [backported to 4.14.y]
    Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0ed70f20644959caf01a89b17fccebd19b204d92
Author: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
Date:   Tue May 22 19:45:09 2018 +0200

    ARM: dts: imx6q: Use correct SDMA script for SPI5 core
    
    commit df07101e1c4a29e820df02f9989a066988b160e6 upstream.
    
    According to the reference manual the shp_2_mcu / mcu_2_shp
    scripts must be used for devices connected through the SPBA.
    
    This fixes an issue we saw with DMA transfers.
    Sometimes the SPI controller RX FIFO was not empty after a DMA
    transfer and the driver got stuck in the next PIO transfer when
    it read one word more than expected.
    
    commit dd4b487b32a35 ("ARM: dts: imx6: Use correct SDMA script
    for SPI cores") is fixing the same issue but only for SPI1 - 4.
    
    Fixes: 677940258dd8e ("ARM: dts: imx6q: enable dma for ecspi5")
    Signed-off-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk>
    Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 259cc05cce439944121a7c26e439713b873af8b2
Author: Taehee Yoo <ap420073@gmail.com>
Date:   Mon Jun 11 22:16:33 2018 +0900

    netfilter: nf_tables: use WARN_ON_ONCE instead of BUG_ON in nft_do_chain()
    
    commit adc972c5b88829d38ede08b1069718661c7330ae upstream.
    
    When depth of chain is bigger than NFT_JUMP_STACK_SIZE, the nft_do_chain
    crashes. But there is no need to crash hard here.
    
    Suggested-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Taehee Yoo <ap420073@gmail.com>
    Acked-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5acd64888e020f0ce758fa14e65a75692dcc6e37
Author: Vincent Bernat <vincent@bernat.im>
Date:   Sun May 20 13:03:38 2018 +0200

    netfilter: ip6t_rpfilter: provide input interface for route lookup
    
    commit cede24d1b21d68d84ac5a36c44f7d37daadcc258 upstream.
    
    In commit 47b7e7f82802, this bit was removed at the same time the
    RT6_LOOKUP_F_IFACE flag was removed. However, it is needed when
    link-local addresses are used, which is a very common case: when
    packets are routed, neighbor solicitations are done using link-local
    addresses. For example, the following neighbor solicitation is not
    matched by "-m rpfilter":
    
        IP6 fe80::5254:33ff:fe00:1 > ff02::1:ff00:3: ICMP6, neighbor
        solicitation, who has 2001:db8::5254:33ff:fe00:3, length 32
    
    Commit 47b7e7f82802 doesn't quite explain why we shouldn't use
    RT6_LOOKUP_F_IFACE in the rpfilter case. I suppose the interface check
    later in the function would make it redundant. However, the remaining
    of the routing code is using RT6_LOOKUP_F_IFACE when there is no
    source address (which matches rpfilter's case with a non-unicast
    destination, like with neighbor solicitation).
    
    Signed-off-by: Vincent Bernat <vincent@bernat.im>
    Fixes: 47b7e7f82802 ("netfilter: don't set F_IFACE on ipv6 fib lookups")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3f8e85fbbaa55c9981e27ae9e5182569b393189b
Author: Florian Westphal <fw@strlen.de>
Date:   Thu Feb 15 00:23:05 2018 +0100

    netfilter: don't set F_IFACE on ipv6 fib lookups
    
    commit 47b7e7f82802dced3ac73658bf4b77584a63063f upstream.
    
    "fib" starts to behave strangely when an ipv6 default route is
    added - the FIB lookup returns a route using 'oif' in this case.
    
    This behaviour was inherited from ip6tables rpfilter so change
    this as well.
    
    Bugzilla: https://bugzilla.netfilter.org/show_bug.cgi?id=1221
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2fc45ef962879d29f9567202e3a183fab5a7fd37
Author: NeilBrown <neilb@suse.com>
Date:   Thu Oct 19 12:49:15 2017 +1100

    md: remove special meaning of ->quiesce(.., 2)
    
    commit b03e0ccb5ab9df3efbe51c87843a1ffbecbafa1f upstream.
    
    The '2' argument means "wake up anything that is waiting".
    This is an inelegant part of the design and was added
    to help support management of suspend_lo/suspend_hi setting.
    Now that suspend_lo/hi is managed in mddev_suspend/resume,
    that need is gone.
    These is still a couple of places where we call 'quiesce'
    with an argument of '2', but they can safely be changed to
    call ->quiesce(.., 1); ->quiesce(.., 0) which
    achieve the same result at the small cost of pausing IO
    briefly.
    
    This removes a small "optimization" from suspend_{hi,lo}_store,
    but it isn't clear that optimization served a useful purpose.
    The code now is a lot clearer.
    
    Suggested-by: Shaohua Li <shli@kernel.org>
    Signed-off-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Shaohua Li <shli@fb.com>
    Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ce57466d323b224bc817bbb07791b4ca111bd53e
Author: NeilBrown <neilb@suse.com>
Date:   Tue Oct 17 13:46:43 2017 +1100

    md: allow metadata update while suspending.
    
    commit 35bfc52187f6df8779d0f1cebdb52b7f797baf4e upstream.
    
    There are various deadlocks that can occur
    when a thread holds reconfig_mutex and calls
    ->quiesce(mddev, 1).
    As some write request block waiting for
    metadata to be updated (e.g. to record device
    failure), and as the md thread updates the metadata
    while the reconfig mutex is held, holding the mutex
    can stop write requests completing, and this prevents
    ->quiesce(mddev, 1) from completing.
    
    ->quiesce() is now usually called from mddev_suspend(),
    and it is always called with reconfig_mutex held.  So
    at this time it is safe for the thread to update metadata
    without explicitly taking the lock.
    
    So add 2 new flags, one which says the unlocked updates is
    allowed, and one which ways it is happening.  Then allow it
    while the quiesce completes, and then wait for it to finish.
    
    Reported-and-tested-by: Xiao Ni <xni@redhat.com>
    Signed-off-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Shaohua Li <shli@fb.com>
    Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7c435e22453038ea29e6467be9afe05225d53de2
Author: NeilBrown <neilb@suse.com>
Date:   Tue Oct 17 13:46:43 2017 +1100

    md: use mddev_suspend/resume instead of ->quiesce()
    
    commit 9e1cc0a54556a6c63dc0cfb7cd7d60d43337bba6 upstream.
    
    mddev_suspend() is a more general interface than
    calling ->quiesce() and is so more extensible.  A
    future patch will make use of this.
    
    Signed-off-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Shaohua Li <shli@fb.com>
    Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit feabea21655961e6b0f87ad7351a4f99515c6b09
Author: NeilBrown <neilb@suse.com>
Date:   Tue Oct 17 13:46:43 2017 +1100

    md: move suspend_hi/lo handling into core md code
    
    commit b3143b9a38d5039bcd1f2d1c94039651bfba8043 upstream.
    
    responding to ->suspend_lo and ->suspend_hi is similar
    to responding to ->suspended.  It is best to wait in
    the common core code without incrementing ->active_io.
    This allows mddev_suspend()/mddev_resume() to work while
    requests are waiting for suspend_lo/hi to change.
    This is will be important after a subsequent patch
    which uses mddev_suspend() to synchronize updating for
    suspend_lo/hi.
    
    So move the code for testing suspend_lo/hi out of raid1.c
    and raid5.c, and place it in md.c
    
    Signed-off-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Shaohua Li <shli@fb.com>
    Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit cc091f3fbbdb117d819536d6249e34322f991899
Author: NeilBrown <neilb@suse.com>
Date:   Tue Oct 17 13:46:43 2017 +1100

    md: don't call bitmap_create() while array is quiesced.
    
    commit 52a0d49de3d592a3118e13f35985e3d99eaf43df upstream.
    
    bitmap_create() allocates memory with GFP_KERNEL and
    so can wait for IO.
    If called while the array is quiesced, it could wait indefinitely
    for write out to the array - deadlock.
    So call bitmap_create() before quiescing the array.
    
    Signed-off-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Shaohua Li <shli@fb.com>
    Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e44e4cf3a8dbfee3f6e078f254c26e5a5168c6a2
Author: NeilBrown <neilb@suse.com>
Date:   Thu Oct 19 12:17:16 2017 +1100

    md: always hold reconfig_mutex when calling mddev_suspend()
    
    commit 4d5324f760aacaefeb721b172aa14bf66045c332 upstream.
    
    Most often mddev_suspend() is called with
    reconfig_mutex held.  Make this a requirement in
    preparation a subsequent patch.  Also require
    reconfig_mutex to be held for mddev_resume(),
    partly for symmetry and partly to guarantee
    no races with incr/decr of mddev->suspend.
    
    Taking the mutex in r5c_disable_writeback_async() is
    a little tricky as this is called from a work queue
    via log->disable_writeback_work, and flush_work()
    is called on that while holding ->reconfig_mutex.
    If the work item hasn't run before flush_work()
    is called, the work function will not be able to
    get the mutex.
    
    So we use mddev_trylock() inside the wait_event() call, and have that
    abort when conf->log is set to NULL, which happens before
    flush_work() is called.
    We wait in mddev->sb_wait and ensure this is woken
    when any of the conditions change.  This requires
    waking mddev->sb_wait in mddev_unlock().  This is only
    like to trigger extra wake_ups of threads that needn't
    be woken when metadata is being written, and that
    doesn't happen often enough that the cost would be
    noticeable.
    
    Signed-off-by: NeilBrown <neilb@suse.com>
    Signed-off-by: Shaohua Li <shli@fb.com>
    Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b8d8cde449fd51db0bb407dece03d36ced1acb83
Author: Taehee Yoo <ap420073@gmail.com>
Date:   Tue May 29 01:13:45 2018 +0900

    netfilter: nf_tables: fix NULL-ptr in nf_tables_dump_obj()
    
    commit 360cc79d9d299ce297b205508276285ceffc5fa8 upstream.
    
    The table field in nft_obj_filter is not an array. In order to check
    tablename, we should check if the pointer is set.
    
    Test commands:
    
       %nft add table ip filter
       %nft add counter ip filter ct1
       %nft reset counters
    
    Splat looks like:
    
    [  306.510504] kasan: CONFIG_KASAN_INLINE enabled
    [  306.516184] kasan: GPF could be caused by NULL-ptr deref or user memory access
    [  306.524775] general protection fault: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
    [  306.528284] Modules linked in: nft_objref nft_counter nf_tables nfnetlink ip_tables x_tables
    [  306.528284] CPU: 0 PID: 1488 Comm: nft Not tainted 4.17.0-rc4+ #17
    [  306.528284] Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 07/08/2015
    [  306.528284] RIP: 0010:nf_tables_dump_obj+0x52c/0xa70 [nf_tables]
    [  306.528284] RSP: 0018:ffff8800b6cb7520 EFLAGS: 00010246
    [  306.528284] RAX: 0000000000000000 RBX: ffff8800b6c49820 RCX: 0000000000000000
    [  306.528284] RDX: 0000000000000000 RSI: dffffc0000000000 RDI: ffffed0016d96e9a
    [  306.528284] RBP: ffff8800b6cb75c0 R08: ffffed00236fce7c R09: ffffed00236fce7b
    [  306.528284] R10: ffffffff9f6241e8 R11: ffffed00236fce7c R12: ffff880111365108
    [  306.528284] R13: 0000000000000000 R14: ffff8800b6c49860 R15: ffff8800b6c49860
    [  306.528284] FS:  00007f838b007700(0000) GS:ffff88011b600000(0000) knlGS:0000000000000000
    [  306.528284] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  306.528284] CR2: 00007ffeafabcf78 CR3: 00000000b6cbe000 CR4: 00000000001006f0
    [  306.528284] Call Trace:
    [  306.528284]  netlink_dump+0x470/0xa20
    [  306.528284]  __netlink_dump_start+0x5ae/0x690
    [  306.528284]  ? nf_tables_getobj+0x1b3/0x740 [nf_tables]
    [  306.528284]  nf_tables_getobj+0x2f5/0x740 [nf_tables]
    [  306.528284]  ? nft_obj_notify+0x100/0x100 [nf_tables]
    [  306.528284]  ? nf_tables_getobj+0x740/0x740 [nf_tables]
    [  306.528284]  ? nf_tables_dump_flowtable_done+0x70/0x70 [nf_tables]
    [  306.528284]  ? nft_obj_notify+0x100/0x100 [nf_tables]
    [  306.528284]  nfnetlink_rcv_msg+0x8ff/0x932 [nfnetlink]
    [  306.528284]  ? nfnetlink_rcv_msg+0x216/0x932 [nfnetlink]
    [  306.528284]  netlink_rcv_skb+0x1c9/0x2f0
    [  306.528284]  ? nfnetlink_bind+0x1d0/0x1d0 [nfnetlink]
    [  306.528284]  ? debug_check_no_locks_freed+0x270/0x270
    [  306.528284]  ? netlink_ack+0x7a0/0x7a0
    [  306.528284]  ? ns_capable_common+0x6e/0x110
    [ ... ]
    
    Fixes: e46abbcc05aa8 ("netfilter: nf_tables: Allow table names of up to 255 chars")
    Signed-off-by: Taehee Yoo <ap420073@gmail.com>
    Acked-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 44956f98fd8b4f235f8f40a367955f55f0477b37
Author: Florian Westphal <fw@strlen.de>
Date:   Tue Mar 20 15:25:37 2018 +0100

    netfilter: nf_tables: add missing netlink attrs to policies
    
    commit 467697d289e7e6e1b15910d99096c0da08c56d5b upstream.
    
    Fixes: 8aeff920dcc9 ("netfilter: nf_tables: add stateful object reference to set elements")
    Fixes: f25ad2e907f1 ("netfilter: nf_tables: prepare for expressions associated to set elements")
    Fixes: 1a94e38d254b ("netfilter: nf_tables: add NFTA_RULE_ID attribute")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 082711fa317845b535faa0aeea7ee3ff82a08301
Author: Colin Ian King <colin.king@canonical.com>
Date:   Wed May 9 13:22:56 2018 +0100

    netfilter: nf_tables: fix memory leak on error exit return
    
    commit f0dfd7a2b35b02030949100247d851b793cb275f upstream.
    
    Currently the -EBUSY error return path is not free'ing resources
    allocated earlier, leaving a memory leak. Fix this by exiting via the
    error exit label err5 that performs the necessary resource clean
    up.
    
    Detected by CoverityScan, CID#1432975 ("Resource leak")
    
    Fixes: 9744a6fcefcb ("netfilter: nf_tables: check if same extensions are set when adding elements")
    Signed-off-by: Colin Ian King <colin.king@canonical.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 174757e28b7bc261f8ddd12467786f286717a108
Author: Taehee Yoo <ap420073@gmail.com>
Date:   Tue May 29 01:14:12 2018 +0900

    netfilter: nf_tables: increase nft_counters_enabled in nft_chain_stats_replace()
    
    commit bbb8c61f97e3a2dd91b30d3e57b7964a67569d11 upstream.
    
    When a chain is updated, a counter can be attached. if so,
    the nft_counters_enabled should be increased.
    
    test commands:
    
       %nft add table ip filter
       %nft add chain ip filter input { type filter hook input priority 4\; }
       %iptables-compat -Z input
       %nft delete chain ip filter input
    
    we can see below messages.
    
    [  286.443720] jump label: negative count!
    [  286.448278] WARNING: CPU: 0 PID: 1459 at kernel/jump_label.c:197 __static_key_slow_dec_cpuslocked+0x6f/0xf0
    [  286.449144] Modules linked in: nf_tables nfnetlink ip_tables x_tables
    [  286.449144] CPU: 0 PID: 1459 Comm: nft Tainted: G        W         4.17.0-rc2+ #12
    [  286.449144] RIP: 0010:__static_key_slow_dec_cpuslocked+0x6f/0xf0
    [  286.449144] RSP: 0018:ffff88010e5176f0 EFLAGS: 00010286
    [  286.449144] RAX: 000000000000001b RBX: ffffffffc0179500 RCX: ffffffffb8a82522
    [  286.449144] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff88011b7e5eac
    [  286.449144] RBP: 0000000000000000 R08: ffffed00236fce5c R09: ffffed00236fce5b
    [  286.449144] R10: ffffffffc0179503 R11: ffffed00236fce5c R12: 0000000000000000
    [  286.449144] R13: ffff88011a28e448 R14: ffff88011a28e470 R15: dffffc0000000000
    [  286.449144] FS:  00007f0384328700(0000) GS:ffff88011b600000(0000) knlGS:0000000000000000
    [  286.449144] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [  286.449144] CR2: 00007f038394bf10 CR3: 0000000104a86000 CR4: 00000000001006f0
    [  286.449144] Call Trace:
    [  286.449144]  static_key_slow_dec+0x6a/0x70
    [  286.449144]  nf_tables_chain_destroy+0x19d/0x210 [nf_tables]
    [  286.449144]  nf_tables_commit+0x1891/0x1c50 [nf_tables]
    [  286.449144]  nfnetlink_rcv+0x1148/0x13d0 [nfnetlink]
    [ ... ]
    
    Signed-off-by: Taehee Yoo <ap420073@gmail.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d3a9b8a511812fce32be5253e8ef2a3d54b34b4d
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Sun May 27 21:08:13 2018 +0200

    netfilter: nf_tables: disable preemption in nft_update_chain_stats()
    
    commit ad9d9e85072b668731f356be0a3750a3ba22a607 upstream.
    
    This patch fixes the following splat.
    
    [118709.054937] BUG: using smp_processor_id() in preemptible [00000000] code: test/1571
    [118709.054970] caller is nft_update_chain_stats.isra.4+0x53/0x97 [nf_tables]
    [118709.054980] CPU: 2 PID: 1571 Comm: test Not tainted 4.17.0-rc6+ #335
    [...]
    [118709.054992] Call Trace:
    [118709.055011]  dump_stack+0x5f/0x86
    [118709.055026]  check_preemption_disabled+0xd4/0xe4
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 491b1a866e4ad2f5b6f5d60a23e16ae77ec37d5c
Author: Taehee Yoo <ap420073@gmail.com>
Date:   Thu May 17 22:49:49 2018 +0900

    netfilter: nft_meta: fix wrong value dereference in nft_meta_set_eval
    
    commit 97a0549b15a0b466c47f6a0143a490a082c64b4e upstream.
    
    In the nft_meta_set_eval, nftrace value is dereferenced as u32 from sreg.
    But correct type is u8. so that sometimes incorrect value is dereferenced.
    
    Steps to reproduce:
    
       %nft add table ip filter
       %nft add chain ip filter input { type filter hook input priority 4\; }
       %nft add rule ip filter input nftrace set 0
       %nft monitor
    
    Sometimes, we can see trace messages.
    
       trace id 16767227 ip filter input packet: iif "enp2s0"
       ether saddr xx:xx:xx:xx:xx:xx ether daddr xx:xx:xx:xx:xx:xx
       ip saddr 192.168.0.1 ip daddr 255.255.255.255 ip dscp cs0
       ip ecn not-ect ip
       trace id 16767227 ip filter input rule nftrace set 0 (verdict continue)
       trace id 16767227 ip filter input verdict continue
       trace id 16767227 ip filter input
    
    Signed-off-by: Taehee Yoo <ap420073@gmail.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2b93cb2861dedfc43d7eb82c37c4eafbc385fef8
Author: Pablo Neira Ayuso <pablo@netfilter.org>
Date:   Tue May 8 02:43:57 2018 +0200

    netfilter: nf_tables: bogus EBUSY in chain deletions
    
    commit bb7b40aecbf778c0c83a5bd62b0f03ca9f49a618 upstream.
    
    When removing a rule that jumps to chain and such chain in the same
    batch, this bogusly hits EBUSY. Add activate and deactivate operations
    to expression that can be called from the preparation and the
    commit/abort phases.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4ae6a7afae5362289cc99aa80f7d6229521888c3
Author: Florian Westphal <fw@strlen.de>
Date:   Sun May 6 00:47:20 2018 +0200

    netfilter: nf_tables: don't assume chain stats are set when jumplabel is set
    
    commit 009240940e84c1c089af88b454f7e804a4c5bd1b upstream.
    
    nft_chain_stats_replace() and all other spots assume ->stats can be
    NULL, but nft_update_chain_stats does not.  It must do this check,
    just because the jump label is set doesn't mean all basechains have stats
    assigned.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 365e73e07fba4c343510adf49d18cb2b97337df8
Author: Florian Westphal <fw@strlen.de>
Date:   Mon May 7 15:22:36 2018 +0200

    netfilter: nft_compat: fix handling of large matchinfo size
    
    commit 732a8049f365f514d0607e03938491bf6cb0d620 upstream.
    
    currently matchinfo gets stored in the expression, but some xt matches
    are very large.
    
    To handle those we either need to switch nft core to kvmalloc and increase
    size limit, or allocate the info blob of large matches separately.
    
    This does the latter, this limits the scope of the changes to
    nft_compat.
    
    I picked a threshold of 192, this allows most matches to work as before and
    handle only few ones via separate alloation (cgroup, u32, sctp, rt).
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ea200cdd605662de24f7cd92e03aa6a335e0b4da
Author: Florian Westphal <fw@strlen.de>
Date:   Mon May 7 15:22:35 2018 +0200

    netfilter: nft_compat: prepare for indirect info storage
    
    commit 8bdf164744b2c7f63561846c01cff3db597f282d upstream.
    
    Next patch will make it possible for *info to be stored in
    a separate allocation instead of the expr private area.
    
    This removes the 'expr priv area is info blob' assumption
    from the match init/destroy/eval functions.
    
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1ea5ed0cadcae75f733d7bd870fea90d05f42528
Author: Florian Westphal <fw@strlen.de>
Date:   Wed May 2 14:07:42 2018 +0200

    netfilter: nf_tables: nft_compat: fix refcount leak on xt module
    
    commit b8e9dc1c75714ceb53615743e1036f76e00f5a17 upstream.
    
    Taehee Yoo reported following bug:
        iptables-compat -I OUTPUT -m cpu --cpu 0
        iptables-compat -F
        lsmod |grep xt_cpu
        xt_cpu                 16384  1
    
    Quote:
    "When above command is given, a netlink message has two expressions that
    are the cpu compat and the nft_counter.
    The nft_expr_type_get() in the nf_tables_expr_parse() successes
    first expression then, calls select_ops callback.
    (allocates memory and holds module)
    But, second nft_expr_type_get() in the nf_tables_expr_parse()
    returns -EAGAIN because of request_module().
    In that point, by the 'goto err1',
    the 'module_put(info[i].ops->type->owner)' is called.
    There is no release routine."
    
    The core problem is that unlike all other expression,
    nft_compat select_ops has side effects.
    
    1. it allocates dynamic memory which holds an nft ops struct.
       In all other expressions, ops has static storage duration.
    2. It grabs references to the xt module that it is supposed to
       invoke.
    
    Depending on where things go wrong, error unwinding doesn't
    always do the right thing.
    
    In the above scenario, a new nft_compat_expr is created and
    xt_cpu module gets loaded with a refcount of 1.
    
    Due to to -EAGAIN, the netlink messages get re-parsed.
    When that happens, nft_compat finds that xt_cpu is already present
    and increments module refcount again.
    
    This fixes the problem by making select_ops to have no visible
    side effects and removes all extra module_get/put.
    
    When select_ops creates a new nft_compat expression, the new
    expression has a refcount of 0, and the xt module gets its refcount
    incremented.
    
    When error happens, the next call finds existing entry, but will no
    longer increase the reference count -- the presence of existing
    nft_xt means we already hold a module reference.
    
    Because nft_xt_put is only called from nft_compat destroy hook,
    it will never see the initial zero reference count.
    ->destroy can only be called after ->init(), and that will increase the
    refcount.
    
    Lastly, we now free nft_xt struct with kfree_rcu.
    Else, we get use-after free in nf_tables_rule_destroy:
    
      while (expr != nft_expr_last(rule) && expr->ops) {
        nf_tables_expr_destroy(ctx, expr);
        expr = nft_expr_next(expr); // here
    
    nft_expr_next() dereferences expr->ops. This is safe
    for all users, as ops have static storage duration.
    In nft_compat case however, its ->destroy callback can
    free the memory that hold the ops structure.
    
    Tested-by: Taehee Yoo <ap420073@gmail.com>
    Reported-by: Taehee Yoo <ap420073@gmail.com>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1d795d1241d3269bd44d4ef8cfb4da3480ab744c
Author: Kenneth Graunke <kenneth@whitecape.org>
Date:   Fri Jun 15 20:06:05 2018 +0100

    drm/i915: Enable provoking vertex fix on Gen9 systems.
    
    commit 7a3727f385dc64773db1c144f6b15c1e9d4735bb upstream.
    
    The SF and clipper units mishandle the provoking vertex in some cases,
    which can cause misrendering with shaders that use flat shaded inputs.
    
    There are chicken bits in 3D_CHICKEN3 (for SF) and FF_SLICE_CHICKEN
    (for the clipper) that work around the issue.  These registers are
    unfortunately not part of the logical context (even the power context),
    and so we must reload them every time we start executing in a context.
    
    Bugzilla: https://bugs.freedesktop.org/103047
    Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180615190605.16238-1-chris@chris-wilson.co.uk
    Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
    Cc: stable@vger.kernel.org
    (cherry picked from commit b77422f80337d363eed60c8c48db9cb6e33085c9)
    Signed-off-by: Jani Nikula <jani.nikula@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 78e7000fe63f32058e913daf0c9fa2cff23ea206
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Jun 12 12:07:33 2018 +0200

    drm/amdgpu: Refactor amdgpu_vram_mgr_bo_invisible_size helper
    
    commit 5e9244ff585239630f15f8ad8e676bc91a94ca9e upstream.
    
    Preparation for the following fix, no functional change intended.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a1bf87cfb6ea83a262d218b2bc123a11b949caaa
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Fri Jun 8 12:58:15 2018 +0200

    drm/amdgpu: Use kvmalloc_array for allocating VRAM manager nodes array
    
    commit 6fa39bc1e01dab8b4f54b23e95a181a2ed5a2d38 upstream.
    
    It can be quite big, and there's no need for it to be physically
    contiguous. This is less likely to fail under memory pressure (has
    actually happened while running piglit).
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit af597bb61370e337eec93ae655625d3dbd1fc0bb
Author: Stefan Agner <stefan@agner.ch>
Date:   Sun Jun 17 10:48:22 2018 +0200

    drm/atmel-hlcdc: check stride values in the first plane
    
    commit 9fcf2b3c1c0276650fea537c71b513d27d929b05 upstream.
    
    The statement always evaluates to true since the struct fields
    are arrays. This has shown up as a warning when compiling with
    clang:
      warning: address of array 'desc->layout.xstride' will always
          evaluate to 'true' [-Wpointer-bool-conversion]
    
    Check for values in the first plane instead.
    
    Fixes: 1a396789f65a ("drm: add Atmel HLCDC Display Controller support")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Stefan Agner <stefan@agner.ch>
    Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20180617084826.31885-1-stefan@agner.ch
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7d0ed747bc56ca05868423220c62e64ea525aad7
Author: Jeremy Cline <jcline@redhat.com>
Date:   Fri Jun 1 16:05:32 2018 -0400

    drm/qxl: Call qxl_bo_unref outside atomic context
    
    commit 889ad63d41eea20184b0483e7e585e5b20fb6cfe upstream.
    
    "qxl_bo_unref" may sleep, but calling "qxl_release_map" causes
    "preempt_disable()" to be called and "preempt_enable()" isn't called
    until "qxl_release_unmap" is used. Move the call to "qxl_bo_unref" out
    from in between the two to avoid sleeping from an atomic context.
    
    This issue can be demonstrated on a kernel with CONFIG_LOCKDEP=y by
    creating a VM using QXL, using a desktop environment using Xorg, then
    moving the cursor on or off a window.
    
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1571128
    Fixes: 9428088c90b6 ("drm/qxl: reapply cursor after resetting primary")
    Cc: stable@vger.kernel.org
    Signed-off-by: Jeremy Cline <jcline@redhat.com>
    Link: http://patchwork.freedesktop.org/patch/msgid/20180601200532.13619-1-jcline@redhat.com
    Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit dd19ea36f5963a7160dbc4526455d2fb4d9cb516
Author: Huang Rui <ray.huang@amd.com>
Date:   Wed May 23 11:18:43 2018 +0800

    drm/amdgpu: fix the missed vcn fw version report
    
    commit a0b2ac29415bb44d1c212184c1385a1abe68db5c upstream.
    
    It missed vcn.fw_version setting when init vcn microcode, and it will be used to
    report vcn ucode version via amdgpu_firmware_info sysfs interface.
    
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Reviewed-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 40e2064b8fc7025cf6def10ffc5d4ebc5dc8837e
Author: Rex Zhu <Rex.Zhu@amd.com>
Date:   Tue Apr 10 17:49:56 2018 +0800

    drm/amdgpu: Add APU support in vi_set_vce_clocks
    
    commit 08ebb6e9f4fd7098c28e0ebbb42847cf0488ebb8 upstream.
    
    1. fix set vce clocks failed on Cz/St
       which lead 1s delay when boot up.
    2. remove the workaround in vce_v3_0.c
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Huang Rui <ray.huang@amd.com>
    Acked-by: Christian König <christian.koenig@amd.com>
    Acked-by: Shirish S <shirish.s@amd.com>
    Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ce686c42476ec140756d3f1f16cfe8251f8d7520
Author: Rex Zhu <Rex.Zhu@amd.com>
Date:   Tue Apr 10 17:17:22 2018 +0800

    drm/amdgpu: Add APU support in vi_set_uvd_clocks
    
    commit 819a23f83e3b2513cffbef418458a47ca02c36b3 upstream.
    
    fix the issue set uvd clock failed on CZ/ST
    which lead 1s delay when boot up.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
    Reviewed-by: Huang Rui <ray.huang@amd.com>
    Acked-by: Christian König <christian.koenig@amd.com>
    Acked-by: Shirish S <shirish.s@amd.com>
    Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b141de45e2dc73d6997e6bf7b8347b688bc7c5f7
Author: Alexander Potapenko <glider@google.com>
Date:   Thu Jun 14 12:23:09 2018 +0200

    vt: prevent leaking uninitialized data to userspace via /dev/vcs*
    
    commit 21eff69aaaa0e766ca0ce445b477698dc6a9f55a upstream.
    
    KMSAN reported an infoleak when reading from /dev/vcs*:
    
      BUG: KMSAN: kernel-infoleak in vcs_read+0x18ba/0x1cc0
      Call Trace:
      ...
       kmsan_copy_to_user+0x7a/0x160 mm/kmsan/kmsan.c:1253
       copy_to_user ./include/linux/uaccess.h:184
       vcs_read+0x18ba/0x1cc0 drivers/tty/vt/vc_screen.c:352
       __vfs_read+0x1b2/0x9d0 fs/read_write.c:416
       vfs_read+0x36c/0x6b0 fs/read_write.c:452
      ...
      Uninit was created at:
       kmsan_save_stack_with_flags mm/kmsan/kmsan.c:279
       kmsan_internal_poison_shadow+0xb8/0x1b0 mm/kmsan/kmsan.c:189
       kmsan_kmalloc+0x94/0x100 mm/kmsan/kmsan.c:315
       __kmalloc+0x13a/0x350 mm/slub.c:3818
       kmalloc ./include/linux/slab.h:517
       vc_allocate+0x438/0x800 drivers/tty/vt/vt.c:787
       con_install+0x8c/0x640 drivers/tty/vt/vt.c:2880
       tty_driver_install_tty drivers/tty/tty_io.c:1224
       tty_init_dev+0x1b5/0x1020 drivers/tty/tty_io.c:1324
       tty_open_by_driver drivers/tty/tty_io.c:1959
       tty_open+0x17b4/0x2ed0 drivers/tty/tty_io.c:2007
       chrdev_open+0xc25/0xd90 fs/char_dev.c:417
       do_dentry_open+0xccc/0x1440 fs/open.c:794
       vfs_open+0x1b6/0x2f0 fs/open.c:908
      ...
      Bytes 0-79 of 240 are uninitialized
    
    Consistently allocating |vc_screenbuf| with kzalloc() fixes the problem
    
    Reported-by: syzbot+17a8efdf800000@syzkaller.appspotmail.com
    Signed-off-by: Alexander Potapenko <glider@google.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b124a1c182fa933f579281cc650f60ac47c7026d
Author: Johan Hovold <johan@kernel.org>
Date:   Wed Jun 13 17:08:59 2018 +0200

    serdev: fix memleak on module unload
    
    commit bc6cf3669d22371f573ab0305b3abf13887c0786 upstream.
    
    Make sure to free all resources associated with the ida on module
    exit.
    
    Fixes: cd6484e1830b ("serdev: Introduce new bus for serial attached devices")
    Cc: stable <stable@vger.kernel.org>     # 4.11
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3ff8e558ba7b6f7fce1ea627c797dc03240bc40f
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Wed Jun 6 21:00:41 2018 +0300

    serial: 8250_pci: Remove stalled entries in blacklist
    
    commit 20dcff436e9fcd2e106b0ccc48a52206bc176d70 upstream.
    
    After the commit
    
      7d8905d06405 ("serial: 8250_pci: Enable device after we check black list")
    
    pure serial multi-port cards, such as CH355, got blacklisted and thus
    not being enumerated anymore. Previously, it seems, blacklisting them
    was on purpose to shut up pciserial_init_one() about record duplication.
    
    So, remove the entries from blacklist in order to get cards enumerated.
    
    Fixes: 7d8905d06405 ("serial: 8250_pci: Enable device after we check black list")
    Reported-by: Matt Turner <mattst88@gmail.com>
    Cc: Sergej Pupykin <ml@sergej.pp.ru>
    Cc: Alexandr Petrenko <petrenkoas83@gmail.com>
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Reviewed-and-Tested-by: Matt Turner <mattst88@gmail.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2a7a8556b3b4d56e60b7e2edc57754e701ddb788
Author: Laura Abbott <labbott@redhat.com>
Date:   Mon Jun 11 11:06:53 2018 -0700

    staging: android: ion: Return an ERR_PTR in ion_map_kernel
    
    commit 0a2bc00341dcfcc793c0dbf4f8d43adf60458b05 upstream.
    
    The expected return value from ion_map_kernel is an ERR_PTR. The error
    path for a vmalloc failure currently just returns NULL, triggering
    a warning in ion_buffer_kmap_get. Encode the vmalloc failure as an ERR_PTR.
    
    Reported-by: syzbot+55b1d9f811650de944c6@syzkaller.appspotmail.com
    Signed-off-by: Laura Abbott <labbott@redhat.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit c034d161fa63f35e0107b9c03d4b3108d2401a08
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Sat May 26 09:53:14 2018 +0900

    n_tty: Access echo_* variables carefully.
    
    commit ebec3f8f5271139df618ebdf8427e24ba102ba94 upstream.
    
    syzbot is reporting stalls at __process_echoes() [1]. This is because
    since ldata->echo_commit < ldata->echo_tail becomes true for some reason,
    the discard loop is serving as almost infinite loop. This patch tries to
    avoid falling into ldata->echo_commit < ldata->echo_tail situation by
    making access to echo_* variables more carefully.
    
    Since reset_buffer_flags() is called without output_lock held, it should
    not touch echo_* variables. And omit a call to reset_buffer_flags() from
    n_tty_open() by using vzalloc().
    
    Since add_echo_byte() is called without output_lock held, it needs memory
    barrier between storing into echo_buf[] and incrementing echo_head counter.
    echo_buf() needs corresponding memory barrier before reading echo_buf[].
    Lack of handling the possibility of not-yet-stored multi-byte operation
    might be the reason of falling into ldata->echo_commit < ldata->echo_tail
    situation, for if I do WARN_ON(ldata->echo_commit == tail + 1) prior to
    echo_buf(ldata, tail + 1), the WARN_ON() fires.
    
    Also, explicitly masking with buffer for the former "while" loop, and
    use ldata->echo_commit > tail for the latter "while" loop.
    
    [1] https://syzkaller.appspot.com/bug?id=17f23b094cd80df750e5b0f8982c521ee6bcbf40
    
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Reported-by: syzbot <syzbot+108696293d7a21ab688f@syzkaller.appspotmail.com>
    Cc: Peter Hurley <peter@hurleysoftware.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d105fb8c88940765d9555ec921ea2e1267286628
Author: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Date:   Sat May 26 09:53:13 2018 +0900

    n_tty: Fix stall at n_tty_receive_char_special().
    
    commit 3d63b7e4ae0dc5e02d28ddd2fa1f945defc68d81 upstream.
    
    syzbot is reporting stalls at n_tty_receive_char_special() [1]. This is
    because comparison is not working as expected since ldata->read_head can
    change at any moment. Mitigate this by explicitly masking with buffer size
    when checking condition for "while" loops.
    
    [1] https://syzkaller.appspot.com/bug?id=3d7481a346958d9469bebbeb0537d5f056bdd6e8
    
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Reported-by: syzbot <syzbot+18df353d7540aa6b5467@syzkaller.appspotmail.com>
    Fixes: bc5a5e3f45d04784 ("n_tty: Don't wrap input buffer indices at buffer size")
    Cc: stable <stable@vger.kernel.org>
    Cc: Peter Hurley <peter@hurleysoftware.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 716382f1c1eaca706ab694a61215b5e3416a0ea6
Author: Zhengjun Xing <zhengjun.xing@linux.intel.com>
Date:   Thu Jun 21 16:19:42 2018 +0300

    xhci: Fix kernel oops in trace_xhci_free_virt_device
    
    commit d850c1658328e757635a46763783c6fd56390dcb upstream.
    
    commit 44a182b9d177 ("xhci: Fix use-after-free in xhci_free_virt_device")
    set dev->udev pointer to NULL in xhci_free_dev(), it will cause kernel
    panic in trace_xhci_free_virt_device. This patch reimplement the trace
    function trace_xhci_free_virt_device, remove dev->udev dereference and
    added more useful parameters to show in the trace function,it also makes
    sure dev->udev is not NULL before calling trace_xhci_free_virt_device.
    This issue happened when xhci-hcd trace is enabled and USB devices hot
    plug test. Original use-after-free patch went to stable so this needs so
    be applied there as well.
    
    [ 1092.022457] usb 2-4: USB disconnect, device number 6
    [ 1092.092772] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
    [ 1092.101694] PGD 0 P4D 0
    [ 1092.104601] Oops: 0000 [#1] SMP
    [ 1092.207734] Workqueue: usb_hub_wq hub_event
    [ 1092.212507] RIP: 0010:trace_event_raw_event_xhci_log_virt_dev+0x6c/0xf0
    [ 1092.220050] RSP: 0018:ffff8c252e883d28 EFLAGS: 00010086
    [ 1092.226024] RAX: ffff8c24af86fa84 RBX: 0000000000000003 RCX: ffff8c25255c2a01
    [ 1092.234130] RDX: 0000000000000000 RSI: 00000000aef55009 RDI: ffff8c252e883d28
    [ 1092.242242] RBP: ffff8c252550e2c0 R08: ffff8c24af86fa84 R09: 0000000000000a70
    [ 1092.250364] R10: 0000000000000a70 R11: 0000000000000000 R12: ffff8c251f21a000
    [ 1092.258468] R13: 000000000000000c R14: ffff8c251f21a000 R15: ffff8c251f432f60
    [ 1092.266572] FS:  0000000000000000(0000) GS:ffff8c252e880000(0000) knlGS:0000000000000000
    [ 1092.275757] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 1092.282281] CR2: 0000000000000000 CR3: 0000000154209001 CR4: 00000000003606e0
    [ 1092.290384] Call Trace:
    [ 1092.293156]  <IRQ>
    [ 1092.295439]  xhci_free_virt_device.part.34+0x182/0x1a0
    [ 1092.301288]  handle_cmd_completion+0x7ac/0xfa0
    [ 1092.306336]  ? trace_event_raw_event_xhci_log_trb+0x6e/0xa0
    [ 1092.312661]  xhci_irq+0x3e8/0x1f60
    [ 1092.316524]  __handle_irq_event_percpu+0x75/0x180
    [ 1092.321876]  handle_irq_event_percpu+0x20/0x50
    [ 1092.326922]  handle_irq_event+0x36/0x60
    [ 1092.331273]  handle_edge_irq+0x6d/0x180
    [ 1092.335644]  handle_irq+0x16/0x20
    [ 1092.339417]  do_IRQ+0x41/0xc0
    [ 1092.342782]  common_interrupt+0xf/0xf
    [ 1092.346955]  </IRQ>
    
    Fixes: 44a182b9d177 ("xhci: Fix use-after-free in xhci_free_virt_device")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Zhengjun Xing <zhengjun.xing@linux.intel.com>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0a7db82ed9ccbf6a85f4269a454e06e438b41b99
Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date:   Thu Jun 21 16:43:19 2018 +0300

    usb: typec: ucsi: Fix for incorrect status data issue
    
    commit 68816e16b4789f2d05e77b6dcb77564cf5d6a8d8 upstream.
    
    According to UCSI Specification, Connector Change Event only
    means a change in the Connector Status and Operation Mode
    fields of the STATUS data structure. So any other change
    should create another event.
    
    Unfortunately on some platforms the firmware acting as PPM
    (platform policy manager - usually embedded controller
    firmware) still does not report any other status changes if
    there is a connector change event. So if the connector power
    or data role was changed when a device was plugged to the
    connector, the driver does not get any indication about
    that. The port will show wrong roles if that happens.
    
    To fix the issue, always checking the data and power role
    together with a connector change event.
    
    Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 47adbb26373f2e89f8ef76524489a250e4608b04
Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date:   Thu Jun 21 16:43:18 2018 +0300

    usb: typec: ucsi: acpi: Workaround for cache mode issue
    
    commit 1f9f9d168ce619608572b01771c47a41b15429e6 upstream.
    
    This fixes an issue where the driver fails with an error:
    
            ioremap error for 0x3f799000-0x3f79a000, requested 0x2, got 0x0
    
    On some platforms the UCSI ACPI mailbox SystemMemory
    Operation Region may be setup before the driver has been
    loaded. That will lead into the driver failing to map the
    mailbox region, as it has been already marked as write-back
    memory. acpi_os_ioremap() for x86 uses ioremap_cache()
    unconditionally.
    
    When the issue happens, the embedded controller has a
    pending query event for the UCSI notification right after
    boot-up which causes the operation region to be setup before
    UCSI driver has been loaded.
    
    The fix is to notify acpi core that the driver is about to
    access memory region which potentially overlaps with an
    operation region right before mapping it.
    acpi_release_memory() will check if the memory has already
    been setup (mapped) by acpi core, and deactivate it (unmap)
    if it has. The driver is then able to map the memory with
    ioremap_nocache() and set the memtype to uncached for the
    region.
    
    Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Fixes: 8243edf44152 ("usb: typec: ucsi: Add ACPI driver")
    Cc: stable@vger.kernel.org
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f2e9a38558d8bbd670357922c3d06b845c8d92df
Author: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date:   Thu Jun 21 16:43:17 2018 +0300

    acpi: Add helper for deactivating memory region
    
    commit d2d2e3c46be5d6dd8001d0eebdf7cafb9bc7006b upstream.
    
    Sometimes memory resource may be overlapping with
    SystemMemory Operation Region by design, for example if the
    memory region is used as a mailbox for communication with a
    firmware in the system. One occasion of such mailboxes is
    USB Type-C Connector System Software Interface (UCSI).
    
    With regions like that, it is important that the driver is
    able to map the memory with the requirements it has. For
    example, the driver should be allowed to map the memory as
    non-cached memory. However, if the operation region has been
    accessed before the driver has mapped the memory, the memory
    has been marked as write-back by the time the driver is
    loaded. That means the driver will fail to map the memory
    if it expects non-cached memory.
    
    To work around the problem, introducing helper that the
    drivers can use to temporarily deactivate (unmap)
    SystemMemory Operation Regions that overlap with their
    IO memory.
    
    Fixes: 8243edf44152 ("usb: typec: ucsi: Add ACPI driver")
    Cc: stable@vger.kernel.org
    Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 447294efb995181076c2c34e9c6bee1703c74a9a
Author: William Wu <william.wu@rock-chips.com>
Date:   Mon May 21 18:12:00 2018 +0800

    usb: dwc2: fix the incorrect bitmaps for the ports of multi_tt hub
    
    commit 8760675932ddb614e83702117d36ea644050c609 upstream.
    
    The dwc2_get_ls_map() use ttport to reference into the
    bitmap if we're on a multi_tt hub. But the bitmaps index
    from 0 to (hub->maxchild - 1), while the ttport index from
    1 to hub->maxchild. This will cause invalid memory access
    when the number of ttport is hub->maxchild.
    
    Without this patch, I can easily meet a Kernel panic issue
    if connect a low-speed USB mouse with the max port of FE2.1
    multi-tt hub (1a40:0201) on rk3288 platform.
    
    Fixes: 9f9f09b048f5 ("usb: dwc2: host: Totally redo the microframe scheduler")
    Cc: <stable@vger.kernel.org>
    Reviewed-by: Douglas Anderson <dianders@chromium.org>
    Acked-by: Minas Harutyunyan hminas@synopsys.com>
    Signed-off-by: William Wu <william.wu@rock-chips.com>
    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e80add5223dda08db1e5453a0ed4bc1175f394e9
Author: Karoly Pados <pados@pados.hu>
Date:   Sat Jun 9 13:26:08 2018 +0200

    USB: serial: cp210x: add Silicon Labs IDs for Windows Update
    
    commit 2f839823382748664b643daa73f41ee0cc01ced6 upstream.
    
    Silicon Labs defines alternative VID/PID pairs for some chips that when
    used will automatically install drivers for Windows users without manual
    intervention. Unfortunately, these IDs are not recognized by the Linux
    module, so using these IDs improves user experience on one platform but
    degrades it on Linux. This patch addresses this problem.
    
    Signed-off-by: Karoly Pados <pados@pados.hu>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 15e449969537594f970c166bbe811889f2ec853b
Author: Johan Hovold <johan@kernel.org>
Date:   Mon Jun 18 10:24:03 2018 +0200

    USB: serial: cp210x: add CESINEL device ids
    
    commit 24160628a34af962ac99f2f58e547ac3c4cbd26f upstream.
    
    Add device ids for CESINEL products.
    
    Reported-by: Carlos Barcala Lara <cabl@cesinel.com>
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 874f2a7d412ef7a30179349e9dc480f0c2429289
Author: Houston Yaroschoff <hstn@4ever3.net>
Date:   Mon Jun 11 12:39:09 2018 +0200

    usb: cdc_acm: Add quirk for Uniden UBC125 scanner
    
    commit 4a762569a2722b8a48066c7bacf0e1dc67d17fa1 upstream.
    
    Uniden UBC125 radio scanner has USB interface which fails to work
    with cdc_acm driver:
      usb 1-1.5: new full-speed USB device number 4 using xhci_hcd
      cdc_acm 1-1.5:1.0: Zero length descriptor references
      cdc_acm: probe of 1-1.5:1.0 failed with error -22
    
    Adding the NO_UNION_NORMAL quirk for the device fixes the issue:
      usb 1-4: new full-speed USB device number 15 using xhci_hcd
      usb 1-4: New USB device found, idVendor=1965, idProduct=0018
      usb 1-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
      usb 1-4: Product: UBC125XLT
      usb 1-4: Manufacturer: Uniden Corp.
      usb 1-4: SerialNumber: 0001
      cdc_acm 1-4:1.0: ttyACM0: USB ACM device
    
    `lsusb -v` of the device:
    
      Bus 001 Device 015: ID 1965:0018 Uniden Corporation
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            2 Communications
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        64
        idVendor           0x1965 Uniden Corporation
        idProduct          0x0018
        bcdDevice            0.01
        iManufacturer           1 Uniden Corp.
        iProduct                2 UBC125XLT
        iSerial                 3 0001
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength           48
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          0
          bmAttributes         0x80
            (Bus Powered)
          MaxPower              500mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      0 None
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x87  EP 7 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0008  1x 8 bytes
              bInterval              10
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0040  1x 64 bytes
              bInterval               0
      Device Status:     0x0000
        (Bus Powered)
    
    Signed-off-by: Houston Yaroschoff <hstn@4ever3.net>
    Cc: stable <stable@vger.kernel.org>
    Acked-by: Oliver Neukum <oneukum@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>