commit b8f3be299d5176348b15cc59d55b85faa3dece68
Author: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date:   Mon Jun 6 08:20:58 2022 +0200

    Linux 4.14.282
    
    Link: https://lore.kernel.org/r/20220603173814.362515009@linuxfoundation.org
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 92cc6da11b10a25be13aeeb42fb0a6d7a0587156
Author: Liu Jian <liujian56@huawei.com>
Date:   Sat Apr 16 18:57:59 2022 +0800

    bpf: Enlarge offset check value to INT_MAX in bpf_skb_{load,store}_bytes
    
    commit 45969b4152c1752089351cd6836a42a566d49bcf upstream.
    
    The data length of skb frags + frag_list may be greater than 0xffff, and
    skb_header_pointer can not handle negative offset. So, here INT_MAX is used
    to check the validity of offset. Add the same change to the related function
    skb_store_bytes.
    
    Fixes: 05c74e5e53f6 ("bpf: add bpf_skb_load_bytes helper")
    Signed-off-by: Liu Jian <liujian56@huawei.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Acked-by: Song Liu <songliubraving@fb.com>
    Link: https://lore.kernel.org/bpf/20220416105801.88708-2-liujian56@huawei.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2ec65dc6635d1976bd1dbf2640ff7f810b2f6dd1
Author: Chuck Lever <chuck.lever@oracle.com>
Date:   Sat May 21 19:06:13 2022 -0400

    NFSD: Fix possible sleep during nfsd4_release_lockowner()
    
    commit ce3c4ad7f4ce5db7b4f08a1e237d8dd94b39180b upstream.
    
    nfsd4_release_lockowner() holds clp->cl_lock when it calls
    check_for_locks(). However, check_for_locks() calls nfsd_file_get()
    / nfsd_file_put() to access the backing inode's flc_posix list, and
    nfsd_file_put() can sleep if the inode was recently removed.
    
    Let's instead rely on the stateowner's reference count to gate
    whether the release is permitted. This should be a reliable
    indication of locks-in-use since file lock operations and
    ->lm_get_owner take appropriate references, which are released
    appropriately when file locks are removed.
    
    Reported-by: Dai Ngo <dai.ngo@oracle.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit bb4720010810d13fd2544363e2398b22fbfe0105
Author: Akira Yokosawa <akiyks@gmail.com>
Date:   Wed Apr 27 18:28:39 2022 +0900

    docs: submitting-patches: Fix crossref to 'The canonical patch format'
    
    commit 6d5aa418b3bd42cdccc36e94ee199af423ef7c84 upstream.
    
    The reference to `explicit_in_reply_to` is pointless as when the
    reference was added in the form of "#15" [1], Section 15) was "The
    canonical patch format".
    The reference of "#15" had not been properly updated in a couple of
    reorganizations during the plain-text SubmittingPatches era.
    
    Fix it by using `the_canonical_patch_format`.
    
    [1]: 2ae19acaa50a ("Documentation: Add "how to write a good patch summary" to SubmittingPatches")
    
    Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
    Fixes: 5903019b2a5e ("Documentation/SubmittingPatches: convert it to ReST markup")
    Fixes: 9b2c76777acc ("Documentation/SubmittingPatches: enrich the Sphinx output")
    Cc: Jonathan Corbet <corbet@lwn.net>
    Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
    Cc: stable@vger.kernel.org # v4.9+
    Link: https://lore.kernel.org/r/64e105a5-50be-23f2-6cae-903a2ea98e18@gmail.com
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 2e3d708313d9eddfe6d389d6ff7ff6158635b9c6
Author: Xiu Jianfeng <xiujianfeng@huawei.com>
Date:   Fri Mar 18 14:02:01 2022 +0800

    tpm: ibmvtpm: Correct the return value in tpm_ibmvtpm_probe()
    
    commit d0dc1a7100f19121f6e7450f9cdda11926aa3838 upstream.
    
    Currently it returns zero when CRQ response timed out, it should return
    an error code instead.
    
    Fixes: d8d74ea3c002 ("tpm: ibmvtpm: Wait for buffer to be set before proceeding")
    Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
    Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
    Acked-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 388bc1e69663956f8cee43af3bd02bd3061d222d
