commit 282aeb477a10d09cc5c4d73c54bb996964723f96
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Wed Feb 10 09:09:27 2021 +0100

    Linux 4.9.257
    
    Tested-by: Florian Fainelli <f.fainelli@gmail.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Igor Matheus Andrade Torrente <igormtorrente@gmail.com>
    Tested-by: Jason Self <jason@bluehome.net>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Tested-by: Ross Schmidt <ross.schm.dev@gmail.com>
    Link: https://lore.kernel.org/r/20210208145810.230485165@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit efb6fba8d6dea6b506e7901de1885244f8d5d9e9
Author: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
Date:   Mon Jul 3 14:13:29 2017 +0800

    ALSA: hda/realtek - Fix typo of pincfg for Dell quirk
    
    commit b4576de87243c32fab50dda9f8eba1e3cf13a7e2 upstream.
    
    The PIN number for Dell headset mode of ALC3271 is wrong.
    
    Fixes: fcc6c877a01f ("ALSA: hda/realtek - Support Dell headset mode for ALC3271")
    Signed-off-by: Shih-Yuan Lee (FourDollars) <sylee@canonical.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 14e849336f40fcac71020c3e12e50d6bf4248e32
Author: Nadav Amit <namit@vmware.com>
Date:   Wed Jan 27 09:53:17 2021 -0800

    iommu/vt-d: Do not use flush-queue when caching-mode is on
    
    commit 29b32839725f8c89a41cb6ee054c85f3116ea8b5 upstream.
    
    When an Intel IOMMU is virtualized, and a physical device is
    passed-through to the VM, changes of the virtual IOMMU need to be
    propagated to the physical IOMMU. The hypervisor therefore needs to
    monitor PTE mappings in the IOMMU page-tables. Intel specifications
    provide "caching-mode" capability that a virtual IOMMU uses to report
    that the IOMMU is virtualized and a TLB flush is needed after mapping to
    allow the hypervisor to propagate virtual IOMMU mappings to the physical
    IOMMU. To the best of my knowledge no real physical IOMMU reports
    "caching-mode" as turned on.
    
    Synchronizing the virtual and the physical IOMMU tables is expensive if
    the hypervisor is unaware which PTEs have changed, as the hypervisor is
    required to walk all the virtualized tables and look for changes.
    Consequently, domain flushes are much more expensive than page-specific
    flushes on virtualized IOMMUs with passthrough devices. The kernel
    therefore exploited the "caching-mode" indication to avoid domain
    flushing and use page-specific flushing in virtualized environments. See
    commit 78d5f0f500e6 ("intel-iommu: Avoid global flushes with caching
    mode.")
    
    This behavior changed after commit 13cf01744608 ("iommu/vt-d: Make use
    of iova deferred flushing"). Now, when batched TLB flushing is used (the
    default), full TLB domain flushes are performed frequently, requiring
    the hypervisor to perform expensive synchronization between the virtual
    TLB and the physical one.
    
    Getting batched TLB flushes to use page-specific invalidations again in
    such circumstances is not easy, since the TLB invalidation scheme
    assumes that "full" domain TLB flushes are performed for scalability.
    
    Disable batched TLB flushes when caching-mode is on, as the performance
    benefit from using batched TLB invalidations is likely to be much
    smaller than the overhead of the virtual-to-physical IOMMU page-tables
    synchronization.
    
    Fixes: 13cf01744608 ("iommu/vt-d: Make use of iova deferred flushing")
    Signed-off-by: Nadav Amit <namit@vmware.com>
    Cc: David Woodhouse <dwmw2@infradead.org>
    Cc: Lu Baolu <baolu.lu@linux.intel.com>
    Cc: Joerg Roedel <joro@8bytes.org>
    Cc: Will Deacon <will@kernel.org>
    Cc: stable@vger.kernel.org
    Acked-by: Lu Baolu <baolu.lu@linux.intel.com>
    Link: https://lore.kernel.org/r/20210127175317.1600473-1-namit@vmware.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Nadav Amit <namit@vmware.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 53e37f9950b3fc833bc7b0e01ba65262b2fa9d25
Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Date:   Thu Jan 14 19:34:22 2021 +0100

    ACPI: thermal: Do not call acpi_thermal_check() directly
    
    commit 81b704d3e4674e09781d331df73d76675d5ad8cb upstream.
    
    Calling acpi_thermal_check() from acpi_thermal_notify() directly
    is problematic if _TMP triggers Notify () on the thermal zone for
    which it has been evaluated (which happens on some systems), because
    it causes a new acpi_thermal_notify() invocation to be queued up
    every time and if that takes place too often, an indefinite number of
    pending work items may accumulate in kacpi_notify_wq over time.
    
    Besides, it is not really useful to queue up a new invocation of
    acpi_thermal_check() if one of them is pending already.
    
    For these reasons, rework acpi_thermal_notify() to queue up a thermal
    check instead of calling acpi_thermal_check() directly and only allow
    one thermal check to be pending at a time.  Moreover, only allow one
    acpi_thermal_check_fn() instance at a time to run
    thermal_zone_device_update() for one thermal zone and make it return
    early if it sees other instances running for the same thermal zone.
    
    While at it, fold acpi_thermal_check() into acpi_thermal_check_fn(),
    as it is only called from there after the other changes made here.
    
    [This issue appears to have been exposed by commit 6d25be5782e4
     ("sched/core, workqueues: Distangle worker accounting from rq
     lock"), but it is unclear why it was not visible earlier.]
    
    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208877
    Reported-by: Stephen Berman <stephen.berman@gmx.net>
    Diagnosed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Tested-by: Stephen Berman <stephen.berman@gmx.net>
    Cc: All applicable <stable@vger.kernel.org>
    [bigeasy: Backported to v4.9.y, use atomic_t instead of refcount_t]
    Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 00717a9de7cda4a0aaa1af184dd694c8d633df48
Author: Benjamin Valentin <benpicco@googlemail.com>
Date:   Thu Jan 21 19:24:17 2021 -0800

    Input: xpad - sync supported devices with fork on GitHub
    
    commit 9bbd77d5bbc9aff8cb74d805c31751f5f0691ba8 upstream.
    
    There is a fork of this driver on GitHub [0] that has been updated
    with new device IDs.
    
    Merge those into the mainline driver, so the out-of-tree fork is not
    needed for users of those devices anymore.
    
    [0] https://github.com/paroj/xpad
    
    Signed-off-by: Benjamin Valentin <benpicco@googlemail.com>
    Link: https://lore.kernel.org/r/20210121142523.1b6b050f@rechenknecht2k11
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8cc3e209628bcbe352246bec1bc2d28196023549
Author: Dave Hansen <dave.hansen@linux.intel.com>
Date:   Thu Mar 5 09:47:08 2020 -0800

    x86/apic: Add extra serialization for non-serializing MSRs
    
    commit 25a068b8e9a4eb193d755d58efcb3c98928636e0 upstream.
    
    Jan Kiszka reported that the x2apic_wrmsr_fence() function uses a plain
    MFENCE while the Intel SDM (10.12.3 MSR Access in x2APIC Mode) calls for
    MFENCE; LFENCE.
    
    Short summary: we have special MSRs that have weaker ordering than all
    the rest. Add fencing consistent with current SDM recommendations.
    
    This is not known to cause any issues in practice, only in theory.
    
    Longer story below:
    
    The reason the kernel uses a different semantic is that the SDM changed
    (roughly in late 2017). The SDM changed because folks at Intel were
    auditing all of the recommended fences in the SDM and realized that the
    x2apic fences were insufficient.
    
    Why was the pain MFENCE judged insufficient?
    
    WRMSR itself is normally a serializing instruction. No fences are needed
    because the instruction itself serializes everything.
    
    But, there are explicit exceptions for this serializing behavior written
    into the WRMSR instruction documentation for two classes of MSRs:
    IA32_TSC_DEADLINE and the X2APIC MSRs.
    
    Back to x2apic: WRMSR is *not* serializing in this specific case.
    But why is MFENCE insufficient? MFENCE makes writes visible, but
    only affects load/store instructions. WRMSR is unfortunately not a
    load/store instruction and is unaffected by MFENCE. This means that a
    non-serializing WRMSR could be reordered by the CPU to execute before
    the writes made visible by the MFENCE have even occurred in the first
    place.
    
    This means that an x2apic IPI could theoretically be triggered before
    there is any (visible) data to process.
    
    Does this affect anything in practice? I honestly don't know. It seems
    quite possible that by the time an interrupt gets to consume the (not
    yet) MFENCE'd data, it has become visible, mostly by accident.
    
    To be safe, add the SDM-recommended fences for all x2apic WRMSRs.
    
    This also leaves open the question of the _other_ weakly-ordered WRMSR:
    MSR_IA32_TSC_DEADLINE. While it has the same ordering architecture as
    the x2APIC MSRs, it seems substantially less likely to be a problem in
    practice. While writes to the in-memory Local Vector Table (LVT) might
    theoretically be reordered with respect to a weakly-ordered WRMSR like
    TSC_DEADLINE, the SDM has this to say:
    
      In x2APIC mode, the WRMSR instruction is used to write to the LVT
      entry. The processor ensures the ordering of this write and any
      subsequent WRMSR to the deadline; no fencing is required.
    
    But, that might still leave xAPIC exposed. The safest thing to do for
    now is to add the extra, recommended LFENCE.
    
     [ bp: Massage commit message, fix typos, drop accidentally added
       newline to tools/arch/x86/include/asm/barrier.h. ]
    
    Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Acked-by: Thomas Gleixner <tglx@linutronix.de>
    Cc: <stable@vger.kernel.org>
    Link: https://lkml.kernel.org/r/20200305174708.F77040DD@viggo.jf.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7175b118978c97bba5286c3c58361fbba312fcbf
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Thu Jan 28 15:52:19 2021 -0600

    x86/build: Disable CET instrumentation in the kernel
    
    commit 20bf2b378729c4a0366a53e2018a0b70ace94bcd upstream.
    
    With retpolines disabled, some configurations of GCC, and specifically
    the GCC versions 9 and 10 in Ubuntu will add Intel CET instrumentation
    to the kernel by default. That breaks certain tracing scenarios by
    adding a superfluous ENDBR64 instruction before the fentry call, for
    functions which can be called indirectly.
    
    CET instrumentation isn't currently necessary in the kernel, as CET is
    only supported in user space. Disable it unconditionally and move it
    into the x86's Makefile as CET/CFI... enablement should be a per-arch
    decision anyway.
    
     [ bp: Massage and extend commit message. ]
    
    Fixes: 29be86d7f9cb ("kbuild: add -fcf-protection=none when using retpoline flags")
    Reported-by: Nikolay Borisov <nborisov@suse.com>
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Reviewed-by: Nikolay Borisov <nborisov@suse.com>
    Tested-by: Nikolay Borisov <nborisov@suse.com>
    Cc: <stable@vger.kernel.org>
    Cc: Seth Forshee <seth.forshee@canonical.com>
    Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
    Link: https://lkml.kernel.org/r/20210128215219.6kct3h2eiustncws@treble
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 332293a2301fde82bc41b359f870a96871764aaa
Author: Hugh Dickins <hughd@google.com>
Date:   Thu Feb 4 18:32:31 2021 -0800

    mm: thp: fix MADV_REMOVE deadlock on shmem THP
    
    commit 1c2f67308af4c102b4e1e6cd6f69819ae59408e0 upstream.
    
    Sergey reported deadlock between kswapd correctly doing its usual
    lock_page(page) followed by down_read(page->mapping->i_mmap_rwsem), and
    madvise(MADV_REMOVE) on an madvise(MADV_HUGEPAGE) area doing
    down_write(page->mapping->i_mmap_rwsem) followed by lock_page(page).
    
    This happened when shmem_fallocate(punch hole)'s unmap_mapping_range()
    reaches zap_pmd_range()'s call to __split_huge_pmd().  The same deadlock
    could occur when partially truncating a mapped huge tmpfs file, or using
    fallocate(FALLOC_FL_PUNCH_HOLE) on it.
    
    __split_huge_pmd()'s page lock was added in 5.8, to make sure that any
    concurrent use of reuse_swap_page() (holding page lock) could not catch
    the anon THP's mapcounts and swapcounts while they were being split.
    
    Fortunately, reuse_swap_page() is never applied to a shmem or file THP
    (not even by khugepaged, which checks PageSwapCache before calling), and
    anonymous THPs are never created in shmem or file areas: so that
    __split_huge_pmd()'s page lock can only be necessary for anonymous THPs,
    on which there is no risk of deadlock with i_mmap_rwsem.
    
    Link: https://lkml.kernel.org/r/alpine.LSU.2.11.2101161409470.2022@eggly.anvils
    Fixes: c444eb564fb1 ("mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()")
    Signed-off-by: Hugh Dickins <hughd@google.com>
    Reported-by: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
    Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2a2e1e97098604155720938331c224180b015470
Author: Muchun Song <songmuchun@bytedance.com>
Date:   Thu Feb 4 18:32:13 2021 -0800

    mm: hugetlb: remove VM_BUG_ON_PAGE from page_huge_active
    
    commit ecbf4724e6061b4b01be20f6d797d64d462b2bc8 upstream.
    
    The page_huge_active() can be called from scan_movable_pages() which do
    not hold a reference count to the HugeTLB page.  So when we call
    page_huge_active() from scan_movable_pages(), the HugeTLB page can be
    freed parallel.  Then we will trigger a BUG_ON which is in the
    page_huge_active() when CONFIG_DEBUG_VM is enabled.  Just remove the
    VM_BUG_ON_PAGE.
    
    Link: https://lkml.kernel.org/r/20210115124942.46403-6-songmuchun@bytedance.com
    Fixes: 7e1f049efb86 ("mm: hugetlb: cleanup using paeg_huge_active()")
    Signed-off-by: Muchun Song <songmuchun@bytedance.com>
    Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1ed62140ac553a256af112199a92aecd2da432aa
Author: Muchun Song <songmuchun@bytedance.com>
Date:   Thu Feb 4 18:32:10 2021 -0800

    mm: hugetlb: fix a race between isolating and freeing page
    
    commit 0eb2df2b5629794020f75e94655e1994af63f0d4 upstream.
    
    There is a race between isolate_huge_page() and __free_huge_page().
    
      CPU0:                                     CPU1:
    
      if (PageHuge(page))
                                                put_page(page)
                                                  __free_huge_page(page)
                                                      spin_lock(&hugetlb_lock)
                                                      update_and_free_page(page)
                                                        set_compound_page_dtor(page,
                                                          NULL_COMPOUND_DTOR)
                                                      spin_unlock(&hugetlb_lock)
        isolate_huge_page(page)
          // trigger BUG_ON
          VM_BUG_ON_PAGE(!PageHead(page), page)
          spin_lock(&hugetlb_lock)
          page_huge_active(page)
            // trigger BUG_ON
            VM_BUG_ON_PAGE(!PageHuge(page), page)
          spin_unlock(&hugetlb_lock)
    
    When we isolate a HugeTLB page on CPU0.  Meanwhile, we free it to the
    buddy allocator on CPU1.  Then, we can trigger a BUG_ON on CPU0, because
    it is already freed to the buddy allocator.
    
    Link: https://lkml.kernel.org/r/20210115124942.46403-5-songmuchun@bytedance.com
    Fixes: c8721bbbdd36 ("mm: memory-hotplug: enable memory hotplug to handle hugepage")
    Signed-off-by: Muchun Song <songmuchun@bytedance.com>
    Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2dd160c9886d564d6c6321ca468ecec85744de8e
Author: Muchun Song <songmuchun@bytedance.com>
Date:   Thu Feb 4 18:32:03 2021 -0800

    mm: hugetlbfs: fix cannot migrate the fallocated HugeTLB page
    
    commit 585fc0d2871c9318c949fbf45b1f081edd489e96 upstream.
    
    If a new hugetlb page is allocated during fallocate it will not be
    marked as active (set_page_huge_active) which will result in a later
    isolate_huge_page failure when the page migration code would like to
    move that page.  Such a failure would be unexpected and wrong.
    
    Only export set_page_huge_active, just leave clear_page_huge_active as
    static.  Because there are no external users.
    
    Link: https://lkml.kernel.org/r/20210115124942.46403-3-songmuchun@bytedance.com
    Fixes: 70c3547e36f5 (hugetlbfs: add hugetlbfs_fallocate())
    Signed-off-by: Muchun Song <songmuchun@bytedance.com>
    Acked-by: Michal Hocko <mhocko@suse.com>
    Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
    Reviewed-by: Oscar Salvador <osalvador@suse.de>
    Cc: David Hildenbrand <david@redhat.com>
    Cc: Yang Shi <shy828301@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 137482a0e50e18aa9d5d75edc355146727e0dbc8
Author: Russell King <rmk+kernel@armlinux.org.uk>
Date:   Sun Oct 18 09:39:21 2020 +0100

    ARM: footbridge: fix dc21285 PCI configuration accessors
    
    commit 39d3454c3513840eb123b3913fda6903e45ce671 upstream.
    
    Building with gcc 4.9.2 reveals a latent bug in the PCI accessors
    for Footbridge platforms, which causes a fatal alignment fault
    while accessing IO memory. Fix this by making the assembly volatile.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0c1b6b22fdac7344ea7dd318e6d071dc23da836e
Author: Fengnan Chang <fengnanchang@gmail.com>
Date:   Sat Jan 23 11:32:31 2021 +0800

    mmc: core: Limit retries when analyse of SDIO tuples fails
    
    commit f92e04f764b86e55e522988e6f4b6082d19a2721 upstream.
    
    When analysing tuples fails we may loop indefinitely to retry. Let's avoid
    this by using a 10s timeout and bail if not completed earlier.
    
    Signed-off-by: Fengnan Chang <fengnanchang@gmail.com>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20210123033230.36442-1-fengnanchang@gmail.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 57659a80d5278d12bf7fd4f1d0b78e44a36f0d34
Author: Aurelien Aptel <aaptel@suse.com>
Date:   Fri Feb 5 15:42:48 2021 +0100

    cifs: report error instead of invalid when revalidating a dentry fails
    
    commit 21b200d091826a83aafc95d847139b2b0582f6d1 upstream.
    
    Assuming
    - //HOST/a is mounted on /mnt
    - //HOST/b is mounted on /mnt/b
    
    On a slow connection, running 'df' and killing it while it's
    processing /mnt/b can make cifs_get_inode_info() returns -ERESTARTSYS.
    
    This triggers the following chain of events:
    => the dentry revalidation fail
    => dentry is put and released
    => superblock associated with the dentry is put
    => /mnt/b is unmounted
    
    This patch makes cifs_d_revalidate() return the error instead of 0
    (invalid) when cifs_revalidate_dentry() fails, except for ENOENT (file
    deleted) and ESTALE (file recreated).
    
    Signed-off-by: Aurelien Aptel <aaptel@suse.com>
    Suggested-by: Shyam Prasad N <nspmangalore@gmail.com>
    Reviewed-by: Shyam Prasad N <nspmangalore@gmail.com>
    CC: stable@vger.kernel.org
    Signed-off-by: Steve French <stfrench@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9d9f8bb2fa25bc4fb7271de3bbe289ba82864273
Author: Mathias Nyman <mathias.nyman@linux.intel.com>
Date:   Wed Feb 3 13:37:02 2021 +0200

    xhci: fix bounce buffer usage for non-sg list case
    
    commit d4a610635400ccc382792f6be69427078541c678 upstream.
    
    xhci driver may in some special cases need to copy small amounts
    of payload data to a bounce buffer in order to meet the boundary
    and alignment restrictions set by the xHCI specification.
    
    In the majority of these cases the data is in a sg list, and
    driver incorrectly assumed data is always in urb->sg when using
    the bounce buffer.
    
    If data instead is contiguous, and in urb->transfer_buffer, we may still
    need to bounce buffer a small part if data starts very close (less than
    packet size) to a 64k boundary.
    
    Check if sg list is used before copying data to/from it.
    
    Fixes: f9c589e142d0 ("xhci: TD-fragment, align the unsplittable case with a bounce buffer")
    Cc: stable@vger.kernel.org
    Reported-by: Andreas Hartmann <andihartmann@01019freenet.de>
    Tested-by: Andreas Hartmann <andihartmann@01019freenet.de>
    Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
    Link: https://lore.kernel.org/r/20210203113702.436762-2-mathias.nyman@linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 87ab5651175e27fc1314840b42b8a00ef009883f
Author: Wang ShaoBo <bobo.shaobowang@huawei.com>
Date:   Thu Jan 28 20:44:27 2021 +0800

    kretprobe: Avoid re-registration of the same kretprobe earlier
    
    commit 0188b87899ffc4a1d36a0badbe77d56c92fd91dc upstream.
    
    Our system encountered a re-init error when re-registering same kretprobe,
    where the kretprobe_instance in rp->free_instances is illegally accessed
    after re-init.
    
    Implementation to avoid re-registration has been introduced for kprobe
    before, but lags for register_kretprobe(). We must check if kprobe has
    been re-registered before re-initializing kretprobe, otherwise it will
    destroy the data struct of kretprobe registered, which can lead to memory
    leak, system crash, also some unexpected behaviors.
    
    We use check_kprobe_rereg() to check if kprobe has been re-registered
    before running register_kretprobe()'s body, for giving a warning message
    and terminate registration process.
    
    Link: https://lkml.kernel.org/r/20210128124427.2031088-1-bobo.shaobowang@huawei.com
    
    Cc: stable@vger.kernel.org
    Fixes: 1f0ab40976460 ("kprobes: Prevent re-registration of the same kprobe")
    [ The above commit should have been done for kretprobes too ]
    Acked-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
    Acked-by: Ananth N Mavinakayanahalli <ananth@linux.ibm.com>
    Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
    Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
    Signed-off-by: Cheng Jian <cj.chengjian@huawei.com>
    Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2718d6e8d6a684b4141df3d51c6946996fa9e864
Author: Felix Fietkau <nbd@nbd.name>
Date:   Mon Feb 1 09:33:24 2021 +0100

    mac80211: fix station rate table updates on assoc
    
    commit 18fe0fae61252b5ae6e26553e2676b5fac555951 upstream.
    
    If the driver uses .sta_add, station entries are only uploaded after the sta
    is in assoc state. Fix early station rate table updates by deferring them
    until the sta has been uploaded.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Link: https://lore.kernel.org/r/20210201083324.3134-1-nbd@nbd.name
    [use rcu_access_pointer() instead since we won't dereference here]
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a3bcb11eba63b1fd0fd6683afabe284bb2e250e9
Author: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
Date:   Wed Jan 27 11:39:19 2021 +0100

    usb: dwc2: Fix endpoint direction check in ep_from_windex
    
    commit f670e9f9c8cac716c3506c6bac9e997b27ad441a upstream.
    
    dwc2_hsotg_process_req_status uses ep_from_windex() to retrieve
    the endpoint for the index provided in the wIndex request param.
    
    In a test-case with a rndis gadget running and sending a malformed
    packet to it like:
        dev.ctrl_transfer(
            0x82,      # bmRequestType
            0x00,       # bRequest
            0x0000,     # wValue
            0x0001,     # wIndex
            0x00       # wLength
        )
    it is possible to cause a crash:
    
    [  217.533022] dwc2 ff300000.usb: dwc2_hsotg_process_req_status: USB_REQ_GET_STATUS
    [  217.559003] Unable to handle kernel read from unreadable memory at virtual address 0000000000000088
    ...
    [  218.313189] Call trace:
    [  218.330217]  ep_from_windex+0x3c/0x54
    [  218.348565]  usb_gadget_giveback_request+0x10/0x20
    [  218.368056]  dwc2_hsotg_complete_request+0x144/0x184
    
    This happens because ep_from_windex wants to compare the endpoint
    direction even if index_to_ep() didn't return an endpoint due to
    the direction not matching.
    
    The fix is easy insofar that the actual direction check is already
    happening when calling index_to_ep() which will return NULL if there
    is no endpoint for the targeted direction, so the offending check
    can go away completely.
    
    Fixes: c6f5c050e2a7 ("usb: dwc2: gadget: add bi-directional endpoint support")
    Cc: stable@vger.kernel.org
    Reported-by: Gerhard Klostermeier <gerhard.klostermeier@syss.de>
    Signed-off-by: Heiko Stuebner <heiko.stuebner@theobroma-systems.com>
    Link: https://lore.kernel.org/r/20210127103919.58215-1-heiko@sntech.de
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b76c2952453c408ab79c082a848678c743eb95a5
Author: Jeremy Figgins <kernel@jeremyfiggins.com>
Date:   Sat Jan 23 18:21:36 2021 -0600

    USB: usblp: don't call usb_set_interface if there's a single alt
    
    commit d8c6edfa3f4ee0d45d7ce5ef18d1245b78774b9d upstream.
    
    Some devices, such as the Winbond Electronics Corp. Virtual Com Port
    (Vendor=0416, ProdId=5011), lockup when usb_set_interface() or
    usb_clear_halt() are called. This device has only a single
    altsetting, so it should not be necessary to call usb_set_interface().
    
    Acked-by: Pete Zaitcev <zaitcev@redhat.com>
    Signed-off-by: Jeremy Figgins <kernel@jeremyfiggins.com>
    Link: https://lore.kernel.org/r/YAy9kJhM/rG8EQXC@watson
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit ccdc62f46b8e4bf7f55e65eab5671e8dd593987d
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Thu Jan 28 12:33:42 2021 +0300

    USB: gadget: legacy: fix an error code in eth_bind()
    
    commit 3e1f4a2e1184ae6ad7f4caf682ced9554141a0f4 upstream.
    
    This code should return -ENOMEM if the allocation fails but it currently
    returns success.
    
    Fixes: 9b95236eebdb ("usb: gadget: ether: allocate and init otg descriptor by otg capabilities")
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Link: https://lore.kernel.org/r/YBKE9rqVuJEOUWpW@mwanda
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit f54be213e213e93a780fde5e383acc021ec3f781
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Fri Dec 11 13:36:46 2020 -0800

    elfcore: fix building with clang
    
    commit 6e7b64b9dd6d96537d816ea07ec26b7dedd397b9 upstream.
    
    kernel/elfcore.c only contains weak symbols, which triggers a bug with
    clang in combination with recordmcount:
    
      Cannot find symbol for section 2: .text.
      kernel/elfcore.o: failed
    
    Move the empty stubs into linux/elfcore.h as inline functions.  As only
    two architectures use these, just use the architecture specific Kconfig
    symbols to key off the declaration.
    
    Link: https://lkml.kernel.org/r/20201204165742.3815221-2-arnd@kernel.org
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Cc: Nathan Chancellor <natechancellor@gmail.com>
    Cc: Nick Desaulniers <ndesaulniers@google.com>
    Cc: Barret Rhoden <brho@google.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 36b509283ae293aaacccaa47aa729fbd5a7e83a5
Author: Xie He <xie.he.0141@gmail.com>
Date:   Sun Jan 31 21:57:06 2021 -0800

    net: lapb: Copy the skb before sending a packet
    
    [ Upstream commit 88c7a9fd9bdd3e453f04018920964c6f848a591a ]
    
    When sending a packet, we will prepend it with an LAPB header.
    This modifies the shared parts of a cloned skb, so we should copy the
    skb rather than just clone it, before we prepend the header.
    
    In "Documentation/networking/driver.rst" (the 2nd point), it states
    that drivers shouldn't modify the shared parts of a cloned skb when
    transmitting.
    
    The "dev_queue_xmit_nit" function in "net/core/dev.c", which is called
    when an skb is being sent, clones the skb and sents the clone to
    AF_PACKET sockets. Because the LAPB drivers first remove a 1-byte
    pseudo-header before handing over the skb to us, if we don't copy the
    skb before prepending the LAPB header, the first byte of the packets
    received on AF_PACKET sockets can be corrupted.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Xie He <xie.he.0141@gmail.com>
    Acked-by: Martin Schiller <ms@dev.tdt.de>
    Link: https://lore.kernel.org/r/20210201055706.415842-1-xie.he.0141@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 8f25a45a217193af55a87b0fe4f9f8514ed29812
Author: Alexey Dobriyan <adobriyan@gmail.com>
Date:   Sun Jan 3 17:59:51 2021 -0800

    Input: i8042 - unbreak Pegatron C15B
    
    [ Upstream commit a3a9060ecad030e2c7903b2b258383d2c716b56c ]
    
    g++ reports
    
            drivers/input/serio/i8042-x86ia64io.h:225:3: error: ‘.matches’ designator used multiple times in the same initializer list
    
    C99 semantics is that last duplicated initialiser wins,
    so DMI entry gets overwritten.
    
    Fixes: a48491c65b51 ("Input: i8042 - add ByteSpeed touchpad to noloop table")
    Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
    Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>
    Link: https://lore.kernel.org/r/20201228072335.GA27766@localhost.localdomain
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit f0df5378de13a240721106f802c9869adda4839b
Author: Christoph Schemmel <christoph.schemmel@gmail.com>
Date:   Wed Jan 27 20:58:46 2021 +0100

    USB: serial: option: Adding support for Cinterion MV31
    
    commit e478d6029dca9d8462f426aee0d32896ef64f10f upstream.
    
    Adding support for Cinterion device MV31 for enumeration with
    PID 0x00B3 and 0x00B7.
    
    usb-devices output for 0x00B3
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  6 Spd=5000 MxCh= 0
    D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
    P:  Vendor=1e2d ProdID=00b3 Rev=04.14
    S:  Manufacturer=Cinterion
    S:  Product=Cinterion PID 0x00B3 USB Mobile Broadband
    S:  SerialNumber=b3246eed
    C:  #Ifs= 6 Cfg#= 1 Atr=a0 MxPwr=896mA
    I:  If#=0x0 Alt= 0 #EPs= 1 Cls=02(commc) Sub=0e Prot=00 Driver=cdc_mbim
    I:  If#=0x1 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
    I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=ff Driver=cdc_wdm
    I:  If#=0x4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x5 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    
    usb-devices output for 0x00B7
    T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  5 Spd=5000 MxCh= 0
    D:  Ver= 3.20 Cls=ef(misc ) Sub=02 Prot=01 MxPS= 9 #Cfgs=  1
    P:  Vendor=1e2d ProdID=00b7 Rev=04.14
    S:  Manufacturer=Cinterion
    S:  Product=Cinterion PID 0x00B3 USB Mobile Broadband
    S:  SerialNumber=b3246eed
    C:  #Ifs= 4 Cfg#= 1 Atr=a0 MxPwr=896mA
    I:  If#=0x0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
    I:  If#=0x1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
    I:  If#=0x3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
    
    Signed-off-by: Christoph Schemmel <christoph.schemmel@gmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 0aa6b8669e9647ffdb87d8cbb5bb9d9ca974acb7
Author: Chenxin Jin <bg4akv@hotmail.com>
Date:   Wed Jan 13 16:59:05 2021 +0800

    USB: serial: cp210x: add new VID/PID for supporting Teraoka AD2000
    
    commit 43377df70480f82919032eb09832e9646a8a5efb upstream.
    
    Teraoka AD2000 uses the CP210x driver, but the chip VID/PID is
    customized with 0988/0578. We need the driver to support the new
    VID/PID.
    
    Signed-off-by: Chenxin Jin <bg4akv@hotmail.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3800d7b5f56c0f4f32c8e5d194ca48e00c9f308c
Author: Pho Tran <Pho.Tran@silabs.com>
Date:   Mon Jan 25 09:26:54 2021 +0000

    USB: serial: cp210x: add pid/vid for WSDA-200-USB
    
    commit 3c4f6ecd93442f4376a58b38bb40ee0b8c46e0e6 upstream.
    
    Information pid/vid of WSDA-200-USB, Lord corporation company:
    vid: 199b
    pid: ba30
    
    Signed-off-by: Pho Tran <pho.tran@silabs.com>
    [ johan: amend comment with product name ]
    Cc: stable@vger.kernel.org
    Signed-off-by: Johan Hovold <johan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 42efb098c75f9d4b95f7cf35d3d52e80cc2fde82
Author: Sasha Levin <sashal@kernel.org>
Date:   Fri Feb 5 12:47:02 2021 -0500

    stable: clamp SUBLEVEL in 4.4 and 4.9
    
    Right now SUBLEVEL is overflowing, and some userspace may start treating
    4.9.256 as 4.10. While out of tree modules have different ways of
      extracting the version number (and we're generally ok with breaking
    them), we do care about breaking userspace and it would appear that this
    overflow might do just that.
    
    Our rules around userspace ABI in the stable kernel are pretty simple:
    we don't break it. Thus, while userspace may be checking major/minor, it
    shouldn't be doing anything with sublevel.
    
    This patch applies a big band-aid to the 4.9 and 4.4 kernels in the form
    of clamping their sublevel to 255.
    
    The clamp is done for the purpose of LINUX_VERSION_CODE only, and
    extracting the version number from the Makefile or "make kernelversion"
    will continue to work as intended.
    
    We might need to do it later in newer trees, but maybe we'll have a
    better solution by then, so I'm ignoring that problem for now.
    
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit a35b3e57a978251ecc8d8d9a7d079eea16b7c3f7
Author: Josh Poimboeuf <jpoimboe@redhat.com>
Date:   Thu Jan 14 16:14:01 2021 -0600

    objtool: Don't fail on missing symbol table
    
    [ Upstream commit 1d489151e9f9d1647110277ff77282fe4d96d09b ]
    
    Thanks to a recent binutils change which doesn't generate unused
    symbols, it's now possible for thunk_64.o be completely empty without
    CONFIG_PREEMPTION: no text, no data, no symbols.
    
    We could edit the Makefile to only build that file when
    CONFIG_PREEMPTION is enabled, but that will likely create confusion
    if/when the thunks end up getting used by some other code again.
    
    Just ignore it and move on.
    
    Reported-by: Nathan Chancellor <natechancellor@gmail.com>
    Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
    Reviewed-by: Miroslav Benes <mbenes@suse.cz>
    Tested-by: Nathan Chancellor <natechancellor@gmail.com>
    Link: https://github.com/ClangBuiltLinux/linux/issues/1254
    Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit fb6c463ef441cc6cf73899d784f430ccd1ae4283
Author: Brian King <brking@linux.vnet.ibm.com>
Date:   Tue Jan 12 09:06:38 2021 -0600

    scsi: ibmvfc: Set default timeout to avoid crash during migration
    
    [ Upstream commit 764907293edc1af7ac857389af9dc858944f53dc ]
    
    While testing live partition mobility, we have observed occasional crashes
    of the Linux partition. What we've seen is that during the live migration,
    for specific configurations with large amounts of memory, slow network
    links, and workloads that are changing memory a lot, the partition can end
    up being suspended for 30 seconds or longer. This resulted in the following
    scenario:
    
    CPU 0                          CPU 1
    -------------------------------  ----------------------------------
    scsi_queue_rq                    migration_store
     -> blk_mq_start_request          -> rtas_ibm_suspend_me
      -> blk_add_timer                 -> on_each_cpu(rtas_percpu_suspend_me
                  _______________________________________V
                 |
                 V
        -> IPI from CPU 1
         -> rtas_percpu_suspend_me
                                         -> __rtas_suspend_last_cpu
    
    -- Linux partition suspended for > 30 seconds --
                                          -> for_each_online_cpu(cpu)
                                               plpar_hcall_norets(H_PROD
     -> scsi_dispatch_cmd
                                          -> scsi_times_out
                                           -> scsi_abort_command
                                            -> queue_delayed_work
      -> ibmvfc_queuecommand_lck
       -> ibmvfc_send_event
        -> ibmvfc_send_crq
         - returns H_CLOSED
       <- returns SCSI_MLQUEUE_HOST_BUSY
    -> __blk_mq_requeue_request
    
                                          -> scmd_eh_abort_handler
                                           -> scsi_try_to_abort_cmd
                                             - returns SUCCESS
                                           -> scsi_queue_insert
    
    Normally, the SCMD_STATE_COMPLETE bit would protect against the command
    completion and the timeout, but that doesn't work here, since we don't
    check that at all in the SCSI_MLQUEUE_HOST_BUSY path.
    
    In this case we end up calling scsi_queue_insert on a request that has
    already been queued, or possibly even freed, and we crash.
    
    The patch below simply increases the default I/O timeout to avoid this race
    condition. This is also the timeout value that nearly all IBM SAN storage
    recommends setting as the default value.
    
    Link: https://lore.kernel.org/r/1610463998-19791-1-git-send-email-brking@linux.vnet.ibm.com
    Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3fb9aa619423539b21dc6801075411f57cd40dd0
Author: Felix Fietkau <nbd@nbd.name>
Date:   Fri Dec 18 19:47:17 2020 +0100

    mac80211: fix fast-rx encryption check
    
    [ Upstream commit 622d3b4e39381262da7b18ca1ed1311df227de86 ]
    
    When using WEP, the default unicast key needs to be selected, instead of
    the STA PTK.
    
    Signed-off-by: Felix Fietkau <nbd@nbd.name>
    Link: https://lore.kernel.org/r/20201218184718.93650-5-nbd@nbd.name
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 4a058d556d3f53178e338746bc90734b025e8d58
Author: Javed Hasan <jhasan@marvell.com>
Date:   Tue Dec 15 11:47:31 2020 -0800

    scsi: libfc: Avoid invoking response handler twice if ep is already completed
    
    [ Upstream commit b2b0f16fa65e910a3ec8771206bb49ee87a54ac5 ]
    
    A race condition exists between the response handler getting called because
    of exchange_mgr_reset() (which clears out all the active XIDs) and the
    response we get via an interrupt.
    
    Sequence of events:
    
             rport ba0200: Port timeout, state PLOGI
             rport ba0200: Port entered PLOGI state from PLOGI state
             xid 1052: Exchange timer armed : 20000 msecs      xid timer armed here
             rport ba0200: Received LOGO request while in state PLOGI
             rport ba0200: Delete port
             rport ba0200: work event 3
             rport ba0200: lld callback ev 3
             bnx2fc: rport_event_hdlr: event = 3, port_id = 0xba0200
             bnx2fc: ba0200 - rport not created Yet!!
             /* Here we reset any outstanding exchanges before
             freeing rport using the exch_mgr_reset() */
             xid 1052: Exchange timer canceled
             /* Here we got two responses for one xid */
             xid 1052: invoking resp(), esb 20000000 state 3
             xid 1052: invoking resp(), esb 20000000 state 3
             xid 1052: fc_rport_plogi_resp() : ep->resp_active 2
             xid 1052: fc_rport_plogi_resp() : ep->resp_active 2
    
    Skip the response if the exchange is already completed.
    
    Link: https://lore.kernel.org/r/20201215194731.2326-1-jhasan@marvell.com
    Signed-off-by: Javed Hasan <jhasan@marvell.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit b960d9ae7f76f98537f251af0363b89d09b8fb11
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Feb 3 13:45:39 2021 +0000

    futex: Handle faults correctly for PI futexes
    
    fixup_pi_state_owner() tries to ensure that the state of the rtmutex,
    pi_state and the user space value related to the PI futex are consistent
    before returning to user space. In case that the user space value update
    faults and the fault cannot be resolved by faulting the page in via
    fault_in_user_writeable() the function returns with -EFAULT and leaves
    the rtmutex and pi_state owner state inconsistent.
    
    A subsequent futex_unlock_pi() operates on the inconsistent pi_state and
    releases the rtmutex despite not owning it which can corrupt the RB tree of
    the rtmutex and cause a subsequent kernel stack use after free.
    
    It was suggested to loop forever in fixup_pi_state_owner() if the fault
    cannot be resolved, but that results in runaway tasks which is especially
    undesired when the problem happens due to a programming error and not due
    to malice.
    
    As the user space value cannot be fixed up, the proper solution is to make
    the rtmutex and the pi_state consistent so both have the same owner. This
    leaves the user space value out of sync. Any subsequent operation on the
    futex will fail because the 10th rule of PI futexes (pi_state owner and
    user space value are consistent) has been violated.
    
    As a consequence this removes the inept attempts of 'fixing' the situation
    in case that the current task owns the rtmutex when returning with an
    unresolvable fault by unlocking the rtmutex which left pi_state::owner and
    rtmutex::owner out of sync in a different and only slightly less dangerous
    way.
    
    Fixes: 1b7558e457ed ("futexes: fix fault handling in futex_lock_pi")
    Reported-by: gzobqq@gmail.com
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 48ab8e8e40599f46a72cee84989518e00e36215c
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Feb 3 13:45:38 2021 +0000

    futex: Simplify fixup_pi_state_owner()
    
    [ Upstream commit f2dac39d93987f7de1e20b3988c8685523247ae2 ]
    
    Too many gotos already and an upcoming fix would make it even more
    unreadable.
    
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 7d455bb66ae87ea11af3630cb546d74c35fb6b7e
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Feb 3 13:45:37 2021 +0000

    futex: Use pi_state_update_owner() in put_pi_state()
    
    [ Upstream commit 6ccc84f917d33312eb2846bd7b567639f585ad6d ]
    
    No point in open coding it. This way it gains the extra sanity checks.
    
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 285b624ec7818a43b96568a45ed7844a78eccd97
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Feb 3 13:45:36 2021 +0000

    rtmutex: Remove unused argument from rt_mutex_proxy_unlock()
    
    [ Upstream commit 2156ac1934166d6deb6cd0f6ffc4c1076ec63697 ]
    Nothing uses the argument. Remove it as preparation to use
    pi_state_update_owner().
    
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 76bc0eca09e1f44f3c40cc4f69dbfe446458aaa1
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Feb 3 13:45:35 2021 +0000

    futex: Provide and use pi_state_update_owner()
    
    [ Upstream commit c5cade200ab9a2a3be9e7f32a752c8d86b502ec7 ]
    
    Updating pi_state::owner is done at several places with the same
    code. Provide a function for it and use that at the obvious places.
    
    This is also a preparation for a bug fix to avoid yet another copy of the
    same code or alternatively introducing a completely unpenetratable mess of
    gotos.
    
    Originally-by: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 083895e36422882ac5bb393337b6f7cb1a5f046d
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Feb 3 13:45:34 2021 +0000

    futex: Replace pointless printk in fixup_owner()
    
    [ Upstream commit 04b79c55201f02ffd675e1231d731365e335c307 ]
    
    If that unexpected case of inconsistent arguments ever happens then the
    futex state is left completely inconsistent and the printk is not really
    helpful. Replace it with a warning and make the state consistent.
    
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: stable@vger.kernel.org
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 781691c797deefe41090e9f0c02e8fcb9fca4ccf
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed Feb 3 13:45:33 2021 +0000

    futex: Avoid violating the 10th rule of futex
    
    commit c1e2f0eaf015fb7076d51a339011f2383e6dd389 upstream.
    
    Julia reported futex state corruption in the following scenario:
    
       waiter                                  waker                                            stealer (prio > waiter)
    
       futex(WAIT_REQUEUE_PI, uaddr, uaddr2,
             timeout=[N ms])
          futex_wait_requeue_pi()
             futex_wait_queue_me()
                freezable_schedule()
                <scheduled out>
                                               futex(LOCK_PI, uaddr2)
                                               futex(CMP_REQUEUE_PI, uaddr,
                                                     uaddr2, 1, 0)
                                                  /* requeues waiter to uaddr2 */
                                               futex(UNLOCK_PI, uaddr2)
                                                     wake_futex_pi()
                                                        cmp_futex_value_locked(uaddr2, waiter)
                                                        wake_up_q()
               <woken by waker>
               <hrtimer_wakeup() fires,
                clears sleeper->task>
                                                                                               futex(LOCK_PI, uaddr2)
                                                                                                  __rt_mutex_start_proxy_lock()
                                                                                                     try_to_take_rt_mutex() /* steals lock */
                                                                                                        rt_mutex_set_owner(lock, stealer)
                                                                                                  <preempted>
             <scheduled in>
             rt_mutex_wait_proxy_lock()
                __rt_mutex_slowlock()
                   try_to_take_rt_mutex() /* fails, lock held by stealer */
                   if (timeout && !timeout->task)
                      return -ETIMEDOUT;
                fixup_owner()
                   /* lock wasn't acquired, so,
                      fixup_pi_state_owner skipped */
    
       return -ETIMEDOUT;
    
       /* At this point, we've returned -ETIMEDOUT to userspace, but the
        * futex word shows waiter to be the owner, and the pi_mutex has
        * stealer as the owner */
    
       futex_lock(LOCK_PI, uaddr2)
         -> bails with EDEADLK, futex word says we're owner.
    
    And suggested that what commit:
    
      73d786bd043e ("futex: Rework inconsistent rt_mutex/futex_q state")
    
    removes from fixup_owner() looks to be just what is needed. And indeed
    it is -- I completely missed that requeue_pi could also result in this
    case. So we need to restore that, except that subsequent patches, like
    commit:
    
      16ffa12d7425 ("futex: Pull rt_mutex_futex_unlock() out from under hb->lock")
    
    changed all the locking rules. Even without that, the sequence:
    
    -               if (rt_mutex_futex_trylock(&q->pi_state->pi_mutex)) {
    -                       locked = 1;
    -                       goto out;
    -               }
    
    -               raw_spin_lock_irq(&q->pi_state->pi_mutex.wait_lock);
    -               owner = rt_mutex_owner(&q->pi_state->pi_mutex);
    -               if (!owner)
    -                       owner = rt_mutex_next_owner(&q->pi_state->pi_mutex);
    -               raw_spin_unlock_irq(&q->pi_state->pi_mutex.wait_lock);
    -               ret = fixup_pi_state_owner(uaddr, q, owner);
    
    already suggests there were races; otherwise we'd never have to look
    at next_owner.
    
    So instead of doing 3 consecutive wait_lock sections with who knows
    what races, we do it all in a single section. Additionally, the usage
    of pi_state->owner in fixup_owner() was only safe because only the
    rt_mutex owner would modify it, which this additional case wrecks.
    
    Luckily the values can only change away and not to the value we're
    testing, this means we can do a speculative test and double check once
    we have the wait_lock.
    
    Fixes: 73d786bd043e ("futex: Rework inconsistent rt_mutex/futex_q state")
    Reported-by: Julia Cartwright <julia@ni.com>
    Reported-by: Gratian Crisan <gratian.crisan@ni.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: Julia Cartwright <julia@ni.com>
    Tested-by: Gratian Crisan <gratian.crisan@ni.com>
    Cc: Darren Hart <dvhart@infradead.org>
    Link: https://lkml.kernel.org/r/20171208124939.7livp7no2ov65rrc@hirez.programming.kicks-ass.net
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    [Lee: Back-ported to solve a dependency]
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 71f093c5e90df65b843cafa6372dca745bce2f53
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed Feb 3 13:45:32 2021 +0000

    futex: Rework inconsistent rt_mutex/futex_q state
    
    [Upstream commit 73d786bd043ebc855f349c81ea805f6b11cbf2aa ]
    
    There is a weird state in the futex_unlock_pi() path when it interleaves
    with a concurrent futex_lock_pi() at the point where it drops hb->lock.
    
    In this case, it can happen that the rt_mutex wait_list and the futex_q
    disagree on pending waiters, in particular rt_mutex will find no pending
    waiters where futex_q thinks there are. In this case the rt_mutex unlock
    code cannot assign an owner.
    
    The futex side fixup code has to cleanup the inconsistencies with quite a
    bunch of interesting corner cases.
    
    Simplify all this by changing wake_futex_pi() to return -EAGAIN when this
    situation occurs. This then gives the futex_lock_pi() code the opportunity
    to continue and the retried futex_unlock_pi() will now observe a coherent
    state.
    
    The only problem is that this breaks RT timeliness guarantees. That
    is, consider the following scenario:
    
      T1 and T2 are both pinned to CPU0. prio(T2) > prio(T1)
    
        CPU0
    
        T1
          lock_pi()
          queue_me()  <- Waiter is visible
    
        preemption
    
        T2
          unlock_pi()
            loops with -EAGAIN forever
    
    Which is undesirable for PI primitives. Future patches will rectify
    this.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: juri.lelli@arm.com
    Cc: bigeasy@linutronix.de
    Cc: xlpang@redhat.com
    Cc: rostedt@goodmis.org
    Cc: mathieu.desnoyers@efficios.com
    Cc: jdesfossez@efficios.com
    Cc: dvhart@infradead.org
    Cc: bristot@redhat.com
    Link: http://lkml.kernel.org/r/20170322104151.850383690@infradead.org
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    [Lee: Back-ported to solve a dependency]
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d4dd7588558a0227b63193a57652e2bb8280f52c
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed Feb 3 13:45:31 2021 +0000

    futex: Remove rt_mutex_deadlock_account_*()
    
    These are unused and clutter up the code.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: juri.lelli@arm.com
    Cc: bigeasy@linutronix.de
    Cc: xlpang@redhat.com
    Cc: rostedt@goodmis.org
    Cc: mathieu.desnoyers@efficios.com
    Cc: jdesfossez@efficios.com
    Cc: dvhart@infradead.org
    Cc: bristot@redhat.com
    Link: http://lkml.kernel.org/r/20170322104151.652692478@infradead.org
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    [Lee: Back-ported to solve a dependency]
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2c60d4aa8855bd699ad4d3c8ddd47e09c06868d7
Author: Peter Zijlstra <peterz@infradead.org>
Date:   Wed Feb 3 13:45:30 2021 +0000

    futex,rt_mutex: Provide futex specific rt_mutex API
    
    [ Upstream commit 5293c2efda37775346885c7e924d4ef7018ea60b ]
    
    Part of what makes futex_unlock_pi() intricate is that
    rt_mutex_futex_unlock() -> rt_mutex_slowunlock() can drop
    rt_mutex::wait_lock.
    
    This means it cannot rely on the atomicy of wait_lock, which would be
    preferred in order to not rely on hb->lock so much.
    
    The reason rt_mutex_slowunlock() needs to drop wait_lock is because it can
    race with the rt_mutex fastpath, however futexes have their own fast path.
    
    Since futexes already have a bunch of separate rt_mutex accessors, complete
    that set and implement a rt_mutex variant without fastpath for them.
    
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Cc: juri.lelli@arm.com
    Cc: bigeasy@linutronix.de
    Cc: xlpang@redhat.com
    Cc: rostedt@goodmis.org
    Cc: mathieu.desnoyers@efficios.com
    Cc: jdesfossez@efficios.com
    Cc: dvhart@infradead.org
    Cc: bristot@redhat.com
    Link: http://lkml.kernel.org/r/20170322104151.702962446@infradead.org
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    [Lee: Back-ported to solve a dependency]
    Signed-off-by: Lee Jones <lee.jones@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 17af6146dd9c9f5e354029f44030df47fecdda02
Author: Eric Dumazet <edumazet@google.com>
Date:   Thu Jan 14 08:06:37 2021 -0800

    net_sched: reject silly cell_log in qdisc_get_rtab()
    
    commit e4bedf48aaa5552bc1f49703abd17606e7e6e82a upstream
    
    iproute2 probably never goes beyond 8 for the cell exponent,
    but stick to the max shift exponent for signed 32bit.
    
    UBSAN reported:
    UBSAN: shift-out-of-bounds in net/sched/sch_api.c:389:22
    shift exponent 130 is too large for 32-bit type 'int'
    CPU: 1 PID: 8450 Comm: syz-executor586 Not tainted 5.11.0-rc3-syzkaller #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
    Call Trace:
     __dump_stack lib/dump_stack.c:79 [inline]
     dump_stack+0x183/0x22e lib/dump_stack.c:120
     ubsan_epilogue lib/ubsan.c:148 [inline]
     __ubsan_handle_shift_out_of_bounds+0x432/0x4d0 lib/ubsan.c:395
     __detect_linklayer+0x2a9/0x330 net/sched/sch_api.c:389
     qdisc_get_rtab+0x2b5/0x410 net/sched/sch_api.c:435
     cbq_init+0x28f/0x12c0 net/sched/sch_cbq.c:1180
     qdisc_create+0x801/0x1470 net/sched/sch_api.c:1246
     tc_modify_qdisc+0x9e3/0x1fc0 net/sched/sch_api.c:1662
     rtnetlink_rcv_msg+0xb1d/0xe60 net/core/rtnetlink.c:5564
     netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2494
     netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
     netlink_unicast+0x7de/0x9b0 net/netlink/af_netlink.c:1330
     netlink_sendmsg+0xaa6/0xe90 net/netlink/af_netlink.c:1919
     sock_sendmsg_nosec net/socket.c:652 [inline]
     sock_sendmsg net/socket.c:672 [inline]
     ____sys_sendmsg+0x5a2/0x900 net/socket.c:2345
     ___sys_sendmsg net/socket.c:2399 [inline]
     __sys_sendmsg+0x319/0x400 net/socket.c:2432
     do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
     entry_SYSCALL_64_after_hwframe+0x44/0xa9
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: syzbot <syzkaller@googlegroups.com>
    Acked-by: Cong Wang <cong.wang@bytedance.com>
    Link: https://lore.kernel.org/r/20210114160637.1660597-1-eric.dumazet@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [sudip: adjust context]
    Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 9d54b998870b9d6b856065b7dabed3f84286ec72
Author: Lijun Pan <ljp@linux.ibm.com>
Date:   Wed Jan 27 19:34:42 2021 -0600

    ibmvnic: Ensure that CRQ entry read are correctly ordered
    
    commit e41aec79e62fa50f940cf222d1e9577f14e149dc upstream.
    
    Ensure that received Command-Response Queue (CRQ) entries are
    properly read in order by the driver. dma_rmb barrier has
    been added before accessing the CRQ descriptor to ensure
    the entire descriptor is read before processing.
    
    Fixes: 032c5e82847a ("Driver for IBM System i/p VNIC protocol")
    Signed-off-by: Lijun Pan <ljp@linux.ibm.com>
    Link: https://lore.kernel.org/r/20210128013442.88319-1-ljp@linux.ibm.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 78dcc1b1712a81a689597b6f9e4602078f0790fb
Author: Pan Bian <bianpan2016@163.com>
Date:   Thu Jan 21 04:33:43 2021 -0800

    net: dsa: bcm_sf2: put device node before return
    
    commit cf3c46631e1637582f517a574c77cd6c05793817 upstream.
    
    Put the device node dn before return error code on failure path.
    
    Fixes: 461cd1b03e32 ("net: dsa: bcm_sf2: Register our slave MDIO bus")
    Signed-off-by: Pan Bian <bianpan2016@163.com>
    Link: https://lore.kernel.org/r/20210121123343.26330-1-bianpan2016@163.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>