Linux 5.15.105

 
ACPI: x86: utils: Add Cezanne to the list for forcing StorageD3Enable [+ + +]
Author: Mario Limonciello <[email protected]>
Date:   Tue Feb 28 16:11:28 2023 -0600

    ACPI: x86: utils: Add Cezanne to the list for forcing StorageD3Enable
    
    [ Upstream commit e2a56364485e7789e7b8f342637c7f3a219f7ede ]
    
    commit 018d6711c26e4 ("ACPI: x86: Add a quirk for Dell Inspiron 14 2-in-1
    for StorageD3Enable") introduced a quirk to allow a system with ambiguous
    use of _ADR 0 to force StorageD3Enable.
    
    It was reported that several more Dell systems suffered the same symptoms.
    As the list is continuing to grow but these are all Cezanne systems,
    instead add Cezanne to the CPU list to apply the StorageD3Enable property
    and remove the whole list.
    
    It was also reported that an HP system only has StorageD3Enable on the ACPI
    device for the first NVME disk, not the second.
    
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217003
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=216773
    Reported-by: David Alvarez Lombardi <[email protected]>
    Reported-by: [email protected]
    Reported-and-tested-by: Elvis Angelaccio <[email protected]>
    Tested-by: [email protected]
    Tested-by: [email protected]
    Signed-off-by: Mario Limonciello <[email protected]>
    Signed-off-by: Rafael J. Wysocki <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
act_mirred: use the backlog for nested calls to mirred ingress [+ + +]
Author: Davide Caratti <[email protected]>
Date:   Fri Jan 20 18:01:40 2023 +0100

    act_mirred: use the backlog for nested calls to mirred ingress
    
    [ Upstream commit ca22da2fbd693b54dc8e3b7b54ccc9f7e9ba3640 ]
    
    William reports kernel soft-lockups on some OVS topologies when TC mirred
    egress->ingress action is hit by local TCP traffic [1].
    The same can also be reproduced with SCTP (thanks Xin for verifying), when
    client and server reach themselves through mirred egress to ingress, and
    one of the two peers sends a "heartbeat" packet (from within a timer).
    
    Enqueueing to backlog proved to fix this soft lockup; however, as Cong
    noticed [2], we should preserve - when possible - the current mirred
    behavior that counts as "overlimits" any eventual packet drop subsequent to
    the mirred forwarding action [3]. A compromise solution might use the
    backlog only when tcf_mirred_act() has a nest level greater than one:
    change tcf_mirred_forward() accordingly.
    
    Also, add a kselftest that can reproduce the lockup and verifies TC mirred
    ability to account for further packet drops after TC mirred egress->ingress
    (when the nest level is 1).
    
     [1] https://lore.kernel.org/netdev/33dc43f587ec1388ba456b4915c75f02a8aae226.1663945716.git.dcaratti@redhat.com/
     [2] https://lore.kernel.org/netdev/Y0w%[email protected]/
     [3] such behavior is not guaranteed: for example, if RPS or skb RX
         timestamping is enabled on the mirred target device, the kernel
         can defer receiving the skb and return NET_RX_SUCCESS inside
         tcf_mirred_forward().
    
    Reported-by: William Zhao <[email protected]>
    CC: Xin Long <[email protected]>
    Signed-off-by: Davide Caratti <[email protected]>
    Reviewed-by: Marcelo Ricardo Leitner <[email protected]>
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
arm64: dts: imx8mm-nitrogen-r2: fix WM8960 clock name [+ + +]
Author: Krzysztof Kozlowski <[email protected]>
Date:   Fri Feb 17 16:06:26 2023 +0100

    arm64: dts: imx8mm-nitrogen-r2: fix WM8960 clock name
    
    commit 32f86da7c86b27ebed31c24453a0713f612e43fb upstream.
    
    The WM8960 Linux driver expects the clock to be named "mclk".  Otherwise
    the clock will be ignored and not prepared/enabled by the driver.
    
    Fixes: 40ba2eda0a7b ("arm64: dts: imx8mm-nitrogen-r2: add audio")
    Cc: <[email protected]>
    Signed-off-by: Krzysztof Kozlowski <[email protected]>
    Signed-off-by: Shawn Guo <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

arm64: dts: imx8mn: specify #sound-dai-cells for SAI nodes [+ + +]
Author: Marek Vasut <[email protected]>
Date:   Tue Feb 28 22:52:44 2023 +0100

    arm64: dts: imx8mn: specify #sound-dai-cells for SAI nodes
    
    [ Upstream commit 62fb54148cd6eb456ff031be8fb447c98cf0bd9b ]
    
    Add #sound-dai-cells properties to SAI nodes.
    
    Reviewed-by: Adam Ford <[email protected]>
    Reviewed-by: Fabio Estevam <[email protected]>
    Fixes: 9e9860069725 ("arm64: dts: imx8mn: Add SAI nodes")
    Signed-off-by: Marek Vasut <[email protected]>
    Reviewed-by: Marco Felsch <[email protected]>
    Signed-off-by: Shawn Guo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ARM: dts: imx6sl: tolino-shine2hd: fix usbotg1 pinctrl [+ + +]
Author: Peng Fan <[email protected]>
Date:   Sun Feb 26 21:12:14 2023 +0800

    ARM: dts: imx6sl: tolino-shine2hd: fix usbotg1 pinctrl
    
    [ Upstream commit 1cd489e1ada1cffa56bd06fd4609f5a60a985d43 ]
    
    usb@2184000: 'pinctrl-0' is a dependency of 'pinctrl-names'
    
    Signed-off-by: Peng Fan <[email protected]>
    Fixes: 9c7016f1ca6d ("ARM: dts: imx: add devicetree for Tolino Shine 2 HD")
    Signed-off-by: Shawn Guo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ARM: dts: imx6sll: e60k02: fix usbotg1 pinctrl [+ + +]
Author: Peng Fan <[email protected]>
Date:   Sun Feb 26 21:12:13 2023 +0800

    ARM: dts: imx6sll: e60k02: fix usbotg1 pinctrl
    
    [ Upstream commit 957c04e9784c7c757e8cc293d7fb2a60cdf461b6 ]
    
    usb@2184000: 'pinctrl-0' is a dependency of 'pinctrl-names'
    
    Signed-off-by: Peng Fan <[email protected]>
    Fixes: c100ea86e6ab ("ARM: dts: add Netronix E60K02 board common file")
    Signed-off-by: Shawn Guo <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
atm: idt77252: fix kmemleak when rmmod idt77252 [+ + +]
Author: Li Zetao <[email protected]>
Date:   Mon Mar 20 14:33:18 2023 +0000

    atm: idt77252: fix kmemleak when rmmod idt77252
    
    [ Upstream commit 4fe3c88552a3fbe1944426a4506a18cdeb457b5a ]
    
    There are memory leaks reported by kmemleak:
    
      unreferenced object 0xffff888106500800 (size 128):
        comm "modprobe", pid 1017, jiffies 4297787785 (age 67.152s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<00000000970ce626>] __kmem_cache_alloc_node+0x20c/0x380
          [<00000000fb5f78d9>] kmalloc_trace+0x2f/0xb0
          [<000000000e947e2a>] idt77252_init_one+0x2847/0x3c90 [idt77252]
          [<000000006efb048e>] local_pci_probe+0xeb/0x1a0
        ...
    
      unreferenced object 0xffff888106500b00 (size 128):
        comm "modprobe", pid 1017, jiffies 4297787785 (age 67.152s)
        hex dump (first 32 bytes):
          00 20 3d 01 80 88 ff ff 00 20 3d 01 80 88 ff ff  . =...... =.....
          f0 23 3d 01 80 88 ff ff 00 20 3d 01 00 00 00 00  .#=...... =.....
        backtrace:
          [<00000000970ce626>] __kmem_cache_alloc_node+0x20c/0x380
          [<00000000fb5f78d9>] kmalloc_trace+0x2f/0xb0
          [<00000000f451c5be>] alloc_scq.constprop.0+0x4a/0x400 [idt77252]
          [<00000000e6313849>] idt77252_init_one+0x28cf/0x3c90 [idt77252]
    
    The root cause is traced to the vc_maps which alloced in open_card_oam()
    are not freed in close_card_oam(). The vc_maps are used to record
    open connections, so when close a vc_map in close_card_oam(), the memory
    should be freed. Moreover, the ubr0 is not closed when close a idt77252
    device, leading to the memory leak of vc_map and scq_info.
    
    Fix them by adding kfree in close_card_oam() and implementing new
    close_card_ubr0() to close ubr0.
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Li Zetao <[email protected]>
    Reviewed-by: Francois Romieu <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
Bluetooth: btqcomsmd: Fix command timeout after setting BD address [+ + +]
Author: Stephan Gerhold <[email protected]>
Date:   Wed Mar 8 14:31:55 2023 +0100

    Bluetooth: btqcomsmd: Fix command timeout after setting BD address
    
    [ Upstream commit 5d44ab9e204200a78ad55cdf185aa2bb109b5950 ]
    
    On most devices using the btqcomsmd driver (e.g. the DragonBoard 410c
    and other devices based on the Qualcomm MSM8916/MSM8909/... SoCs)
    the Bluetooth firmware seems to become unresponsive for a while after
    setting the BD address. On recent kernel versions (at least 5.17+)
    this often causes timeouts for subsequent commands, e.g. the HCI reset
    sent by the Bluetooth core during initialization:
    
        Bluetooth: hci0: Opcode 0x c03 failed: -110
    
    Unfortunately this behavior does not seem to be documented anywhere.
    Experimentation suggests that the minimum necessary delay to avoid
    the problem is ~150us. However, to be sure add a sleep for > 1ms
    in case it is a bit longer on other firmware versions.
    
    Older kernel versions are likely also affected, although perhaps with
    slightly different errors or less probability. Side effects can easily
    hide the issue in most cases, e.g. unrelated incoming interrupts that
    cause the necessary delay.
    
    Fixes: 1511cc750c3d ("Bluetooth: Introduce Qualcomm WCNSS SMD based HCI driver")
    Signed-off-by: Stephan Gerhold <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Thu Mar 9 16:07:39 2023 +0800

    Bluetooth: btsdio: fix use after free bug in btsdio_remove due to unfinished work
    
    [ Upstream commit 1e9ac114c4428fdb7ff4635b45d4f46017e8916f ]
    
    In btsdio_probe, &data->work was bound with btsdio_work.In
    btsdio_send_frame, it was started by schedule_work.
    
    If we call btsdio_remove with an unfinished job, there may
    be a race condition and cause UAF bug on hdev.
    
    Fixes: ddbaf13e3609 ("[Bluetooth] Add generic driver for Bluetooth SDIO devices")
    Signed-off-by: Zheng Wang <[email protected]>
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

Bluetooth: L2CAP: Fix responding with wrong PDU type [+ + +]
Author: Luiz Augusto von Dentz <[email protected]>
Date:   Wed Mar 8 14:20:34 2023 -0800

    Bluetooth: L2CAP: Fix responding with wrong PDU type
    
    [ Upstream commit 9aa9d9473f1550d1936c31259720b3f1f4690576 ]
    
    L2CAP_ECRED_CONN_REQ shall be responded with L2CAP_ECRED_CONN_RSP not
    L2CAP_LE_CONN_RSP:
    
    L2CAP LE EATT Server - Reject - run
      Listening for connections
      New client connection with handle 0x002a
      Sending L2CAP Request from client
      Client received response code 0x15
      Unexpected L2CAP response code (expected 0x18)
    L2CAP LE EATT Server - Reject - test failed
    
    > ACL Data RX: Handle 42 flags 0x02 dlen 26
          LE L2CAP: Enhanced Credit Connection Request (0x17) ident 1 len 18
            PSM: 39 (0x0027)
            MTU: 64
            MPS: 64
            Credits: 5
            Source CID: 65
            Source CID: 66
            Source CID: 67
            Source CID: 68
            Source CID: 69
    < ACL Data TX: Handle 42 flags 0x00 dlen 16
          LE L2CAP: LE Connection Response (0x15) ident 1 len 8
            invalid size
            00 00 00 00 00 00 06 00
    
    L2CAP LE EATT Server - Reject - run
      Listening for connections
      New client connection with handle 0x002a
      Sending L2CAP Request from client
      Client received response code 0x18
    L2CAP LE EATT Server - Reject - test passed
    
    Fixes: 15f02b910562 ("Bluetooth: L2CAP: Add initial code for Enhanced Credit Based Mode")
    Signed-off-by: Luiz Augusto von Dentz <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
bootconfig: Fix testcase to increase max node [+ + +]
Author: Masami Hiramatsu (Google) <[email protected]>
Date:   Wed Mar 15 22:54:08 2023 +0900

    bootconfig: Fix testcase to increase max node
    
    [ Upstream commit b69245126a48e50882021180fa5d264dc7149ccc ]
    
    Since commit 6c40624930c5 ("bootconfig: Increase max nodes of bootconfig
    from 1024 to 8192 for DCC support") increased the max number of bootconfig
    node to 8192, the bootconfig testcase of the max number of nodes fails.
    To fix this issue, we can not simply increase the number in the test script
    because the test bootconfig file becomes too big (>32KB). To fix that, we
    can use a combination of three alphabets (26^3 = 17576). But with that,
    we can not express the 8193 (just one exceed from the limitation) because
    it also exceeds the max size of bootconfig. So, the first 26 nodes will just
    use one alphabet.
    
    With this fix, test-bootconfig.sh passes all tests.
    
    Link: https://lore.kernel.org/all/167888844790.791176.670805252426835131.stgit@devnote2/
    
    Reported-by: Heinz Wiesinger <[email protected]>
    Link: https://lore.kernel.org/all/[email protected]
    Fixes: 6c40624930c5 ("bootconfig: Increase max nodes of bootconfig from 1024 to 8192 for DCC support")
    Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
    Reviewed-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
bpf: Adjust insufficient default bpf_jit_limit [+ + +]
Author: Daniel Borkmann <[email protected]>
Date:   Mon Mar 20 15:37:25 2023 +0100

    bpf: Adjust insufficient default bpf_jit_limit
    
    [ Upstream commit 10ec8ca8ec1a2f04c4ed90897225231c58c124a7 ]
    
    We've seen recent AWS EKS (Kubernetes) user reports like the following:
    
      After upgrading EKS nodes from v20230203 to v20230217 on our 1.24 EKS
      clusters after a few days a number of the nodes have containers stuck
      in ContainerCreating state or liveness/readiness probes reporting the
      following error:
    
        Readiness probe errored: rpc error: code = Unknown desc = failed to
        exec in container: failed to start exec "4a11039f730203ffc003b7[...]":
        OCI runtime exec failed: exec failed: unable to start container process:
        unable to init seccomp: error loading seccomp filter into kernel:
        error loading seccomp filter: errno 524: unknown
    
      However, we had not been seeing this issue on previous AMIs and it only
      started to occur on v20230217 (following the upgrade from kernel 5.4 to
      5.10) with no other changes to the underlying cluster or workloads.
    
      We tried the suggestions from that issue (sysctl net.core.bpf_jit_limit=452534528)
      which helped to immediately allow containers to be created and probes to
      execute but after approximately a day the issue returned and the value
      returned by cat /proc/vmallocinfo | grep bpf_jit | awk '{s+=$2} END {print s}'
      was steadily increasing.
    
    I tested bpf tree to observe bpf_jit_charge_modmem, bpf_jit_uncharge_modmem
    their sizes passed in as well as bpf_jit_current under tcpdump BPF filter,
    seccomp BPF and native (e)BPF programs, and the behavior all looks sane
    and expected, that is nothing "leaking" from an upstream perspective.
    
    The bpf_jit_limit knob was originally added in order to avoid a situation
    where unprivileged applications loading BPF programs (e.g. seccomp BPF
    policies) consuming all the module memory space via BPF JIT such that loading
    of kernel modules would be prevented. The default limit was defined back in
    2018 and while good enough back then, we are generally seeing far more BPF
    consumers today.
    
    Adjust the limit for the BPF JIT pool from originally 1/4 to now 1/2 of the
    module memory space to better reflect today's needs and avoid more users
    running into potentially hard to debug issues.
    
    Fixes: fdadd04931c2 ("bpf: fix bpf_jit_limit knob for PAGE_SIZE >= 64K")
    Reported-by: Stephen Haynes <[email protected]>
    Reported-by: Lefteris Alexakis <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
    Link: https://github.com/awslabs/amazon-eks-ami/issues/1179
    Link: https://github.com/awslabs/amazon-eks-ami/issues/1219
    Reviewed-by: Kuniyuki Iwashima <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Alexei Starovoitov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ca8210: fix mac_len negative array access [+ + +]
Author: Alexander Aring <[email protected]>
Date:   Thu Feb 16 23:25:04 2023 -0500

    ca8210: fix mac_len negative array access
    
    [ Upstream commit 6c993779ea1d0cccdb3a5d7d45446dd229e610a3 ]
    
    This patch fixes a buffer overflow access of skb->data if
    ieee802154_hdr_peek_addrs() fails.
    
    Reported-by: lianhui tang <[email protected]>
    Signed-off-by: Alexander Aring <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Stefan Schmidt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
cifs: empty interface list when server doesn't support query interfaces [+ + +]
Author: Shyam Prasad N <[email protected]>
Date:   Thu Mar 9 13:23:29 2023 +0000

    cifs: empty interface list when server doesn't support query interfaces
    
    commit 896cd316b841053f6df95ab77b5f1322c16a8e18 upstream.
    
    When querying server interfaces returns -EOPNOTSUPP,
    clear the list of interfaces. Assumption is that multichannel
    would be disabled too.
    
    Signed-off-by: Shyam Prasad N <[email protected]>
    Reviewed-by: Paulo Alcantara (SUSE) <[email protected]>
    Cc: [email protected]
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

cifs: print session id while listing open files [+ + +]
Author: Shyam Prasad N <[email protected]>
Date:   Mon Mar 13 12:17:34 2023 +0000

    cifs: print session id while listing open files
    
    commit 175b54abc443b6965e9379b71ec05f7c73c192e9 upstream.
    
    In the output of /proc/fs/cifs/open_files, we only print
    the tree id for the tcon of each open file. It becomes
    difficult to know which tcon these files belong to with
    just the tree id.
    
    This change dumps ses id in addition to all other data today.
    
    Signed-off-by: Shyam Prasad N <[email protected]>
    Reviewed-by: Paulo Alcantara (SUSE) <[email protected]>
    Cc: [email protected]
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dm crypt: add cond_resched() to dmcrypt_write() [+ + +]
Author: Mikulas Patocka <[email protected]>
Date:   Mon Mar 6 11:17:58 2023 -0500

    dm crypt: add cond_resched() to dmcrypt_write()
    
    commit fb294b1c0ba982144ca467a75e7d01ff26304e2b upstream.
    
    The loop in dmcrypt_write may be running for unbounded amount of time,
    thus we need cond_resched() in it.
    
    This commit fixes the following warning:
    
    [ 3391.153255][   C12] watchdog: BUG: soft lockup - CPU#12 stuck for 23s! [dmcrypt_write/2:2897]
    ...
    [ 3391.387210][   C12] Call trace:
    [ 3391.390338][   C12]  blk_attempt_bio_merge.part.6+0x38/0x158
    [ 3391.395970][   C12]  blk_attempt_plug_merge+0xc0/0x1b0
    [ 3391.401085][   C12]  blk_mq_submit_bio+0x398/0x550
    [ 3391.405856][   C12]  submit_bio_noacct+0x308/0x380
    [ 3391.410630][   C12]  dmcrypt_write+0x1e4/0x208 [dm_crypt]
    [ 3391.416005][   C12]  kthread+0x130/0x138
    [ 3391.419911][   C12]  ret_from_fork+0x10/0x18
    
    Reported-by: yangerkun <[email protected]>
    Fixes: dc2676210c42 ("dm crypt: offload writes to thread")
    Cc: [email protected]
    Signed-off-by: Mikulas Patocka <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

dm crypt: avoid accessing uninitialized tasklet [+ + +]
Author: Mike Snitzer <[email protected]>
Date:   Wed Mar 8 14:39:54 2023 -0500

    dm crypt: avoid accessing uninitialized tasklet
    
    commit d9a02e016aaf5a57fb44e9a5e6da8ccd3b9e2e70 upstream.
    
    When neither "no_read_workqueue" nor "no_write_workqueue" are enabled,
    tasklet_trylock() in crypt_dec_pending() may still return false due to
    an uninitialized state, and dm-crypt will unnecessarily do io completion
    in io_queue workqueue instead of current context.
    
    Fix this by adding an 'in_tasklet' flag to dm_crypt_io struct and
    initialize it to false in crypt_io_init(). Set this flag to true in
    kcryptd_queue_crypt() before calling tasklet_schedule(). If set
    crypt_dec_pending() will punt io completion to a workqueue.
    
    This also nicely avoids the tasklet_trylock/unlock hack when tasklets
    aren't in use.
    
    Fixes: 8e14f610159d ("dm crypt: do not call bio_endio() from the dm-crypt tasklet")
    Cc: [email protected]
    Reported-by: Hou Tao <[email protected]>
    Suggested-by: Ignat Korchagin <[email protected]>
    Reviewed-by: Ignat Korchagin <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dm stats: check for and propagate alloc_percpu failure [+ + +]
Author: Jiasheng Jiang <[email protected]>
Date:   Thu Mar 16 14:55:06 2023 +0800

    dm stats: check for and propagate alloc_percpu failure
    
    commit d3aa3e060c4a80827eb801fc448debc9daa7c46b upstream.
    
    Check alloc_precpu()'s return value and return an error from
    dm_stats_init() if it fails. Update alloc_dev() to fail if
    dm_stats_init() does.
    
    Otherwise, a NULL pointer dereference will occur in dm_stats_cleanup()
    even if dm-stats isn't being actively used.
    
    Fixes: fd2ed4d25270 ("dm: add statistics support")
    Cc: [email protected]
    Signed-off-by: Jiasheng Jiang <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
dm thin: fix deadlock when swapping to thin device [+ + +]
Author: Coly Li <[email protected]>
Date:   Mon Feb 27 23:23:17 2023 +0800

    dm thin: fix deadlock when swapping to thin device
    
    commit 9bbf5feecc7eab2c370496c1c161bbfe62084028 upstream.
    
    This is an already known issue that dm-thin volume cannot be used as
    swap, otherwise a deadlock may happen when dm-thin internal memory
    demand triggers swap I/O on the dm-thin volume itself.
    
    But thanks to commit a666e5c05e7c ("dm: fix deadlock when swapping to
    encrypted device"), the limit_swap_bios target flag can also be used
    for dm-thin to avoid the recursive I/O when it is used as swap.
    
    Fix is to simply set ti->limit_swap_bios to true in both pool_ctr()
    and thin_ctr().
    
    In my test, I create a dm-thin volume /dev/vg/swap and use it as swap
    device. Then I run fio on another dm-thin volume /dev/vg/main and use
    large --blocksize to trigger swap I/O onto /dev/vg/swap.
    
    The following fio command line is used in my test,
      fio --name recursive-swap-io --lockmem 1 --iodepth 128 \
         --ioengine libaio --filename /dev/vg/main --rw randrw \
        --blocksize 1M --numjobs 32 --time_based --runtime=12h
    
    Without this fix, the whole system can be locked up within 15 seconds.
    
    With this fix, there is no any deadlock or hung task observed after
    2 hours of running fio.
    
    Furthermore, if blocksize is changed from 1M to 128M, after around 30
    seconds fio has no visible I/O, and the out-of-memory killer message
    shows up in kernel message. After around 20 minutes all fio processes
    are killed and the whole system is back to being alive.
    
    This is exactly what is expected when recursive I/O happens on dm-thin
    volume when it is used as swap.
    
    Depends-on: a666e5c05e7c ("dm: fix deadlock when swapping to encrypted device")
    Cc: [email protected]
    Signed-off-by: Coly Li <[email protected]>
    Acked-by: Mikulas Patocka <[email protected]>
    Signed-off-by: Mike Snitzer <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/amdgpu/nv: Apply ASPM quirk on Intel ADL + AMD Navi [+ + +]
Author: Kai-Heng Feng <[email protected]>
Date:   Wed Mar 15 20:07:23 2023 +0800

    drm/amdgpu/nv: Apply ASPM quirk on Intel ADL + AMD Navi
    
    commit 2b072442f4962231a8516485012bb2d2551ef2fe upstream.
    
    S2idle resume freeze can be observed on Intel ADL + AMD WX5500. This is
    caused by commit 0064b0ce85bb ("drm/amd/pm: enable ASPM by default").
    
    The root cause is still not clear for now.
    
    So extend and apply the ASPM quirk from commit e02fe3bc7aba
    ("drm/amdgpu: vi: disable ASPM on Intel Alder Lake based systems"), to
    workaround the issue on Navi cards too.
    
    Fixes: 0064b0ce85bb ("drm/amd/pm: enable ASPM by default")
    Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2458
    Reviewed-by: Alex Deucher <[email protected]>
    Signed-off-by: Kai-Heng Feng <[email protected]>
    Reviewed-by: Mario Limonciello <[email protected]>
    Signed-off-by: Alex Deucher <[email protected]>
    Cc: [email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/bridge: lt8912b: return EPROBE_DEFER if bridge is not found [+ + +]
Author: Matheus Castello <[email protected]>
Date:   Wed Mar 22 15:38:21 2023 +0100

    drm/bridge: lt8912b: return EPROBE_DEFER if bridge is not found
    
    commit 1a70ca89d59c7c8af006d29b965a95ede0abb0da upstream.
    
    Returns EPROBE_DEFER when of_drm_find_bridge() fails, this is consistent
    with what all the other DRM bridge drivers are doing and this is
    required since the bridge might not be there when the driver is probed
    and this should not be a fatal failure.
    
    Cc: <[email protected]>
    Fixes: 30e2ae943c26 ("drm/bridge: Introduce LT8912B DSI to HDMI bridge")
    Signed-off-by: Matheus Castello <[email protected]>
    Signed-off-by: Francesco Dolcini <[email protected]>
    Reviewed-by: Laurent Pinchart <[email protected]>
    Reviewed-by: Andrzej Hajda <[email protected]>
    Signed-off-by: Neil Armstrong <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/cirrus: NULL-check pipe->plane.state->fb in cirrus_pipe_update() [+ + +]
Author: Alexandr Sapozhnikov <[email protected]>
Date:   Wed Feb 15 20:15:49 2023 +0300

    drm/cirrus: NULL-check pipe->plane.state->fb in cirrus_pipe_update()
    
    [ Upstream commit 7245e629dcaaf308f1868aeffa218e9849c77893 ]
    
    After having been compared to NULL value at cirrus.c:455, pointer
    'pipe->plane.state->fb' is passed as 1st parameter in call to function
    'cirrus_fb_blit_rect' at cirrus.c:461, where it is dereferenced at
    cirrus.c:316.
    
    Found by Linux Verification Center (linuxtesting.org) with SVACE.
    
    v2:
            * aligned commit message to line-length limits
    
    Signed-off-by: Alexandr Sapozhnikov <[email protected]>
    Reviewed-by: Thomas Zimmermann <[email protected]>
    Signed-off-by: Thomas Zimmermann <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915/active: Fix missing debug object activation [+ + +]
Author: Nirmoy Das <[email protected]>
Date:   Tue Mar 14 15:29:14 2023 +0100

    drm/i915/active: Fix missing debug object activation
    
    commit e92eb246feb9019b0b137706c934b8891cdfe3c2 upstream.
    
    debug_active_activate() expected ref->count to be zero
    which is not true anymore as __i915_active_activate() calls
    debug_active_activate() after incrementing the count.
    
    v2: No need to check for "ref->count == 1" as __i915_active_activate()
    already make sure of that(Janusz).
    
    References: https://gitlab.freedesktop.org/drm/intel/-/issues/6733
    Fixes: 04240e30ed06 ("drm/i915: Skip taking acquire mutex for no ref->active callback")
    Cc: Chris Wilson <[email protected]>
    Cc: Tvrtko Ursulin <[email protected]>
    Cc: Thomas Hellström <[email protected]>
    Cc: Andi Shyti <[email protected]>
    Cc: [email protected]
    Cc: Janusz Krzysztofik <[email protected]>
    Cc: <[email protected]> # v5.10+
    Signed-off-by: Nirmoy Das <[email protected]>
    Reviewed-by: Janusz Krzysztofik <[email protected]>
    Reviewed-by: Andrzej Hajda <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    (cherry picked from commit bfad380c542438a9b642f8190b7fd37bc77e2723)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/i915/gt: perform uc late init after probe error injection [+ + +]
Author: Andrzej Hajda <[email protected]>
Date:   Tue Mar 14 16:19:20 2023 +0100

    drm/i915/gt: perform uc late init after probe error injection
    
    [ Upstream commit 150784f9285e656373cf3953ef4a7663f1e1a0f2 ]
    
    Probe pseudo errors should be injected only in places where real errors
    can be encountered, otherwise unwinding code can be broken.
    Placing intel_uc_init_late before i915_inject_probe_error violated
    this rule, resulting in following bug:
    __intel_gt_disable:655 GEM_BUG_ON(intel_gt_pm_is_awake(gt))
    
    Fixes: 481d458caede ("drm/i915/guc: Add golden context to GuC ADS")
    Acked-by: Nirmoy Das <[email protected]>
    Reviewed-by: Andi Shyti <[email protected]>
    Signed-off-by: Andrzej Hajda <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    (cherry picked from commit c4252a11131c7f27a158294241466e2a4e7ff94e)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
drm/i915: Preserve crtc_state->inherited during state clearing [+ + +]
Author: Ville Syrjälä <[email protected]>
Date:   Thu Feb 23 17:20:48 2023 +0200

    drm/i915: Preserve crtc_state->inherited during state clearing
    
    commit 3a84f2c6c9558c554a90ec26ad25df92fc5e05b7 upstream.
    
    intel_crtc_prepare_cleared_state() is unintentionally losing
    the "inherited" flag. This will happen if intel_initial_commit()
    is forced to go through the full modeset calculations for
    whatever reason.
    
    Afterwards the first real commit from userspace will not get
    forced to the full modeset path, and thus eg. audio state may
    not get recomputed properly. So if the monitor was already
    enabled during boot audio will not work until userspace itself
    does an explicit full modeset.
    
    Cc: [email protected]
    Tested-by: Lee Shawn C <[email protected]>
    Signed-off-by: Ville Syrjälä <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Reviewed-by: Uma Shankar <[email protected]>
    (cherry picked from commit 2553bacaf953b48c59357f5a622282bc0c45adae)
    Signed-off-by: Jani Nikula <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
drm/meson: fix missing component unbind on bind errors [+ + +]
Author: Johan Hovold <[email protected]>
Date:   Mon Mar 6 11:35:33 2023 +0100

    drm/meson: fix missing component unbind on bind errors
    
    commit ba98413bf45edbf33672e2539e321b851b2cfbd1 upstream.
    
    Make sure to unbind all subcomponents when binding the aggregate device
    fails.
    
    Fixes: a41e82e6c457 ("drm/meson: Add support for components")
    Cc: [email protected]      # 4.12
    Cc: Neil Armstrong <[email protected]>
    Signed-off-by: Johan Hovold <[email protected]>
    Acked-by: Neil Armstrong <[email protected]>
    Signed-off-by: Neil Armstrong <[email protected]>
    Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
efi: sysfb_efi: Fix DMI quirks not working for simpledrm [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Tue Mar 14 13:31:02 2023 +0100

    efi: sysfb_efi: Fix DMI quirks not working for simpledrm
    
    commit 3615c78673c332b69aaacefbcde5937c5c706686 upstream.
    
    Commit 8633ef82f101 ("drivers/firmware: consolidate EFI framebuffer setup
    for all arches") moved the sysfb_apply_efi_quirks() call in sysfb_init()
    from before the [sysfb_]parse_mode() call to after it.
    But sysfb_apply_efi_quirks() modifies the global screen_info struct which
    [sysfb_]parse_mode() parses, so doing it later is too late.
    
    This has broken all DMI based quirks for correcting wrong firmware efifb
    settings when simpledrm is used.
    
    To fix this move the sysfb_apply_efi_quirks() call back to its old place
    and split the new setup of the efifb_fwnode (which requires
    the platform_device) into its own function and call that at
    the place of the moved sysfb_apply_efi_quirks(pd) calls.
    
    Fixes: 8633ef82f101 ("drivers/firmware: consolidate EFI framebuffer setup for all arches")
    Cc: [email protected]
    Cc: Javier Martinez Canillas <[email protected]>
    Cc: Thomas Zimmermann <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Reviewed-by: Javier Martinez Canillas <[email protected]>
    Signed-off-by: Ard Biesheuvel <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up [+ + +]
Author: Frederic Weisbecker <[email protected]>
Date:   Wed Mar 15 19:43:43 2023 +0000

    entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up
    
    [ Upstream commit b416514054810cf2d2cc348ae477cea619b64da7 ]
    
    RCU sometimes needs to perform a delayed wake up for specific kthreads
    handling offloaded callbacks (RCU_NOCB).  These wakeups are performed
    by timers and upon entry to idle (also to guest and to user on nohz_full).
    
    However the delayed wake-up on kernel exit is actually performed after
    the thread flags are fetched towards the fast path check for work to
    do on exit to user. As a result, and if there is no other pending work
    to do upon that kernel exit, the current task will resume to userspace
    with TIF_RESCHED set and the pending wake up ignored.
    
    Fix this with fetching the thread flags _after_ the delayed RCU-nocb
    kthread wake-up.
    
    Fixes: 47b8ff194c1f ("entry: Explicitly flush pending rcuog wakeup before last rescheduling point")
    Signed-off-by: Frederic Weisbecker <[email protected]>
    Signed-off-by: Paul E. McKenney <[email protected]>
    Signed-off-by: Joel Fernandes (Google) <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
entry: Snapshot thread flags [+ + +]
Author: Mark Rutland <[email protected]>
Date:   Mon Nov 29 13:06:44 2021 +0000

    entry: Snapshot thread flags
    
    [ Upstream commit 6ce895128b3bff738fe8d9dd74747a03e319e466 ]
    
    Some thread flags can be set remotely, and so even when IRQs are disabled,
    the flags can change under our feet. Generally this is unlikely to cause a
    problem in practice, but it is somewhat unsound, and KCSAN will
    legitimately warn that there is a data race.
    
    To avoid such issues, a snapshot of the flags has to be taken prior to
    using them. Some places already use READ_ONCE() for that, others do not.
    
    Convert them all to the new flag accessor helpers.
    
    Signed-off-by: Mark Rutland <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Acked-by: Paul E. McKenney <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: b41651405481 ("entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up")
    Signed-off-by: Sasha Levin <[email protected]>

 
erspan: do not use skb_mac_header() in ndo_start_xmit() [+ + +]
Author: Eric Dumazet <[email protected]>
Date:   Mon Mar 20 16:34:27 2023 +0000

    erspan: do not use skb_mac_header() in ndo_start_xmit()
    
    [ Upstream commit 8e50ed774554f93d55426039b27b1e38d7fa64d8 ]
    
    Drivers should not assume skb_mac_header(skb) == skb->data in their
    ndo_start_xmit().
    
    Use skb_network_offset() and skb_transport_offset() which
    better describe what is needed in erspan_fb_xmit() and
    ip6erspan_tunnel_xmit()
    
    syzbot reported:
    WARNING: CPU: 0 PID: 5083 at include/linux/skbuff.h:2873 skb_mac_header include/linux/skbuff.h:2873 [inline]
    WARNING: CPU: 0 PID: 5083 at include/linux/skbuff.h:2873 ip6erspan_tunnel_xmit+0x1d9c/0x2d90 net/ipv6/ip6_gre.c:962
    Modules linked in:
    CPU: 0 PID: 5083 Comm: syz-executor406 Not tainted 6.3.0-rc2-syzkaller-00866-gd4671cb96fa3 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
    RIP: 0010:skb_mac_header include/linux/skbuff.h:2873 [inline]
    RIP: 0010:ip6erspan_tunnel_xmit+0x1d9c/0x2d90 net/ipv6/ip6_gre.c:962
    Code: 04 02 41 01 de 84 c0 74 08 3c 03 0f 8e 1c 0a 00 00 45 89 b4 24 c8 00 00 00 c6 85 77 fe ff ff 01 e9 33 e7 ff ff e8 b4 27 a1 f8 <0f> 0b e9 b6 e7 ff ff e8 a8 27 a1 f8 49 8d bf f0 0c 00 00 48 b8 00
    RSP: 0018:ffffc90003b2f830 EFLAGS: 00010293
    RAX: 0000000000000000 RBX: 000000000000ffff RCX: 0000000000000000
    RDX: ffff888021273a80 RSI: ffffffff88e1bd4c RDI: 0000000000000003
    RBP: ffffc90003b2f9d8 R08: 0000000000000003 R09: 000000000000ffff
    R10: 000000000000ffff R11: 0000000000000000 R12: ffff88802b28da00
    R13: 00000000000000d0 R14: ffff88807e25b6d0 R15: ffff888023408000
    FS: 0000555556a61300(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
    CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 000055e5b11eb6e8 CR3: 0000000027c1b000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
    <TASK>
    __netdev_start_xmit include/linux/netdevice.h:4900 [inline]
    netdev_start_xmit include/linux/netdevice.h:4914 [inline]
    __dev_direct_xmit+0x504/0x730 net/core/dev.c:4300
    dev_direct_xmit include/linux/netdevice.h:3088 [inline]
    packet_xmit+0x20a/0x390 net/packet/af_packet.c:285
    packet_snd net/packet/af_packet.c:3075 [inline]
    packet_sendmsg+0x31a0/0x5150 net/packet/af_packet.c:3107
    sock_sendmsg_nosec net/socket.c:724 [inline]
    sock_sendmsg+0xde/0x190 net/socket.c:747
    __sys_sendto+0x23a/0x340 net/socket.c:2142
    __do_sys_sendto net/socket.c:2154 [inline]
    __se_sys_sendto net/socket.c:2150 [inline]
    __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2150
    do_syscall_x64 arch/x86/entry/common.c:50 [inline]
    do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
    entry_SYSCALL_64_after_hwframe+0x63/0xcd
    RIP: 0033:0x7f123aaa1039
    Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007ffc15d12058 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f123aaa1039
    RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003
    RBP: 0000000000000000 R08: 0000000020000040 R09: 0000000000000014
    R10: 0000000000000000 R11: 0000000000000246 R12: 00007f123aa648c0
    R13: 431bde82d7b634db R14: 0000000000000000 R15: 0000000000000000
    
    Fixes: 1baf5ebf8954 ("erspan: auto detect truncated packets.")
    Reported-by: syzbot <[email protected]>
    Signed-off-by: Eric Dumazet <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
firmware: arm_scmi: Fix device node validation for mailbox transport [+ + +]
Author: Cristian Marussi <[email protected]>
Date:   Tue Mar 7 16:23:24 2023 +0000

    firmware: arm_scmi: Fix device node validation for mailbox transport
    
    commit 2ab4f4018cb6b8010ca5002c3bdc37783b5d28c2 upstream.
    
    When mailboxes are used as a transport it is possible to setup the SCMI
    transport layer, depending on the underlying channels configuration, to use
    one or two mailboxes, associated, respectively, to one or two, distinct,
    shared memory areas: any other combination should be treated as invalid.
    
    Add more strict checking of SCMI mailbox transport device node descriptors.
    
    Fixes: 5c8a47a5a91d ("firmware: arm_scmi: Make scmi core independent of the transport type")
    Cc: <[email protected]> # 4.19
    Signed-off-by: Cristian Marussi <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sudeep Holla <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fscrypt: destroy keyring after security_sb_delete() [+ + +]
Author: Eric Biggers <[email protected]>
Date:   Mon Mar 13 15:12:29 2023 -0700

    fscrypt: destroy keyring after security_sb_delete()
    
    commit ccb820dc7d2236b1af0d54ae038a27b5b6d5ae5a upstream.
    
    fscrypt_destroy_keyring() must be called after all potentially-encrypted
    inodes were evicted; otherwise it cannot safely destroy the keyring.
    Since inodes that are in-use by the Landlock LSM don't get evicted until
    security_sb_delete(), this means that fscrypt_destroy_keyring() must be
    called *after* security_sb_delete().
    
    This fixes a WARN_ON followed by a NULL dereference, only possible if
    Landlock was being used on encrypted files.
    
    Fixes: d7e7b9af104c ("fscrypt: stop using keyrings subsystem for fscrypt_master_key")
    Cc: [email protected]
    Reported-by: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Christian Brauner <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Eric Biggers <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
fsverity: Remove WQ_UNBOUND from fsverity read workqueue [+ + +]
Author: Nathan Huckleberry <[email protected]>
Date:   Fri Mar 10 11:33:25 2023 -0800

    fsverity: Remove WQ_UNBOUND from fsverity read workqueue
    
    commit f959325e6ac3f499450088b8d9c626d1177be160 upstream.
    
    WQ_UNBOUND causes significant scheduler latency on ARM64/Android.  This
    is problematic for latency sensitive workloads, like I/O
    post-processing.
    
    Removing WQ_UNBOUND gives a 96% reduction in fsverity workqueue related
    scheduler latency and improves app cold startup times by ~30ms.
    WQ_UNBOUND was also removed from the dm-verity workqueue for the same
    reason [1].
    
    This code was tested by running Android app startup benchmarks and
    measuring how long the fsverity workqueue spent in the runnable state.
    
    Before
    Total workqueue scheduler latency: 553800us
    After
    Total workqueue scheduler latency: 18962us
    
    [1]: https://lore.kernel.org/all/[email protected]/
    
    Signed-off-by: Nathan Huckleberry <[email protected]>
    Fixes: 8a1d0f9cacc9 ("fs-verity: add data verification hooks for ->readpages()")
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Eric Biggers <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
gve: Cache link_speed value from device [+ + +]
Author: Joshua Washington <[email protected]>
Date:   Tue Mar 21 10:23:32 2023 -0700

    gve: Cache link_speed value from device
    
    [ Upstream commit 68c3e4fc8628b1487c965aabb29207249657eb5f ]
    
    The link speed is never changed for the uptime of a VM, and the current
    implementation sends an admin queue command for each call. Admin queue
    command invocations have nontrivial overhead (e.g., VM exits), which can
    be disruptive to users if triggered frequently. Our telemetry data shows
    that there are VMs that make frequent calls to this admin queue command.
    Caching the result of the original admin queue command would eliminate
    the need to send multiple admin queue commands on subsequent calls to
    retrieve link speed.
    
    Fixes: 7e074d5a76ca ("gve: Enable Link Speed Reporting in the driver.")
    Signed-off-by: Joshua Washington <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
HID: cp2112: Fix driver not registering GPIO IRQ chip as threaded [+ + +]
Author: Danny Kaehn <[email protected]>
Date:   Fri Feb 10 11:00:44 2023 -0600

    HID: cp2112: Fix driver not registering GPIO IRQ chip as threaded
    
    [ Upstream commit 37f5b858a66543b2b67c0288280af623985abc29 ]
    
    The CP2112 generates interrupts from a polling routine on a thread,
    and can only support threaded interrupts. This patch configures the
    gpiochip irq chip with this flag, disallowing consumers to request
    a hard IRQ from this driver, which resulted in a segfault previously.
    
    Signed-off-by: Danny Kaehn <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Benjamin Tissoires <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

HID: intel-ish-hid: ipc: Fix potential use-after-free in work function [+ + +]
Author: Reka Norman <[email protected]>
Date:   Mon Feb 27 13:49:38 2023 +1100

    HID: intel-ish-hid: ipc: Fix potential use-after-free in work function
    
    [ Upstream commit 8ae2f2b0a28416ed2f6d8478ac8b9f7862f36785 ]
    
    When a reset notify IPC message is received, the ISR schedules a work
    function and passes the ISHTP device to it via a global pointer
    ishtp_dev. If ish_probe() fails, the devm-managed device resources
    including ishtp_dev are freed, but the work is not cancelled, causing a
    use-after-free when the work function tries to access ishtp_dev. Use
    devm_work_autocancel() instead, so that the work is automatically
    cancelled if probe fails.
    
    Signed-off-by: Reka Norman <[email protected]>
    Acked-by: Srinivas Pandruvada <[email protected]>
    Signed-off-by: Jiri Kosina <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
hvc/xen: prevent concurrent accesses to the shared ring [+ + +]
Author: Roger Pau Monne <[email protected]>
Date:   Wed Nov 30 16:09:11 2022 +0100

    hvc/xen: prevent concurrent accesses to the shared ring
    
    [ Upstream commit 6214894f49a967c749ee6c07cb00f9cede748df4 ]
    
    The hvc machinery registers both a console and a tty device based on
    the hv ops provided by the specific implementation.  Those two
    interfaces however have different locks, and there's no single locks
    that's shared between the tty and the console implementations, hence
    the driver needs to protect itself against concurrent accesses.
    Otherwise concurrent calls using the split interfaces are likely to
    corrupt the ring indexes, leaving the console unusable.
    
    Introduce a lock to xencons_info to serialize accesses to the shared
    ring.  This is only required when using the shared memory console,
    concurrent accesses to the hypercall based console implementation are
    not an issue.
    
    Note the conditional logic in domU_read_console() is slightly modified
    so the notify_daemon() call can be done outside of the locked region:
    it's an hypercall and there's no need for it to be done with the lock
    held.
    
    Fixes: b536b4b96230 ('xen: use the hvc console infrastructure for Xen console')
    Signed-off-by: Roger Pau Monné <[email protected]>
    Reviewed-by: Juergen Gross <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Juergen Gross <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
hwmon (it87): Fix voltage scaling for chips with 10.9mV ADCs [+ + +]
Author: Frank Crawford <[email protected]>
Date:   Sat Mar 18 19:05:42 2023 +1100

    hwmon (it87): Fix voltage scaling for chips with 10.9mV ADCs
    
    [ Upstream commit 968b66ffeb7956acc72836a7797aeb7b2444ec51 ]
    
    Fix voltage scaling for chips that have 10.9mV ADCs, where scaling was
    not performed.
    
    Fixes: ead8080351c9 ("hwmon: (it87) Add support for IT8732F")
    Signed-off-by: Frank Crawford <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [groeck: Update subject and description to focus on bug fix]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
hwmon: fix potential sensor registration fail if of_node is missing [+ + +]
Author: Phinex Hung <[email protected]>
Date:   Tue Mar 21 14:02:23 2023 +0800

    hwmon: fix potential sensor registration fail if of_node is missing
    
    [ Upstream commit 2315332efcbe7124252f080e03b57d3d2f1f4771 ]
    
    It is not sufficient to check of_node in current device.
    In some cases, this would cause the sensor registration to fail.
    
    This patch looks for device's ancestors to find a valid of_node if any.
    
    Fixes: d560168b5d0f ("hwmon: (core) New hwmon registration API")
    Signed-off-by: Phinex Hung <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Guenter Roeck <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
i2c: hisi: Only use the completion interrupt to finish the transfer [+ + +]
Author: Yicong Yang <[email protected]>
Date:   Mon Mar 13 15:45:52 2023 +0800

    i2c: hisi: Only use the completion interrupt to finish the transfer
    
    [ Upstream commit d98263512684a47e81bcb72a5408958ecd1e60b0 ]
    
    The controller will always generate a completion interrupt when the
    transfer is finished normally or not. Currently we use either error or
    completion interrupt to finish, this may result the completion
    interrupt unhandled and corrupt the next transfer, especially at low
    speed mode. Since on error case, the error interrupt will come first
    then is the completion interrupt. So only use the completion interrupt
    to finish the whole transfer process.
    
    Fixes: d62fbdb99a85 ("i2c: add support for HiSilicon I2C controller")
    Reported-by: Sheng Feng <[email protected]>
    Signed-off-by: Sheng Feng <[email protected]>
    Signed-off-by: Yicong Yang <[email protected]>
    Signed-off-by: Wolfram Sang <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

i2c: imx-lpi2c: check only for enabled interrupt flags [+ + +]
Author: Alexander Stein <[email protected]>
Date:   Mon Jan 30 16:32:47 2023 +0100

    i2c: imx-lpi2c: check only for enabled interrupt flags
    
    [ Upstream commit 1c7885004567e8951d65a983be095f254dd20bef ]
    
    When reading from I2C, the Tx watermark is set to 0. Unfortunately the
    TDF (transmit data flag) is enabled when Tx FIFO entries is equal or less
    than watermark. So it is set in every case, hence the reset default of 1.
    This results in the MSR_RDF _and_ MSR_TDF flags to be set thus trying
    to send Tx data on a read message.
    Mask the IRQ status to filter for wanted flags only.
    
    Fixes: a55fa9d0e42e ("i2c: imx-lpi2c: add low power i2c bus driver")
    Signed-off-by: Alexander Stein <[email protected]>
    Tested-by: Emanuele Ghidoli <[email protected]>
    Signed-off-by: Wolfram Sang <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

i2c: xgene-slimpro: Fix out-of-bounds bug in xgene_slimpro_i2c_xfer() [+ + +]
Author: Wei Chen <[email protected]>
Date:   Tue Mar 14 16:54:21 2023 +0000

    i2c: xgene-slimpro: Fix out-of-bounds bug in xgene_slimpro_i2c_xfer()
    
    commit 92fbb6d1296f81f41f65effd7f5f8c0f74943d15 upstream.
    
    The data->block[0] variable comes from user and is a number between
    0-255. Without proper check, the variable may be very large to cause
    an out-of-bounds when performing memcpy in slimpro_i2c_blkwr.
    
    Fix this bug by checking the value of writelen.
    
    Fixes: f6505fbabc42 ("i2c: add SLIMpro I2C device driver on APM X-Gene platform")
    Signed-off-by: Wei Chen <[email protected]>
    Cc: [email protected]
    Reviewed-by: Andi Shyti <[email protected]>
    Signed-off-by: Wolfram Sang <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
i40e: fix flow director packet filter programming [+ + +]
Author: Radoslaw Tyl <[email protected]>
Date:   Mon Mar 13 15:07:33 2023 +0100

    i40e: fix flow director packet filter programming
    
    [ Upstream commit c672297bbc0e86dbf88396b8053e2fbb173f16ff ]
    
    Initialize to zero structures to build a valid
    Tx Packet used for the filter programming.
    
    Fixes: a9219b332f52 ("i40e: VLAN field for flow director")
    Signed-off-by: Radoslaw Tyl <[email protected]>
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Tested-by: Arpana Arland <[email protected]> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
iavf: fix hang on reboot with ice [+ + +]
Author: Stefan Assmann <[email protected]>
Date:   Mon Mar 13 17:06:45 2023 +0100

    iavf: fix hang on reboot with ice
    
    [ Upstream commit 4e264be98b88a6d6f476c11087fe865696e8bef5 ]
    
    When a system with E810 with existing VFs gets rebooted the following
    hang may be observed.
    
     Pid 1 is hung in iavf_remove(), part of a network driver:
     PID: 1        TASK: ffff965400e5a340  CPU: 24   COMMAND: "systemd-shutdow"
      #0 [ffffaad04005fa50] __schedule at ffffffff8b3239cb
      #1 [ffffaad04005fae8] schedule at ffffffff8b323e2d
      #2 [ffffaad04005fb00] schedule_hrtimeout_range_clock at ffffffff8b32cebc
      #3 [ffffaad04005fb80] usleep_range_state at ffffffff8b32c930
      #4 [ffffaad04005fbb0] iavf_remove at ffffffffc12b9b4c [iavf]
      #5 [ffffaad04005fbf0] pci_device_remove at ffffffff8add7513
      #6 [ffffaad04005fc10] device_release_driver_internal at ffffffff8af08baa
      #7 [ffffaad04005fc40] pci_stop_bus_device at ffffffff8adcc5fc
      #8 [ffffaad04005fc60] pci_stop_and_remove_bus_device at ffffffff8adcc81e
      #9 [ffffaad04005fc70] pci_iov_remove_virtfn at ffffffff8adf9429
     #10 [ffffaad04005fca8] sriov_disable at ffffffff8adf98e4
     #11 [ffffaad04005fcc8] ice_free_vfs at ffffffffc04bb2c8 [ice]
     #12 [ffffaad04005fd10] ice_remove at ffffffffc04778fe [ice]
     #13 [ffffaad04005fd38] ice_shutdown at ffffffffc0477946 [ice]
     #14 [ffffaad04005fd50] pci_device_shutdown at ffffffff8add58f1
     #15 [ffffaad04005fd70] device_shutdown at ffffffff8af05386
     #16 [ffffaad04005fd98] kernel_restart at ffffffff8a92a870
     #17 [ffffaad04005fda8] __do_sys_reboot at ffffffff8a92abd6
     #18 [ffffaad04005fee0] do_syscall_64 at ffffffff8b317159
     #19 [ffffaad04005ff08] __context_tracking_enter at ffffffff8b31b6fc
     #20 [ffffaad04005ff18] syscall_exit_to_user_mode at ffffffff8b31b50d
     #21 [ffffaad04005ff28] do_syscall_64 at ffffffff8b317169
     #22 [ffffaad04005ff50] entry_SYSCALL_64_after_hwframe at ffffffff8b40009b
         RIP: 00007f1baa5c13d7  RSP: 00007fffbcc55a98  RFLAGS: 00000202
         RAX: ffffffffffffffda  RBX: 0000000000000000  RCX: 00007f1baa5c13d7
         RDX: 0000000001234567  RSI: 0000000028121969  RDI: 00000000fee1dead
         RBP: 00007fffbcc55ca0   R8: 0000000000000000   R9: 00007fffbcc54e90
         R10: 00007fffbcc55050  R11: 0000000000000202  R12: 0000000000000005
         R13: 0000000000000000  R14: 00007fffbcc55af0  R15: 0000000000000000
         ORIG_RAX: 00000000000000a9  CS: 0033  SS: 002b
    
    During reboot all drivers PM shutdown callbacks are invoked.
    In iavf_shutdown() the adapter state is changed to __IAVF_REMOVE.
    In ice_shutdown() the call chain above is executed, which at some point
    calls iavf_remove(). However iavf_remove() expects the VF to be in one
    of the states __IAVF_RUNNING, __IAVF_DOWN or __IAVF_INIT_FAILED. If
    that's not the case it sleeps forever.
    So if iavf_shutdown() gets invoked before iavf_remove() the system will
    hang indefinitely because the adapter is already in state __IAVF_REMOVE.
    
    Fix this by returning from iavf_remove() if the state is __IAVF_REMOVE,
    as we already went through iavf_shutdown().
    
    Fixes: 974578017fc1 ("iavf: Add waiting so the port is initialized in remove")
    Fixes: a8417330f8a5 ("iavf: Fix race condition between iavf_shutdown and iavf_remove")
    Reported-by: Marius Cornea <[email protected]>
    Signed-off-by: Stefan Assmann <[email protected]>
    Reviewed-by: Michal Kubiak <[email protected]>
    Tested-by: Rafal Romanowski <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

iavf: fix inverted Rx hash condition leading to disabled hash [+ + +]
Author: Alexander Lobakin <[email protected]>
Date:   Wed Mar 1 12:59:07 2023 +0100

    iavf: fix inverted Rx hash condition leading to disabled hash
    
    [ Upstream commit 32d57f667f871bc5a8babbe27ea4c5e668ee0ea8 ]
    
    Condition, which checks whether the netdev has hashing enabled is
    inverted. Basically, the tagged commit effectively disabled passing flow
    hash from descriptor to skb, unless user *disables* it via Ethtool.
    Commit a876c3ba59a6 ("i40e/i40evf: properly report Rx packet hash")
    fixed this problem, but only for i40e.
    Invert the condition now in iavf and unblock passing hash to skbs again.
    
    Fixes: 857942fd1aa1 ("i40e: Fix Rx hash reported to the stack by our driver")
    Reviewed-by: Larysa Zaremba <[email protected]>
    Reviewed-by: Michal Kubiak <[email protected]>
    Signed-off-by: Alexander Lobakin <[email protected]>
    Tested-by: Rafal Romanowski <[email protected]>
    Reviewed-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

iavf: fix non-tunneled IPv6 UDP packet type and hashing [+ + +]
Author: Alexander Lobakin <[email protected]>
Date:   Wed Mar 1 12:59:08 2023 +0100

    iavf: fix non-tunneled IPv6 UDP packet type and hashing
    
    [ Upstream commit de58647b4301fe181f9c38e8b46f7021584ae427 ]
    
    Currently, IAVF's decode_rx_desc_ptype() correctly reports payload type
    of L4 for IPv4 UDP packets and IPv{4,6} TCP, but only L3 for IPv6 UDP.
    Originally, i40e, ice and iavf were affected.
    Commit 73df8c9e3e3d ("i40e: Correct UDP packet header for non_tunnel-ipv6")
    fixed that in i40e, then
    commit 638a0c8c8861 ("ice: fix incorrect payload indicator on PTYPE")
    fixed that for ice.
    IPv6 UDP is L4 obviously. Fix it and make iavf report correct L4 hash
    type for such packets, so that the stack won't calculate it on CPU when
    needs it.
    
    Fixes: 206812b5fccb ("i40e/i40evf: i40e implementation for skb_set_hash")
    Reviewed-by: Larysa Zaremba <[email protected]>
    Reviewed-by: Michal Kubiak <[email protected]>
    Signed-off-by: Alexander Lobakin <[email protected]>
    Tested-by: Rafal Romanowski <[email protected]>
    Reviewed-by: Leon Romanovsky <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
igb: revert rtnl_lock() that causes deadlock [+ + +]
Author: Lin Ma <[email protected]>
Date:   Tue Mar 7 23:29:17 2023 +0800

    igb: revert rtnl_lock() that causes deadlock
    
    commit 65f69851e44d71248b952a687e44759a7abb5016 upstream.
    
    The commit 6faee3d4ee8b ("igb: Add lock to avoid data race") adds
    rtnl_lock to eliminate a false data race shown below
    
     (FREE from device detaching)      |   (USE from netdev core)
    igb_remove                         |  igb_ndo_get_vf_config
     igb_disable_sriov                 |  vf >= adapter->vfs_allocated_count?
      kfree(adapter->vf_data)          |
      adapter->vfs_allocated_count = 0 |
                                       |    memcpy(... adapter->vf_data[vf]
    
    The above race will never happen and the extra rtnl_lock causes deadlock
    below
    
    [  141.420169]  <TASK>
    [  141.420672]  __schedule+0x2dd/0x840
    [  141.421427]  schedule+0x50/0xc0
    [  141.422041]  schedule_preempt_disabled+0x11/0x20
    [  141.422678]  __mutex_lock.isra.13+0x431/0x6b0
    [  141.423324]  unregister_netdev+0xe/0x20
    [  141.423578]  igbvf_remove+0x45/0xe0 [igbvf]
    [  141.423791]  pci_device_remove+0x36/0xb0
    [  141.423990]  device_release_driver_internal+0xc1/0x160
    [  141.424270]  pci_stop_bus_device+0x6d/0x90
    [  141.424507]  pci_stop_and_remove_bus_device+0xe/0x20
    [  141.424789]  pci_iov_remove_virtfn+0xba/0x120
    [  141.425452]  sriov_disable+0x2f/0xf0
    [  141.425679]  igb_disable_sriov+0x4e/0x100 [igb]
    [  141.426353]  igb_remove+0xa0/0x130 [igb]
    [  141.426599]  pci_device_remove+0x36/0xb0
    [  141.426796]  device_release_driver_internal+0xc1/0x160
    [  141.427060]  driver_detach+0x44/0x90
    [  141.427253]  bus_remove_driver+0x55/0xe0
    [  141.427477]  pci_unregister_driver+0x2a/0xa0
    [  141.428296]  __x64_sys_delete_module+0x141/0x2b0
    [  141.429126]  ? mntput_no_expire+0x4a/0x240
    [  141.429363]  ? syscall_trace_enter.isra.19+0x126/0x1a0
    [  141.429653]  do_syscall_64+0x5b/0x80
    [  141.429847]  ? exit_to_user_mode_prepare+0x14d/0x1c0
    [  141.430109]  ? syscall_exit_to_user_mode+0x12/0x30
    [  141.430849]  ? do_syscall_64+0x67/0x80
    [  141.431083]  ? syscall_exit_to_user_mode_prepare+0x183/0x1b0
    [  141.431770]  ? syscall_exit_to_user_mode+0x12/0x30
    [  141.432482]  ? do_syscall_64+0x67/0x80
    [  141.432714]  ? exc_page_fault+0x64/0x140
    [  141.432911]  entry_SYSCALL_64_after_hwframe+0x72/0xdc
    
    Since the igb_disable_sriov() will call pci_disable_sriov() before
    releasing any resources, the netdev core will synchronize the cleanup to
    avoid any races. This patch removes the useless rtnl_(un)lock to guarantee
    correctness.
    
    CC: [email protected]
    Fixes: 6faee3d4ee8b ("igb: Add lock to avoid data race")
    Reported-by: Corinna Vinschen <[email protected]>
    Link: https://lore.kernel.org/intel-wired-lan/[email protected]/
    Signed-off-by: Lin Ma <[email protected]>
    Tested-by: Corinna Vinschen <[email protected]>
    Reviewed-by: Jacob Keller <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Tested-by: Rafal Romanowski <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
igbvf: Regard vf reset nack as success [+ + +]
Author: Akihiko Odaki <[email protected]>
Date:   Thu Dec 1 19:20:03 2022 +0900

    igbvf: Regard vf reset nack as success
    
    [ Upstream commit 02c83791ef969c6a8a150b4927193d0d0e50fb23 ]
    
    vf reset nack actually represents the reset operation itself is
    performed but no address is assigned. Therefore, e1000_reset_hw_vf
    should fill the "perm_addr" with the zero address and return success on
    such an occasion. This prevents its callers in netdev.c from saying PF
    still resetting, and instead allows them to correctly report that no
    address is assigned.
    
    Fixes: 6ddbc4cf1f4d ("igb: Indicate failure on vf reset for empty mac address")
    Signed-off-by: Akihiko Odaki <[email protected]>
    Reviewed-by: Leon Romanovsky <[email protected]>
    Tested-by: Marek Szlosek <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
igc: fix the validation logic for taprio's gate list [+ + +]
Author: AKASHI Takahiro <[email protected]>
Date:   Tue Mar 7 15:45:31 2023 +0900

    igc: fix the validation logic for taprio's gate list
    
    [ Upstream commit 2b4cc3d3f4d8ec42961e98568a0afeee96a943ab ]
    
    The check introduced in the commit a5fd39464a40 ("igc: Lift TAPRIO schedule
    restriction") can detect a false positive error in some corner case.
    For instance,
        tc qdisc replace ... taprio num_tc 4
            ...
            sched-entry S 0x01 100000       # slot#1
            sched-entry S 0x03 100000       # slot#2
            sched-entry S 0x04 100000       # slot#3
            sched-entry S 0x08 200000       # slot#4
            flags 0x02                      # hardware offload
    
    Here the queue#0 (the first queue) is on at the slot#1 and #2,
    and off at the slot#3 and #4. Under the current logic, when the slot#4
    is examined, validate_schedule() returns *false* since the enablement
    count for the queue#0 is two and it is already off at the previous slot
    (i.e. #3). But this definition is truely correct.
    
    Let's fix the logic to enforce a strict validation for consecutively-opened
    slots.
    
    Fixes: a5fd39464a40 ("igc: Lift TAPRIO schedule restriction")
    Signed-off-by: AKASHI Takahiro <[email protected]>
    Reviewed-by: Kurt Kanzenbach <[email protected]>
    Acked-by: Vinicius Costa Gomes <[email protected]>
    Tested-by: Naama Meir <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
intel/igbvf: free irq on the error path in igbvf_request_msix() [+ + +]
Author: Gaosheng Cui <[email protected]>
Date:   Tue Nov 22 10:28:52 2022 +0800

    intel/igbvf: free irq on the error path in igbvf_request_msix()
    
    [ Upstream commit 85eb39bb39cbb5c086df1e19ba67cc1366693a77 ]
    
    In igbvf_request_msix(), irqs have not been freed on the err path,
    we need to free it. Fix it.
    
    Fixes: d4e0fe01a38a ("igbvf: add new driver to support 82576 virtual functions")
    Signed-off-by: Gaosheng Cui <[email protected]>
    Reviewed-by: Maciej Fijalkowski <[email protected]>
    Tested-by: Marek Szlosek <[email protected]>
    Signed-off-by: Tony Nguyen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
interconnect: qcom: osm-l3: fix icc_onecell_data allocation [+ + +]
Author: Dmitry Baryshkov <[email protected]>
Date:   Thu Jan 5 02:22:19 2023 +0200

    interconnect: qcom: osm-l3: fix icc_onecell_data allocation
    
    [ Upstream commit f77ebdda0ee652124061c2ac42399bb6c367e729 ]
    
    This is a struct with a trailing zero-length array of icc_node pointers
    but it's allocated as if it were a single array of icc_nodes instead.
    
    Fortunately this overallocates memory rather then allocating less memory
    than required.
    
    Fix by replacing devm_kcalloc() with devm_kzalloc() and struct_size()
    macro.
    
    Fixes: 5bc9900addaf ("interconnect: qcom: Add OSM L3 interconnect provider support")
    Signed-off-by: Dmitry Baryshkov <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Georgi Djakov <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>
 
keys: Do not cache key in task struct if key is requested from kernel thread [+ + +]
Author: David Howells <[email protected]>
Date:   Tue Mar 14 15:15:18 2023 +0000

    keys: Do not cache key in task struct if key is requested from kernel thread
    
    [ Upstream commit 47f9e4c924025c5be87959d3335e66fcbb7f6b5c ]
    
    The key which gets cached in task structure from a kernel thread does not
    get invalidated even after expiry.  Due to which, a new key request from
    kernel thread will be served with the cached key if it's present in task
    struct irrespective of the key validity.  The change is to not cache key in
    task_struct when key requested from kernel thread so that kernel thread
    gets a valid key on every key request.
    
    The problem has been seen with the cifs module doing DNS lookups from a
    kernel thread and the results getting pinned by being attached to that
    kernel thread's cache - and thus not something that can be easily got rid
    of.  The cache would ordinarily be cleared by notify-resume, but kernel
    threads don't do that.
    
    This isn't seen with AFS because AFS is doing request_key() within the
    kernel half of a user thread - which will do notify-resume.
    
    Fixes: 7743c48e54ee ("keys: Cache result of request_key*() temporarily in task_struct")
    Signed-off-by: Bharath SM <[email protected]>
    Signed-off-by: David Howells <[email protected]>
    Reviewed-by: Jarkko Sakkinen <[email protected]>
    cc: Shyam Prasad N <[email protected]>
    cc: Steve French <[email protected]>
    cc: [email protected]
    cc: [email protected]
    cc: [email protected]
    Link: https://lore.kernel.org/r/CAGypqWw951d=zYRbdgNR4snUDvJhWL=q3=WOyh7HhSJupjz2vA@mail.gmail.com/
    Signed-off-by: Sasha Levin <[email protected]>

 
kfence: avoid passing -g for test [+ + +]
Author: Marco Elver <[email protected]>
Date:   Thu Mar 16 23:47:04 2023 +0100

    kfence: avoid passing -g for test
    
    commit 2e08ca1802441224f5b7cc6bffbb687f7406de95 upstream.
    
    Nathan reported that when building with GNU as and a version of clang that
    defaults to DWARF5:
    
      $ make -skj"$(nproc)" ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- \
                            LLVM=1 LLVM_IAS=0 O=build \
                            mrproper allmodconfig mm/kfence/kfence_test.o
      /tmp/kfence_test-08a0a0.s: Assembler messages:
      /tmp/kfence_test-08a0a0.s:14627: Error: non-constant .uleb128 is not supported
      /tmp/kfence_test-08a0a0.s:14628: Error: non-constant .uleb128 is not supported
      /tmp/kfence_test-08a0a0.s:14632: Error: non-constant .uleb128 is not supported
      /tmp/kfence_test-08a0a0.s:14633: Error: non-constant .uleb128 is not supported
      /tmp/kfence_test-08a0a0.s:14639: Error: non-constant .uleb128 is not supported
      ...
    
    This is because `-g` defaults to the compiler debug info default.  If the
    assembler does not support some of the directives used, the above errors
    occur.  To fix, remove the explicit passing of `-g`.
    
    All the test wants is that stack traces print valid function names, and
    debug info is not required for that.  (I currently cannot recall why I
    added the explicit `-g`.)
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: bc8fbc5f305a ("kfence: add test suite")
    Signed-off-by: Marco Elver <[email protected]>
    Reported-by: Nathan Chancellor <[email protected]>
    Cc: Alexander Potapenko <[email protected]>
    Cc: Dmitry Vyukov <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
ksmbd: add low bound validation to FSCTL_QUERY_ALLOCATED_RANGES [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Tue Mar 7 21:56:07 2023 +0900

    ksmbd: add low bound validation to FSCTL_QUERY_ALLOCATED_RANGES
    
    [ Upstream commit 342edb60dcda7a409430359b0cac2864bb9dfe44 ]
    
    Smatch static checker warning:
     fs/ksmbd/vfs.c:1040 ksmbd_vfs_fqar_lseek() warn: no lower bound on 'length'
     fs/ksmbd/vfs.c:1041 ksmbd_vfs_fqar_lseek() warn: no lower bound on 'start'
    
    Fix unexpected result that could caused from negative start and length.
    
    Fixes: f44158485826 ("cifsd: add file operations")
    Reported-by: Dan Carpenter <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Reviewed-by: Sergey Senozhatsky <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ksmbd: add low bound validation to FSCTL_SET_ZERO_DATA [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Sun Mar 5 21:04:00 2023 +0900

    ksmbd: add low bound validation to FSCTL_SET_ZERO_DATA
    
    [ Upstream commit 2d74ec97131b1179a373b6d521f195c84e894eb6 ]
    
    Smatch static checker warning:
     fs/ksmbd/smb2pdu.c:7759 smb2_ioctl()
     warn: no lower bound on 'off'
    
    Fix unexpected result that could caused from negative off and bfz.
    
    Fixes: b5e5f9dfc915 ("ksmbd: check invalid FileOffset and BeyondFinalZero in FSCTL_ZERO_DATA")
    Reported-by: Dan Carpenter <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Reviewed-by: Sergey Senozhatsky <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ksmbd: fix possible refcount leak in smb2_open() [+ + +]
Author: ChenXiaoSong <[email protected]>
Date:   Thu Mar 2 21:58:04 2023 +0800

    ksmbd: fix possible refcount leak in smb2_open()
    
    [ Upstream commit 2624b445544ffc1472ccabfb6ec867c199d4c95c ]
    
    Reference count of acls will leak when memory allocation fails. Fix this
    by adding the missing posix_acl_release().
    
    Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3")
    Signed-off-by: ChenXiaoSong <[email protected]>
    Acked-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

ksmbd: return STATUS_NOT_SUPPORTED on unsupported smb2.0 dialect [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Tue Mar 21 15:36:40 2023 +0900

    ksmbd: return STATUS_NOT_SUPPORTED on unsupported smb2.0 dialect
    
    commit b53e8cfec30b93c120623232ba27c041b1ef8f1a upstream.
    
    ksmbd returned "Input/output error" when mounting with vers=2.0 to
    ksmbd. It should return STATUS_NOT_SUPPORTED on unsupported smb2.0
    dialect.
    
    Cc: [email protected]
    Reported-by: Steve French <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ksmbd: return unsupported error on smb1 mount [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Thu Mar 23 21:15:52 2023 +0900

    ksmbd: return unsupported error on smb1 mount
    
    commit 39b291b86b5988bf8753c3874d5c773399d09b96 upstream.
    
    ksmbd disconnect connection when mounting with vers=smb1.
    ksmbd should send smb1 negotiate response to client for correct
    unsupported error return. This patch add needed SMB1 macros and fill
    NegProt part of the response for smb1 negotiate response.
    
    Cc: [email protected]
    Reported-by: Steve French <[email protected]>
    Reviewed-by: Sergey Senozhatsky <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

ksmbd: set FILE_NAMED_STREAMS attribute in FS_ATTRIBUTE_INFORMATION [+ + +]
Author: Namjae Jeon <[email protected]>
Date:   Wed Mar 1 00:02:30 2023 +0900

    ksmbd: set FILE_NAMED_STREAMS attribute in FS_ATTRIBUTE_INFORMATION
    
    commit 728f14c72b71a19623df329c1c7c9d1452e56f1e upstream.
    
    If vfs objects = streams_xattr in ksmbd.conf FILE_NAMED_STREAMS should
    be set to Attributes in FS_ATTRIBUTE_INFORMATION. MacOS client show
    "Format: SMB (Unknown)" on faked NTFS and no streams support.
    
    Cc: [email protected]
    Reported-by: Miao Lihua <[email protected]>
    Tested-by: Miao Lihua <[email protected]>
    Signed-off-by: Namjae Jeon <[email protected]>
    Signed-off-by: Steve French <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
kthread: add the helper function kthread_run_on_cpu() [+ + +]
Author: Cai Huoqing <[email protected]>
Date:   Fri Jan 14 14:02:52 2022 -0800

    kthread: add the helper function kthread_run_on_cpu()
    
    [ Upstream commit 800977f6f32e452cba6b04ef21d2f5383ca29209 ]
    
    Add a new helper function kthread_run_on_cpu(), which includes
    kthread_create_on_cpu/wake_up_process().
    
    In some cases, use kthread_run_on_cpu() directly instead of
    kthread_create_on_node/kthread_bind/wake_up_process() or
    kthread_create_on_cpu/wake_up_process() or
    kthreadd_create/kthread_bind/wake_up_process() to simplify the code.
    
    [[email protected]: export kthread_create_on_cpu to modules]
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Cai Huoqing <[email protected]>
    Cc: Bernard Metzler <[email protected]>
    Cc: Cai Huoqing <[email protected]>
    Cc: Daniel Bristot de Oliveira <[email protected]>
    Cc: Davidlohr Bueso <[email protected]>
    Cc: Doug Ledford <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Jason Gunthorpe <[email protected]>
    Cc: Joel Fernandes (Google) <[email protected]>
    Cc: Josh Triplett <[email protected]>
    Cc: Lai Jiangshan <[email protected]>
    Cc: Mathieu Desnoyers <[email protected]>
    Cc: "Paul E . McKenney" <[email protected]>
    Cc: Steven Rostedt <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Stable-dep-of: 08697bca9bbb ("trace/hwlat: Do not start per-cpu thread if it is already running")
    Signed-off-by: Sasha Levin <[email protected]>

 
KVM: x86: hyper-v: Avoid calling kvm_make_vcpus_request_mask() with vcpu_mask==NULL [+ + +]
Author: Vitaly Kuznetsov <[email protected]>
Date:   Fri Sep 3 09:51:36 2021 +0200

    KVM: x86: hyper-v: Avoid calling kvm_make_vcpus_request_mask() with vcpu_mask==NULL
    
    commit 6470accc7ba948b0b3aca22b273fe84ec638a116 upstream.
    
    In preparation to making kvm_make_vcpus_request_mask() use for_each_set_bit()
    switch kvm_hv_flush_tlb() to calling kvm_make_all_cpus_request() for 'all cpus'
    case.
    
    Note: kvm_make_all_cpus_request() (unlike kvm_make_vcpus_request_mask())
    currently dynamically allocates cpumask on each call and this is suboptimal.
    Both kvm_make_all_cpus_request() and kvm_make_vcpus_request_mask() are
    going to be switched to using pre-allocated per-cpu masks.
    
    Reviewed-by: Sean Christopherson <[email protected]>
    Signed-off-by: Vitaly Kuznetsov <[email protected]>
    Signed-off-by: Paolo Bonzini <[email protected]>
    Message-Id: <[email protected]>
    Signed-off-by: Paolo Bonzini <[email protected]>
    Cc: Mathias Krause <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
Linux: Linux 5.15.105 [+ + +]
Author: Greg Kroah-Hartman <[email protected]>
Date:   Thu Mar 30 12:48:01 2023 +0200

    Linux 5.15.105
    
    Link: https://lore.kernel.org/r/[email protected]
    Tested-by: Shuah Khan <[email protected]>
    Tested-by: Florian Fainelli <[email protected]>
    Tested-by: Linux Kernel Functional Testing <[email protected]>
    Tested-by: Bagas Sanjaya <[email protected]>
    Tested-by: Chris Paterson (CIP) <[email protected]>
    Tested-by: Harshit Mogalapalli <[email protected]>
    Tested-by: Jon Hunter <[email protected]>
    Tested-by: Guenter Roeck <[email protected]>
    Tested-by: Ron Economos <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
lockd: set file_lock start and end when decoding nlm4 testargs [+ + +]
Author: Jeff Layton <[email protected]>
Date:   Tue Mar 14 06:20:58 2023 -0400

    lockd: set file_lock start and end when decoding nlm4 testargs
    
    commit 7ff84910c66c9144cc0de9d9deed9fb84c03aff0 upstream.
    
    Commit 6930bcbfb6ce dropped the setting of the file_lock range when
    decoding a nlm_lock off the wire. This causes the client side grant
    callback to miss matching blocks and reject the lock, only to rerequest
    it 30s later.
    
    Add a helper function to set the file_lock range from the start and end
    values that the protocol uses, and have the nlm_lock decoder call that to
    set up the file_lock args properly.
    
    Fixes: 6930bcbfb6ce ("lockd: detect and reject lock arguments that overflow")
    Reported-by: Amir Goldstein <[email protected]>
    Signed-off-by: Jeff Layton <[email protected]>
    Tested-by: Amir Goldstein <[email protected]>
    Cc: [email protected] #6.0
    Signed-off-by: Anna Schumaker <[email protected]>
    Signed-off-by: Amir Goldstein <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
m68k: Only force 030 bus error if PC not in exception table [+ + +]
Author: Michael Schmitz <[email protected]>
Date:   Wed Mar 1 15:11:07 2023 +1300

    m68k: Only force 030 bus error if PC not in exception table
    
    [ Upstream commit e36a82bebbf7da814530d5a179bef9df5934b717 ]
    
    __get_kernel_nofault() does copy data in supervisor mode when
    forcing a task backtrace log through /proc/sysrq_trigger.
    This is expected cause a bus error exception on e.g. NULL
    pointer dereferencing when logging a kernel task has no
    workqueue associated. This bus error ought to be ignored.
    
    Our 030 bus error handler is ill equipped to deal with this:
    
    Whenever ssw indicates a kernel mode access on a data fault,
    we don't even attempt to handle the fault and instead always
    send a SEGV signal (or panic). As a result, the check
    for exception handling at the fault PC (buried in
    send_sig_fault() which gets called from do_page_fault()
    eventually) is never used.
    
    In contrast, both 040 and 060 access error handlers do not
    care whether a fault happened on supervisor mode access,
    and will call do_page_fault() on those, ultimately honoring
    the exception table.
    
    Add a check in bus_error030 to call do_page_fault() in case
    we do have an entry for the fault PC in our exception table.
    
    I had attempted a fix for this earlier in 2019 that did rely
    on testing pagefault_disabled() (see link below) to achieve
    the same thing, but this patch should be more generic.
    
    Tested on 030 Atari Falcon.
    
    Reported-by: Eero Tamminen <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Michael Schmitz <[email protected]>
    Reviewed-by: Geert Uytterhoeven <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
mm/slab: Fix undefined init_cache_node_node() for NUMA and !SMP [+ + +]
Author: Geert Uytterhoeven <[email protected]>
Date:   Tue Mar 21 09:30:59 2023 +0100

    mm/slab: Fix undefined init_cache_node_node() for NUMA and !SMP
    
    commit 66a1c22b709178e7b823d44465d0c2e5ed7492fb upstream.
    
    sh/migor_defconfig:
    
        mm/slab.c: In function ‘slab_memory_callback’:
        mm/slab.c:1127:23: error: implicit declaration of function ‘init_cache_node_node’; did you mean ‘drain_cache_node_node’? [-Werror=implicit-function-declaration]
         1127 |                 ret = init_cache_node_node(nid);
              |                       ^~~~~~~~~~~~~~~~~~~~
              |                       drain_cache_node_node
    
    The #ifdef condition protecting the definition of init_cache_node_node()
    no longer matches the conditions protecting the (multiple) users.
    
    Fix this by syncing the conditions.
    
    Fixes: 76af6a054da40553 ("mm/migrate: add CPU hotplug to demotion #ifdef")
    Reported-by: Randy Dunlap <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Reviewed-by: John Paul Adrian Glaubitz <[email protected]>
    Acked-by: Randy Dunlap <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Vlastimil Babka <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
mm: kfence: fix using kfence_metadata without initialization in show_object() [+ + +]
Author: Muchun Song <[email protected]>
Date:   Wed Mar 15 11:44:41 2023 +0800

    mm: kfence: fix using kfence_metadata without initialization in show_object()
    
    commit 1c86a188e03156223a34d09ce290b49bd4dd0403 upstream.
    
    The variable kfence_metadata is initialized in kfence_init_pool(), then,
    it is not initialized if kfence is disabled after booting.  In this case,
    kfence_metadata will be used (e.g.  ->lock and ->state fields) without
    initialization when reading /sys/kernel/debug/kfence/objects.  There will
    be a warning if you enable CONFIG_DEBUG_SPINLOCK.  Fix it by creating
    debugfs files when necessary.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: 0ce20dd84089 ("mm: add Kernel Electric-Fence infrastructure")
    Signed-off-by: Muchun Song <[email protected]>
    Tested-by: Marco Elver <[email protected]>
    Reviewed-by: Marco Elver <[email protected]>
    Cc: Alexander Potapenko <[email protected]>
    Cc: Dmitry Vyukov <[email protected]>
    Cc: Jann Horn <[email protected]>
    Cc: SeongJae Park <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
net/mlx5: E-Switch, Fix an Oops in error handling code [+ + +]
Author: Dan Carpenter <[email protected]>
Date:   Mon Feb 27 14:16:10 2023 +0300

    net/mlx5: E-Switch, Fix an Oops in error handling code
    
    [ Upstream commit 640fcdbcf27fc62de9223f958ceb4e897a00e791 ]
    
    The error handling dereferences "vport".  There is nothing we can do if
    it is an error pointer except returning the error code.
    
    Fixes: 133dcfc577ea ("net/mlx5: E-Switch, Alloc and free unique metadata for match")
    Signed-off-by: Dan Carpenter <[email protected]>
    Reviewed-by: Roi Dayan <[email protected]>
    Signed-off-by: Saeed Mahameed <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/mlx5: Fix steering rules cleanup [+ + +]
Author: Lama Kayal <[email protected]>
Date:   Tue Jan 31 14:07:03 2023 +0200

    net/mlx5: Fix steering rules cleanup
    
    [ Upstream commit 922f56e9a795d6f3dd72d3428ebdd7ee040fa855 ]
    
    vport's mc, uc and multicast rules are not deleted in teardown path when
    EEH happens. Since the vport's promisc settings(uc, mc and all) in
    firmware are reset after EEH, mlx5 driver will try to delete the above
    rules in the initialization path. This cause kernel crash because these
    software rules are no longer valid.
    
    Fix by nullifying these rules right after delete to avoid accessing any dangling
    pointers.
    
    Call Trace:
    __list_del_entry_valid+0xcc/0x100 (unreliable)
    tree_put_node+0xf4/0x1b0 [mlx5_core]
    tree_remove_node+0x30/0x70 [mlx5_core]
    mlx5_del_flow_rules+0x14c/0x1f0 [mlx5_core]
    esw_apply_vport_rx_mode+0x10c/0x200 [mlx5_core]
    esw_update_vport_rx_mode+0xb4/0x180 [mlx5_core]
    esw_vport_change_handle_locked+0x1ec/0x230 [mlx5_core]
    esw_enable_vport+0x130/0x260 [mlx5_core]
    mlx5_eswitch_enable_sriov+0x2a0/0x2f0 [mlx5_core]
    mlx5_device_enable_sriov+0x74/0x440 [mlx5_core]
    mlx5_load_one+0x114c/0x1550 [mlx5_core]
    mlx5_pci_resume+0x68/0xf0 [mlx5_core]
    eeh_report_resume+0x1a4/0x230
    eeh_pe_dev_traverse+0x98/0x170
    eeh_handle_normal_event+0x3e4/0x640
    eeh_handle_event+0x4c/0x370
    eeh_event_handler+0x14c/0x210
    kthread+0x168/0x1b0
    ret_from_kernel_thread+0x5c/0x84
    
    Fixes: a35f71f27a61 ("net/mlx5: E-Switch, Implement promiscuous rx modes vf request handling")
    Signed-off-by: Huy Nguyen <[email protected]>
    Signed-off-by: Lama Kayal <[email protected]>
    Reviewed-by: Tariq Toukan <[email protected]>
    Reviewed-by: Maor Dickman <[email protected]>
    Signed-off-by: Saeed Mahameed <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/mlx5: Read the TC mapping of all priorities on ETS query [+ + +]
Author: Maher Sanalla <[email protected]>
Date:   Wed Mar 15 11:04:38 2023 +0200

    net/mlx5: Read the TC mapping of all priorities on ETS query
    
    [ Upstream commit 44d553188c38ac74b799dfdcebafef2f7bb70942 ]
    
    When ETS configurations are queried by the user to get the mapping
    assignment between packet priority and traffic class, only priorities up
    to maximum TCs are queried from QTCT register in FW to retrieve their
    assigned TC, leaving the rest of the priorities mapped to the default
    TC #0 which might be misleading.
    
    Fix by querying the TC mapping of all priorities on each ETS query,
    regardless of the maximum number of TCs configured in FW.
    
    Fixes: 820c2c5e773d ("net/mlx5e: Read ETS settings directly from firmware")
    Signed-off-by: Maher Sanalla <[email protected]>
    Reviewed-by: Moshe Shemesh <[email protected]>
    Signed-off-by: Saeed Mahameed <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net/mlx5e: Set uplink rep as NETNS_LOCAL [+ + +]
Author: Gavin Li <[email protected]>
Date:   Fri Nov 25 04:15:40 2022 +0200

    net/mlx5e: Set uplink rep as NETNS_LOCAL
    
    [ Upstream commit c83172b0639c8a005c0dd3b36252dc22ddd9f19c ]
    
    Previously, NETNS_LOCAL was not set for uplink representors, inconsistent
    with VF representors, and allowed the uplink representor to be moved
    between net namespaces and separated from the VF representors it shares
    the core device with. Such usage would break the isolation model of
    namespaces, as devices in different namespaces would have access to
    shared memory.
    
    To solve this issue, set NETNS_LOCAL for uplink representors if eswitch is
    in switchdev mode.
    
    Fixes: 7a9fb35e8c3a ("net/mlx5e: Do not reload ethernet ports when changing eswitch mode")
    Signed-off-by: Gavin Li <[email protected]>
    Reviewed-by: Gavi Teitz <[email protected]>
    Signed-off-by: Saeed Mahameed <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net/ps3_gelic_net: Fix RX sk_buff length [+ + +]
Author: Geoff Levand <[email protected]>
Date:   Sat Mar 18 17:39:16 2023 +0000

    net/ps3_gelic_net: Fix RX sk_buff length
    
    [ Upstream commit 19b3bb51c3bc288b3f2c6f8c4450b0f548320625 ]
    
    The Gelic Ethernet device needs to have the RX sk_buffs aligned to
    GELIC_NET_RXBUF_ALIGN, and also the length of the RX sk_buffs must
    be a multiple of GELIC_NET_RXBUF_ALIGN.
    
    The current Gelic Ethernet driver was not allocating sk_buffs large
    enough to allow for this alignment.
    
    Also, correct the maximum and minimum MTU sizes, and add a new
    preprocessor macro for the maximum frame size, GELIC_NET_MAX_FRAME.
    
    Fixes various randomly occurring runtime network errors.
    
    Fixes: 02c1889166b4 ("ps3: gigabit ethernet driver for PS3, take3")
    Signed-off-by: Geoff Levand <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net/ps3_gelic_net: Use dma_mapping_error [+ + +]
Author: Geoff Levand <[email protected]>
Date:   Sat Mar 18 17:39:16 2023 +0000

    net/ps3_gelic_net: Use dma_mapping_error
    
    [ Upstream commit bebe933d35a63d4f042fbf4dce4f22e689ba0fcd ]
    
    The current Gelic Etherenet driver was checking the return value of its
    dma_map_single call, and not using the dma_mapping_error() routine.
    
    Fixes runtime problems like these:
    
      DMA-API: ps3_gelic_driver sb_05: device driver failed to check map error
      WARNING: CPU: 0 PID: 0 at kernel/dma/debug.c:1027 .check_unmap+0x888/0x8dc
    
    Fixes: 02c1889166b4 ("ps3: gigabit ethernet driver for PS3, take3")
    Reviewed-by: Alexander Duyck <[email protected]>
    Signed-off-by: Geoff Levand <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net/sched: act_mirred: better wording on protection against excessive stack growth [+ + +]
Author: Davide Caratti <[email protected]>
Date:   Fri Jan 20 18:01:39 2023 +0100

    net/sched: act_mirred: better wording on protection against excessive stack growth
    
    [ Upstream commit 78dcdffe0418ac8f3f057f26fe71ccf4d8ed851f ]
    
    with commit e2ca070f89ec ("net: sched: protect against stack overflow in
    TC act_mirred"), act_mirred protected itself against excessive stack growth
    using per_cpu counter of nested calls to tcf_mirred_act(), and capping it
    to MIRRED_RECURSION_LIMIT. However, such protection does not detect
    recursion/loops in case the packet is enqueued to the backlog (for example,
    when the mirred target device has RPS or skb timestamping enabled). Change
    the wording from "recursion" to "nesting" to make it more clear to readers.
    
    CC: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Davide Caratti <[email protected]>
    Reviewed-by: Marcelo Ricardo Leitner <[email protected]>
    Acked-by: Jamal Hadi Salim <[email protected]>
    Signed-off-by: Paolo Abeni <[email protected]>
    Stable-dep-of: ca22da2fbd69 ("act_mirred: use the backlog for nested calls to mirred ingress")
    Signed-off-by: Sasha Levin <[email protected]>

 
net/sonic: use dma_mapping_error() for error check [+ + +]
Author: Zhang Changzhong <[email protected]>
Date:   Tue Mar 21 14:45:43 2023 +1100

    net/sonic: use dma_mapping_error() for error check
    
    [ Upstream commit 4107b8746d93ace135b8c4da4f19bbae81db785f ]
    
    The DMA address returned by dma_map_single() should be checked with
    dma_mapping_error(). Fix it accordingly.
    
    Fixes: efcce839360f ("[PATCH] macsonic/jazzsonic network drivers update")
    Signed-off-by: Zhang Changzhong <[email protected]>
    Tested-by: Stan Johnson <[email protected]>
    Signed-off-by: Finn Thain <[email protected]>
    Reviewed-by: Leon Romanovsky <[email protected]>
    Link: https://lore.kernel.org/r/6645a4b5c1e364312103f48b7b36783b94e197a2.1679370343.git.fthain@linux-m68k.org
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
net: dsa: b53: mmap: fix device tree support [+ + +]
Author: Álvaro Fernández Rojas <[email protected]>
Date:   Thu Mar 16 18:28:07 2023 +0100

    net: dsa: b53: mmap: fix device tree support
    
    [ Upstream commit 30796d0dcb6e41c6558a07950f2ce60c209da867 ]
    
    CPU port should also be enabled in order to get a working switch.
    
    Fixes: a5538a777b73 ("net: dsa: b53: mmap: Add device tree support")
    Signed-off-by: Álvaro Fernández Rojas <[email protected]>
    Acked-by: Florian Fainelli <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: mt7530: move enabling disabling core clock to mt7530_pll_setup() [+ + +]
Author: Arınç ÜNAL <[email protected]>
Date:   Mon Mar 20 22:05:18 2023 +0300

    net: dsa: mt7530: move enabling disabling core clock to mt7530_pll_setup()
    
    [ Upstream commit 8f058a6ef99f0b88a177b58cc46a44ff5112e40a ]
    
    Split the code that enables and disables TRGMII clocks and core clock.
    Move enabling and disabling core clock to mt7530_pll_setup() as it's
    supposed to be run there.
    
    Add 20 ms delay before enabling the core clock as seen on the U-Boot
    MediaTek ethernet driver.
    
    Change the comment for enabling and disabling TRGMII clocks as the code
    seems to affect both TXC and RXC.
    
    Tested rgmii and trgmii modes of port 6 and rgmii mode of port 5 on MCM
    MT7530 on MT7621AT Unielec U7621-06 and standalone MT7530 on MT7623NI
    Bananapi BPI-R2.
    
    Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
    Link: https://source.denx.de/u-boot/u-boot/-/blob/29a48bf9ccba45a5e560bb564bbe76e42629325f/drivers/net/mtk_eth.c#L589
    Tested-by: Arınç ÜNAL <[email protected]>
    Signed-off-by: Arınç ÜNAL <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: mt7530: move lowering TRGMII driving to mt7530_setup() [+ + +]
Author: Arınç ÜNAL <[email protected]>
Date:   Mon Mar 20 22:05:19 2023 +0300

    net: dsa: mt7530: move lowering TRGMII driving to mt7530_setup()
    
    [ Upstream commit fdcc8ccd823740c18e803b886cec461bc0e64201 ]
    
    Move lowering the TRGMII Tx clock driving to mt7530_setup(), after setting
    the core clock, as seen on the U-Boot MediaTek ethernet driver.
    
    Move the code which looks like it lowers the TRGMII Rx clock driving to
    after the TRGMII Tx clock driving is lowered. This is run after lowering
    the Tx clock driving on the U-Boot MediaTek ethernet driver as well.
    
    This way, the switch should consume less power regardless of port 6 being
    used.
    
    Update the comment explaining mt7530_pad_clk_setup().
    
    Tested rgmii and trgmii modes of port 6 and rgmii mode of port 5 on MCM
    MT7530 on MT7621AT Unielec U7621-06 and standalone MT7530 on MT7623NI
    Bananapi BPI-R2.
    
    Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
    Link: https://source.denx.de/u-boot/u-boot/-/blob/29a48bf9ccba45a5e560bb564bbe76e42629325f/drivers/net/mtk_eth.c#L682
    Tested-by: Arınç ÜNAL <[email protected]>
    Signed-off-by: Arınç ÜNAL <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: mt7530: move setting ssc_delta to PHY_INTERFACE_MODE_TRGMII case [+ + +]
Author: Arınç ÜNAL <[email protected]>
Date:   Mon Mar 20 22:05:20 2023 +0300

    net: dsa: mt7530: move setting ssc_delta to PHY_INTERFACE_MODE_TRGMII case
    
    [ Upstream commit 407b508bdd70b6848993843d96ed49ac4108fb52 ]
    
    Move setting the ssc_delta variable to under the PHY_INTERFACE_MODE_TRGMII
    case as it's only needed when trgmii is used.
    
    Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch")
    Signed-off-by: Arınç ÜNAL <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: dsa: tag_brcm: legacy: fix daisy-chained switches [+ + +]
Author: Álvaro Fernández Rojas <[email protected]>
Date:   Sun Mar 19 10:55:40 2023 +0100

    net: dsa: tag_brcm: legacy: fix daisy-chained switches
    
    [ Upstream commit 032a954061afd4b7426c3eb6bfd2952ef1e9a384 ]
    
    When BCM63xx internal switches are connected to switches with a 4-byte
    Broadcom tag, it does not identify the packet as VLAN tagged, so it adds one
    based on its PVID (which is likely 0).
    Right now, the packet is received by the BCM63xx internal switch and the 6-byte
    tag is properly processed. The next step would to decode the corresponding
    4-byte tag. However, the internal switch adds an invalid VLAN tag after the
    6-byte tag and the 4-byte tag handling fails.
    In order to fix this we need to remove the invalid VLAN tag after the 6-byte
    tag before passing it to the 4-byte tag decoding.
    
    Fixes: 964dbf186eaa ("net: dsa: tag_brcm: add support for legacy tags")
    Signed-off-by: Álvaro Fernández Rojas <[email protected]>
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Reviewed-by: Florian Fainelli <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: mdio: fix owner field for mdio buses registered using ACPI [+ + +]
Author: Florian Fainelli <[email protected]>
Date:   Thu Mar 16 16:33:17 2023 -0700

    net: mdio: fix owner field for mdio buses registered using ACPI
    
    [ Upstream commit 30b605b8501e321f79e19c3238aa6ca31da6087c ]
    
    Bus ownership is wrong when using acpi_mdiobus_register() to register an
    mdio bus. That function is not inline, so when it calls
    mdiobus_register() the wrong THIS_MODULE value is captured.
    
    CC: Maxime Bizon <[email protected]>
    Fixes: 803ca24d2f92 ("net: mdio: Add ACPI support code for mdio")
    Signed-off-by: Florian Fainelli <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: mdio: fix owner field for mdio buses registered using device-tree [+ + +]
Author: Maxime Bizon <[email protected]>
Date:   Thu Mar 16 16:33:16 2023 -0700

    net: mdio: fix owner field for mdio buses registered using device-tree
    
    [ Upstream commit 99669259f3361d759219811e670b7e0742668556 ]
    
    Bus ownership is wrong when using of_mdiobus_register() to register an mdio
    bus. That function is not inline, so when it calls mdiobus_register() the wrong
    THIS_MODULE value is captured.
    
    Signed-off-by: Maxime Bizon <[email protected]>
    Fixes: 90eff9096c01 ("net: phy: Allow splitting MDIO bus/device support from PHYs")
    [florian: fix kdoc, added Fixes tag]
    Signed-off-by: Florian Fainelli <[email protected]>
    Reviewed-by: Simon Horman <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: mdio: thunder: Add missing fwnode_handle_put() [+ + +]
Author: Liang He <[email protected]>
Date:   Wed Mar 22 14:20:57 2023 +0800

    net: mdio: thunder: Add missing fwnode_handle_put()
    
    [ Upstream commit b1de5c78ebe9858ccec9d49af2f76724f1d47e3e ]
    
    In device_for_each_child_node(), we should add fwnode_handle_put()
    when break out of the iteration device_for_each_child_node()
    as it will automatically increase and decrease the refcounter.
    
    Fixes: 379d7ac7ca31 ("phy: mdio-thunder: Add driver for Cavium Thunder SoC MDIO buses.")
    Signed-off-by: Liang He <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: phy: Ensure state transitions are processed from phy_stop() [+ + +]
Author: Florian Fainelli <[email protected]>
Date:   Thu Mar 16 13:33:24 2023 -0700

    net: phy: Ensure state transitions are processed from phy_stop()
    
    [ Upstream commit 4203d84032e28f893594a453bd8bc9c3b15c7334 ]
    
    In the phy_disconnect() -> phy_stop() path, we will be forcibly setting
    the PHY state machine to PHY_HALTED. This invalidates the old_state !=
    phydev->state condition in phy_state_machine() such that we will neither
    display the state change for debugging, nor will we invoke the
    link_change_notify() callback.
    
    Factor the code by introducing phy_process_state_change(), and ensure
    that we process the state change from phy_stop() as well.
    
    Fixes: 5c5f626bcace ("net: phy: improve handling link_change_notify callback")
    Signed-off-by: Florian Fainelli <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: qcom/emac: Fix use after free bug in emac_remove due to race condition [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Sat Mar 18 16:05:26 2023 +0800

    net: qcom/emac: Fix use after free bug in emac_remove due to race condition
    
    [ Upstream commit 6b6bc5b8bd2d4ca9e1efa9ae0f98a0b0687ace75 ]
    
    In emac_probe, &adpt->work_thread is bound with
    emac_work_thread. Then it will be started by timeout
    handler emac_tx_timeout or a IRQ handler emac_isr.
    
    If we remove the driver which will call emac_remove
      to make cleanup, there may be a unfinished work.
    
    The possible sequence is as follows:
    
    Fix it by finishing the work before cleanup in the emac_remove
    and disable timeout response.
    
    CPU0                  CPU1
    
                        |emac_work_thread
    emac_remove         |
    free_netdev         |
    kfree(netdev);      |
                        |emac_reinit_locked
                        |emac_mac_down
                        |//use netdev
    Fixes: b9b17debc69d ("net: emac: emac gigabit ethernet controller driver")
    Signed-off-by: Zheng Wang <[email protected]>
    
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: tls: fix possible race condition between do_tls_getsockopt_conf() and do_tls_setsockopt_conf() [+ + +]
Author: Hangyu Hua <[email protected]>
Date:   Thu Mar 23 00:54:40 2023 +0000

    net: tls: fix possible race condition between do_tls_getsockopt_conf() and do_tls_setsockopt_conf()
    
    commit 49c47cc21b5b7a3d8deb18fc57b0aa2ab1286962 upstream.
    
    ctx->crypto_send.info is not protected by lock_sock in
    do_tls_getsockopt_conf(). A race condition between do_tls_getsockopt_conf()
    and error paths of do_tls_setsockopt_conf() may lead to a use-after-free
    or null-deref.
    
    More discussion:  https://lore.kernel.org/all/Y/ht6gQL+u6fj3dG@hog/
    
    Fixes: 3c4d7559159b ("tls: kernel TLS support")
    Signed-off-by: Hangyu Hua <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Meena Shanmugam <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: usb: cdc_mbim: avoid altsetting toggling for Telit FE990 [+ + +]
Author: Enrico Sau <[email protected]>
Date:   Mon Mar 6 12:59:33 2023 +0100

    net: usb: cdc_mbim: avoid altsetting toggling for Telit FE990
    
    [ Upstream commit 418383e6ed6b4624a54ec05c535f13d184fbf33b ]
    
    Add quirk CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE for Telit FE990
    0x1081 composition in order to avoid bind error.
    
    Signed-off-by: Enrico Sau <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: usb: qmi_wwan: add Telit 0x1080 composition [+ + +]
Author: Enrico Sau <[email protected]>
Date:   Mon Mar 6 13:05:28 2023 +0100

    net: usb: qmi_wwan: add Telit 0x1080 composition
    
    [ Upstream commit 382e363d5bed0cec5807b35761d14e55955eee63 ]
    
    Add the following Telit FE990 composition:
    
    0x1080: tty, adb, rmnet, tty, tty, tty, tty
    
    Signed-off-by: Enrico Sau <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Paolo Abeni <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

net: usb: smsc95xx: Limit packet length to skb->len [+ + +]
Author: Szymon Heidrich <[email protected]>
Date:   Thu Mar 16 11:19:54 2023 +0100

    net: usb: smsc95xx: Limit packet length to skb->len
    
    [ Upstream commit ff821092cf02a70c2bccd2d19269f01e29aa52cf ]
    
    Packet length retrieved from descriptor may be larger than
    the actual socket buffer length. In such case the cloned
    skb passed up the network stack will leak kernel memory contents.
    
    Fixes: 2f7ca802bdae ("net: Add SMSC LAN9500 USB2.0 10/100 ethernet adapter driver")
    Signed-off-by: Szymon Heidrich <[email protected]>
    Reviewed-by: Jakub Kicinski <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
NFSD: fix use-after-free in __nfs42_ssc_open() [+ + +]
Author: Dai Ngo <[email protected]>
Date:   Mon Dec 12 14:50:11 2022 -0800

    NFSD: fix use-after-free in __nfs42_ssc_open()
    
    commit 75333d48f92256a0dec91dbf07835e804fc411c0 upstream.
    
    Problem caused by source's vfsmount being unmounted but remains
    on the delayed unmount list. This happens when nfs42_ssc_open()
    return errors.
    
    Fixed by removing nfsd4_interssc_connect(), leave the vfsmount
    for the laundromat to unmount when idle time expires.
    
    We don't need to call nfs_do_sb_deactive when nfs42_ssc_open
    return errors since the file was not opened so nfs_server->active
    was not incremented. Same as in nfsd4_copy, if we fail to
    launch nfsd4_do_async_copy thread then there's no need to
    call nfs_do_sb_deactive
    
    Reported-by: Xingyuan Mo <[email protected]>
    Signed-off-by: Dai Ngo <[email protected]>
    Tested-by: Xingyuan Mo <[email protected]>
    Signed-off-by: Chuck Lever <[email protected]>
    Signed-off-by: Ovidiu Panait <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nilfs2: fix kernel-infoleak in nilfs_ioctl_wrap_copy() [+ + +]
Author: Ryusuke Konishi <[email protected]>
Date:   Tue Mar 7 17:55:48 2023 +0900

    nilfs2: fix kernel-infoleak in nilfs_ioctl_wrap_copy()
    
    commit 003587000276f81d0114b5ce773d80c119d8cb30 upstream.
    
    The ioctl helper function nilfs_ioctl_wrap_copy(), which exchanges a
    metadata array to/from user space, may copy uninitialized buffer regions
    to user space memory for read-only ioctl commands NILFS_IOCTL_GET_SUINFO
    and NILFS_IOCTL_GET_CPINFO.
    
    This can occur when the element size of the user space metadata given by
    the v_size member of the argument nilfs_argv structure is larger than the
    size of the metadata element (nilfs_suinfo structure or nilfs_cpinfo
    structure) on the file system side.
    
    KMSAN-enabled kernels detect this issue as follows:
    
     BUG: KMSAN: kernel-infoleak in instrument_copy_to_user
     include/linux/instrumented.h:121 [inline]
     BUG: KMSAN: kernel-infoleak in _copy_to_user+0xc0/0x100 lib/usercopy.c:33
      instrument_copy_to_user include/linux/instrumented.h:121 [inline]
      _copy_to_user+0xc0/0x100 lib/usercopy.c:33
      copy_to_user include/linux/uaccess.h:169 [inline]
      nilfs_ioctl_wrap_copy+0x6fa/0xc10 fs/nilfs2/ioctl.c:99
      nilfs_ioctl_get_info fs/nilfs2/ioctl.c:1173 [inline]
      nilfs_ioctl+0x2402/0x4450 fs/nilfs2/ioctl.c:1290
      nilfs_compat_ioctl+0x1b8/0x200 fs/nilfs2/ioctl.c:1343
      __do_compat_sys_ioctl fs/ioctl.c:968 [inline]
      __se_compat_sys_ioctl+0x7dd/0x1000 fs/ioctl.c:910
      __ia32_compat_sys_ioctl+0x93/0xd0 fs/ioctl.c:910
      do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
      __do_fast_syscall_32+0xa2/0x100 arch/x86/entry/common.c:178
      do_fast_syscall_32+0x37/0x80 arch/x86/entry/common.c:203
      do_SYSENTER_32+0x1f/0x30 arch/x86/entry/common.c:246
      entry_SYSENTER_compat_after_hwframe+0x70/0x82
    
     Uninit was created at:
      __alloc_pages+0x9f6/0xe90 mm/page_alloc.c:5572
      alloc_pages+0xab0/0xd80 mm/mempolicy.c:2287
      __get_free_pages+0x34/0xc0 mm/page_alloc.c:5599
      nilfs_ioctl_wrap_copy+0x223/0xc10 fs/nilfs2/ioctl.c:74
      nilfs_ioctl_get_info fs/nilfs2/ioctl.c:1173 [inline]
      nilfs_ioctl+0x2402/0x4450 fs/nilfs2/ioctl.c:1290
      nilfs_compat_ioctl+0x1b8/0x200 fs/nilfs2/ioctl.c:1343
      __do_compat_sys_ioctl fs/ioctl.c:968 [inline]
      __se_compat_sys_ioctl+0x7dd/0x1000 fs/ioctl.c:910
      __ia32_compat_sys_ioctl+0x93/0xd0 fs/ioctl.c:910
      do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline]
      __do_fast_syscall_32+0xa2/0x100 arch/x86/entry/common.c:178
      do_fast_syscall_32+0x37/0x80 arch/x86/entry/common.c:203
      do_SYSENTER_32+0x1f/0x30 arch/x86/entry/common.c:246
      entry_SYSENTER_compat_after_hwframe+0x70/0x82
    
     Bytes 16-127 of 3968 are uninitialized
     ...
    
    This eliminates the leak issue by initializing the page allocated as
    buffer using get_zeroed_page().
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Ryusuke Konishi <[email protected]>
    Reported-by: [email protected]
      Link: https://lkml.kernel.org/r/[email protected]
    Tested-by: Ryusuke Konishi <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
nvme-tcp: fix nvme_tcp_term_pdu to match spec [+ + +]
Author: Caleb Sander <[email protected]>
Date:   Mon Mar 20 09:57:36 2023 -0600

    nvme-tcp: fix nvme_tcp_term_pdu to match spec
    
    [ Upstream commit aa01c67de5926fdb276793180564f172c55fb0d7 ]
    
    The FEI field of C2HTermReq/H2CTermReq is 4 bytes but not 4-byte-aligned
    in the NVMe/TCP specification (it is located at offset 10 in the PDU).
    Split it into two 16-bit integers in struct nvme_tcp_term_pdu
    so no padding is inserted. There should also be 10 reserved bytes after.
    There are currently no users of this type.
    
    Fixes: fc221d05447aa6db ("nvme-tcp: Add protocol header")
    Reported-by: Geert Uytterhoeven <[email protected]>
    Signed-off-by: Caleb Sander <[email protected]>
    Reviewed-by: Sagi Grimberg <[email protected]>
    Signed-off-by: Christoph Hellwig <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
ocfs2: fix data corruption after failed write [+ + +]
Author: Jan Kara via Ocfs2-devel <[email protected]>
Date:   Thu Mar 2 16:38:43 2023 +0100

    ocfs2: fix data corruption after failed write
    
    commit 90410bcf873cf05f54a32183afff0161f44f9715 upstream.
    
    When buffered write fails to copy data into underlying page cache page,
    ocfs2_write_end_nolock() just zeroes out and dirties the page.  This can
    leave dirty page beyond EOF and if page writeback tries to write this page
    before write succeeds and expands i_size, page gets into inconsistent
    state where page dirty bit is clear but buffer dirty bits stay set
    resulting in page data never getting written and so data copied to the
    page is lost.  Fix the problem by invalidating page beyond EOF after
    failed write.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Fixes: 6dbf7bb55598 ("fs: Don't invalidate page buffers in block_write_full_page()")
    Signed-off-by: Jan Kara <[email protected]>
    Reviewed-by: Joseph Qi <[email protected]>
    Cc: Mark Fasheh <[email protected]>
    Cc: Joel Becker <[email protected]>
    Cc: Junxiao Bi <[email protected]>
    Cc: Changwei Ge <[email protected]>
    Cc: Gang He <[email protected]>
    Cc: Jun Piao <[email protected]>
    Cc: <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    [ replace block_invalidate_folio to block_invalidatepage ]
    Signed-off-by: Joseph Qi <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
octeontx2-vf: Add missing free for alloc_percpu [+ + +]
Author: Jiasheng Jiang <[email protected]>
Date:   Fri Mar 17 14:43:37 2023 +0800

    octeontx2-vf: Add missing free for alloc_percpu
    
    [ Upstream commit f038f3917baf04835ba2b7bcf2a04ac93fbf8a9c ]
    
    Add the free_percpu for the allocated "vf->hw.lmt_info" in order to avoid
    memory leak, same as the "pf->hw.lmt_info" in
    `drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c`.
    
    Fixes: 5c0512072f65 ("octeontx2-pf: cn10k: Use runtime allocated LMTLINE region")
    Signed-off-by: Jiasheng Jiang <[email protected]>
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Acked-by: Geethasowjanya Akula <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Jakub Kicinski <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
perf/core: Fix perf_output_begin parameter is incorrectly invoked in perf_event_bpf_output [+ + +]
Author: Yang Jihong <[email protected]>
Date:   Tue Mar 14 04:47:35 2023 +0000

    perf/core: Fix perf_output_begin parameter is incorrectly invoked in perf_event_bpf_output
    
    [ Upstream commit eb81a2ed4f52be831c9fb879752d89645a312c13 ]
    
    syzkaller reportes a KASAN issue with stack-out-of-bounds.
    The call trace is as follows:
      dump_stack+0x9c/0xd3
      print_address_description.constprop.0+0x19/0x170
      __kasan_report.cold+0x6c/0x84
      kasan_report+0x3a/0x50
      __perf_event_header__init_id+0x34/0x290
      perf_event_header__init_id+0x48/0x60
      perf_output_begin+0x4a4/0x560
      perf_event_bpf_output+0x161/0x1e0
      perf_iterate_sb_cpu+0x29e/0x340
      perf_iterate_sb+0x4c/0xc0
      perf_event_bpf_event+0x194/0x2c0
      __bpf_prog_put.constprop.0+0x55/0xf0
      __cls_bpf_delete_prog+0xea/0x120 [cls_bpf]
      cls_bpf_delete_prog_work+0x1c/0x30 [cls_bpf]
      process_one_work+0x3c2/0x730
      worker_thread+0x93/0x650
      kthread+0x1b8/0x210
      ret_from_fork+0x1f/0x30
    
    commit 267fb27352b6 ("perf: Reduce stack usage of perf_output_begin()")
    use on-stack struct perf_sample_data of the caller function.
    
    However, perf_event_bpf_output uses incorrect parameter to convert
    small-sized data (struct perf_bpf_event) into large-sized data
    (struct perf_sample_data), which causes memory overwriting occurs in
    __perf_event_header__init_id.
    
    Fixes: 267fb27352b6 ("perf: Reduce stack usage of perf_output_begin()")
    Signed-off-by: Yang Jihong <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
perf: fix perf_event_context->time [+ + +]
Author: Song Liu <[email protected]>
Date:   Mon Mar 13 10:16:08 2023 -0700

    perf: fix perf_event_context->time
    
    [ Upstream commit baf1b12a67f5b24f395baca03e442ce27cab0c18 ]
    
    Time readers rely on perf_event_context->[time|timestamp|timeoffset] to get
    accurate time_enabled and time_running for an event. The difference between
    ctx->timestamp and ctx->time is the among of time when the context is not
    enabled. __update_context_time(ctx, false) is used to increase timestamp,
    but not time. Therefore, it should only be called in ctx_sched_in() when
    EVENT_TIME was not enabled.
    
    Fixes: 09f5e7dc7ad7 ("perf: Fix perf_event_read_local() time")
    Signed-off-by: Song Liu <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Acked-by: Namhyung Kim <[email protected]>
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
platform/chrome: cros_ec_chardev: fix kernel data leak from ioctl [+ + +]
Author: Tzung-Bi Shih <[email protected]>
Date:   Fri Mar 24 09:06:58 2023 +0800

    platform/chrome: cros_ec_chardev: fix kernel data leak from ioctl
    
    [ Upstream commit b20cf3f89c56b5f6a38b7f76a8128bf9f291bbd3 ]
    
    It is possible to peep kernel page's data by providing larger `insize`
    in struct cros_ec_command[1] when invoking EC host commands.
    
    Fix it by using zeroed memory.
    
    [1]: https://elixir.bootlin.com/linux/v6.2/source/include/linux/platform_data/cros_ec_proto.h#L74
    
    Fixes: eda2e30c6684 ("mfd / platform: cros_ec: Miscellaneous character device to talk with the EC")
    Signed-off-by: Tzung-Bi Shih <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>

 
power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Fri Mar 10 01:47:28 2023 +0800

    power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition
    
    [ Upstream commit 47c29d69212911f50bdcdd0564b5999a559010d4 ]
    
    In bq24190_probe, &bdi->input_current_limit_work is bound
    with bq24190_input_current_limit_work. When external power
    changed, it will call bq24190_charger_external_power_changed
     to start the work.
    
    If we remove the module which will call bq24190_remove to make
    cleanup, there may be a unfinished work. The possible
    sequence is as follows:
    
    CPU0                  CPUc1
    
                        |bq24190_input_current_limit_work
    bq24190_remove      |
    power_supply_unregister  |
    device_unregister   |
    power_supply_dev_release|
    kfree(psy)          |
                        |
                        | power_supply_get_property_from_supplier
                        |   //use
    
    Fix it by finishing the work before cleanup in the bq24190_remove
    
    Fixes: 97774672573a ("power_supply: Initialize changed_work before calling device_add")
    Signed-off-by: Zheng Wang <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

power: supply: bq24190_charger: using pm_runtime_resume_and_get instead of pm_runtime_get_sync [+ + +]
Author: Minghao Chi <[email protected]>
Date:   Tue Apr 12 08:30:44 2022 +0000

    power: supply: bq24190_charger: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
    
    [ Upstream commit d96a89407e5f682d1cb22569d91784506c784863 ]
    
    Using pm_runtime_resume_and_get is more appropriate
    for simplifing code
    
    Reported-by: Zeal Robot <[email protected]>
    Signed-off-by: Minghao Chi <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Stable-dep-of: 47c29d692129 ("power: supply: bq24190: Fix use after free bug in bq24190_remove due to race condition")
    Signed-off-by: Sasha Levin <[email protected]>

power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Sun Mar 12 01:46:50 2023 +0800

    power: supply: da9150: Fix use after free bug in da9150_charger_remove due to race condition
    
    [ Upstream commit 06615d11cc78162dfd5116efb71f29eb29502d37 ]
    
    In da9150_charger_probe, &charger->otg_work is bound with
    da9150_charger_otg_work. da9150_charger_otg_ncb may be
    called to start the work.
    
    If we remove the module which will call da9150_charger_remove
    to make cleanup, there may be a unfinished work. The possible
    sequence is as follows:
    
    Fix it by canceling the work before cleanup in the da9150_charger_remove
    
    CPU0                  CPUc1
    
                        |da9150_charger_otg_work
    da9150_charger_remove      |
    power_supply_unregister  |
    device_unregister   |
    power_supply_dev_release|
    kfree(psy)          |
                        |
                        |   power_supply_changed(charger->usb);
                        |   //use
    
    Fixes: c1a281e34dae ("power: Add support for DA9150 Charger")
    Signed-off-by: Zheng Wang <[email protected]>
    Signed-off-by: Sebastian Reichel <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
qed/qed_sriov: guard against NULL derefs from qed_iov_get_vf_info [+ + +]
Author: Daniil Tatianin <[email protected]>
Date:   Thu Mar 16 13:29:21 2023 +0300

    qed/qed_sriov: guard against NULL derefs from qed_iov_get_vf_info
    
    [ Upstream commit 25143b6a01d0cc5319edd3de22ffa2578b045550 ]
    
    We have to make sure that the info returned by the helper is valid
    before using it.
    
    Found by Linux Verification Center (linuxtesting.org) with the SVACE
    static analysis tool.
    
    Fixes: f990c82c385b ("qed*: Add support for ndo_set_vf_trust")
    Fixes: 733def6a04bf ("qed*: IOV link control")
    Signed-off-by: Daniil Tatianin <[email protected]>
    Reviewed-by: Michal Swiatkowski <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
riscv: Bump COMMAND_LINE_SIZE value to 1024 [+ + +]
Author: Alexandre Ghiti <[email protected]>
Date:   Tue Mar 16 15:34:20 2021 -0400

    riscv: Bump COMMAND_LINE_SIZE value to 1024
    
    [ Upstream commit 61fc1ee8be26bc192d691932b0a67eabee45d12f ]
    
    Increase COMMAND_LINE_SIZE as the current default value is too low
    for syzbot kernel command line.
    
    There has been considerable discussion on this patch that has led to a
    larger patch set removing COMMAND_LINE_SIZE from the uapi headers on all
    ports.  That's not quite done yet, but it's gotten far enough we're
    confident this is not a uABI change so this is safe.
    
    Reported-by: Dmitry Vyukov <[email protected]>
    Signed-off-by: Alexandre Ghiti <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    [Palmer: it's not uabi]
    Link: https://lore.kernel.org/linux-riscv/[email protected]/#t
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

riscv: Handle zicsr/zifencei issues between clang and binutils [+ + +]
Author: Nathan Chancellor <[email protected]>
Date:   Mon Mar 13 16:00:23 2023 -0700

    riscv: Handle zicsr/zifencei issues between clang and binutils
    
    commit e89c2e815e76471cb507bd95728bf26da7976430 upstream.
    
    There are two related issues that appear in certain combinations with
    clang and GNU binutils.
    
    The first occurs when a version of clang that supports zicsr or zifencei
    via '-march=' [1] (i.e, >= 17.x) is used in combination with a version
    of GNU binutils that do not recognize zicsr and zifencei in the
    '-march=' value (i.e., < 2.36):
    
      riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
      riscv64-linux-gnu-ld: failed to merge target specific data of file fs/efivarfs/file.o
      riscv64-linux-gnu-ld: -march=rv64i2p0_m2p0_a2p0_c2p0_zicsr2p0_zifencei2p0: Invalid or unknown z ISA extension: 'zifencei'
      riscv64-linux-gnu-ld: failed to merge target specific data of file fs/efivarfs/super.o
    
    The second occurs when a version of clang that does not support zicsr or
    zifencei via '-march=' (i.e., <= 16.x) is used in combination with a
    version of GNU as that defaults to a newer ISA base spec, which requires
    specifying zicsr and zifencei in the '-march=' value explicitly (i.e, >=
    2.38):
    
      ../arch/riscv/kernel/kexec_relocate.S: Assembler messages:
      ../arch/riscv/kernel/kexec_relocate.S:147: Error: unrecognized opcode `fence.i', extension `zifencei' required
      clang-12: error: assembler command failed with exit code 1 (use -v to see invocation)
    
    This is the same issue addressed by commit 6df2a016c0c8 ("riscv: fix
    build with binutils 2.38") (see [2] for additional information) but
    older versions of clang miss out on it because the cc-option check
    fails:
    
      clang-12: error: invalid arch name 'rv64imac_zicsr_zifencei', unsupported standard user-level extension 'zicsr'
      clang-12: error: invalid arch name 'rv64imac_zicsr_zifencei', unsupported standard user-level extension 'zicsr'
    
    To resolve the first issue, only attempt to add zicsr and zifencei to
    the march string when using the GNU assembler 2.38 or newer, which is
    when the default ISA spec was updated, requiring these extensions to be
    specified explicitly. LLVM implements an older version of the base
    specification for all currently released versions, so these instructions
    are available as part of the 'i' extension. If LLVM's implementation is
    updated in the future, a CONFIG_AS_IS_LLVM condition can be added to
    CONFIG_TOOLCHAIN_NEEDS_EXPLICIT_ZICSR_ZIFENCEI.
    
    To resolve the second issue, use version 2.2 of the base ISA spec when
    using an older version of clang that does not support zicsr or zifencei
    via '-march=', as that is the spec version most compatible with the one
    clang/LLVM implements and avoids the need to specify zicsr and zifencei
    explicitly due to still being a part of 'i'.
    
    [1]: https://github.com/llvm/llvm-project/commit/22e199e6afb1263c943c0c0d4498694e15bf8a16
    [2]: https://lore.kernel.org/[email protected]/
    
    Cc: [email protected]
    Link: https://github.com/ClangBuiltLinux/linux/issues/1808
    Co-developed-by: Conor Dooley <[email protected]>
    Signed-off-by: Conor Dooley <[email protected]>
    Signed-off-by: Nathan Chancellor <[email protected]>
    Acked-by: Conor Dooley <[email protected]>
    Link: https://lore.kernel.org/r/20230313-riscv-zicsr-zifencei-fiasco-v1-1-dd1b7840a551@kernel.org
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

riscv: mm: Fix incorrect ASID argument when flushing TLB [+ + +]
Author: Dylan Jhong <[email protected]>
Date:   Mon Mar 13 11:49:06 2023 +0800

    riscv: mm: Fix incorrect ASID argument when flushing TLB
    
    commit 9a801afd3eb95e1a89aba17321062df06fb49d98 upstream.
    
    Currently, we pass the CONTEXTID instead of the ASID to the TLB flush
    function. We should only take the ASID field to prevent from touching
    the reserved bit field.
    
    Fixes: 3f1e782998cd ("riscv: add ASID-based tlbflushing methods")
    Signed-off-by: Dylan Jhong <[email protected]>
    Reviewed-by: Sergey Matyukevich <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Cc: [email protected]
    Signed-off-by: Palmer Dabbelt <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
sched/fair: Sanitize vruntime of entity being migrated [+ + +]
Author: Vincent Guittot <[email protected]>
Date:   Fri Mar 17 17:08:10 2023 +0100

    sched/fair: Sanitize vruntime of entity being migrated
    
    commit a53ce18cacb477dd0513c607f187d16f0fa96f71 upstream.
    
    Commit 829c1651e9c4 ("sched/fair: sanitize vruntime of entity being placed")
    fixes an overflowing bug, but ignore a case that se->exec_start is reset
    after a migration.
    
    For fixing this case, we delay the reset of se->exec_start after
    placing the entity which se->exec_start to detect long sleeping task.
    
    In order to take into account a possible divergence between the clock_task
    of 2 rqs, we increase the threshold to around 104 days.
    
    Fixes: 829c1651e9c4 ("sched/fair: sanitize vruntime of entity being placed")
    Originally-by: Zhang Qiao <[email protected]>
    Signed-off-by: Vincent Guittot <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Tested-by: Zhang Qiao <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

sched/fair: sanitize vruntime of entity being placed [+ + +]
Author: Zhang Qiao <[email protected]>
Date:   Mon Jan 30 13:22:16 2023 +0100

    sched/fair: sanitize vruntime of entity being placed
    
    commit 829c1651e9c4a6f78398d3e67651cef9bb6b42cc upstream.
    
    When a scheduling entity is placed onto cfs_rq, its vruntime is pulled
    to the base level (around cfs_rq->min_vruntime), so that the entity
    doesn't gain extra boost when placed backwards.
    
    However, if the entity being placed wasn't executed for a long time, its
    vruntime may get too far behind (e.g. while cfs_rq was executing a
    low-weight hog), which can inverse the vruntime comparison due to s64
    overflow.  This results in the entity being placed with its original
    vruntime way forwards, so that it will effectively never get to the cpu.
    
    To prevent that, ignore the vruntime of the entity being placed if it
    didn't execute for much longer than the characteristic sheduler time
    scale.
    
    [rkagan: formatted, adjusted commit log, comments, cutoff value]
    Signed-off-by: Zhang Qiao <[email protected]>
    Co-developed-by: Roman Kagan <[email protected]>
    Signed-off-by: Roman Kagan <[email protected]>
    Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
scsi: core: Add BLIST_SKIP_VPD_PAGES for SKhynix H28U74301AMR [+ + +]
Author: Joel Selvaraj <[email protected]>
Date:   Sun Mar 12 23:14:02 2023 -0500

    scsi: core: Add BLIST_SKIP_VPD_PAGES for SKhynix H28U74301AMR
    
    commit a204b490595de71016b2360a1886ec8c12d0afac upstream.
    
    Xiaomi Poco F1 (qcom/sdm845-xiaomi-beryllium*.dts) comes with a SKhynix
    H28U74301AMR UFS. The sd_read_cpr() operation leads to a 120 second
    timeout, making the device bootup very slow:
    
    [  121.457736] sd 0:0:0:1: [sdb] tag#23 timing out command, waited 120s
    
    Setting the BLIST_SKIP_VPD_PAGES allows the device to skip the failing
    sd_read_cpr operation and boot normally.
    
    Signed-off-by: Joel Selvaraj <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Cc: [email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: hisi_sas: Check devm_add_action() return value [+ + +]
Author: Kang Chen <[email protected]>
Date:   Mon Feb 27 11:10:30 2023 +0800

    scsi: hisi_sas: Check devm_add_action() return value
    
    [ Upstream commit 06d1a90de60208054cca15ef200138cfdbb642a9 ]
    
    In case devm_add_action() fails, check it in the caller of
    interrupt_preinit_v3_hw().
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Kang Chen <[email protected]>
    Acked-by: Xiang Chen <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: lpfc: Avoid usage of list iterator variable after loop [+ + +]
Author: Jakob Koschel <[email protected]>
Date:   Wed Mar 1 18:19:14 2023 +0100

    scsi: lpfc: Avoid usage of list iterator variable after loop
    
    [ Upstream commit 2850b23e9f9ae3696e472d2883ea1b43aafa884e ]
    
    If the &epd_pool->list is empty when executing
    lpfc_get_io_buf_from_expedite_pool() the function would return an invalid
    pointer. Even in the case if the list is guaranteed to be populated, the
    iterator variable should not be used after the loop to be more robust for
    future changes.
    
    Linus proposed to avoid any use of the list iterator variable after the
    loop, in the attempt to move the list iterator variable declaration into
    the macro to avoid any potential misuse after the loop [1].
    
    Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ [1]
    Signed-off-by: Jakob Koschel <[email protected]>
    Link: https://lore.kernel.org/r/20230301-scsi-lpfc-avoid-list-iterator-after-loop-v1-1-325578ae7561@gmail.com
    Reviewed-by: Justin Tee <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: lpfc: Check kzalloc() in lpfc_sli4_cgn_params_read() [+ + +]
Author: Justin Tee <[email protected]>
Date:   Mon Feb 27 20:43:36 2023 -0800

    scsi: lpfc: Check kzalloc() in lpfc_sli4_cgn_params_read()
    
    [ Upstream commit 312320b0e0ec21249a17645683fe5304d796aec1 ]
    
    If kzalloc() fails in lpfc_sli4_cgn_params_read(), then we rely on
    lpfc_read_object()'s routine to NULL check pdata.
    
    Currently, an early return error is thrown from lpfc_read_object() to
    protect us from NULL ptr dereference, but the errno code is -ENODEV.
    
    Change the errno code to a more appropriate -ENOMEM.
    
    Reported-by: Kang Chen <[email protected]>
    Link: https://lore.kernel.org/all/[email protected]
    Signed-off-by: Justin Tee <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: qla2xxx: Perform lockless command completion in abort path [+ + +]
Author: Nilesh Javali <[email protected]>
Date:   Sun Mar 12 21:37:10 2023 -0700

    scsi: qla2xxx: Perform lockless command completion in abort path
    
    commit 0367076b0817d5c75dfb83001ce7ce5c64d803a9 upstream.
    
    While adding and removing the controller, the following call trace was
    observed:
    
    WARNING: CPU: 3 PID: 623596 at kernel/dma/mapping.c:532 dma_free_attrs+0x33/0x50
    CPU: 3 PID: 623596 Comm: sh Kdump: loaded Not tainted 5.14.0-96.el9.x86_64 #1
    RIP: 0010:dma_free_attrs+0x33/0x50
    
    Call Trace:
       qla2x00_async_sns_sp_done+0x107/0x1b0 [qla2xxx]
       qla2x00_abort_srb+0x8e/0x250 [qla2xxx]
       ? ql_dbg+0x70/0x100 [qla2xxx]
       __qla2x00_abort_all_cmds+0x108/0x190 [qla2xxx]
       qla2x00_abort_all_cmds+0x24/0x70 [qla2xxx]
       qla2x00_abort_isp_cleanup+0x305/0x3e0 [qla2xxx]
       qla2x00_remove_one+0x364/0x400 [qla2xxx]
       pci_device_remove+0x36/0xa0
       __device_release_driver+0x17a/0x230
       device_release_driver+0x24/0x30
       pci_stop_bus_device+0x68/0x90
       pci_stop_and_remove_bus_device_locked+0x16/0x30
       remove_store+0x75/0x90
       kernfs_fop_write_iter+0x11c/0x1b0
       new_sync_write+0x11f/0x1b0
       vfs_write+0x1eb/0x280
       ksys_write+0x5f/0xe0
       do_syscall_64+0x5c/0x80
       ? do_user_addr_fault+0x1d8/0x680
       ? do_syscall_64+0x69/0x80
       ? exc_page_fault+0x62/0x140
       ? asm_exc_page_fault+0x8/0x30
       entry_SYSCALL_64_after_hwframe+0x44/0xae
    
    The command was completed in the abort path during driver unload with a
    lock held, causing the warning in abort path. Hence complete the command
    without any lock held.
    
    Reported-by: Lin Li <[email protected]>
    Tested-by: Lin Li <[email protected]>
    Cc: [email protected]
    Signed-off-by: Nilesh Javali <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Himanshu Madhani <[email protected]>
    Reviewed-by: John Meneghini <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: qla2xxx: Synchronize the IOCB count to be in order [+ + +]
Author: Quinn Tran <[email protected]>
Date:   Sun Mar 12 21:37:11 2023 -0700

    scsi: qla2xxx: Synchronize the IOCB count to be in order
    
    commit d3affdeb400f3adc925bd996f3839481f5291839 upstream.
    
    A system hang was observed with the following call trace:
    
    BUG: kernel NULL pointer dereference, address: 0000000000000000
    PGD 0 P4D 0
    Oops: 0000 [#1] PREEMPT SMP NOPTI
    CPU: 15 PID: 86747 Comm: nvme Kdump: loaded Not tainted 6.2.0+ #1
    Hardware name: Dell Inc. PowerEdge R6515/04F3CJ, BIOS 2.7.3 03/31/2022
    RIP: 0010:__wake_up_common+0x55/0x190
    Code: 41 f6 01 04 0f 85 b2 00 00 00 48 8b 43 08 4c 8d
          40 e8 48 8d 43 08 48 89 04 24 48 89 c6\
          49 8d 40 18 48 39 c6 0f 84 e9 00 00 00 <49> 8b 40 18 89 6c 24 14 31
          ed 4c 8d 60 e8 41 8b 18 f6 c3 04 75 5d
    RSP: 0018:ffffb05a82afbba0 EFLAGS: 00010082
    RAX: 0000000000000000 RBX: ffff8f9b83a00018 RCX: 0000000000000000
    RDX: 0000000000000001 RSI: ffff8f9b83a00020 RDI: ffff8f9b83a00018
    RBP: 0000000000000001 R08: ffffffffffffffe8 R09: ffffb05a82afbbf8
    R10: 70735f7472617473 R11: 5f30307832616c71 R12: 0000000000000001
    R13: 0000000000000003 R14: 0000000000000000 R15: 0000000000000000
    FS:  00007f815cf4c740(0000) GS:ffff8f9eeed80000(0000)
            knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000000000000000 CR3: 000000010633a000 CR4: 0000000000350ee0
    Call Trace:
        <TASK>
        __wake_up_common_lock+0x83/0xd0
        qla_nvme_ls_req+0x21b/0x2b0 [qla2xxx]
        __nvme_fc_send_ls_req+0x1b5/0x350 [nvme_fc]
        nvme_fc_xmt_disconnect_assoc+0xca/0x110 [nvme_fc]
        nvme_fc_delete_association+0x1bf/0x220 [nvme_fc]
        ? nvme_remove_namespaces+0x9f/0x140 [nvme_core]
        nvme_do_delete_ctrl+0x5b/0xa0 [nvme_core]
        nvme_sysfs_delete+0x5f/0x70 [nvme_core]
        kernfs_fop_write_iter+0x12b/0x1c0
        vfs_write+0x2a3/0x3b0
        ksys_write+0x5f/0xe0
        do_syscall_64+0x5c/0x90
        ? syscall_exit_work+0x103/0x130
        ? syscall_exit_to_user_mode+0x12/0x30
        ? do_syscall_64+0x69/0x90
        ? exit_to_user_mode_loop+0xd0/0x130
        ? exit_to_user_mode_prepare+0xec/0x100
        ? syscall_exit_to_user_mode+0x12/0x30
        ? do_syscall_64+0x69/0x90
        ? syscall_exit_to_user_mode+0x12/0x30
        ? do_syscall_64+0x69/0x90
        entry_SYSCALL_64_after_hwframe+0x72/0xdc
        RIP: 0033:0x7f815cd3eb97
    
    The IOCB counts are out of order and that would block any commands from
    going out and subsequently hang the system. Synchronize the IOCB count to
    be in correct order.
    
    Fixes: 5f63a163ed2f ("scsi: qla2xxx: Fix exchange oversubscription for management commands")
    Cc: [email protected]
    Signed-off-by: Quinn Tran <[email protected]>
    Signed-off-by: Nilesh Javali <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Himanshu Madhani <[email protected]>
    Reviewed-by: John Meneghini <[email protected]>
    Tested-by: Lin Li <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

scsi: scsi_dh_alua: Fix memleak for 'qdata' in alua_activate() [+ + +]
Author: Yu Kuai <[email protected]>
Date:   Wed Mar 15 14:21:54 2023 +0800

    scsi: scsi_dh_alua: Fix memleak for 'qdata' in alua_activate()
    
    [ Upstream commit a13faca032acbf2699293587085293bdfaafc8ae ]
    
    If alua_rtpg_queue() failed from alua_activate(), then 'qdata' is not
    freed, which will cause following memleak:
    
    unreferenced object 0xffff88810b2c6980 (size 32):
      comm "kworker/u16:2", pid 635322, jiffies 4355801099 (age 1216426.076s)
      hex dump (first 32 bytes):
        00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        40 39 24 c1 ff ff ff ff 00 f8 ea 0a 81 88 ff ff  @9$.............
      backtrace:
        [<0000000098f3a26d>] alua_activate+0xb0/0x320
        [<000000003b529641>] scsi_dh_activate+0xb2/0x140
        [<000000007b296db3>] activate_path_work+0xc6/0xe0 [dm_multipath]
        [<000000007adc9ace>] process_one_work+0x3c5/0x730
        [<00000000c457a985>] worker_thread+0x93/0x650
        [<00000000cb80e628>] kthread+0x1ba/0x210
        [<00000000a1e61077>] ret_from_fork+0x22/0x30
    
    Fix the problem by freeing 'qdata' in error path.
    
    Fixes: 625fe857e4fa ("scsi: scsi_dh_alua: Check scsi_device_get() return value")
    Signed-off-by: Yu Kuai <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Reviewed-by: Benjamin Block <[email protected]>
    Reviewed-by: Bart Van Assche <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: storvsc: Handle BlockSize change in Hyper-V VHD/VHDX file [+ + +]
Author: Michael Kelley <[email protected]>
Date:   Mon Feb 27 08:48:34 2023 -0800

    scsi: storvsc: Handle BlockSize change in Hyper-V VHD/VHDX file
    
    [ Upstream commit 11d9874c4204a785f43d899a1ab12f9dc8d9de3e ]
    
    Hyper-V uses a VHD or VHDX file on the host as the underlying storage for a
    virtual disk.  The VHD/VHDX file format is a sparse format where real disk
    space on the host is assigned in chunks that the VHD/VHDX file format calls
    the BlockSize.  This BlockSize is not to be confused with the 512-byte (or
    4096-byte) sector size of the underlying storage device.  The default block
    size for a new VHD/VHDX file is 32 Mbytes.  When a guest VM touches any
    disk space within a 32 Mbyte chunk of the VHD/VHDX file, Hyper-V allocates
    32 Mbytes of real disk space for that section of the VHD/VHDX. Similarly,
    if a discard operation is done that covers an entire 32 Mbyte chunk,
    Hyper-V will free the real disk space for that portion of the VHD/VHDX.
    This BlockSize is surfaced in Linux as the "discard_granularity" in
    /sys/block/sd<x>/queue, which makes sense.
    
    Hyper-V also has differencing disks that can overlay a VHD/VHDX file to
    capture changes to the VHD/VHDX while preserving the original VHD/VHDX.
    One example of this differencing functionality is for VM snapshots.  When a
    snapshot is created, a differencing disk is created.  If the snapshot is
    rolled back, Hyper-V can just delete the differencing disk, and the VM will
    see the original disk contents at the time the snapshot was taken.
    Differencing disks are used in other scenarios as well.
    
    The BlockSize for a differencing disk defaults to 2 Mbytes, not 32 Mbytes.
    The smaller default is used because changes to differencing disks are
    typically scattered all over, and Hyper-V doesn't want to allocate 32
    Mbytes of real disk space for a stray write here or there.  The smaller
    BlockSize provides more efficient use of real disk space.
    
    When a differencing disk is added to a VHD/VHDX, Hyper-V reports
    UNIT_ATTENTION with a sense code indicating "Operating parameters have
    changed", because the value of discard_granularity should be changed to 2
    Mbytes. When the differencing disk is removed, discard_granularity should
    be changed back to 32 Mbytes.  However, current code simply reports a
    message from scsi_report_sense() and the value of
    /sys/block/sd<x>/queue/discard_granularity is not updated. The message
    isn't very actionable by a sysadmin.
    
    Fix this by having the storvsc driver check for the sense code indicating
    that the underly VHD/VHDX block size has changed, and do a rescan of the
    device to pick up the new discard_granularity.  With this change the entire
    transition to/from differencing disks is handled automatically and
    transparently, with no confusing messages being output.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Michael Kelley <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: target: iscsi: Fix an error message in iscsi_check_key() [+ + +]
Author: Maurizio Lombardi <[email protected]>
Date:   Tue Feb 14 15:15:56 2023 +0100

    scsi: target: iscsi: Fix an error message in iscsi_check_key()
    
    [ Upstream commit 6cc55c969b7ce8d85e09a636693d4126c3676c11 ]
    
    The first half of the error message is printed by pr_err(), the second half
    is printed by pr_debug(). The user will therefore see only the first part
    of the message and will miss some useful information.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Maurizio Lombardi <[email protected]>
    Reviewed-by: Mike Christie <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

scsi: ufs: core: Add soft dependency on governor_simpleondemand [+ + +]
Author: Adrien Thierry <[email protected]>
Date:   Mon Feb 20 09:07:40 2023 -0500

    scsi: ufs: core: Add soft dependency on governor_simpleondemand
    
    [ Upstream commit 2ebe16155dc8bd4e602cad5b5f65458d2eaa1a75 ]
    
    The ufshcd driver uses simpleondemand governor for devfreq. Add it to the
    list of ufshcd softdeps to allow userspace initramfs tools like dracut to
    automatically pull the governor module into the initramfs together with UFS
    drivers.
    
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Adrien Thierry <[email protected]>
    Signed-off-by: Martin K. Petersen <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
selftests/bpf: check that modifier resolves after pointer [+ + +]
Author: Lorenz Bauer <[email protected]>
Date:   Mon Mar 6 11:21:38 2023 +0000

    selftests/bpf: check that modifier resolves after pointer
    
    [ Upstream commit dfdd608c3b365f0fd49d7e13911ebcde06b9865b ]
    
    Add a regression test that ensures that a VAR pointing at a
    modifier which follows a PTR (or STRUCT or ARRAY) is resolved
    correctly by the datasec validator.
    
    Signed-off-by: Lorenz Bauer <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Martin KaFai Lau <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
serial: 8250: ASPEED_VUART: select REGMAP instead of depending on it [+ + +]
Author: Randy Dunlap <[email protected]>
Date:   Sat Feb 25 21:39:53 2023 -0800

    serial: 8250: ASPEED_VUART: select REGMAP instead of depending on it
    
    [ Upstream commit f8086d1a65ac693e3fd863128352b4b11ee7324d ]
    
    REGMAP is a hidden (not user visible) symbol. Users cannot set it
    directly thru "make *config", so drivers should select it instead of
    depending on it if they need it.
    
    Consistently using "select" or "depends on" can also help reduce
    Kconfig circular dependency issues.
    
    Therefore, change the use of "depends on REGMAP" to "select REGMAP".
    
    Fixes: 8d310c9107a2 ("drivers/tty/serial/8250: Make Aspeed VUART SIRQ polarity configurable")
    Cc: stable <[email protected]>
    Signed-off-by: Randy Dunlap <[email protected]>
    Cc: Greg Kroah-Hartman <[email protected]>
    Cc: Oskar Senft <[email protected]>
    Cc: [email protected]
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

serial: 8250: SERIAL_8250_ASPEED_VUART should depend on ARCH_ASPEED [+ + +]
Author: Geert Uytterhoeven <[email protected]>
Date:   Mon Jul 11 10:42:52 2022 +0200

    serial: 8250: SERIAL_8250_ASPEED_VUART should depend on ARCH_ASPEED
    
    [ Upstream commit 806a449725cbd679a7f52c394d3c87b451d66bd5 ]
    
    The Aspeed Virtual UART is only present on Aspeed BMC platforms.  Hence
    add a dependency on ARCH_ASPEED, to prevent asking the user about this
    driver when configuring a kernel without Aspeed BMC support.
    
    Reviewed-by: Jeremy Kerr <[email protected]>
    Signed-off-by: Geert Uytterhoeven <[email protected]>
    Link: https://lore.kernel.org/r/259138c372d433005b4871789ef9ee8d15320307.1657528861.git.geert+renesas@glider.be
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stable-dep-of: f8086d1a65ac ("serial: 8250: ASPEED_VUART: select REGMAP instead of depending on it")
    Signed-off-by: Sasha Levin <[email protected]>

serial: fsl_lpuart: Fix comment typo [+ + +]
Author: Jason Wang <[email protected]>
Date:   Wed Aug 3 18:42:08 2022 +0800

    serial: fsl_lpuart: Fix comment typo
    
    [ Upstream commit 374e01fa1304e1eabd2cd16f750da3ecaeab069b ]
    
    The double `as' is duplicated in the comment, remove one.
    
    Signed-off-by: Jason Wang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stable-dep-of: 1be6f2b15f90 ("tty: serial: fsl_lpuart: fix race on RX DMA shutdown")
    Signed-off-by: Sasha Levin <[email protected]>

 
sh: sanitize the flags on sigreturn [+ + +]
Author: Al Viro <[email protected]>
Date:   Mon Mar 6 01:20:30 2023 +0000

    sh: sanitize the flags on sigreturn
    
    [ Upstream commit 573b22ccb7ce9ab7f0539a2e11a9d3609a8783f5 ]
    
    We fetch %SR value from sigframe; it might have been modified by signal
    handler, so we can't trust it with any bits that are not modifiable in
    user mode.
    
    Signed-off-by: Al Viro <[email protected]>
    Cc: Rich Felker <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
tee: amdtee: fix race condition in amdtee_open_session [+ + +]
Author: Rijo Thomas <[email protected]>
Date:   Tue Feb 28 15:11:20 2023 +0530

    tee: amdtee: fix race condition in amdtee_open_session
    
    commit f8502fba45bd30e1a6a354d9d898bc99d1a11e6d upstream.
    
    There is a potential race condition in amdtee_open_session that may
    lead to use-after-free. For instance, in amdtee_open_session() after
    sess->sess_mask is set, and before setting:
    
        sess->session_info[i] = session_info;
    
    if amdtee_close_session() closes this same session, then 'sess' data
    structure will be released, causing kernel panic when 'sess' is
    accessed within amdtee_open_session().
    
    The solution is to set the bit sess->sess_mask as the last step in
    amdtee_open_session().
    
    Fixes: 757cc3e9ff1d ("tee: add AMD-TEE driver")
    Cc: [email protected]
    Signed-off-by: Rijo Thomas <[email protected]>
    Acked-by: Sumit Garg <[email protected]>
    Signed-off-by: Jens Wiklander <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
thread_info: Add helpers to snapshot thread flags [+ + +]
Author: Mark Rutland <[email protected]>
Date:   Mon Nov 29 13:06:43 2021 +0000

    thread_info: Add helpers to snapshot thread flags
    
    [ Upstream commit 7ad639840acf2800b5f387c495795f995a67a329 ]
    
    In <linux/thread_info.h> there are helpers to manipulate individual thread
    flags, but where code wants to check several flags at once, it must open
    code reading current_thread_info()->flags and operating on a snapshot.
    
    As some flags can be set remotely it's necessary to use READ_ONCE() to get
    a consistent snapshot even when IRQs are disabled, but some code forgets to
    do this. Generally this is unlike to cause a problem in practice, but it is
    somewhat unsound, and KCSAN will legitimately warn that there is a data
    race.
    
    To make it easier to do the right thing, and to highlight that concurrent
    modification is possible, add new helpers to snapshot the flags, which
    should be used in preference to plain reads. Subsequent patches will move
    existing code to use the new helpers.
    
    Signed-off-by: Mark Rutland <[email protected]>
    Signed-off-by: Thomas Gleixner <[email protected]>
    Reviewed-by: Thomas Gleixner <[email protected]>
    Acked-by: Marco Elver <[email protected]>
    Acked-by: Paul E. McKenney <[email protected]>
    Cc: Boqun Feng <[email protected]>
    Cc: Dmitry Vyukov <[email protected]>
    Cc: Peter Zijlstra <[email protected]>
    Cc: Will Deacon <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Stable-dep-of: b41651405481 ("entry/rcu: Check TIF_RESCHED _after_ delayed RCU wake-up")
    Signed-off-by: Sasha Levin <[email protected]>

 
thunderbolt: Add missing UNSET_INBOUND_SBTX for retimer access [+ + +]
Author: Gil Fine <[email protected]>
Date:   Fri Mar 3 00:17:24 2023 +0200

    thunderbolt: Add missing UNSET_INBOUND_SBTX for retimer access
    
    commit cd0c1e582b055dea615001b8bd8eccaf6f69f7ce upstream.
    
    According to USB4 retimer specification, the process of firmware update
    sequence requires issuing a SET_INBOUND_SBTX port operation that later
    shall be followed by UNSET_INBOUND_SBTX port operation. This last step
    is not currently issued by the driver but it is necessary to make sure
    the retimers are put back to passthrough mode even during enumeration.
    
    If this step is missing the link may not come up properly after
    soft-reboot for example.
    
    For this reason issue UNSET_INBOUND_SBTX after SET_INBOUND_SBTX for
    enumeration and also when the NVM upgrade is run.
    
    Reported-by: Christian Schaubschläger <[email protected]>
    Link: https://lore.kernel.org/linux-usb/[email protected]/
    Cc: [email protected]
    Signed-off-by: Gil Fine <[email protected]>
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

thunderbolt: Call tb_check_quirks() after initializing adapters [+ + +]
Author: Mika Westerberg <[email protected]>
Date:   Fri Feb 3 15:55:41 2023 +0200

    thunderbolt: Call tb_check_quirks() after initializing adapters
    
    commit d2d6ddf188f609861489d5d188d545856a3ed399 upstream.
    
    In order to apply quirks based on certain adapter types move call to
    tb_check_quirks() happen after the adapters are initialized. This should
    not affect the existing quirks.
    
    Cc: [email protected]
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

thunderbolt: Disable interrupt auto clear for rings [+ + +]
Author: Mario Limonciello <[email protected]>
Date:   Fri Mar 10 11:20:50 2023 -0600

    thunderbolt: Disable interrupt auto clear for rings
    
    commit 468c49f44759720a312e52d44a71c3949ed63d7c upstream.
    
    When interrupt auto clear is programmed, any read to the interrupt
    status register will clear all interrupts.  If two interrupts have
    come in before one can be serviced then this will cause lost interrupts.
    
    On AMD USB4 routers this has manifested in odd problems particularly
    with long strings of control tranfers such as reading the DROM via bit
    banging.
    
    Instead of clearing interrupts automatically, clear the bit corresponding
    to the given ring's interrupt in the ISR.
    
    Fixes: 7a1808f82a37 ("thunderbolt: Handle ring interrupt by reading interrupt status register")
    Cc: Sanju Mehta <[email protected]>
    Cc: [email protected]
    Tested-by: Anson Tsao <[email protected]>
    Signed-off-by: Mario Limonciello <[email protected]>
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

thunderbolt: Rename shadowed variables bit to interrupt_bit and auto_clear_bit [+ + +]
Author: Tom Rix <[email protected]>
Date:   Wed Mar 15 18:04:50 2023 -0400

    thunderbolt: Rename shadowed variables bit to interrupt_bit and auto_clear_bit
    
    commit 58cdfe6f58b35f17f56386f5fcf937168a423ad1 upstream.
    
    cppcheck reports
    drivers/thunderbolt/nhi.c:74:7: style: Local variable 'bit' shadows outer variable [shadowVariable]
      int bit;
          ^
    drivers/thunderbolt/nhi.c:66:6: note: Shadowed declaration
     int bit = ring_interrupt_index(ring) & 31;
         ^
    drivers/thunderbolt/nhi.c:74:7: note: Shadow variable
      int bit;
          ^
    For readablity rename the outer to interrupt_bit and the innner
    to auto_clear_bit.
    
    Fixes: 468c49f44759 ("thunderbolt: Disable interrupt auto clear for ring")
    Cc: [email protected]
    Signed-off-by: Tom Rix <[email protected]>
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

thunderbolt: Use const qualifier for `ring_interrupt_index` [+ + +]
Author: Mario Limonciello <[email protected]>
Date:   Fri Mar 10 11:20:49 2023 -0600

    thunderbolt: Use const qualifier for `ring_interrupt_index`
    
    commit 1716efdb07938bd6510e1127d02012799112c433 upstream.
    
    `ring_interrupt_index` doesn't change the data for `ring` so mark it as
    const. This is needed by the following patch that disables interrupt
    auto clear for rings.
    
    Cc: Sanju Mehta <[email protected]>
    Cc: [email protected]
    Signed-off-by: Mario Limonciello <[email protected]>
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

thunderbolt: Use scale field when allocating USB3 bandwidth [+ + +]
Author: Mika Westerberg <[email protected]>
Date:   Tue Dec 27 11:55:26 2022 +0200

    thunderbolt: Use scale field when allocating USB3 bandwidth
    
    commit c82510b1d87bdebfe916048857d2ef46f1778aa5 upstream.
    
    When tunneling aggregated USB3 (20 Gb/s) the bandwidth values that are
    programmed to the ADP_USB3_CS_2 go higher than 4096 and that does not
    fit anymore to the 12-bit field. Fix this by scaling the value using
    the scale field accordingly.
    
    Fixes: 3b1d8d577ca8 ("thunderbolt: Implement USB3 bandwidth negotiation routines")
    Cc: [email protected]
    Signed-off-by: Mika Westerberg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
trace/hwlat: Do not start per-cpu thread if it is already running [+ + +]
Author: Tero Kristo <[email protected]>
Date:   Fri Mar 10 12:04:51 2023 +0200

    trace/hwlat: Do not start per-cpu thread if it is already running
    
    [ Upstream commit 08697bca9bbba15f2058fdbd9f970bd5f6a8a2e8 ]
    
    The hwlatd tracer will end up starting multiple per-cpu threads with
    the following script:
    
        #!/bin/sh
        cd /sys/kernel/debug/tracing
        echo 0 > tracing_on
        echo hwlat > current_tracer
        echo per-cpu > hwlat_detector/mode
        echo 100000 > hwlat_detector/width
        echo 200000 > hwlat_detector/window
        echo 1 > tracing_on
    
    To fix the issue, check if the hwlatd thread for the cpu is already
    running, before starting a new one. Along with the previous patch, this
    avoids running multiple instances of the same CPU thread on the system.
    
    Link: https://lore.kernel.org/all/[email protected]/
    Link: https://lkml.kernel.org/r/[email protected]
    
    Cc: [email protected]
    Fixes: f46b16520a087 ("trace/hwlat: Implement the per-cpu mode")
    Signed-off-by: Tero Kristo <[email protected]>
    Acked-by: Daniel Bristot de Oliveira <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

trace/hwlat: make use of the helper function kthread_run_on_cpu() [+ + +]
Author: Cai Huoqing <[email protected]>
Date:   Fri Jan 14 14:03:10 2022 -0800

    trace/hwlat: make use of the helper function kthread_run_on_cpu()
    
    [ Upstream commit ff78f6679d2e223e073fcbdc8f70b6bc0abadf99 ]
    
    Replace kthread_create_on_cpu/wake_up_process() with kthread_run_on_cpu()
    to simplify the code.
    
    Link: https://lkml.kernel.org/r/[email protected]
    Signed-off-by: Cai Huoqing <[email protected]>
    Cc: Bernard Metzler <[email protected]>
    Cc: Daniel Bristot de Oliveira <[email protected]>
    Cc: Davidlohr Bueso <[email protected]>
    Cc: Doug Ledford <[email protected]>
    Cc: Ingo Molnar <[email protected]>
    Cc: Jason Gunthorpe <[email protected]>
    Cc: Joel Fernandes (Google) <[email protected]>
    Cc: Josh Triplett <[email protected]>
    Cc: Lai Jiangshan <[email protected]>
    Cc: Mathieu Desnoyers <[email protected]>
    Cc: "Paul E . McKenney" <[email protected]>
    Cc: Steven Rostedt <[email protected]>
    Signed-off-by: Andrew Morton <[email protected]>
    Signed-off-by: Linus Torvalds <[email protected]>
    Stable-dep-of: 08697bca9bbb ("trace/hwlat: Do not start per-cpu thread if it is already running")
    Signed-off-by: Sasha Levin <[email protected]>

 
tracing/hwlat: Replace sched_setaffinity with set_cpus_allowed_ptr [+ + +]
Author: Costa Shulyupin <[email protected]>
Date:   Thu Mar 16 16:45:35 2023 +0200

    tracing/hwlat: Replace sched_setaffinity with set_cpus_allowed_ptr
    
    [ Upstream commit 71c7a30442b724717a30d5e7d1662ba4904eb3d4 ]
    
    There is a problem with the behavior of hwlat in a container,
    resulting in incorrect output. A warning message is generated:
    "cpumask changed while in round-robin mode, switching to mode none",
    and the tracing_cpumask is ignored. This issue arises because
    the kernel thread, hwlatd, is not a part of the container, and
    the function sched_setaffinity is unable to locate it using its PID.
    Additionally, the task_struct of hwlatd is already known.
    Ultimately, the function set_cpus_allowed_ptr achieves
    the same outcome as sched_setaffinity, but employs task_struct
    instead of PID.
    
    Test case:
    
      # cd /sys/kernel/tracing
      # echo 0 > tracing_on
      # echo round-robin > hwlat_detector/mode
      # echo hwlat > current_tracer
      # unshare --fork --pid bash -c 'echo 1 > tracing_on'
      # dmesg -c
    
    Actual behavior:
    
    [573502.809060] hwlat_detector: cpumask changed while in round-robin mode, switching to mode none
    
    Link: https://lore.kernel.org/linux-trace-kernel/[email protected]
    
    Cc: Masami Hiramatsu <[email protected]>
    Fixes: 0330f7aa8ee63 ("tracing: Have hwlat trace migrate across tracing_cpumask CPUs")
    Signed-off-by: Costa Shulyupin <[email protected]>
    Acked-by: Daniel Bristot de Oliveira <[email protected]>
    Signed-off-by: Steven Rostedt (Google) <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
tty: serial: fsl_lpuart: fix race on RX DMA shutdown [+ + +]
Author: Alexander Sverdlin <[email protected]>
Date:   Thu Mar 9 14:43:02 2023 +0100

    tty: serial: fsl_lpuart: fix race on RX DMA shutdown
    
    [ Upstream commit 1be6f2b15f902c02e055ae0b419ca789200473c9 ]
    
    From time to time DMA completion can come in the middle of DMA shutdown:
    
    <process ctx>:                          <IRQ>:
    lpuart32_shutdown()
      lpuart_dma_shutdown()
        del_timer_sync()
                                            lpuart_dma_rx_complete()
                                              lpuart_copy_rx_to_tty()
                                                mod_timer()
        lpuart_dma_rx_free()
    
    When the timer fires a bit later, sport->dma_rx_desc is NULL:
    
    Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004
    pc : lpuart_copy_rx_to_tty+0xcc/0x5bc
    lr : lpuart_timer_func+0x1c/0x2c
    Call trace:
     lpuart_copy_rx_to_tty
     lpuart_timer_func
     call_timer_fn
     __run_timers.part.0
     run_timer_softirq
     __do_softirq
     __irq_exit_rcu
     irq_exit
     handle_domain_irq
     gic_handle_irq
     call_on_irq_stack
     do_interrupt_handler
     ...
    
    To fix this fold del_timer_sync() into lpuart_dma_rx_free() after
    dmaengine_terminate_sync() to make sure timer will not be re-started in
    lpuart_copy_rx_to_tty() <= lpuart_dma_rx_complete().
    
    Fixes: 4a8588a1cf86 ("serial: fsl_lpuart: delete timer on shutdown")
    Cc: stable <[email protected]>
    Signed-off-by: Alexander Sverdlin <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

tty: serial: fsl_lpuart: switch to new dmaengine_terminate_* API [+ + +]
Author: Sherry Sun <[email protected]>
Date:   Wed Nov 23 10:36:19 2022 +0800

    tty: serial: fsl_lpuart: switch to new dmaengine_terminate_* API
    
    [ Upstream commit 8682ab0eea89c300ebb120c02ead3999ca5560a8 ]
    
    Convert dmaengine_terminate_all() calls to synchronous and asynchronous
    versions where appropriate.
    
    Signed-off-by: Sherry Sun <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Stable-dep-of: 1be6f2b15f90 ("tty: serial: fsl_lpuart: fix race on RX DMA shutdown")
    Signed-off-by: Sasha Levin <[email protected]>

 
uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS583Gen 2 [+ + +]
Author: Yaroslav Furman <[email protected]>
Date:   Sun Mar 12 11:07:45 2023 +0200

    uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS583Gen 2
    
    commit a37eb61b6ec064ac794b8a1e89fd33eb582fe51d upstream.
    
    Just like other JMicron JMS5xx enclosures, it chokes on report-opcodes,
    let's avoid them.
    
    Signed-off-by: Yaroslav Furman <[email protected]>
    Cc: stable <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
usb: cdns3: Fix issue with using incorrect PCI device function [+ + +]
Author: Pawel Laszczak <[email protected]>
Date:   Wed Mar 8 07:44:27 2023 -0500

    usb: cdns3: Fix issue with using incorrect PCI device function
    
    commit 1272fd652a226ccb34e9f47371b6121948048438 upstream.
    
    PCI based platform can have more than two PCI functions.
    USBSS PCI Glue driver during initialization should
    consider only DRD/HOST/DEVICE PCI functions and
    all other should be ignored. This patch adds additional
    condition which causes that only DRD and HOST/DEVICE
    function will be accepted.
    
    cc: <[email protected]>
    Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver")
    Signed-off-by: Pawel Laszczak <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: cdnsp: changes PCI Device ID to fix conflict with CNDS3 driver [+ + +]
Author: Pawel Laszczak <[email protected]>
Date:   Thu Mar 9 01:30:48 2023 -0500

    usb: cdnsp: changes PCI Device ID to fix conflict with CNDS3 driver
    
    commit 96b96b2a567fb34dd41c87e6cf01f6902ce8cae4 upstream.
    
    Patch changes CDNS_DEVICE_ID in USBSSP PCI Glue driver to remove
    the conflict with Cadence USBSS driver.
    
    cc: <[email protected]>
    Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
    Signed-off-by: Pawel Laszczak <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: cdnsp: Fixes issue with redundant Status Stage [+ + +]
Author: Pawel Laszczak <[email protected]>
Date:   Tue Mar 7 06:14:20 2023 -0500

    usb: cdnsp: Fixes issue with redundant Status Stage
    
    commit 5bc38d33a5a1209fd4de65101d1ae8255ea12c6e upstream.
    
    In some cases, driver trees to send Status Stage twice.
    The first one from upper layer of gadget usb subsystem and
    second time from controller driver.
    This patch fixes this issue and remove tricky handling of
    SET_INTERFACE from controller driver which is no longer
    needed.
    
    cc: <[email protected]>
    Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
    Signed-off-by: Pawel Laszczak <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: chipdea: core: fix return -EINVAL if request role is the same with current role [+ + +]
Author: Xu Yang <[email protected]>
Date:   Fri Mar 17 14:15:15 2023 +0800

    usb: chipdea: core: fix return -EINVAL if request role is the same with current role
    
    commit 3670de80678961eda7fa2220883fc77c16868951 upstream.
    
    It should not return -EINVAL if the request role is the same with current
    role, return non-error and without do anything instead.
    
    Fixes: a932a8041ff9 ("usb: chipidea: core: add sysfs group")
    cc: <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Signed-off-by: Xu Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: chipidea: core: fix possible concurrent when switch role [+ + +]
Author: Xu Yang <[email protected]>
Date:   Fri Mar 17 14:15:16 2023 +0800

    usb: chipidea: core: fix possible concurrent when switch role
    
    commit 451b15ed138ec15bffbebb58a00ebdd884c3e659 upstream.
    
    The user may call role_store() when driver is handling
    ci_handle_id_switch() which is triggerred by otg event or power lost
    event. Unfortunately, the controller may go into chaos in this case.
    Fix this by protecting it with mutex lock.
    
    Fixes: a932a8041ff9 ("usb: chipidea: core: add sysfs group")
    cc: <[email protected]>
    Acked-by: Peter Chen <[email protected]>
    Signed-off-by: Xu Yang <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: dwc2: fix a devres leak in hw_enable upon suspend resume [+ + +]
Author: Fabrice Gasnier <[email protected]>
Date:   Thu Mar 16 09:41:27 2023 +0100

    usb: dwc2: fix a devres leak in hw_enable upon suspend resume
    
    commit f747313249b74f323ddf841a9c8db14d989f296a upstream.
    
    Each time the platform goes to low power, PM suspend / resume routines
    call: __dwc2_lowlevel_hw_enable -> devm_add_action_or_reset().
    This adds a new devres each time.
    This may also happen at runtime, as dwc2_lowlevel_hw_enable() can be
    called from udc_start().
    
    This can be seen with tracing:
    - echo 1 > /sys/kernel/debug/tracing/events/dev/devres_log/enable
    - go to low power
    - cat /sys/kernel/debug/tracing/trace
    
    A new "ADD" entry is found upon each low power cycle:
    ... devres_log: 49000000.usb-otg ADD 82a13bba devm_action_release (8 bytes)
    ... devres_log: 49000000.usb-otg ADD 49889daf devm_action_release (8 bytes)
    ...
    
    A second issue is addressed here:
    - regulator_bulk_enable() is called upon each PM cycle (suspend/resume).
    - regulator_bulk_disable() never gets called.
    
    So the reference count for these regulators constantly increase, by one
    upon each low power cycle, due to missing regulator_bulk_disable() call
    in __dwc2_lowlevel_hw_disable().
    
    The original fix that introduced the devm_add_action_or_reset() call,
    fixed an issue during probe, that happens due to other errors in
    dwc2_driver_probe() -> dwc2_core_reset(). Then the probe fails without
    disabling regulators, when dr_mode == USB_DR_MODE_PERIPHERAL.
    
    Rather fix the error path: disable all the low level hardware in the
    error path, by using the "hsotg->ll_hw_enabled" flag. Checking dr_mode
    has been introduced to avoid a dual call to dwc2_lowlevel_hw_disable().
    "ll_hw_enabled" should achieve the same (and is used currently in the
    remove() routine).
    
    Fixes: 54c196060510 ("usb: dwc2: Always disable regulators on driver teardown")
    Fixes: 33a06f1300a7 ("usb: dwc2: Fix error path in gadget registration")
    Cc: stable <[email protected]>
    Signed-off-by: Fabrice Gasnier <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: gadget: u_audio: don't let userspace block driver unbind [+ + +]
Author: Alvin Šipraga <[email protected]>
Date:   Thu Mar 2 17:36:47 2023 +0100

    usb: gadget: u_audio: don't let userspace block driver unbind
    
    commit 6c67ed9ad9b83e453e808f9b31a931a20a25629b upstream.
    
    In the unbind callback for f_uac1 and f_uac2, a call to snd_card_free()
    via g_audio_cleanup() will disconnect the card and then wait for all
    resources to be released, which happens when the refcount falls to zero.
    Since userspace can keep the refcount incremented by not closing the
    relevant file descriptor, the call to unbind may block indefinitely.
    This can cause a deadlock during reboot, as evidenced by the following
    blocked task observed on my machine:
    
      task:reboot  state:D stack:0   pid:2827  ppid:569    flags:0x0000000c
      Call trace:
       __switch_to+0xc8/0x140
       __schedule+0x2f0/0x7c0
       schedule+0x60/0xd0
       schedule_timeout+0x180/0x1d4
       wait_for_completion+0x78/0x180
       snd_card_free+0x90/0xa0
       g_audio_cleanup+0x2c/0x64
       afunc_unbind+0x28/0x60
       ...
       kernel_restart+0x4c/0xac
       __do_sys_reboot+0xcc/0x1ec
       __arm64_sys_reboot+0x28/0x30
       invoke_syscall+0x4c/0x110
       ...
    
    The issue can also be observed by opening the card with arecord and
    then stopping the process through the shell before unbinding:
    
      # arecord -D hw:UAC2Gadget -f S32_LE -c 2 -r 48000 /dev/null
      Recording WAVE '/dev/null' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
      ^Z[1]+  Stopped                    arecord -D hw:UAC2Gadget -f S32_LE -c 2 -r 48000 /dev/null
      # echo gadget.0 > /sys/bus/gadget/drivers/configfs-gadget/unbind
      (observe that the unbind command never finishes)
    
    Fix the problem by using snd_card_free_when_closed() instead, which will
    still disconnect the card as desired, but defer the task of freeing the
    resources to the core once userspace closes its file descriptor.
    
    Fixes: 132fcb460839 ("usb: gadget: Add Audio Class 2.0 Driver")
    Cc: [email protected]
    Signed-off-by: Alvin Šipraga <[email protected]>
    Reviewed-by: Ruslan Bilovol <[email protected]>
    Reviewed-by: John Keeping <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: typec: tcpm: fix warning when handle discover_identity message [+ + +]
Author: Xu Yang <[email protected]>
Date:   Thu Feb 16 11:15:15 2023 +0800

    usb: typec: tcpm: fix warning when handle discover_identity message
    
    commit abfc4fa28f0160df61c7149567da4f6494dfb488 upstream.
    
    Since both source and sink device can send discover_identity message in
    PD3, kernel may dump below warning:
    
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 169 at drivers/usb/typec/tcpm/tcpm.c:1446 tcpm_queue_vdm+0xe0/0xf0
    Modules linked in:
    CPU: 0 PID: 169 Comm: 1-0050 Not tainted 6.1.1-00038-g6a3c36cf1da2-dirty #567
    Hardware name: NXP i.MX8MPlus EVK board (DT)
    pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : tcpm_queue_vdm+0xe0/0xf0
    lr : tcpm_queue_vdm+0x2c/0xf0
    sp : ffff80000c19bcd0
    x29: ffff80000c19bcd0 x28: 0000000000000001 x27: ffff0000d11c8ab8
    x26: ffff0000d11cc000 x25: 0000000000000000 x24: 00000000ff008081
    x23: 0000000000000001 x22: 00000000ff00a081 x21: ffff80000c19bdbc
    x20: 0000000000000000 x19: ffff0000d11c8080 x18: ffffffffffffffff
    x17: 0000000000000000 x16: 0000000000000000 x15: ffff0000d716f580
    x14: 0000000000000001 x13: ffff0000d716f507 x12: 0000000000000001
    x11: 0000000000000000 x10: 0000000000000020 x9 : 00000000000ee098
    x8 : 00000000ffffffff x7 : 000000000000001c x6 : ffff0000d716f580
    x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000
    x2 : ffff80000c19bdbc x1 : 00000000ff00a081 x0 : 0000000000000004
    Call trace:
    tcpm_queue_vdm+0xe0/0xf0
    tcpm_pd_rx_handler+0x340/0x1ab0
    kthread_worker_fn+0xcc/0x18c
    kthread+0x10c/0x110
    ret_from_fork+0x10/0x20
    ---[ end trace 0000000000000000 ]---
    
    Below sequences may trigger this warning:
    
    tcpm_send_discover_work(work)
      tcpm_send_vdm(port, USB_SID_PD, CMD_DISCOVER_IDENT, NULL, 0);
       tcpm_queue_vdm(port, header, data, count);
        port->vdm_state = VDM_STATE_READY;
    
    vdm_state_machine_work(work);
                            <-- received discover_identity from partner
     vdm_run_state_machine(port);
      port->vdm_state = VDM_STATE_SEND_MESSAGE;
       mod_vdm_delayed_work(port, x);
    
    tcpm_pd_rx_handler(work);
     tcpm_pd_data_request(port, msg);
      tcpm_handle_vdm_request(port, msg->payload, cnt);
       tcpm_queue_vdm(port, response[0], &response[1], rlen - 1);
    --> WARN_ON(port->vdm_state > VDM_STATE_DONE);
    
    For this case, the state machine could still send out discover
    identity message later if we skip current discover_identity message.
    So we should handle the received message firstly and override the pending
    discover_identity message without warning in this case. Then, a delayed
    send_discover work will send discover_identity message again.
    
    Fixes: e00943e91678 ("usb: typec: tcpm: PD3.0 sinks can send Discover Identity even in device mode")
    cc: <[email protected]>
    Signed-off-by: Xu Yang <[email protected]>
    Reviewed-by: Guenter Roeck <[email protected]>
    Reviewed-by: Heikki Krogerus <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

usb: ucsi: Fix NULL pointer deref in ucsi_connector_change() [+ + +]
Author: Hans de Goede <[email protected]>
Date:   Wed Mar 8 16:42:42 2023 +0100

    usb: ucsi: Fix NULL pointer deref in ucsi_connector_change()
    
    commit f87fb985452ab2083967103ac00bfd68fb182764 upstream.
    
    When ucsi_init() fails, ucsi->connector is NULL, yet in case of
    ucsi_acpi we may still get events which cause the ucs_acpi code to call
    ucsi_connector_change(), which then derefs the NULL ucsi->connector
    pointer.
    
    Fix this by not setting ucsi->ntfy inside ucsi_init() until ucsi_init()
    has succeeded, so that ucsi_connector_change() ignores the events
    because UCSI_ENABLE_NTFY_CONNECTOR_CHANGE is not set in the ntfy mask.
    
    Fixes: bdc62f2bae8f ("usb: typec: ucsi: Simplified registration and I/O API")
    Link: https://bugzilla.kernel.org/show_bug.cgi?id=217106
    Cc: [email protected]
    Reviewed-by: Heikki Krogerus <[email protected]>
    Signed-off-by: Hans de Goede <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
wifi: mac80211: fix qos on mesh interfaces [+ + +]
Author: Felix Fietkau <[email protected]>
Date:   Tue Mar 14 10:59:50 2023 +0100

    wifi: mac80211: fix qos on mesh interfaces
    
    commit 4e348c6c6e23491ae6eb5e077848a42d0562339c upstream.
    
    When ieee80211_select_queue is called for mesh, the sta pointer is usually
    NULL, since the nexthop is looked up much later in the tx path.
    Explicitly check for unicast address in that case in order to make qos work
    again.
    
    Cc: [email protected]
    Fixes: 50e2ab392919 ("wifi: mac80211: fix queue selection for mesh/OCB interfaces")
    Signed-off-by: Felix Fietkau <[email protected]>
    Link: https://lore.kernel.org/r/[email protected]
    Signed-off-by: Johannes Berg <[email protected]>
    Signed-off-by: Greg Kroah-Hartman <[email protected]>

 
xirc2ps_cs: Fix use after free bug in xirc2ps_detach [+ + +]
Author: Zheng Wang <[email protected]>
Date:   Fri Mar 17 00:15:26 2023 +0800

    xirc2ps_cs: Fix use after free bug in xirc2ps_detach
    
    [ Upstream commit e8d20c3ded59a092532513c9bd030d1ea66f5f44 ]
    
    In xirc2ps_probe, the local->tx_timeout_task was bounded
    with xirc2ps_tx_timeout_task. When timeout occurs,
    it will call xirc_tx_timeout->schedule_work to start the
    work.
    
    When we call xirc2ps_detach to remove the driver, there
    may be a sequence as follows:
    
    Stop responding to timeout tasks and complete scheduled
    tasks before cleanup in xirc2ps_detach, which will fix
    the problem.
    
    CPU0                  CPU1
    
                        |xirc2ps_tx_timeout_task
    xirc2ps_detach      |
      free_netdev       |
        kfree(dev);     |
                        |
                        | do_reset
                        |   //use dev
    
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Signed-off-by: Zheng Wang <[email protected]>
    Signed-off-by: David S. Miller <[email protected]>
    Signed-off-by: Sasha Levin <[email protected]>

 
xsk: Add missing overflow check in xdp_umem_reg [+ + +]
Author: Kal Conley <[email protected]>
Date:   Wed Mar 8 18:40:13 2023 +0100

    xsk: Add missing overflow check in xdp_umem_reg
    
    [ Upstream commit c7df4813b149362248d6ef7be41a311e27bf75fe ]
    
    The number of chunks can overflow u32. Make sure to return -EINVAL on
    overflow. Also remove a redundant u32 cast assigning umem->npgs.
    
    Fixes: bbff2f321a86 ("xsk: new descriptor addressing scheme")
    Signed-off-by: Kal Conley <[email protected]>
    Signed-off-by: Daniel Borkmann <[email protected]>
    Acked-by: Magnus Karlsson <[email protected]>
    Link: https://lore.kernel.org/bpf/[email protected]
    Signed-off-by: Sasha Levin <[email protected]>