Author: Sarthak Kukreti <sarthakkukreti@google.com>
Date:   Tue May 31 15:56:40 2022 -0400

    dm verity: set DM_TARGET_IMMUTABLE feature flag
    
    commit 4caae58406f8ceb741603eee460d79bacca9b1b5 upstream.
    
    The device-mapper framework provides a mechanism to mark targets as
    immutable (and hence fail table reloads that try to change the target
    type). Add the DM_TARGET_IMMUTABLE flag to the dm-verity target's
    feature flags to prevent switching the verity target with a different
    target type.
    
    Fixes: a4ffc152198e ("dm: add verity target")
    Cc: stable@vger.kernel.org
    Signed-off-by: Sarthak Kukreti <sarthakkukreti@google.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 1dbcb821c63d09dc4a641bf99bb05f238610717f
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Sun Apr 24 16:43:00 2022 -0400

    dm stats: add cond_resched when looping over entries
    
    commit bfe2b0146c4d0230b68f5c71a64380ff8d361f8b upstream.
    
    dm-stats can be used with a very large number of entries (it is only
    limited by 1/4 of total system memory), so add rescheduling points to
    the loops that iterate over the entries.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4cd9c5f4235d0132e89bcc4cf03843494531e99b
Author: Mikulas Patocka <mpatocka@redhat.com>
Date:   Mon Apr 25 08:53:29 2022 -0400

    dm crypt: make printing of the key constant-time
    
    commit 567dd8f34560fa221a6343729474536aa7ede4fd upstream.
    
    The device mapper dm-crypt target is using scnprintf("%02x", cc->key[i]) to
    report the current key to userspace. However, this is not a constant-time
    operation and it may leak information about the key via timing, via cache
    access patterns or via the branch predictor.
    
    Change dm-crypt's key printing to use "%c" instead of "%02x". Also
    introduce hex2asc() that carefully avoids any branching or memory
    accesses when converting a number in the range 0 ... 15 to an ascii
    character.
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Tested-by: Milan Broz <gmazyland@gmail.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 43133f74880eca1be093c1a4cc74d5b6aa6f2f22
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Mon Apr 25 14:56:48 2022 +0300

    dm integrity: fix error code in dm_integrity_ctr()
    
    commit d3f2a14b8906df913cb04a706367b012db94a6e8 upstream.
    
    The "r" variable shadows an earlier "r" that has function scope.  It
    means that we accidentally return success instead of an error code.
    Smatch has a warning for this:
    
            drivers/md/dm-integrity.c:4503 dm_integrity_ctr()
            warn: missing error code 'r'
    
    Fixes: 7eada909bfd7 ("dm: add integrity target")
    Cc: stable@vger.kernel.org
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Reviewed-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: Mike Snitzer <snitzer@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 3674d8a8dadd03a447dd21069d4dacfc3399b63b
Author: Sultan Alsawaf <sultan@kerneltoast.com>
Date:   Fri May 13 15:11:26 2022 -0700

    zsmalloc: fix races between asynchronous zspage free and page migration
    
    commit 2505a981114dcb715f8977b8433f7540854851d8 upstream.
    
    The asynchronous zspage free worker tries to lock a zspage's entire page
    list without defending against page migration.  Since pages which haven't
    yet been locked can concurrently migrate off the zspage page list while
    lock_zspage() churns away, lock_zspage() can suffer from a few different
    lethal races.
    
    It can lock a page which no longer belongs to the zspage and unsafely
    dereference page_private(), it can unsafely dereference a torn pointer to
    the next page (since there's a data race), and it can observe a spurious
    NULL pointer to the next page and thus not lock all of the zspage's pages
    (since a single page migration will reconstruct the entire page list, and
    create_page_chain() unconditionally zeroes out each list pointer in the
    process).
    
    Fix the races by using migrate_read_lock() in lock_zspage() to synchronize
    with page migration.
    
    Link: https://lkml.kernel.org/r/20220509024703.243847-1-sultan@kerneltoast.com
    Fixes: 77ff465799c602 ("zsmalloc: zs_page_migrate: skip unnecessary loops but not return -EBUSY if zspage is not inuse")
    Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
    Acked-by: Minchan Kim <minchan@kernel.org>
    Cc: Nitin Gupta <ngupta@vflare.org>
    Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit e97222b785e70e8973281666d709baad6523d8af
Author: Florian Westphal <fw@strlen.de>
Date:   Fri May 20 00:02:04 2022 +0200

    netfilter: conntrack: re-fetch conntrack after insertion
    
    commit 56b14ecec97f39118bf85c9ac2438c5a949509ed upstream.
    
    In case the conntrack is clashing, insertion can free skb->_nfct and
    set skb->_nfct to the already-confirmed entry.
    
    This wasn't found before because the conntrack entry and the extension
    space used to free'd after an rcu grace period, plus the race needs
    events enabled to trigger.
    
    Reported-by: <syzbot+793a590957d9c1b96620@syzkaller.appspotmail.com>
    Fixes: 71d8c47fc653 ("netfilter: conntrack: introduce clash resolution on insertion race")
    Fixes: 2ad9d7747c10 ("netfilter: conntrack: free extension area immediately")
    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 98e0c7c702894987732776736c99b85ade6fba45
Author: Kees Cook <keescook@chromium.org>
Date:   Mon Jan 31 16:09:47 2022 -0800

    exec: Force single empty string when argv is empty
    
    commit dcd46d897adb70d63e025f175a00a89797d31a43 upstream.
    
    Quoting[1] Ariadne Conill:
    
    "In several other operating systems, it is a hard requirement that the
    second argument to execve(2) be the name of a program, thus prohibiting
    a scenario where argc < 1. POSIX 2017 also recommends this behaviour,
    but it is not an explicit requirement[2]:
    
        The argument arg0 should point to a filename string that is
        associated with the process being started by one of the exec
        functions.
    ...
    Interestingly, Michael Kerrisk opened an issue about this in 2008[3],
    but there was no consensus to support fixing this issue then.
    Hopefully now that CVE-2021-4034 shows practical exploitative use[4]
    of this bug in a shellcode, we can reconsider.
    
    This issue is being tracked in the KSPP issue tracker[5]."
    
    While the initial code searches[6][7] turned up what appeared to be
    mostly corner case tests, trying to that just reject argv == NULL
    (or an immediately terminated pointer list) quickly started tripping[8]
    existing userspace programs.
    
    The next best approach is forcing a single empty string into argv and
    adjusting argc to match. The number of programs depending on argc == 0
    seems a smaller set than those calling execve with a NULL argv.
    
    Account for the additional stack space in bprm_stack_limits(). Inject an
    empty string when argc == 0 (and set argc = 1). Warn about the case so
    userspace has some notice about the change:
    
        process './argc0' launched './argc0' with NULL argv: empty string added
    
    Additionally WARN() and reject NULL argv usage for kernel threads.
    
    [1] https://lore.kernel.org/lkml/20220127000724.15106-1-ariadne@dereferenced.org/
    [2] https://pubs.opengroup.org/onlinepubs/9699919799/functions/exec.html
    [3] https://bugzilla.kernel.org/show_bug.cgi?id=8408
    [4] https://www.qualys.com/2022/01/25/cve-2021-4034/pwnkit.txt
    [5] https://github.com/KSPP/linux/issues/176
    [6] https://codesearch.debian.net/search?q=execve%5C+*%5C%28%5B%5E%2C%5D%2B%2C+*NULL&literal=0
    [7] https://codesearch.debian.net/search?q=execlp%3F%5Cs*%5C%28%5B%5E%2C%5D%2B%2C%5Cs*NULL&literal=0
    [8] https://lore.kernel.org/lkml/20220131144352.GE16385@xsang-OptiPlex-9020/
    
    Reported-by: Ariadne Conill <ariadne@dereferenced.org>
    Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Rich Felker <dalias@libc.org>
    Cc: Eric Biederman <ebiederm@xmission.com>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: linux-fsdevel@vger.kernel.org
    Cc: stable@vger.kernel.org
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Acked-by: Christian Brauner <brauner@kernel.org>
    Acked-by: Ariadne Conill <ariadne@dereferenced.org>
    Acked-by: Andy Lutomirski <luto@kernel.org>
    Link: https://lore.kernel.org/r/20220201000947.2453721-1-keescook@chromium.org
    [vegard: fixed conflicts due to missing
     886d7de631da71e30909980fdbf318f7caade262^- and
     3950e975431bc914f7e81b8f2a2dbdf2064acb0f^- and
     655c16a8ce9c15842547f40ce23fd148aeccc074]
    Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 4f3ea768c56e8dce55ae538f18b37420366c5c22
Author: Haimin Zhang <tcs.kernel@gmail.com>
Date:   Wed Feb 16 16:40:38 2022 +0800

    block-map: add __GFP_ZERO flag for alloc_page in function bio_copy_kern
    
    commit cc8f7fe1f5eab010191aa4570f27641876fa1267 upstream.
    
    Add __GFP_ZERO flag for alloc_page in function bio_copy_kern to initialize
    the buffer of a bio.
    
    Signed-off-by: Haimin Zhang <tcs.kernel@gmail.com>
    Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Link: https://lore.kernel.org/r/20220216084038.15635-1-tcs.kernel@gmail.com
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    [DP: Backported to 4.19: Manually added __GFP_ZERO flag]
    Signed-off-by: Dragos-Marian Panait <dragos.panait@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1709d3697ef28e5a55dd0aea29804173fd7e185
Author: Gustavo A. R. Silva <gustavoars@kernel.org>
Date:   Wed Apr 27 17:47:14 2022 -0500

    drm/i915: Fix -Wstringop-overflow warning in call to intel_read_wm_latency()
    
    commit 336feb502a715909a8136eb6a62a83d7268a353b upstream.
    
    Fix the following -Wstringop-overflow warnings when building with GCC-11:
    
    drivers/gpu/drm/i915/intel_pm.c:3106:9: warning: ‘intel_read_wm_latency’ accessing 16 bytes in a region of size 10 [-Wstringop-overflow=]
     3106 |         intel_read_wm_latency(dev_priv, dev_priv->wm.pri_latency);
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    drivers/gpu/drm/i915/intel_pm.c:3106:9: note: referencing argument 2 of type ‘u16 *’ {aka ‘short unsigned int *’}
    drivers/gpu/drm/i915/intel_pm.c:2861:13: note: in a call to function ‘intel_read_wm_latency’
     2861 | static void intel_read_wm_latency(struct drm_i915_private *dev_priv,
          |             ^~~~~~~~~~~~~~~~~~~~~
    
    by removing the over-specified array size from the argument declarations.
    
    It seems that this code is actually safe because the size of the
    array depends on the hardware generation, and the function checks
    for that.
    
    Notice that wm can be an array of 5 elements:
    drivers/gpu/drm/i915/intel_pm.c:3109:   intel_read_wm_latency(dev_priv, dev_priv->wm.pri_latency);
    
    or an array of 8 elements:
    drivers/gpu/drm/i915/intel_pm.c:3131:   intel_read_wm_latency(dev_priv, dev_priv->wm.skl_latency);
    
    and the compiler legitimately complains about that.
    
    This helps with the ongoing efforts to globally enable
    -Wstringop-overflow.
    
    Link: https://github.com/KSPP/linux/issues/181
    Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 8a24b70dcdaf41d90156bd268118f1f7322f3632
Author: Stephen Brennan <stephen.s.brennan@oracle.com>
Date:   Thu May 19 09:50:30 2022 +0100

    assoc_array: Fix BUG_ON during garbage collect
    
    commit d1dc87763f406d4e67caf16dbe438a5647692395 upstream.
    
    A rare BUG_ON triggered in assoc_array_gc:
    
        [3430308.818153] kernel BUG at lib/assoc_array.c:1609!
    
    Which corresponded to the statement currently at line 1593 upstream:
    
        BUG_ON(assoc_array_ptr_is_meta(p));
    
    Using the data from the core dump, I was able to generate a userspace
    reproducer[1] and determine the cause of the bug.
    
    [1]: https://github.com/brenns10/kernel_stuff/tree/master/assoc_array_gc
    
    After running the iterator on the entire branch, an internal tree node
    looked like the following:
    
        NODE (nr_leaves_on_branch: 3)
          SLOT [0] NODE (2 leaves)
          SLOT [1] NODE (1 leaf)
          SLOT [2..f] NODE (empty)
    
    In the userspace reproducer, the pr_devel output when compressing this
    node was:
    
        -- compress node 0x5607cc089380 --
        free=0, leaves=0
        [0] retain node 2/1 [nx 0]
        [1] fold node 1/1 [nx 0]
        [2] fold node 0/1 [nx 2]
        [3] fold node 0/2 [nx 2]
        [4] fold node 0/3 [nx 2]
        [5] fold node 0/4 [nx 2]
        [6] fold node 0/5 [nx 2]
        [7] fold node 0/6 [nx 2]
        [8] fold node 0/7 [nx 2]
        [9] fold node 0/8 [nx 2]
        [10] fold node 0/9 [nx 2]
        [11] fold node 0/10 [nx 2]
        [12] fold node 0/11 [nx 2]
        [13] fold node 0/12 [nx 2]
        [14] fold node 0/13 [nx 2]
        [15] fold node 0/14 [nx 2]
        after: 3
    
    At slot 0, an internal node with 2 leaves could not be folded into the
    node, because there was only one available slot (slot 0). Thus, the
    internal node was retained. At slot 1, the node had one leaf, and was
    able to be folded in successfully. The remaining nodes had no leaves,
    and so were removed. By the end of the compression stage, there were 14
    free slots, and only 3 leaf nodes. The tree was ascended and then its
    parent node was compressed. When this node was seen, it could not be
    folded, due to the internal node it contained.
    
    The invariant for compression in this function is: whenever
    nr_leaves_on_branch < ASSOC_ARRAY_FAN_OUT, the node should contain all
    leaf nodes. The compression step currently cannot guarantee this, given
    the corner case shown above.
    
    To fix this issue, retry compression whenever we have retained a node,
    and yet nr_leaves_on_branch < ASSOC_ARRAY_FAN_OUT. This second
    compression will then allow the node in slot 1 to be folded in,
    satisfying the invariant. Below is the output of the reproducer once the
    fix is applied:
    
        -- compress node 0x560e9c562380 --
        free=0, leaves=0
        [0] retain node 2/1 [nx 0]
        [1] fold node 1/1 [nx 0]
        [2] fold node 0/1 [nx 2]
        [3] fold node 0/2 [nx 2]
        [4] fold node 0/3 [nx 2]
        [5] fold node 0/4 [nx 2]
        [6] fold node 0/5 [nx 2]
        [7] fold node 0/6 [nx 2]
        [8] fold node 0/7 [nx 2]
        [9] fold node 0/8 [nx 2]
        [10] fold node 0/9 [nx 2]
        [11] fold node 0/10 [nx 2]
        [12] fold node 0/11 [nx 2]
        [13] fold node 0/12 [nx 2]
        [14] fold node 0/13 [nx 2]
        [15] fold node 0/14 [nx 2]
        internal nodes remain despite enough space, retrying
        -- compress node 0x560e9c562380 --
        free=14, leaves=1
        [0] fold node 2/15 [nx 0]
        after: 3
    
    Changes
    =======
    DH:
     - Use false instead of 0.
     - Reorder the inserted lines in a couple of places to put retained before
       next_slot.
    
    ver #2)
     - Fix typo in pr_devel, correct comparison to "<="
    
    Fixes: 3cb989501c26 ("Add a generic associative array implementation.")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
    Signed-off-by: David Howells <dhowells@redhat.com>
    cc: Andrew Morton <akpm@linux-foundation.org>
    cc: keyrings@vger.kernel.org
    Link: https://lore.kernel.org/r/20220511225517.407935-1-stephen.s.brennan@oracle.com/ # v1
    Link: https://lore.kernel.org/r/20220512215045.489140-1-stephen.s.brennan@oracle.com/ # v2
    Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit b1db0b5c81831861ce40a3e0f6d5eb2b1075bf24
Author: Piyush Malgujar <pmalgujar@marvell.com>
Date:   Wed May 11 06:36:59 2022 -0700

    drivers: i2c: thunderx: Allow driver to work with ACPI defined TWSI controllers
    
    [ Upstream commit 03a35bc856ddc09f2cc1f4701adecfbf3b464cb3 ]
    
    Due to i2c->adap.dev.fwnode not being set, ACPI_COMPANION() wasn't properly
    found for TWSI controllers.
    
    Signed-off-by: Szymon Balcerak <sbalcerak@marvell.com>
    Signed-off-by: Piyush Malgujar <pmalgujar@marvell.com>
    Signed-off-by: Wolfram Sang <wsa@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 3c15e931fe7cc533728cd5e2fa521bc3ce952ba3
Author: Joel Stanley <joel@jms.id.au>
Date:   Tue May 17 18:52:17 2022 +0930

    net: ftgmac100: Disable hardware checksum on AST2600
    
    [ Upstream commit 6fd45e79e8b93b8d22fb8fe22c32fbad7e9190bd ]
    
    The AST2600 when using the i210 NIC over NC-SI has been observed to
    produce incorrect checksum results with specific MTU values. This was
    first observed when sending data across a long distance set of networks.
    
    On a local network, the following test was performed using a 1MB file of
    random data.
    
    On the receiver run this script:
    
     #!/bin/bash
     while [ 1 ]; do
            # Zero the stats
            nstat -r  > /dev/null
            nc -l 9899 > test-file
            # Check for checksum errors
            TcpInCsumErrors=$(nstat | grep TcpInCsumErrors)
            if [ -z "$TcpInCsumErrors" ]; then
                    echo No TcpInCsumErrors
            else
                    echo TcpInCsumErrors = $TcpInCsumErrors
            fi
     done
    
    On an AST2600 system:
    
     # nc <IP of  receiver host> 9899 < test-file
    
    The test was repeated with various MTU values:
    
     # ip link set mtu 1410 dev eth0
    
    The observed results:
    
     1500 - good
     1434 - bad
     1400 - good
     1410 - bad
     1420 - good
    
    The test was repeated after disabling tx checksumming:
    
     # ethtool -K eth0 tx-checksumming off
    
    And all MTU values tested resulted in transfers without error.
    
    An issue with the driver cannot be ruled out, however there has been no
    bug discovered so far.
    
    David has done the work to take the original bug report of slow data
    transfer between long distance connections and triaged it down to this
    test case.
    
    The vendor suspects this this is a hardware issue when using NC-SI. The
    fixes line refers to the patch that introduced AST2600 support.
    
    Reported-by: David Wilder <wilder@us.ibm.com>
    Reviewed-by: Dylan Hung <dylan_hung@aspeedtech.com>
    Signed-off-by: Joel Stanley <joel@jms.id.au>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 0aa0d8ab332f218edadad0654f3cb1e559578831
Author: Thomas Bartschies <thomas.bartschies@cvk.de>
Date:   Wed May 18 08:32:18 2022 +0200

    net: af_key: check encryption module availability consistency
    
    [ Upstream commit 015c44d7bff3f44d569716117becd570c179ca32 ]
    
    Since the recent introduction supporting the SM3 and SM4 hash algos for IPsec, the kernel
    produces invalid pfkey acquire messages, when these encryption modules are disabled. This
    happens because the availability of the algos wasn't checked in all necessary functions.
    This patch adds these checks.
    
    Signed-off-by: Thomas Bartschies <thomas.bartschies@cvk.de>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>

commit 853b1bcc5c53b2efb34e6427e753c75ff52d0210
Author: Lorenzo Pieralisi <lpieralisi@kernel.org>
Date:   Thu Apr 7 11:51:20 2022 +0100

    ACPI: sysfs: Fix BERT error region memory mapping
    
    commit 1bbc21785b7336619fb6a67f1fff5afdaf229acc upstream.
    
    Currently the sysfs interface maps the BERT error region as "memory"
    (through acpi_os_map_memory()) in order to copy the error records into
    memory buffers through memory operations (eg memory_read_from_buffer()).
    
    The OS system cannot detect whether the BERT error region is part of
    system RAM or it is "device memory" (eg BMC memory) and therefore it
    cannot detect which memory attributes the bus to memory support (and
    corresponding kernel mapping, unless firmware provides the required
    information).
    
    The acpi_os_map_memory() arch backend implementation determines the
    mapping attributes. On arm64, if the BERT error region is not present in
    the EFI memory map, the error region is mapped as device-nGnRnE; this
    triggers alignment faults since memcpy unaligned accesses are not
    allowed in device-nGnRnE regions.
    
    The ACPI sysfs code cannot therefore map by default the BERT error
    region with memory semantics but should use a safer default.
    
    Change the sysfs code to map the BERT error region as MMIO (through
    acpi_os_map_iomem()) and use the memcpy_fromio() interface to read the
    error region into the kernel buffer.
    
    Link: https://lore.kernel.org/linux-arm-kernel/31ffe8fc-f5ee-2858-26c5-0fd8bdd68702@arm.com
    Link: https://lore.kernel.org/linux-acpi/CAJZ5v0g+OVbhuUUDrLUCfX_mVqY_e8ubgLTU98=jfjTeb4t+Pw@mail.gmail.com
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Tested-by: Veronika Kabatova <vkabatov@redhat.com>
    Tested-by: Aristeu Rozanski <aris@redhat.com>
    Acked-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: dann frazier <dann.frazier@canonical.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 5a63f921136e879aab23a83b3fb8e3d3d767c3cf
Author: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Date:   Wed Jun 16 20:03:32 2021 +0300

    ACPI: sysfs: Make sparse happy about address space in use
    
    commit bdd56d7d8931e842775d2e5b93d426a8d1940e33 upstream.
    
    Sparse is not happy about address space in use in acpi_data_show():
    
    drivers/acpi/sysfs.c:428:14: warning: incorrect type in assignment (different address spaces)
    drivers/acpi/sysfs.c:428:14:    expected void [noderef] __iomem *base
    drivers/acpi/sysfs.c:428:14:    got void *
    drivers/acpi/sysfs.c:431:59: warning: incorrect type in argument 4 (different address spaces)
    drivers/acpi/sysfs.c:431:59:    expected void const *from
    drivers/acpi/sysfs.c:431:59:    got void [noderef] __iomem *base
    drivers/acpi/sysfs.c:433:30: warning: incorrect type in argument 1 (different address spaces)
    drivers/acpi/sysfs.c:433:30:    expected void *logical_address
    drivers/acpi/sysfs.c:433:30:    got void [noderef] __iomem *base
    
    Indeed, acpi_os_map_memory() returns a void pointer with dropped specific
    address space. Hence, we don't need to carry out __iomem in acpi_data_show().
    
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Cc: dann frazier <dann.frazier@canonical.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 40d20f3186ddd9b6b94598f4ef3d07644b0fa43c
Author: Willy Tarreau <w@1wt.eu>
Date:   Mon May 2 10:46:08 2022 +0200

    secure_seq: use the 64 bits of the siphash for port offset calculation
    
    commit b2d057560b8107c633b39aabe517ff9d93f285e3 upstream.
    
    SipHash replaced MD5 in secure_ipv{4,6}_port_ephemeral() via commit
    7cd23e5300c1 ("secure_seq: use SipHash in place of MD5"), but the output
    remained truncated to 32-bit only. In order to exploit more bits from the
    hash, let's make the functions return the full 64-bit of siphash_3u32().
    We also make sure the port offset calculation in __inet_hash_connect()
    remains done on 32-bit to avoid the need for div_u64_rem() and an extra
    cost on 32-bit systems.
    
    Cc: Jason A. Donenfeld <Jason@zx2c4.com>
    Cc: Moshe Kol <moshe.kol@mail.huji.ac.il>
    Cc: Yossi Gilad <yossi.gilad@mail.huji.ac.il>
    Cc: Amit Klein <aksecurity@gmail.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Willy Tarreau <w@1wt.eu>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    [SG: Adjusted context]
    Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 22ee96b72a9b9dccbbb85e8aa51b7eb7cfb1ac9f
Author: Eric Dumazet <edumazet@google.com>
Date:   Tue Feb 9 11:20:27 2021 -0800

    tcp: change source port randomizarion at connect() time
    
    commit 190cc82489f46f9d88e73c81a47e14f80a791e1a upstream.
    
    RFC 6056 (Recommendations for Transport-Protocol Port Randomization)
    provides good summary of why source selection needs extra care.
    
    David Dworken reminded us that linux implements Algorithm 3
    as described in RFC 6056 3.3.3
    
    Quoting David :
       In the context of the web, this creates an interesting info leak where
       websites can count how many TCP connections a user's computer is
       establishing over time. For example, this allows a website to count
       exactly how many subresources a third party website loaded.
       This also allows:
       - Distinguishing between different users behind a VPN based on
           distinct source port ranges.
       - Tracking users over time across multiple networks.
       - Covert communication channels between different browsers/browser
           profiles running on the same computer
       - Tracking what applications are running on a computer based on
           the pattern of how fast source ports are getting incremented.
    
    Section 3.3.4 describes an enhancement, that reduces
    attackers ability to use the basic information currently
    stored into the shared 'u32 hint'.
    
    This change also decreases collision rate when
    multiple applications need to connect() to
    different destinations.
    
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Reported-by: David Dworken <ddworken@google.com>
    Cc: Willem de Bruijn <willemb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    [SG: Adjusted context]
    Signed-off-by: Stefan Ghinea <stefan.ghinea@windriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit d982b0715812fa3a4527010a44018ad01b86986f
Author: Denis Efremov (Oracle) <efremov@linux.com>
Date:   Mon May 23 21:39:43 2022 +0400

    staging: rtl8723bs: prevent ->Ssid overflow in rtw_wx_set_scan()
    
    This code has a check to prevent read overflow but it needs another
    check to prevent writing beyond the end of the ->Ssid[] array.
    
    Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
    Cc: stable <stable@vger.kernel.org>
    Signed-off-by: Denis Efremov (Oracle) <efremov@linux.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

commit 171ca9a7813df186e7c629f286a55c246a6ce9af
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Thu Apr 28 15:50:54 2022 +0200

    x86/pci/xen: Disable PCI/MSI[-X] masking for XEN_HVM guests
    
    commit 7e0815b3e09986d2fe651199363e135b9358132a upstream.
    
    When a XEN_HVM guest uses the XEN PIRQ/Eventchannel mechanism, then
    PCI/MSI[-X] masking is solely controlled by the hypervisor, but contrary to
    XEN_PV guests this does not disable PCI/MSI[-X] masking in the PCI/MSI
    layer.
    
    This can lead to a situation where the PCI/MSI layer masks an MSI[-X]
    interrupt and the hypervisor grants the write despite the fact that it
    already requested the interrupt. As a consequence interrupt delivery on the
    affected device is not happening ever.
    
    Set pci_msi_ignore_mask to prevent that like it's done for XEN_PV guests
    already.
    
    Fixes: 809f9267bbab ("xen: map MSIs into pirqs")
    Reported-by: Jeremi Piotrowski <jpiotrowski@linux.microsoft.com>
    Reported-by: Dusty Mabe <dustymabe@redhat.com>
    Reported-by: Salvatore Bonaccorso <carnil@debian.org>
    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: Noah Meyerhans <noahm@debian.org>
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/87tuaduxj5.ffs@tglx
    [nmeyerha@amazon.com: backported to 4.14]
    Signed-off-by: Noah Meyerhans <nmeyerha@amazon.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>