Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge stable upstream #7

Closed
wants to merge 687 commits into from
Closed

Merge stable upstream #7

wants to merge 687 commits into from
This pull request is big! We’re only showing the most recent 250 commits.

Commits on Mar 1, 2024

  1. s390: use the correct count for __iowrite64_copy()

    [ Upstream commit 723a2cc ]
    
    The signature for __iowrite64_copy() requires the number of 64 bit
    quantities, not bytes. Multiple by 8 to get to a byte length before
    invoking zpci_memcpy_toio()
    
    Fixes: 87bc359 ("s390/pci: speed up __iowrite64_copy by using pci store block insn")
    Acked-by: Niklas Schnelle <schnelle@linux.ibm.com>
    Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
    Link: https://lore.kernel.org/r/0-v1-9223d11a7662+1d7785-s390_iowrite64_jgg@nvidia.com
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    jgunthorpe authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    11277d1 View commit details
    Browse the repository at this point in the history
  2. bpf, sockmap: Fix NULL pointer dereference in sk_psock_verdict_data_r…

    …eady()
    
    [ Upstream commit 4cd12c6 ]
    
    syzbot reported the following NULL pointer dereference issue [1]:
    
      BUG: kernel NULL pointer dereference, address: 0000000000000000
      [...]
      RIP: 0010:0x0
      [...]
      Call Trace:
       <TASK>
       sk_psock_verdict_data_ready+0x232/0x340 net/core/skmsg.c:1230
       unix_stream_sendmsg+0x9b4/0x1230 net/unix/af_unix.c:2293
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg+0x221/0x270 net/socket.c:745
       ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
       ___sys_sendmsg net/socket.c:2638 [inline]
       __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
       do_syscall_64+0xf9/0x240
       entry_SYSCALL_64_after_hwframe+0x6f/0x77
    
    If sk_psock_verdict_data_ready() and sk_psock_stop_verdict() are called
    concurrently, psock->saved_data_ready can be NULL, causing the above issue.
    
    This patch fixes this issue by calling the appropriate data ready function
    using the sk_psock_data_ready() helper and protecting it from concurrency
    with sk->sk_callback_lock.
    
    Fixes: 6df7f76 ("bpf, sockmap: Wake up polling after data copy")
    Reported-by: syzbot+fd7b34375c1c8ce29c93@syzkaller.appspotmail.com
    Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Tested-by: syzbot+fd7b34375c1c8ce29c93@syzkaller.appspotmail.com
    Acked-by: John Fastabend <john.fastabend@gmail.com>
    Closes: https://syzkaller.appspot.com/bug?extid=fd7b34375c1c8ce29c93 [1]
    Link: https://lore.kernel.org/bpf/20240218150933.6004-1-syoshida@redhat.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Shigeru Yoshida authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    4588b13 View commit details
    Browse the repository at this point in the history
  3. tls: break out of main loop when PEEK gets a non-data record

    [ Upstream commit 10f41d0 ]
    
    PEEK needs to leave decrypted records on the rx_list so that we can
    receive them later on, so it jumps back into the async code that
    queues the skb. Unfortunately that makes us skip the
    TLS_RECORD_TYPE_DATA check at the bottom of the main loop, so if two
    records of the same (non-DATA) type are queued, we end up merging
    them.
    
    Add the same record type check, and make it unlikely to not penalize
    the async fastpath. Async decrypt only applies to data record, so this
    check is only needed for PEEK.
    
    process_rx_list also has similar issues.
    
    Fixes: 692d7b5 ("tls: Fix recvmsg() to be able to peek across multiple records")
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Link: https://lore.kernel.org/r/3df2eef4fdae720c55e69472b5bea668772b45a2.1708007371.git.sd@queasysnail.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    qsn authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    ca89b4f View commit details
    Browse the repository at this point in the history
  4. tls: stop recv() if initial process_rx_list gave us non-DATA

    [ Upstream commit fdfbaec ]
    
    If we have a non-DATA record on the rx_list and another record of the
    same type still on the queue, we will end up merging them:
     - process_rx_list copies the non-DATA record
     - we start the loop and process the first available record since it's
       of the same type
     - we break out of the loop since the record was not DATA
    
    Just check the record type and jump to the end in case process_rx_list
    did some work.
    
    Fixes: 692d7b5 ("tls: Fix recvmsg() to be able to peek across multiple records")
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Link: https://lore.kernel.org/r/bd31449e43bd4b6ff546f5c51cf958c31c511deb.1708007371.git.sd@queasysnail.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    qsn authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    6756168 View commit details
    Browse the repository at this point in the history
  5. tls: don't skip over different type records from the rx_list

    [ Upstream commit ec823bf ]
    
    If we queue 3 records:
     - record 1, type DATA
     - record 2, some other type
     - record 3, type DATA
    and do a recv(PEEK), the rx_list will contain the first two records.
    
    The next large recv will walk through the rx_list and copy data from
    record 1, then stop because record 2 is a different type. Since we
    haven't filled up our buffer, we will process the next available
    record. It's also DATA, so we can merge it with the current read.
    
    We shouldn't do that, since there was a record in between that we
    ignored.
    
    Add a flag to let process_rx_list inform tls_sw_recvmsg that it had
    more data available.
    
    Fixes: 692d7b5 ("tls: Fix recvmsg() to be able to peek across multiple records")
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Link: https://lore.kernel.org/r/f00c0c0afa080c60f016df1471158c1caf983c34.1708007371.git.sd@queasysnail.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    qsn authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    bdaf6bb View commit details
    Browse the repository at this point in the history
  6. netfilter: nf_tables: set dormant flag on hook register failure

    [ Upstream commit bccebf6 ]
    
    We need to set the dormant flag again if we fail to register
    the hooks.
    
    During memory pressure hook registration can fail and we end up
    with a table marked as active but no registered hooks.
    
    On table/base chain deletion, nf_tables will attempt to unregister
    the hook again which yields a warn splat from the nftables core.
    
    Reported-and-tested-by: syzbot+de4025c006ec68ac56fc@syzkaller.appspotmail.com
    Fixes: 179d9ba ("netfilter: nf_tables: fix table flag updates")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Florian Westphal authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    0c9302a View commit details
    Browse the repository at this point in the history
  7. netfilter: flowtable: simplify route logic

    [ Upstream commit fa502c8 ]
    
    Grab reference to dst from skbuff earlier to simplify route caching.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Stable-dep-of: 9e0f043 ("netfilter: nft_flow_offload: reset dst in route object after setting up flow")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ummakynes authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    9c5662e View commit details
    Browse the repository at this point in the history
  8. netfilter: nft_flow_offload: reset dst in route object after setting …

    …up flow
    
    [ Upstream commit 9e0f043 ]
    
    dst is transferred to the flow object, route object does not own it
    anymore.  Reset dst in route object, otherwise if flow_offload_add()
    fails, error path releases dst twice, leading to a refcount underflow.
    
    Fixes: a3c90f7 ("netfilter: nf_tables: flow offload expression")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ummakynes authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    012df10 View commit details
    Browse the repository at this point in the history
  9. netfilter: nft_flow_offload: release dst in case direct xmit path is …

    …used
    
    [ Upstream commit 8762785 ]
    
    Direct xmit does not use it since it calls dev_queue_xmit() to send
    packets, hence it calls dst_release().
    
    kmemleak reports:
    
    unreferenced object 0xffff88814f440900 (size 184):
      comm "softirq", pid 0, jiffies 4294951896
      hex dump (first 32 bytes):
        00 60 5b 04 81 88 ff ff 00 e6 e8 82 ff ff ff ff  .`[.............
        21 0b 50 82 ff ff ff ff 00 00 00 00 00 00 00 00  !.P.............
      backtrace (crc cb2bf5d6):
        [<000000003ee17107>] kmem_cache_alloc+0x286/0x340
        [<0000000021a5de2c>] dst_alloc+0x43/0xb0
        [<00000000f0671159>] rt_dst_alloc+0x2e/0x190
        [<00000000fe5092c9>] __mkroute_output+0x244/0x980
        [<000000005fb96fb0>] ip_route_output_flow+0xc0/0x160
        [<0000000045367433>] nf_ip_route+0xf/0x30
        [<0000000085da1d8e>] nf_route+0x2d/0x60
        [<00000000d1ecd1cb>] nft_flow_route+0x171/0x6a0 [nft_flow_offload]
        [<00000000d9b2fb60>] nft_flow_offload_eval+0x4e8/0x700 [nft_flow_offload]
        [<000000009f447dbb>] expr_call_ops_eval+0x53/0x330 [nf_tables]
        [<00000000072e1be6>] nft_do_chain+0x17c/0x840 [nf_tables]
        [<00000000d0551029>] nft_do_chain_inet+0xa1/0x210 [nf_tables]
        [<0000000097c9d5c6>] nf_hook_slow+0x5b/0x160
        [<0000000005eccab1>] ip_forward+0x8b6/0x9b0
        [<00000000553a269b>] ip_rcv+0x221/0x230
        [<00000000412872e5>] __netif_receive_skb_one_core+0xfe/0x110
    
    Fixes: fa502c8 ("netfilter: flowtable: simplify route logic")
    Reported-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ummakynes authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    a6cafdb View commit details
    Browse the repository at this point in the history
  10. netfilter: nf_tables: rename function to destroy hook list

    [ Upstream commit cdc3254 ]
    
    Rename nft_flowtable_hooks_destroy() by nft_hooks_destroy() to prepare
    for netdev chain device updates.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Stable-dep-of: d472e98 ("netfilter: nf_tables: register hooks last when adding new chain/flowtable")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ummakynes authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    26994a0 View commit details
    Browse the repository at this point in the history
  11. netfilter: nf_tables: register hooks last when adding new chain/flowt…

    …able
    
    [ Upstream commit d472e98 ]
    
    Register hooks last when adding chain/flowtable to ensure that packets do
    not walk over datastructure that is being released in the error path
    without waiting for the rcu grace period.
    
    Fixes: 91c7b38 ("netfilter: nf_tables: use new transaction infrastructure to handle chain")
    Fixes: 3b49e2e ("netfilter: nf_tables: add flow table netlink frontend")
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ummakynes authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    f305359 View commit details
    Browse the repository at this point in the history
  12. netfilter: nf_tables: use kzalloc for hook allocation

    [ Upstream commit 195e5f8 ]
    
    KMSAN reports unitialized variable when registering the hook,
       reg->hook_ops_type == NF_HOOK_OP_BPF)
            ~~~~~~~~~~~ undefined
    
    This is a small structure, just use kzalloc to make sure this
    won't happen again when new fields get added to nf_hook_ops.
    
    Fixes: 7b4b2fa ("netfilter: annotate nf_tables base hook ops")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Florian Westphal authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    ea33b81 View commit details
    Browse the repository at this point in the history
  13. net: mctp: put sock on tag allocation failure

    [ Upstream commit 9990889 ]
    
    We may hold an extra reference on a socket if a tag allocation fails: we
    optimistically allocate the sk_key, and take a ref there, but do not
    drop if we end up not using the allocated key.
    
    Ensure we're dropping the sock on this failure by doing a proper unref
    rather than directly kfree()ing.
    
    Fixes: de8a6b1 ("net: mctp: add an explicit reference from a mctp_sk_key to sock")
    Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://lore.kernel.org/r/ce9b61e44d1cdae7797be0c5e3141baf582d23a0.1707983487.git.jk@codeconstruct.com.au
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    jk-ozlabs authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    c22ad76 View commit details
    Browse the repository at this point in the history
  14. net: sparx5: Add spinlock for frame transmission from CPU

    [ Upstream commit 603ead9 ]
    
    Both registers used when doing manual injection or fdma injection are
    shared between all the net devices of the switch. It was noticed that
    when having two process which each of them trying to inject frames on
    different ethernet ports, that the HW started to behave strange, by
    sending out more frames then expected. When doing fdma injection it is
    required to set the frame in the DCB and then make sure that the next
    pointer of the last DCB is invalid. But because there is no locks for
    this, then easily this pointer between the DCB can be broken and then it
    would create a loop of DCBs. And that means that the HW will
    continuously transmit these frames in a loop. Until the SW will break
    this loop.
    Therefore to fix this issue, add a spin lock for when accessing the
    registers for manual or fdma injection.
    
    Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
    Reviewed-by: Daniel Machon <daniel.machon@microchip.com>
    Fixes: f3cad26 ("net: sparx5: add hostmode with phylink support")
    Link: https://lore.kernel.org/r/20240219080043.1561014-1-horatiu.vultur@microchip.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    HoratiuVultur authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    1623161 View commit details
    Browse the repository at this point in the history
  15. phonet: take correct lock to peek at the RX queue

    [ Upstream commit 3b2d9bc ]
    
    The receive queue is protected by its embedded spin-lock, not the
    socket lock, so we need the former lock here (and only that one).
    
    Fixes: 107d0d9 ("Phonet: Phonet datagram transport protocol")
    Reported-by: Luosili <rootlab@huawei.com>
    Signed-off-by: Rémi Denis-Courmont <courmisch@gmail.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20240218081214.4806-1-remi@remlab.net
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Rémi Denis-Courmont authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    f556a35 View commit details
    Browse the repository at this point in the history
  16. phonet/pep: fix racy skb_queue_empty() use

    [ Upstream commit 7d2a894 ]
    
    The receive queues are protected by their respective spin-lock, not
    the socket lock. This could lead to skb_peek() unexpectedly
    returning NULL or a pointer to an already dequeued socket buffer.
    
    Fixes: 9641458 ("Phonet: Pipe End Point for Phonet Pipes protocol")
    Signed-off-by: Rémi Denis-Courmont <courmisch@gmail.com>
    Link: https://lore.kernel.org/r/20240218081214.4806-2-remi@remlab.net
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Rémi Denis-Courmont authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    9d5523e View commit details
    Browse the repository at this point in the history
  17. Fix write to cloned skb in ipv6_hop_ioam()

    [ Upstream commit f198d93 ]
    
    ioam6_fill_trace_data() writes inside the skb payload without ensuring
    it's writeable (e.g., not cloned). This function is called both from the
    input and output path. The output path (ioam6_iptunnel) already does the
    check. This commit provides a fix for the input path, inside
    ipv6_hop_ioam(). It also updates ip6_parse_tlv() to refresh the network
    header pointer ("nh") when returning from ipv6_hop_ioam().
    
    Fixes: 9ee11f0 ("ipv6: ioam: Data plane support for Pre-allocated Trace")
    Reported-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    IurmanJ authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    37919ef View commit details
    Browse the repository at this point in the history
  18. net: phy: realtek: Fix rtl8211f_config_init() for RTL8211F(D)(I)-VD-C…

    …G PHY
    
    [ Upstream commit 3489182 ]
    
    Commit bb726b7 ("net: phy: realtek: add support for
    RTL8211F(D)(I)-VD-CG") extended support of the driver from the existing
    support for RTL8211F(D)(I)-CG PHY to the newer RTL8211F(D)(I)-VD-CG PHY.
    
    While that commit indicated that the RTL8211F_PHYCR2 register is not
    supported by the "VD-CG" PHY model and therefore updated the corresponding
    section in rtl8211f_config_init() to be invoked conditionally, the call to
    "genphy_soft_reset()" was left as-is, when it should have also been invoked
    conditionally. This is because the call to "genphy_soft_reset()" was first
    introduced by the commit 0a4355c ("net: phy: realtek: add dt property
    to disable CLKOUT clock") since the RTL8211F guide indicates that a PHY
    reset should be issued after setting bits in the PHYCR2 register.
    
    As the PHYCR2 register is not applicable to the "VD-CG" PHY model, fix the
    rtl8211f_config_init() function by invoking "genphy_soft_reset()"
    conditionally based on the presence of the "PHYCR2" register.
    
    Fixes: bb726b7 ("net: phy: realtek: add support for RTL8211F(D)(I)-VD-CG")
    Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://lore.kernel.org/r/20240220070007.968762-1-s-vadapalli@ti.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Siddharth-Vadapalli-at-TI authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    b919628 View commit details
    Browse the repository at this point in the history
  19. drm/syncobj: call drm_syncobj_fence_add_wait when WAIT_AVAILABLE flag…

    … is set
    
    [ Upstream commit 3c43177 ]
    
    When waiting for a syncobj timeline point whose fence has not yet been
    submitted with the WAIT_FOR_SUBMIT flag, a callback is registered using
    drm_syncobj_fence_add_wait and the thread is put to sleep until the
    timeout expires. If the fence is submitted before then,
    drm_syncobj_add_point will wake up the sleeping thread immediately which
    will proceed to wait for the fence to be signaled.
    
    However, if the WAIT_AVAILABLE flag is used instead,
    drm_syncobj_fence_add_wait won't get called, meaning the waiting thread
    will always sleep for the full timeout duration, even if the fence gets
    submitted earlier. If it turns out that the fence *has* been submitted
    by the time it eventually wakes up, it will still indicate to userspace
    that the wait completed successfully (it won't return -ETIME), but it
    will have taken much longer than it should have.
    
    To fix this, we must call drm_syncobj_fence_add_wait if *either* the
    WAIT_FOR_SUBMIT flag or the WAIT_AVAILABLE flag is set. The only
    difference being that with WAIT_FOR_SUBMIT we will also wait for the
    fence to be signaled after it has been submitted while with
    WAIT_AVAILABLE we will return immediately.
    
    IGT test patch: https://lists.freedesktop.org/archives/igt-dev/2024-January/067537.html
    
    v1 -> v2: adjust lockdep_assert_none_held_once condition
    
    (cherry picked from commit 8c44ea8)
    
    Fixes: 01d6c35 ("drm/syncobj: add support for timeline point wait v8")
    Signed-off-by: Erik Kurzinger <ekurzinger@nvidia.com>
    Signed-off-by: Simon Ser <contact@emersion.fr>
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Reviewed-by: Simon Ser <contact@emersion.fr>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240119163208.3723457-1-ekurzinger@nvidia.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Erik Kurzinger authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    fd7b4f4 View commit details
    Browse the repository at this point in the history
  20. drm/amd/display: Fix memory leak in dm_sw_fini()

    [ Upstream commit bae6789 ]
    
    After destroying dmub_srv, the memory associated with it is
    not freed, causing a memory leak:
    
    unreferenced object 0xffff896302b45800 (size 1024):
      comm "(udev-worker)", pid 222, jiffies 4294894636
      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 (crc 6265fd77):
        [<ffffffff993495ed>] kmalloc_trace+0x29d/0x340
        [<ffffffffc0ea4a94>] dm_dmub_sw_init+0xb4/0x450 [amdgpu]
        [<ffffffffc0ea4e55>] dm_sw_init+0x15/0x2b0 [amdgpu]
        [<ffffffffc0ba8557>] amdgpu_device_init+0x1417/0x24e0 [amdgpu]
        [<ffffffffc0bab285>] amdgpu_driver_load_kms+0x15/0x190 [amdgpu]
        [<ffffffffc0ba09c7>] amdgpu_pci_probe+0x187/0x4e0 [amdgpu]
        [<ffffffff9968fd1e>] local_pci_probe+0x3e/0x90
        [<ffffffff996918a3>] pci_device_probe+0xc3/0x230
        [<ffffffff99805872>] really_probe+0xe2/0x480
        [<ffffffff99805c98>] __driver_probe_device+0x78/0x160
        [<ffffffff99805daf>] driver_probe_device+0x1f/0x90
        [<ffffffff9980601e>] __driver_attach+0xce/0x1c0
        [<ffffffff99803170>] bus_for_each_dev+0x70/0xc0
        [<ffffffff99804822>] bus_add_driver+0x112/0x210
        [<ffffffff99807245>] driver_register+0x55/0x100
        [<ffffffff990012d1>] do_one_initcall+0x41/0x300
    
    Fix this by freeing dmub_srv after destroying it.
    
    Fixes: 743b978 ("drm/amd/display: Hook up the DMUB service in DM")
    Signed-off-by: Armin Wolf <W_Armin@gmx.de>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Wer-Wolf authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    5816800 View commit details
    Browse the repository at this point in the history
  21. i2c: imx: when being a target, mark the last read as processed

    [ Upstream commit 87aec49 ]
    
    When being a target, NAK from the controller means that all bytes have
    been transferred. So, the last byte needs also to be marked as
    'processed'. Otherwise index registers of backends may not increase.
    
    Fixes: f7414cd ("i2c: imx: support slave mode for imx I2C driver")
    Signed-off-by: Corey Minyard <minyard@acm.org>
    Tested-by: Andrew Manley <andrew.manley@sealingtech.com>
    Reviewed-by: Andrew Manley <andrew.manley@sealingtech.com>
    Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
    [wsa: fixed comment and commit message to properly describe the case]
    Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
    Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    cminyard authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    b1301f1 View commit details
    Browse the repository at this point in the history
  22. erofs: simplify compression configuration parser

    commit efb4fb0 upstream.
    
    Move erofs_load_compr_cfgs() into decompressor.c as well as introduce
    a callback instead of a hard-coded switch for each algorithm for
    simplicity.
    
    Reviewed-by: Chao Yu <chao@kernel.org>
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Link: https://lore.kernel.org/r/20231022130957.11398-1-xiang@kernel.org
    Stable-dep-of: 118a8cf ("erofs: fix inconsistent per-file compression format")
    Signed-off-by: Yue Hu <huyue2@coolpad.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    hsiangkao authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    54407d9 View commit details
    Browse the repository at this point in the history
  23. erofs: fix inconsistent per-file compression format

    commit 118a8cf upstream.
    
    EROFS can select compression algorithms on a per-file basis, and each
    per-file compression algorithm needs to be marked in the on-disk
    superblock for initialization.
    
    However, syzkaller can generate inconsistent crafted images that use
    an unsupported algorithmtype for specific inodes, e.g. use MicroLZMA
    algorithmtype even it's not set in `sbi->available_compr_algs`.  This
    can lead to an unexpected "BUG: kernel NULL pointer dereference" if
    the corresponding decompressor isn't built-in.
    
    Fix this by checking against `sbi->available_compr_algs` for each
    m_algorithmformat request.  Incorrect !erofs_sb_has_compr_cfgs preset
    bitmap is now fixed together since it was harmless previously.
    
    Reported-by: <bugreport@ubisectech.com>
    Fixes: 8f89926 ("erofs: get compression algorithms directly on mapping")
    Fixes: 622cead ("erofs: lzma compression support")
    Reviewed-by: Yue Hu <huyue2@coolpad.com>
    Link: https://lore.kernel.org/r/20240113150602.1471050-1-hsiangkao@linux.alibaba.com
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
    Signed-off-by: Yue Hu <huyue2@coolpad.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    hsiangkao authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    47467e0 View commit details
    Browse the repository at this point in the history
  24. mm/damon/reclaim: fix quota stauts loss due to online tunings

    commit 1b0ca4e upstream.
    
    Patch series "mm/damon: fix quota status loss due to online tunings".
    
    DAMON_RECLAIM and DAMON_LRU_SORT is not preserving internal quota status
    when applying new user parameters, and hence could cause temporal quota
    accuracy degradation.  Fix it by preserving the status.
    
    
    This patch (of 2):
    
    For online parameters change, DAMON_RECLAIM creates new scheme based on
    latest values of the parameters and replaces the old scheme with the new
    one.  When creating it, the internal status of the quota of the old
    scheme is not preserved.  As a result, charging of the quota starts from
    zero after the online tuning.  The data that collected to estimate the
    throughput of the scheme's action is also reset, and therefore the
    estimation should start from the scratch again.  Because the throughput
    estimation is being used to convert the time quota to the effective size
    quota, this could result in temporal time quota inaccuracy.  It would be
    recovered over time, though.  In short, the quota accuracy could be
    temporarily degraded after online parameters update.
    
    Fix the problem by checking the case and copying the internal fields for
    the status.
    
    Link: https://lkml.kernel.org/r/20240216194025.9207-1-sj@kernel.org
    Link: https://lkml.kernel.org/r/20240216194025.9207-2-sj@kernel.org
    Fixes: e035c28 ("mm/damon/reclaim: support online inputs update")
    Signed-off-by: SeongJae Park <sj@kernel.org>
    Cc: <stable@vger.kernel.org>	[5.19+]
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    sjp38 authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    7ebeee5 View commit details
    Browse the repository at this point in the history
  25. fs/aio: Restrict kiocb_set_cancel_fn() to I/O submitted via libaio

    commit b820de7 upstream.
    
    If kiocb_set_cancel_fn() is called for I/O submitted via io_uring, the
    following kernel warning appears:
    
    WARNING: CPU: 3 PID: 368 at fs/aio.c:598 kiocb_set_cancel_fn+0x9c/0xa8
    Call trace:
     kiocb_set_cancel_fn+0x9c/0xa8
     ffs_epfile_read_iter+0x144/0x1d0
     io_read+0x19c/0x498
     io_issue_sqe+0x118/0x27c
     io_submit_sqes+0x25c/0x5fc
     __arm64_sys_io_uring_enter+0x104/0xab0
     invoke_syscall+0x58/0x11c
     el0_svc_common+0xb4/0xf4
     do_el0_svc+0x2c/0xb0
     el0_svc+0x2c/0xa4
     el0t_64_sync_handler+0x68/0xb4
     el0t_64_sync+0x1a4/0x1a8
    
    Fix this by setting the IOCB_AIO_RW flag for read and write I/O that is
    submitted by libaio.
    
    Suggested-by: Jens Axboe <axboe@kernel.dk>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Avi Kivity <avi@scylladb.com>
    Cc: Sandeep Dhavale <dhavale@google.com>
    Cc: Jens Axboe <axboe@kernel.dk>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: Kent Overstreet <kent.overstreet@linux.dev>
    Cc: stable@vger.kernel.org
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Link: https://lore.kernel.org/r/20240215204739.2677806-2-bvanassche@acm.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Bart Van Assche <bvanassche@acm.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    bvanassche authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    18f6143 View commit details
    Browse the repository at this point in the history
  26. mm: zswap: fix missing folio cleanup in writeback race path

    commit e3b63e9 upstream.
    
    In zswap_writeback_entry(), after we get a folio from
    __read_swap_cache_async(), we grab the tree lock again to check that the
    swap entry was not invalidated and recycled.  If it was, we delete the
    folio we just added to the swap cache and exit.
    
    However, __read_swap_cache_async() returns the folio locked when it is
    newly allocated, which is always true for this path, and the folio is
    ref'd.  Make sure to unlock and put the folio before returning.
    
    This was discovered by code inspection, probably because this path handles
    a race condition that should not happen often, and the bug would not crash
    the system, it will only strand the folio indefinitely.
    
    Link: https://lkml.kernel.org/r/20240125085127.1327013-1-yosryahmed@google.com
    Fixes: 04fc781 ("mm: fix zswap writeback race condition")
    Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
    Reviewed-by: Chengming Zhou <zhouchengming@bytedance.com>
    Acked-by: Johannes Weiner <hannes@cmpxchg.org>
    Reviewed-by: Nhat Pham <nphamcs@gmail.com>
    Cc: Domenico Cerasuolo <cerasuolodomenico@gmail.com>
    Cc: <stable@vger.kernel.org>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    yosrym93 authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    14f1992 View commit details
    Browse the repository at this point in the history
  27. mptcp: userspace pm send RM_ADDR for ID 0

    commit 84c531f upstream.
    
    This patch adds the ability to send RM_ADDR for local ID 0. Check
    whether id 0 address is removed, if not, put id 0 into a removing
    list, pass it to mptcp_pm_remove_addr() to remove id 0 address.
    
    There is no reason not to allow the userspace to remove the initial
    address (ID 0). This special case was not taken into account not
    letting the userspace to delete all addresses as announced.
    
    Closes: multipath-tcp/mptcp_net-next#379
    Reviewed-by: Matthieu Baerts <matttbe@kernel.org>
    Signed-off-by: Geliang Tang <geliang.tang@suse.com>
    Signed-off-by: Mat Martineau <martineau@kernel.org>
    Link: https://lore.kernel.org/r/20231025-send-net-next-20231025-v1-3-db8f25f798eb@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Fixes: d9a4594 ("mptcp: netlink: Add MPTCP_PM_CMD_REMOVE")
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    geliangtang authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    b03bca8 View commit details
    Browse the repository at this point in the history
  28. mptcp: add needs_id for netlink appending addr

    commit 584f389 upstream.
    
    Just the same as userspace PM, a new parameter needs_id is added for
    in-kernel PM mptcp_pm_nl_append_new_local_addr() too.
    
    Add a new helper mptcp_pm_has_addr_attr_id() to check whether an address
    ID is set from PM or not.
    
    In mptcp_pm_nl_get_local_id(), needs_id is always true, but in
    mptcp_pm_nl_add_addr_doit(), pass mptcp_pm_has_addr_attr_id() to
    needs_it.
    
    Fixes: efd5a4c ("mptcp: add the address ID assignment bitmap")
    Cc: stable@vger.kernel.org
    Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Geliang Tang authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    70a4a26 View commit details
    Browse the repository at this point in the history
  29. ata: ahci: add identifiers for ASM2116 series adapters

    commit 3bf6141 upstream.
    
    Add support for PCIe SATA adapter cards based on Asmedia 2116 controllers.
    These cards can provide up to 10 SATA ports on PCIe card.
    
    Signed-off-by: Szuying Chen <Chloe_Chen@asmedia.com.tw>
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Szuying Chen authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    4a37c6c View commit details
    Browse the repository at this point in the history
  30. ahci: Extend ASM1061 43-bit DMA address quirk to other ASM106x parts

    commit 51af8f2 upstream.
    
    ASMedia have confirmed that all ASM106x parts currently listed in
    ahci_pci_tbl[] suffer from the 43-bit DMA address limitation that we ran
    into on the ASM1061, and therefore, we need to apply the quirk added by
    commit 20730e9 ("ahci: add 43-bit DMA address quirk for ASMedia
    ASM1061 controllers") to the other supported ASM106x parts as well.
    
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/linux-ide/ZbopwKZJAKQRA4Xv@x1-carbon/
    Signed-off-by: Lennert Buytenhek <kernel@wantstofly.org>
    [cassel: add link to ASMedia confirmation email]
    Signed-off-by: Niklas Cassel <cassel@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Lennert Buytenhek authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    f8fc1f1 View commit details
    Browse the repository at this point in the history
  31. arp: Prevent overflow in arp_req_get().

    commit a7d6027 upstream.
    
    syzkaller reported an overflown write in arp_req_get(). [0]
    
    When ioctl(SIOCGARP) is issued, arp_req_get() looks up an neighbour
    entry and copies neigh->ha to struct arpreq.arp_ha.sa_data.
    
    The arp_ha here is struct sockaddr, not struct sockaddr_storage, so
    the sa_data buffer is just 14 bytes.
    
    In the splat below, 2 bytes are overflown to the next int field,
    arp_flags.  We initialise the field just after the memcpy(), so it's
    not a problem.
    
    However, when dev->addr_len is greater than 22 (e.g. MAX_ADDR_LEN),
    arp_netmask is overwritten, which could be set as htonl(0xFFFFFFFFUL)
    in arp_ioctl() before calling arp_req_get().
    
    To avoid the overflow, let's limit the max length of memcpy().
    
    Note that commit b5f0de6 ("net: dev: Convert sa_data to flexible
    array in struct sockaddr") just silenced syzkaller.
    
    [0]:
    memcpy: detected field-spanning write (size 16) of single field "r->arp_ha.sa_data" at net/ipv4/arp.c:1128 (size 14)
    WARNING: CPU: 0 PID: 144638 at net/ipv4/arp.c:1128 arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128
    Modules linked in:
    CPU: 0 PID: 144638 Comm: syz-executor.4 Not tainted 6.1.74 raspberrypi#31
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.0-debian-1.16.0-5 04/01/2014
    RIP: 0010:arp_req_get+0x411/0x4a0 net/ipv4/arp.c:1128
    Code: fd ff ff e8 41 42 de fb b9 0e 00 00 00 4c 89 fe 48 c7 c2 20 6d ab 87 48 c7 c7 80 6d ab 87 c6 05 25 af 72 04 01 e8 5f 8d ad fb <0f> 0b e9 6c fd ff ff e8 13 42 de fb be 03 00 00 00 4c 89 e7 e8 a6
    RSP: 0018:ffffc900050b7998 EFLAGS: 00010286
    RAX: 0000000000000000 RBX: ffff88803a815000 RCX: 0000000000000000
    RDX: 0000000000000000 RSI: ffffffff8641a44a RDI: 0000000000000001
    RBP: ffffc900050b7a98 R08: 0000000000000001 R09: 0000000000000000
    R10: 0000000000000000 R11: 203a7970636d656d R12: ffff888039c54000
    R13: 1ffff92000a16f37 R14: ffff88803a815084 R15: 0000000000000010
    FS:  00007f172bf306c0(0000) GS:ffff88805aa00000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007f172b3569f0 CR3: 0000000057f12005 CR4: 0000000000770ef0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    PKRU: 55555554
    Call Trace:
     <TASK>
     arp_ioctl+0x33f/0x4b0 net/ipv4/arp.c:1261
     inet_ioctl+0x314/0x3a0 net/ipv4/af_inet.c:981
     sock_do_ioctl+0xdf/0x260 net/socket.c:1204
     sock_ioctl+0x3ef/0x650 net/socket.c:1321
     vfs_ioctl fs/ioctl.c:51 [inline]
     __do_sys_ioctl fs/ioctl.c:870 [inline]
     __se_sys_ioctl fs/ioctl.c:856 [inline]
     __x64_sys_ioctl+0x18e/0x220 fs/ioctl.c:856
     do_syscall_x64 arch/x86/entry/common.c:51 [inline]
     do_syscall_64+0x37/0x90 arch/x86/entry/common.c:81
     entry_SYSCALL_64_after_hwframe+0x64/0xce
    RIP: 0033:0x7f172b262b8d
    Code: 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 f3 0f 1e fa 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 b8 ff ff ff f7 d8 64 89 01 48
    RSP: 002b:00007f172bf300b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
    RAX: ffffffffffffffda RBX: 00007f172b3abf80 RCX: 00007f172b262b8d
    RDX: 0000000020000000 RSI: 0000000000008954 RDI: 0000000000000003
    RBP: 00007f172b2d3493 R08: 0000000000000000 R09: 0000000000000000
    R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
    R13: 000000000000000b R14: 00007f172b3abf80 R15: 00007f172bf10000
     </TASK>
    
    Reported-by: syzkaller <syzkaller@googlegroups.com>
    Reported-by: Bjoern Doebel <doebel@amazon.de>
    Fixes: 1da177e ("Linux-2.6.12-rc2")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20240215230516.31330-1-kuniyu@amazon.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    q2ven authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    f119f23 View commit details
    Browse the repository at this point in the history
  32. fs/ntfs3: Enhance the attribute size check

    commit 4f082a7 upstream.
    
    This combines the overflow and boundary check so that all attribute size
    will be properly examined while enumerating them.
    
    [  169.181521] BUG: KASAN: slab-out-of-bounds in run_unpack+0x2e3/0x570
    [  169.183161] Read of size 1 at addr ffff8880094b6240 by task mount/247
    [  169.184046]
    [  169.184925] CPU: 0 PID: 247 Comm: mount Not tainted 6.0.0-rc7+ #3
    [  169.185908] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
    [  169.187066] Call Trace:
    [  169.187492]  <TASK>
    [  169.188049]  dump_stack_lvl+0x49/0x63
    [  169.188495]  print_report.cold+0xf5/0x689
    [  169.188964]  ? run_unpack+0x2e3/0x570
    [  169.189331]  kasan_report+0xa7/0x130
    [  169.189714]  ? run_unpack+0x2e3/0x570
    [  169.190079]  __asan_load1+0x51/0x60
    [  169.190634]  run_unpack+0x2e3/0x570
    [  169.191290]  ? run_pack+0x840/0x840
    [  169.191569]  ? run_lookup_entry+0xb3/0x1f0
    [  169.192443]  ? mi_enum_attr+0x20a/0x230
    [  169.192886]  run_unpack_ex+0xad/0x3e0
    [  169.193276]  ? run_unpack+0x570/0x570
    [  169.193557]  ? ni_load_mi+0x80/0x80
    [  169.193889]  ? debug_smp_processor_id+0x17/0x20
    [  169.194236]  ? mi_init+0x4a/0x70
    [  169.194496]  attr_load_runs_vcn+0x166/0x1c0
    [  169.194851]  ? attr_data_write_resident+0x250/0x250
    [  169.195188]  mi_read+0x133/0x2c0
    [  169.195481]  ntfs_iget5+0x277/0x1780
    [  169.196017]  ? call_rcu+0x1c7/0x330
    [  169.196392]  ? ntfs_get_block_bmap+0x70/0x70
    [  169.196708]  ? evict+0x223/0x280
    [  169.197014]  ? __kmalloc+0x33/0x540
    [  169.197305]  ? wnd_init+0x15b/0x1b0
    [  169.197599]  ntfs_fill_super+0x1026/0x1ba0
    [  169.197994]  ? put_ntfs+0x1d0/0x1d0
    [  169.198299]  ? vsprintf+0x20/0x20
    [  169.198583]  ? mutex_unlock+0x81/0xd0
    [  169.198930]  ? set_blocksize+0x95/0x150
    [  169.199269]  get_tree_bdev+0x232/0x370
    [  169.199750]  ? put_ntfs+0x1d0/0x1d0
    [  169.200094]  ntfs_fs_get_tree+0x15/0x20
    [  169.200431]  vfs_get_tree+0x4c/0x130
    [  169.200714]  path_mount+0x654/0xfe0
    [  169.201067]  ? putname+0x80/0xa0
    [  169.201358]  ? finish_automount+0x2e0/0x2e0
    [  169.201965]  ? putname+0x80/0xa0
    [  169.202445]  ? kmem_cache_free+0x1c4/0x440
    [  169.203075]  ? putname+0x80/0xa0
    [  169.203414]  do_mount+0xd6/0xf0
    [  169.203719]  ? path_mount+0xfe0/0xfe0
    [  169.203977]  ? __kasan_check_write+0x14/0x20
    [  169.204382]  __x64_sys_mount+0xca/0x110
    [  169.204711]  do_syscall_64+0x3b/0x90
    [  169.205059]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
    [  169.205571] RIP: 0033:0x7f67a80e948a
    [  169.206327] Code: 48 8b 0d 11 fa 2a 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 008
    [  169.208296] RSP: 002b:00007ffddf020f58 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
    [  169.209253] RAX: ffffffffffffffda RBX: 000055e2547a6060 RCX: 00007f67a80e948a
    [  169.209777] RDX: 000055e2547a6260 RSI: 000055e2547a62e0 RDI: 000055e2547aeaf0
    [  169.210342] RBP: 0000000000000000 R08: 000055e2547a6280 R09: 0000000000000020
    [  169.210843] R10: 00000000c0ed0000 R11: 0000000000000202 R12: 000055e2547aeaf0
    [  169.211307] R13: 000055e2547a6260 R14: 0000000000000000 R15: 00000000ffffffff
    [  169.211913]  </TASK>
    [  169.212304]
    [  169.212680] Allocated by task 0:
    [  169.212963] (stack is not available)
    [  169.213200]
    [  169.213472] The buggy address belongs to the object at ffff8880094b5e00
    [  169.213472]  which belongs to the cache UDP of size 1152
    [  169.214095] The buggy address is located 1088 bytes inside of
    [  169.214095]  1152-byte region [ffff8880094b5e00, ffff8880094b6280)
    [  169.214639]
    [  169.215004] The buggy address belongs to the physical page:
    [  169.215766] page:000000002e324c8c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x94b4
    [  169.218412] head:000000002e324c8c order:2 compound_mapcount:0 compound_pincount:0
    [  169.219078] flags: 0xfffffc0010200(slab|head|node=0|zone=1|lastcpupid=0x1fffff)
    [  169.220272] raw: 000fffffc0010200 0000000000000000 dead000000000122 ffff888002409b40
    [  169.221006] raw: 0000000000000000 00000000800c000c 00000001ffffffff 0000000000000000
    [  169.222320] page dumped because: kasan: bad access detected
    [  169.222922]
    [  169.223119] Memory state around the buggy address:
    [  169.224056]  ffff8880094b6100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  169.224908]  ffff8880094b6180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  169.225677] >ffff8880094b6200: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  169.226445]                                            ^
    [  169.227055]  ffff8880094b6280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
    [  169.227638]  ffff8880094b6300: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
    
    Signed-off-by: Edward Lo <edward.lo@ambergroup.io>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Cc: "Doebel, Bjoern" <doebel@amazon.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Elden-Ring authored and gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    277439e View commit details
    Browse the repository at this point in the history
  33. Linux 6.1.80

    Link: https://lore.kernel.org/r/20240227131610.391465389@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Tested-by: Allen Pais <apais@linux.microsoft.com>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Kelsey Steele <kelseysteele@linux.microsoft.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Yann Sionneau <ysionneau@kalrayinc.com>
    Tested-by: Conor Dooley <conor.dooley@microchip.com>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: kernelci.org bot <bot@kernelci.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    gregkh committed Mar 1, 2024
    Configuration menu
    Copy the full SHA
    a3eb3a7 View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2024

  1. netfilter: nf_tables: disallow timeout for anonymous sets

    commit e26d300 upstream.
    
    Never used from userspace, disallow these parameters.
    
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ummakynes authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    b7be6c7 View commit details
    Browse the repository at this point in the history
  2. drm/meson: fix unbind path if HDMI fails to bind

    [ Upstream commit 6a04464 ]
    
    If the case the HDMI controller fails to bind, we try to unbind
    all components before calling drm_dev_put() which makes drm_bridge_detach()
    crash because unbinding the HDMI controller frees the bridge memory.
    
    The solution is the unbind all components at the end like in the remove
    path.
    
    Reviewed-by: Nicolas Belin <nbelin@baylibre.com>
    Tested-by: Nicolas Belin <nbelin@baylibre.com>
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230512-amlogic-v6-4-upstream-dsi-ccf-vim3-v5-8-56eb7a4d5b8e@linaro.org
    Stable-dep-of: bd915ae ("drm/meson: Don't remove bridges which are created by other drivers")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    superna9999 authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    ae5f10e View commit details
    Browse the repository at this point in the history
  3. drm/meson: Don't remove bridges which are created by other drivers

    [ Upstream commit bd915ae ]
    
    Stop calling drm_bridge_remove() for bridges allocated/managed by other
    drivers in the remove paths of meson_encoder_{cvbs,dsi,hdmi}.
    drm_bridge_remove() unregisters the bridge so it cannot be used
    anymore. Doing so for bridges we don't own can lead to the video
    pipeline not being able to come up after -EPROBE_DEFER of the VPU
    because we're unregistering a bridge that's managed by another driver.
    The other driver doesn't know that we have unregistered it's bridge
    and on subsequent .probe() we're not able to find those bridges anymore
    (since nobody re-creates them).
    
    This fixes probe errors on Meson8b boards with the CVBS outputs enabled.
    
    Fixes: 0984772 ("drm/meson: remove drm bridges at aggregate driver unbind time")
    Fixes: 42dcf15 ("drm/meson: add DSI encoder")
    Cc:  <stable@vger.kernel.org>
    Reported-by: Steve Morvai <stevemorvai@hotmail.com>
    Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Tested-by: Steve Morvai <stevemorvai@hotmail.com>
    Link: https://lore.kernel.org/r/20240215220442.1343152-1-martin.blumenstingl@googlemail.com
    Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240215220442.1343152-1-martin.blumenstingl@googlemail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    xdarklight authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    7d34b10 View commit details
    Browse the repository at this point in the history
  4. scsi: core: Add struct for args to execution functions

    [ Upstream commit d094956 ]
    
    Move the SCSI execution functions to use a struct for passing in optional
    args. This commit adds the new struct, temporarily converts scsi_execute()
    and scsi_execute_req() ands a new helper, scsi_execute_cmd(), which takes
    the scsi_exec_args struct.
    
    There should be no change in behavior. We no longer allow users to pass in
    any request->rq_flags value, but they were only passing in RQF_PM which we
    do support by allowing users to pass in the BLK_MQ_REQ flags used by
    blk_mq_alloc_request().
    
    Subsequent commits will convert scsi_execute() and scsi_execute_req() users
    to the new helpers then remove scsi_execute() and scsi_execute_req().
    
    Signed-off-by: Mike Christie <michael.christie@oracle.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Reviewed-by: John Garry <john.g.garry@oracle.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Stable-dep-of: 321da3d ("scsi: sd: usb_storage: uas: Access media prior to querying device properties")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    mikechristie authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    cf33e6c View commit details
    Browse the repository at this point in the history
  5. scsi: sd: usb_storage: uas: Access media prior to querying device pro…

    …perties
    
    [ Upstream commit 321da3d ]
    
    It has been observed that some USB/UAS devices return generic properties
    hardcoded in firmware for mode pages for a period of time after a device
    has been discovered. The reported properties are either garbage or they do
    not accurately reflect the characteristics of the physical storage device
    attached in the case of a bridge.
    
    Prior to commit 1e02939 ("scsi: sd: Reorganize DIF/DIX code to
    avoid calling revalidate twice") we would call revalidate several
    times during device discovery. As a result, incorrect values would
    eventually get replaced with ones accurately describing the attached
    storage. When we did away with the redundant revalidate pass, several
    cases were reported where devices reported nonsensical values or would
    end up in write-protected state.
    
    An initial attempt at addressing this issue involved introducing a
    delayed second revalidate invocation. However, this approach still
    left some devices reporting incorrect characteristics.
    
    Tasos Sahanidis debugged the problem further and identified that
    introducing a READ operation prior to MODE SENSE fixed the problem and that
    it wasn't a timing issue. Issuing a READ appears to cause the devices to
    update their state to reflect the actual properties of the storage
    media. Device properties like vendor, model, and storage capacity appear to
    be correctly reported from the get-go. It is unclear why these devices
    defer populating the remaining characteristics.
    
    Match the behavior of a well known commercial operating system and
    trigger a READ operation prior to querying device characteristics to
    force the device to populate the mode pages.
    
    The additional READ is triggered by a flag set in the USB storage and
    UAS drivers. We avoid issuing the READ for other transport classes
    since some storage devices identify Linux through our particular
    discovery command sequence.
    
    Link: https://lore.kernel.org/r/20240213143306.2194237-1-martin.petersen@oracle.com
    Fixes: 1e02939 ("scsi: sd: Reorganize DIF/DIX code to avoid calling revalidate twice")
    Cc: stable@vger.kernel.org
    Reported-by: Tasos Sahanidis <tasos@tasossah.com>
    Reviewed-by: Ewan D. Milne <emilne@redhat.com>
    Reviewed-by: Bart Van Assche <bvanassche@acm.org>
    Tested-by: Tasos Sahanidis <tasos@tasossah.com>
    Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    martinkpetersen authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    b73dd5f View commit details
    Browse the repository at this point in the history
  6. af_unix: Fix task hung while purging oob_skb in GC.

    [ Upstream commit 25236c9 ]
    
    syzbot reported a task hung; at the same time, GC was looping infinitely
    in list_for_each_entry_safe() for OOB skb.  [0]
    
    syzbot demonstrated that the list_for_each_entry_safe() was not actually
    safe in this case.
    
    A single skb could have references for multiple sockets.  If we free such
    a skb in the list_for_each_entry_safe(), the current and next sockets could
    be unlinked in a single iteration.
    
    unix_notinflight() uses list_del_init() to unlink the socket, so the
    prefetched next socket forms a loop itself and list_for_each_entry_safe()
    never stops.
    
    Here, we must use while() and make sure we always fetch the first socket.
    
    [0]:
    Sending NMI from CPU 0 to CPUs 1:
    NMI backtrace for cpu 1
    CPU: 1 PID: 5065 Comm: syz-executor236 Not tainted 6.8.0-rc3-syzkaller-00136-g1f719a2f3fa6 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
    RIP: 0010:preempt_count arch/x86/include/asm/preempt.h:26 [inline]
    RIP: 0010:check_kcov_mode kernel/kcov.c:173 [inline]
    RIP: 0010:__sanitizer_cov_trace_pc+0xd/0x60 kernel/kcov.c:207
    Code: cc cc cc cc 66 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa 65 48 8b 14 25 40 c2 03 00 <65> 8b 05 b4 7c 78 7e a9 00 01 ff 00 48 8b 34 24 74 0f f6 c4 01 74
    RSP: 0018:ffffc900033efa58 EFLAGS: 00000283
    RAX: ffff88807b077800 RBX: ffff88807b077800 RCX: 1ffffffff27b1189
    RDX: ffff88802a5a3b80 RSI: ffffffff8968488d RDI: ffff88807b077f70
    RBP: ffffc900033efbb0 R08: 0000000000000001 R09: fffffbfff27a900c
    R10: ffffffff93d48067 R11: ffffffff8ae000eb R12: ffff88807b077800
    R13: dffffc0000000000 R14: ffff88807b077e40 R15: 0000000000000001
    FS:  0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 0000564f4fc1e3a8 CR3: 000000000d57a000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <NMI>
     </NMI>
     <TASK>
     unix_gc+0x563/0x13b0 net/unix/garbage.c:319
     unix_release_sock+0xa93/0xf80 net/unix/af_unix.c:683
     unix_release+0x91/0xf0 net/unix/af_unix.c:1064
     __sock_release+0xb0/0x270 net/socket.c:659
     sock_close+0x1c/0x30 net/socket.c:1421
     __fput+0x270/0xb80 fs/file_table.c:376
     task_work_run+0x14f/0x250 kernel/task_work.c:180
     exit_task_work include/linux/task_work.h:38 [inline]
     do_exit+0xa8a/0x2ad0 kernel/exit.c:871
     do_group_exit+0xd4/0x2a0 kernel/exit.c:1020
     __do_sys_exit_group kernel/exit.c:1031 [inline]
     __se_sys_exit_group kernel/exit.c:1029 [inline]
     __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1029
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0xd5/0x270 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x6f/0x77
    RIP: 0033:0x7f9d6cbdac09
    Code: Unable to access opcode bytes at 0x7f9d6cbdabdf.
    RSP: 002b:00007fff5952feb8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
    RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9d6cbdac09
    RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000
    RBP: 00007f9d6cc552b0 R08: ffffffffffffffb8 R09: 0000000000000006
    R10: 0000000000000006 R11: 0000000000000246 R12: 00007f9d6cc552b0
    R13: 0000000000000000 R14: 00007f9d6cc55d00 R15: 00007f9d6cbabe70
     </TASK>
    
    Reported-by: syzbot+4fa4a2d1f5a5ee06f006@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=4fa4a2d1f5a5ee06f006
    Fixes: 1279f9d ("af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Link: https://lore.kernel.org/r/20240209220453.96053-1-kuniyu@amazon.com
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    q2ven authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2a3d40b View commit details
    Browse the repository at this point in the history
  7. of: overlay: Reorder struct fragment fields kerneldoc

    [ Upstream commit 5d007ff ]
    
    The fields of the fragment structure were reordered, but the kerneldoc
    was not updated.
    
    Fixes: 81225ea ("of: overlay: reorder fields in struct fragment")
    Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
    Link: https://lore.kernel.org/r/cfa36d2bb95e3c399c415dbf58057302c70ef375.1695893695.git.geert+renesas@glider.be
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    geertu authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    a76072b View commit details
    Browse the repository at this point in the history
  8. net: restore alpha order to Ethernet devices in config

    [ Upstream commit a133153 ]
    
    The filename "wangxun" sorts between "intel" and "xscale", but
    xscale/Kconfig contains "Intel XScale" prompts, so Wangxun ends up in the
    wrong place in the config front-ends.
    
    Move wangxun/Kconfig so the Wangxun devices appear in order in the user
    interface.
    
    Fixes: 3ce7547 ("net: txgbe: Add build support for txgbe")
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Link: https://lore.kernel.org/r/20230307221051.890135-1-helgaas@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    bjorn-helgaas authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    00459ae View commit details
    Browse the repository at this point in the history
  9. mlxsw: spectrum_acl_tcam: Make fini symmetric to init

    [ Upstream commit 61fe3b9 ]
    
    Move mutex_destroy() to the end to make the function symmetric with
    mlxsw_sp_acl_tcam_init(). No functional changes.
    
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: Petr Machata <petrm@nvidia.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    idosch authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    174ac6b View commit details
    Browse the repository at this point in the history
  10. mlxsw: spectrum_acl_tcam: Add missing mutex_destroy()

    [ Upstream commit 65823e0 ]
    
    Pair mutex_init() with a mutex_destroy() in the error path. Found during
    code review. No functional changes.
    
    Signed-off-by: Ido Schimmel <idosch@nvidia.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: Petr Machata <petrm@nvidia.com>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    idosch authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    5dbedec View commit details
    Browse the repository at this point in the history
  11. PCI: layerscape: Add the endpoint linkup notifier support

    [ Upstream commit 061cbfa ]
    
    Layerscape has PME interrupt, which can be used as linkup notifier.  Set
    CFG_READY bit of PEX_PF0_CONFIG to enable accesses from root complex when
    linkup detected.
    
    Link: https://lore.kernel.org/r/20230515151049.2797105-1-Frank.Li@nxp.com
    Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    nxpfrankli authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e30f825 View commit details
    Browse the repository at this point in the history
  12. PCI: layerscape: Add workaround for lost link capabilities during reset

    [ Upstream commit 17cf866 ]
    
    The endpoint controller loses the Maximum Link Width and Supported Link Speed
    value from the Link Capabilities Register - initially configured by the Reset
    Configuration Word (RCW) - during a link-down or hot reset event.
    
    Address this issue in the endpoint event handler.
    
    Link: https://lore.kernel.org/r/20230720135834.1977616-2-Frank.Li@nxp.com
    Fixes: a805770 ("PCI: layerscape: Add EP mode support")
    Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
    Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Acked-by: Manivannan Sadhasivam <mani@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Xiaowei Bao authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    507eeaa View commit details
    Browse the repository at this point in the history
  13. ARM: dts: imx: Adjust dma-apbh node name

    [ Upstream commit e9f5cd8 ]
    
    Currently the dtbs_check generates warnings like this:
    
    $nodename:0: 'dma-apbh@110000' does not match '^dma-controller(@.*)?$'
    
    So fix all affected dma-apbh node names.
    
    Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    lategoodbye authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0cea0c3 View commit details
    Browse the repository at this point in the history
  14. ARM: dts: imx7s: Drop dma-apb interrupt-names

    [ Upstream commit 9928f0a ]
    
    Drop "interrupt-names" property, since it is broken. The drivers/dma/mxs-dma.c
    in Linux kernel does not use it, the property contains duplicate array entries
    in existing DTs, and even malformed entries (gmpi, should have been gpmi). Get
    rid of that optional property altogether.
    
    Signed-off-by: Marek Vasut <marex@denx.de>
    Signed-off-by: Shawn Guo <shawnguo@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Marek Vasut authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    49e7349 View commit details
    Browse the repository at this point in the history
  15. usb: gadget: Properly configure the device for remote wakeup

    [ Upstream commit b93c2a6 ]
    
    The wakeup bit in the bmAttributes field indicates whether the device
    is configured for remote wakeup. But this field should be allowed to
    set only if the UDC supports such wakeup mechanism. So configure this
    field based on UDC capability. Also inform the UDC whether the device
    is configured for remote wakeup by implementing a gadget op.
    
    Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
    Signed-off-by: Elson Roy Serrao <quic_eserrao@quicinc.com>
    Link: https://lore.kernel.org/r/1679694482-16430-2-git-send-email-quic_eserrao@quicinc.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Elson Roy Serrao authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    ed9fdc8 View commit details
    Browse the repository at this point in the history
  16. Input: xpad - add constants for GIP interface numbers

    [ Upstream commit f9b2e60 ]
    
    Wired GIP devices present multiple interfaces with the same USB identification
    other than the interface number. This adds constants for differentiating two of
    them and uses them where appropriate
    
    Signed-off-by: Vicki Pfau <vi@endrift.com>
    Link: https://lore.kernel.org/r/20230411031650.960322-2-vi@endrift.com
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    endrift authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f8faa53 View commit details
    Browse the repository at this point in the history
  17. iommu/sprd: Release dma buffer to avoid memory leak

    [ Upstream commit 9afea57 ]
    
    When attaching to a domain, the driver would alloc a DMA buffer which
    is used to store address mapping table, and it need to be released
    when the IOMMU domain is freed.
    
    Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
    Link: https://lore.kernel.org/r/20230331033124.864691-2-zhang.lyra@gmail.com
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Chunyan Zhang authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8745f35 View commit details
    Browse the repository at this point in the history
  18. iommu/arm-smmu-v3: Acknowledge pri/event queue overflow if any

    [ Upstream commit 67ea0b7 ]
    
    When an overflow occurs in the PRI queue, the SMMU toggles the overflow
    flag in the PROD register. To exit the overflow condition, the PRI thread
    is supposed to acknowledge it by toggling this flag in the CONS register.
    Unacknowledged overflow causes the queue to stop adding anything new.
    
    Currently, the priq thread always writes the CONS register back to the
    SMMU after clearing the queue.
    
    The writeback is not necessary if the OVFLG in the PROD register has not
    been changed, no overflow has occured.
    
    This commit checks the difference of the overflow flag between CONS and
    PROD register. If it's different, toggles the OVACKFLG flag in the CONS
    register and write it to the SMMU.
    
    The situation is similar for the event queue.
    The acknowledge register is also toggled after clearing the event
    queue but never propagated to the hardware. This would only be done the
    next time when executing evtq thread.
    
    Unacknowledged event queue overflow doesn't affect the event
    queue, because the SMMU still adds elements to that queue when the
    overflow condition is active.
    But it feel nicer to keep SMMU in sync when possible, so use the same
    way here as well.
    
    Signed-off-by: Tomas Krcka <krckatom@amazon.de>
    Link: https://lore.kernel.org/r/20230329123420.34641-1-tomas.krcka@gmail.com
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Tomas Krcka authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e89c844 View commit details
    Browse the repository at this point in the history
  19. fs/ntfs3: Fix a possible null-pointer dereference in ni_clear()

    [ Upstream commit ec275bf ]
    
    In a previous commit c1006bd, ni->mi.mrec in ni_write_inode()
    could be NULL, and thus a NULL check is added for this variable.
    
    However, in the same call stack, ni->mi.mrec can be also dereferenced
    in ni_clear():
    
    ntfs_evict_inode(inode)
      ni_write_inode(inode, ...)
        ni = ntfs_i(inode);
        is_rec_inuse(ni->mi.mrec) -> Add a NULL check by previous commit
      ni_clear(ntfs_i(inode))
        is_rec_inuse(ni->mi.mrec) -> No check
    
    Thus, a possible null-pointer dereference may exist in ni_clear().
    To fix it, a NULL check is added in this function.
    
    Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
    Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    XidianGeneral authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    39c6312 View commit details
    Browse the repository at this point in the history
  20. clk: tegra20: fix gcc-7 constant overflow warning

    [ Upstream commit b4a2adb ]
    
    Older gcc versions get confused by comparing a u32 value to a negative
    constant in a switch()/case block:
    
    drivers/clk/tegra/clk-tegra20.c: In function 'tegra20_clk_measure_input_freq':
    drivers/clk/tegra/clk-tegra20.c:581:2: error: case label does not reduce to an integer constant
      case OSC_CTRL_OSC_FREQ_12MHZ:
      ^~~~
    drivers/clk/tegra/clk-tegra20.c:593:2: error: case label does not reduce to an integer constant
      case OSC_CTRL_OSC_FREQ_26MHZ:
    
    Make the constants unsigned instead.
    
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Link: https://lore.kernel.org/r/20230227085914.2560984-1-arnd@kernel.org
    Signed-off-by: Stephen Boyd <sboyd@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    arndb authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    976126f View commit details
    Browse the repository at this point in the history
  21. fs/ntfs3: Add length check in indx_get_root

    [ Upstream commit 08e8cf5 ]
    
    This adds a length check to guarantee the retrieved index root is legit.
    
    [  162.459513] BUG: KASAN: use-after-free in hdr_find_e.isra.0+0x10c/0x320
    [  162.460176] Read of size 2 at addr ffff8880037bca99 by task mount/243
    [  162.460851]
    [  162.461252] CPU: 0 PID: 243 Comm: mount Not tainted 6.0.0-rc7 raspberrypi#42
    [  162.461744] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014
    [  162.462609] Call Trace:
    [  162.462954]  <TASK>
    [  162.463276]  dump_stack_lvl+0x49/0x63
    [  162.463822]  print_report.cold+0xf5/0x689
    [  162.464608]  ? unwind_get_return_address+0x3a/0x60
    [  162.465766]  ? hdr_find_e.isra.0+0x10c/0x320
    [  162.466975]  kasan_report+0xa7/0x130
    [  162.467506]  ? _raw_spin_lock_irq+0xc0/0xf0
    [  162.467998]  ? hdr_find_e.isra.0+0x10c/0x320
    [  162.468536]  __asan_load2+0x68/0x90
    [  162.468923]  hdr_find_e.isra.0+0x10c/0x320
    [  162.469282]  ? cmp_uints+0xe0/0xe0
    [  162.469557]  ? cmp_sdh+0x90/0x90
    [  162.469864]  ? ni_find_attr+0x214/0x300
    [  162.470217]  ? ni_load_mi+0x80/0x80
    [  162.470479]  ? entry_SYSCALL_64_after_hwframe+0x63/0xcd
    [  162.470931]  ? ntfs_bread_run+0x190/0x190
    [  162.471307]  ? indx_get_root+0xe4/0x190
    [  162.471556]  ? indx_get_root+0x140/0x190
    [  162.471833]  ? indx_init+0x1e0/0x1e0
    [  162.472069]  ? fnd_clear+0x115/0x140
    [  162.472363]  ? _raw_spin_lock_irqsave+0x100/0x100
    [  162.472731]  indx_find+0x184/0x470
    [  162.473461]  ? sysvec_apic_timer_interrupt+0x57/0xc0
    [  162.474429]  ? indx_find_buffer+0x2d0/0x2d0
    [  162.474704]  ? do_syscall_64+0x3b/0x90
    [  162.474962]  dir_search_u+0x196/0x2f0
    [  162.475381]  ? ntfs_nls_to_utf16+0x450/0x450
    [  162.475661]  ? ntfs_security_init+0x3d6/0x440
    [  162.475906]  ? is_sd_valid+0x180/0x180
    [  162.476191]  ntfs_extend_init+0x13f/0x2c0
    [  162.476496]  ? ntfs_fix_post_read+0x130/0x130
    [  162.476861]  ? iput.part.0+0x286/0x320
    [  162.477325]  ntfs_fill_super+0x11e0/0x1b50
    [  162.477709]  ? put_ntfs+0x1d0/0x1d0
    [  162.477970]  ? vsprintf+0x20/0x20
    [  162.478258]  ? set_blocksize+0x95/0x150
    [  162.478538]  get_tree_bdev+0x232/0x370
    [  162.478789]  ? put_ntfs+0x1d0/0x1d0
    [  162.479038]  ntfs_fs_get_tree+0x15/0x20
    [  162.479374]  vfs_get_tree+0x4c/0x130
    [  162.479729]  path_mount+0x654/0xfe0
    [  162.480124]  ? putname+0x80/0xa0
    [  162.480484]  ? finish_automount+0x2e0/0x2e0
    [  162.480894]  ? putname+0x80/0xa0
    [  162.481467]  ? kmem_cache_free+0x1c4/0x440
    [  162.482280]  ? putname+0x80/0xa0
    [  162.482714]  do_mount+0xd6/0xf0
    [  162.483264]  ? path_mount+0xfe0/0xfe0
    [  162.484782]  ? __kasan_check_write+0x14/0x20
    [  162.485593]  __x64_sys_mount+0xca/0x110
    [  162.486024]  do_syscall_64+0x3b/0x90
    [  162.486543]  entry_SYSCALL_64_after_hwframe+0x63/0xcd
    [  162.487141] RIP: 0033:0x7f9d374e948a
    [  162.488324] Code: 48 8b 0d 11 fa 2a 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 008
    [  162.489728] RSP: 002b:00007ffe30e73d18 EFLAGS: 00000206 ORIG_RAX: 00000000000000a5
    [  162.490971] RAX: ffffffffffffffda RBX: 0000561cdb43a060 RCX: 00007f9d374e948a
    [  162.491669] RDX: 0000561cdb43a260 RSI: 0000561cdb43a2e0 RDI: 0000561cdb442af0
    [  162.492050] RBP: 0000000000000000 R08: 0000561cdb43a280 R09: 0000000000000020
    [  162.492459] R10: 00000000c0ed0000 R11: 0000000000000206 R12: 0000561cdb442af0
    [  162.493183] R13: 0000561cdb43a260 R14: 0000000000000000 R15: 00000000ffffffff
    [  162.493644]  </TASK>
    [  162.493908]
    [  162.494214] The buggy address belongs to the physical page:
    [  162.494761] page:000000003e38a3d5 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x37bc
    [  162.496064] flags: 0xfffffc0000000(node=0|zone=1|lastcpupid=0x1fffff)
    [  162.497278] raw: 000fffffc0000000 ffffea00000df1c8 ffffea00000df008 0000000000000000
    [  162.498928] raw: 0000000000000000 0000000000240000 00000000ffffffff 0000000000000000
    [  162.500542] page dumped because: kasan: bad access detected
    [  162.501057]
    [  162.501242] Memory state around the buggy address:
    [  162.502230]  ffff8880037bc980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    [  162.502977]  ffff8880037bca00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    [  162.503522] >ffff8880037bca80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    [  162.503963]                             ^
    [  162.504370]  ffff8880037bcb00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    [  162.504766]  ffff8880037bcb80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
    
    Signed-off-by: Edward Lo <edward.lo@ambergroup.io>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Elden-Ring authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0d04e45 View commit details
    Browse the repository at this point in the history
  22. fs/ntfs3: Fix NULL dereference in ni_write_inode

    [ Upstream commit 8dae4f6 ]
    
    Syzbot reports a NULL dereference in ni_write_inode.
    When creating a new inode, if allocation fails in mi_init function
    (called in mi_format_new function), mi->mrec is set to NULL.
    In the error path of this inode creation, mi->mrec is later
    dereferenced in ni_write_inode.
    
    Add a NULL check to prevent NULL dereference.
    
    Link: https://syzkaller.appspot.com/bug?extid=f45957555ed4a808cc7a
    Reported-and-tested-by: syzbot+f45957555ed4a808cc7a@syzkaller.appspotmail.com
    Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    nifey authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    b3152af View commit details
    Browse the repository at this point in the history
  23. fs/ntfs3: Fix NULL pointer dereference in 'ni_write_inode'

    [ Upstream commit db2a3cc ]
    
    Syzbot found the following issue:
    Unable to handle kernel NULL pointer dereference at virtual address 0000000000000016
    Mem abort info:
      ESR = 0x0000000096000006
      EC = 0x25: DABT (current EL), IL = 32 bits
      SET = 0, FnV = 0
      EA = 0, S1PTW = 0
      FSC = 0x06: level 2 translation fault
    Data abort info:
      ISV = 0, ISS = 0x00000006
      CM = 0, WnR = 0
    user pgtable: 4k pages, 48-bit VAs, pgdp=000000010af56000
    [0000000000000016] pgd=08000001090da003, p4d=08000001090da003, pud=08000001090ce003, pmd=0000000000000000
    Internal error: Oops: 0000000096000006 [#1] PREEMPT SMP
    Modules linked in:
    CPU: 1 PID: 3036 Comm: syz-executor206 Not tainted 6.0.0-rc6-syzkaller-17739-g16c9f284e746 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/26/2022
    pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    pc : is_rec_inuse fs/ntfs3/ntfs.h:313 [inline]
    pc : ni_write_inode+0xac/0x798 fs/ntfs3/frecord.c:3232
    lr : ni_write_inode+0xa0/0x798 fs/ntfs3/frecord.c:3226
    sp : ffff8000126c3800
    x29: ffff8000126c3860 x28: 0000000000000000 x27: ffff0000c8b02000
    x26: ffff0000c7502320 x25: ffff0000c7502288 x24: 0000000000000000
    x23: ffff80000cbec91c x22: ffff0000c8b03000 x21: ffff0000c8b02000
    x20: 0000000000000001 x19: ffff0000c75024d8 x18: 00000000000000c0
    x17: ffff80000dd1b198 x16: ffff80000db59158 x15: ffff0000c4b6b500
    x14: 00000000000000b8 x13: 0000000000000000 x12: ffff0000c4b6b500
    x11: ff80800008be1b60 x10: 0000000000000000 x9 : ffff0000c4b6b500
    x8 : 0000000000000000 x7 : ffff800008be1b50 x6 : 0000000000000000
    x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000
    x2 : 0000000000000008 x1 : 0000000000000001 x0 : 0000000000000000
    Call trace:
     is_rec_inuse fs/ntfs3/ntfs.h:313 [inline]
     ni_write_inode+0xac/0x798 fs/ntfs3/frecord.c:3232
     ntfs_evict_inode+0x54/0x84 fs/ntfs3/inode.c:1744
     evict+0xec/0x334 fs/inode.c:665
     iput_final fs/inode.c:1748 [inline]
     iput+0x2c4/0x324 fs/inode.c:1774
     ntfs_new_inode+0x7c/0xe0 fs/ntfs3/fsntfs.c:1660
     ntfs_create_inode+0x20c/0xe78 fs/ntfs3/inode.c:1278
     ntfs_create+0x54/0x74 fs/ntfs3/namei.c:100
     lookup_open fs/namei.c:3413 [inline]
     open_last_lookups fs/namei.c:3481 [inline]
     path_openat+0x804/0x11c4 fs/namei.c:3688
     do_filp_open+0xdc/0x1b8 fs/namei.c:3718
     do_sys_openat2+0xb8/0x22c fs/open.c:1311
     do_sys_open fs/open.c:1327 [inline]
     __do_sys_openat fs/open.c:1343 [inline]
     __se_sys_openat fs/open.c:1338 [inline]
     __arm64_sys_openat+0xb0/0xe0 fs/open.c:1338
     __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
     invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
     el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
     do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
     el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:636
     el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:654
     el0t_64_sync+0x18c/0x190
    Code: 97dafee4 340001b4 f9401328 2a1f03e0 (79402d14)
    ---[ end trace 0000000000000000 ]---
    
    Above issue may happens as follows:
    ntfs_new_inode
      mi_init
        mi->mrec = kmalloc(sbi->record_size, GFP_NOFS); -->failed to allocate memory
          if (!mi->mrec)
            return -ENOMEM;
    iput
      iput_final
        evict
          ntfs_evict_inode
            ni_write_inode
    	  is_rec_inuse(ni->mi.mrec)-> As 'ni->mi.mrec' is NULL trigger NULL-ptr-deref
    
    To solve above issue if new inode failed make inode bad before call 'iput()' in
    'ntfs_new_inode()'.
    
    Reported-by: syzbot+f45957555ed4a808cc7a@syzkaller.appspotmail.com
    Signed-off-by: Ye Bin <yebin10@huawei.com>
    Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Ye Bin authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    329fc4d View commit details
    Browse the repository at this point in the history
  24. iommu/arm-smmu-qcom: Limit the SMR groups to 128

    [ Upstream commit 1226113 ]
    
    Some platforms support more than 128 stream matching groups than what is
    defined by the ARM SMMU architecture specification. But due to some unknown
    reasons, those additional groups don't exhibit the same behavior as the
    architecture supported ones.
    
    For instance, the additional groups will not detect the quirky behavior of
    some firmware versions intercepting writes to S2CR register, thus skipping
    the quirk implemented in the driver and causing boot crash.
    
    So let's limit the groups to 128 for now until the issue with those groups
    are fixed and issue a notice to users in that case.
    
    Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
    Link: https://lore.kernel.org/r/20230327080029.11584-1-manivannan.sadhasivam@linaro.org
    [will: Reworded the comment slightly]
    Signed-off-by: Will Deacon <will@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Mani-Sadhasivam authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e5f4889 View commit details
    Browse the repository at this point in the history
  25. RDMA/core: Fix multiple -Warray-bounds warnings

    [ Upstream commit aa4d540 ]
    
    GCC-13 (and Clang)[1] does not like to access a partially allocated
    object, since it cannot reason about it for bounds checking.
    
    In this case 140 bytes are allocated for an object of type struct
    ib_umad_packet:
    
            packet = kzalloc(sizeof(*packet) + IB_MGMT_RMPP_HDR, GFP_KERNEL);
    
    However, notice that sizeof(*packet) is only 104 bytes:
    
    struct ib_umad_packet {
            struct ib_mad_send_buf *   msg;                  /*     0     8 */
            struct ib_mad_recv_wc *    recv_wc;              /*     8     8 */
            struct list_head           list;                 /*    16    16 */
            int                        length;               /*    32     4 */
    
            /* XXX 4 bytes hole, try to pack */
    
            struct ib_user_mad         mad __attribute__((__aligned__(8))); /*    40    64 */
    
            /* size: 104, cachelines: 2, members: 5 */
            /* sum members: 100, holes: 1, sum holes: 4 */
            /* forced alignments: 1, forced holes: 1, sum forced holes: 4 */
            /* last cacheline: 40 bytes */
    } __attribute__((__aligned__(8)));
    
    and 36 bytes extra bytes are allocated for a flexible-array member in
    struct ib_user_mad:
    
    include/rdma/ib_mad.h:
    120 enum {
    ...
    123         IB_MGMT_RMPP_HDR = 36,
    ... }
    
    struct ib_user_mad {
            struct ib_user_mad_hdr     hdr;                  /*     0    64 */
            /* --- cacheline 1 boundary (64 bytes) --- */
            __u64                      data[] __attribute__((__aligned__(8))); /*    64     0 */
    
            /* size: 64, cachelines: 1, members: 2 */
            /* forced alignments: 1 */
    } __attribute__((__aligned__(8)));
    
    So we have sizeof(*packet) + IB_MGMT_RMPP_HDR == 140 bytes
    
    Then the address of the flex-array member (for which only 36 bytes were
    allocated) is casted and copied into a pointer to struct ib_rmpp_mad,
    which, in turn, is of size 256 bytes:
    
            rmpp_mad = (struct ib_rmpp_mad *) packet->mad.data;
    
    struct ib_rmpp_mad {
            struct ib_mad_hdr          mad_hdr;              /*     0    24 */
            struct ib_rmpp_hdr         rmpp_hdr;             /*    24    12 */
            u8                         data[220];            /*    36   220 */
    
            /* size: 256, cachelines: 4, members: 3 */
    };
    
    The thing is that those 36 bytes allocated for flex-array member data
    in struct ib_user_mad onlly account for the size of both struct ib_mad_hdr
    and struct ib_rmpp_hdr, but nothing is left for array u8 data[220].
    So, the compiler is legitimately complaining about accessing an object
    for which not enough memory was allocated.
    
    Apparently, the only members of struct ib_rmpp_mad that are relevant
    (that are actually being used) in function ib_umad_write() are mad_hdr
    and rmpp_hdr. So, instead of casting packet->mad.data to
    (struct ib_rmpp_mad *) create a new structure
    
    struct ib_rmpp_mad_hdr {
            struct ib_mad_hdr       mad_hdr;
            struct ib_rmpp_hdr      rmpp_hdr;
    } __packed;
    
    and cast packet->mad.data to (struct ib_rmpp_mad_hdr *).
    
    Notice that
    
            IB_MGMT_RMPP_HDR == sizeof(struct ib_rmpp_mad_hdr) == 36 bytes
    
    Refactor the rest of the code, accordingly.
    
    Fix the following warnings seen under GCC-13 and -Warray-bounds:
    drivers/infiniband/core/user_mad.c:564:50: warning: array subscript ‘struct ib_rmpp_mad[0]’ is partly outside array bounds of ‘unsigned char[140]’ [-Warray-bounds=]
    drivers/infiniband/core/user_mad.c:566:42: warning: array subscript ‘struct ib_rmpp_mad[0]’ is partly outside array bounds of ‘unsigned char[140]’ [-Warray-bounds=]
    drivers/infiniband/core/user_mad.c:618:25: warning: array subscript ‘struct ib_rmpp_mad[0]’ is partly outside array bounds of ‘unsigned char[140]’ [-Warray-bounds=]
    drivers/infiniband/core/user_mad.c:622:44: warning: array subscript ‘struct ib_rmpp_mad[0]’ is partly outside array bounds of ‘unsigned char[140]’ [-Warray-bounds=]
    
    Link: KSPP/linux#273
    Link: https://godbolt.org/z/oYWaGM4Yb [1]
    Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
    Link: https://lore.kernel.org/r/ZBpB91qQcB10m3Fw@work
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    GustavoARSilva authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    afbf1a5 View commit details
    Browse the repository at this point in the history
  26. mm: huge_memory: don't force huge page alignment on 32 bit

    commit 4ef9ad1 upstream.
    
    commit efa7df3 ("mm: align larger anonymous mappings on THP
    boundaries") caused two issues [1] [2] reported on 32 bit system or compat
    userspace.
    
    It doesn't make too much sense to force huge page alignment on 32 bit
    system due to the constrained virtual address space.
    
    [1] https://lore.kernel.org/linux-mm/d0a136a0-4a31-46bc-adf4-2db109a61672@kernel.org/
    [2] https://lore.kernel.org/linux-mm/CAJuCfpHXLdQy1a2B6xN2d7quTYwg2OoZseYPZTRpU0eHHKD-sQ@mail.gmail.com/
    
    Link: https://lkml.kernel.org/r/20240118180505.2914778-1-shy828301@gmail.com
    Fixes: efa7df3 ("mm: align larger anonymous mappings on THP boundaries")
    Signed-off-by: Yang Shi <yang@os.amperecomputing.com>
    Reported-by: Jiri Slaby <jirislaby@kernel.org>
    Reported-by: Suren Baghdasaryan <surenb@google.com>
    Tested-by: Jiri Slaby <jirislaby@kernel.org>
    Tested-by: Suren Baghdasaryan <surenb@google.com>
    Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
    Cc: Rik van Riel <riel@surriel.com>
    Cc: Christopher Lameter <cl@linux.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Yang Shi authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    87632bc View commit details
    Browse the repository at this point in the history
  27. mtd: spinand: gigadevice: Fix the get ecc status issue

    [ Upstream commit 5995061 ]
    
    Some GigaDevice ecc_get_status functions use on-stack buffer for
    spi_mem_op causes spi_mem_check_op failing, fix the issue by using
    spinand scratchbuf.
    
    Fixes: c40c7a9 ("mtd: spinand: Add support for GigaDevice GD5F1GQ4UExxG")
    Signed-off-by: Han Xu <han.xu@nxp.com>
    Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
    Link: https://lore.kernel.org/linux-mtd/20231108150701.593912-1-han.xu@nxp.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    hanxu-nxp authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    65a389e View commit details
    Browse the repository at this point in the history
  28. netlink: Fix kernel-infoleak-after-free in __skb_datagram_iter

    [ Upstream commit 661779e ]
    
    syzbot reported the following uninit-value access issue [1]:
    
    netlink_to_full_skb() creates a new `skb` and puts the `skb->data`
    passed as a 1st arg of netlink_to_full_skb() onto new `skb`. The data
    size is specified as `len` and passed to skb_put_data(). This `len`
    is based on `skb->end` that is not data offset but buffer offset. The
    `skb->end` contains data and tailroom. Since the tailroom is not
    initialized when the new `skb` created, KMSAN detects uninitialized
    memory area when copying the data.
    
    This patch resolved this issue by correct the len from `skb->end` to
    `skb->len`, which is the actual data offset.
    
    BUG: KMSAN: kernel-infoleak-after-free in instrument_copy_to_user include/linux/instrumented.h:114 [inline]
    BUG: KMSAN: kernel-infoleak-after-free in copy_to_user_iter lib/iov_iter.c:24 [inline]
    BUG: KMSAN: kernel-infoleak-after-free in iterate_ubuf include/linux/iov_iter.h:29 [inline]
    BUG: KMSAN: kernel-infoleak-after-free in iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
    BUG: KMSAN: kernel-infoleak-after-free in iterate_and_advance include/linux/iov_iter.h:271 [inline]
    BUG: KMSAN: kernel-infoleak-after-free in _copy_to_iter+0x364/0x2520 lib/iov_iter.c:186
     instrument_copy_to_user include/linux/instrumented.h:114 [inline]
     copy_to_user_iter lib/iov_iter.c:24 [inline]
     iterate_ubuf include/linux/iov_iter.h:29 [inline]
     iterate_and_advance2 include/linux/iov_iter.h:245 [inline]
     iterate_and_advance include/linux/iov_iter.h:271 [inline]
     _copy_to_iter+0x364/0x2520 lib/iov_iter.c:186
     copy_to_iter include/linux/uio.h:197 [inline]
     simple_copy_to_iter+0x68/0xa0 net/core/datagram.c:532
     __skb_datagram_iter+0x123/0xdc0 net/core/datagram.c:420
     skb_copy_datagram_iter+0x5c/0x200 net/core/datagram.c:546
     skb_copy_datagram_msg include/linux/skbuff.h:3960 [inline]
     packet_recvmsg+0xd9c/0x2000 net/packet/af_packet.c:3482
     sock_recvmsg_nosec net/socket.c:1044 [inline]
     sock_recvmsg net/socket.c:1066 [inline]
     sock_read_iter+0x467/0x580 net/socket.c:1136
     call_read_iter include/linux/fs.h:2014 [inline]
     new_sync_read fs/read_write.c:389 [inline]
     vfs_read+0x8f6/0xe00 fs/read_write.c:470
     ksys_read+0x20f/0x4c0 fs/read_write.c:613
     __do_sys_read fs/read_write.c:623 [inline]
     __se_sys_read fs/read_write.c:621 [inline]
     __x64_sys_read+0x93/0xd0 fs/read_write.c:621
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    Uninit was stored to memory at:
     skb_put_data include/linux/skbuff.h:2622 [inline]
     netlink_to_full_skb net/netlink/af_netlink.c:181 [inline]
     __netlink_deliver_tap_skb net/netlink/af_netlink.c:298 [inline]
     __netlink_deliver_tap+0x5be/0xc90 net/netlink/af_netlink.c:325
     netlink_deliver_tap net/netlink/af_netlink.c:338 [inline]
     netlink_deliver_tap_kernel net/netlink/af_netlink.c:347 [inline]
     netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
     netlink_unicast+0x10f1/0x1250 net/netlink/af_netlink.c:1368
     netlink_sendmsg+0x1238/0x13d0 net/netlink/af_netlink.c:1910
     sock_sendmsg_nosec net/socket.c:730 [inline]
     __sock_sendmsg net/socket.c:745 [inline]
     ____sys_sendmsg+0x9c2/0xd60 net/socket.c:2584
     ___sys_sendmsg+0x28d/0x3c0 net/socket.c:2638
     __sys_sendmsg net/socket.c:2667 [inline]
     __do_sys_sendmsg net/socket.c:2676 [inline]
     __se_sys_sendmsg net/socket.c:2674 [inline]
     __x64_sys_sendmsg+0x307/0x490 net/socket.c:2674
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    Uninit was created at:
     free_pages_prepare mm/page_alloc.c:1087 [inline]
     free_unref_page_prepare+0xb0/0xa40 mm/page_alloc.c:2347
     free_unref_page_list+0xeb/0x1100 mm/page_alloc.c:2533
     release_pages+0x23d3/0x2410 mm/swap.c:1042
     free_pages_and_swap_cache+0xd9/0xf0 mm/swap_state.c:316
     tlb_batch_pages_flush mm/mmu_gather.c:98 [inline]
     tlb_flush_mmu_free mm/mmu_gather.c:293 [inline]
     tlb_flush_mmu+0x6f5/0x980 mm/mmu_gather.c:300
     tlb_finish_mmu+0x101/0x260 mm/mmu_gather.c:392
     exit_mmap+0x49e/0xd30 mm/mmap.c:3321
     __mmput+0x13f/0x530 kernel/fork.c:1349
     mmput+0x8a/0xa0 kernel/fork.c:1371
     exit_mm+0x1b8/0x360 kernel/exit.c:567
     do_exit+0xd57/0x4080 kernel/exit.c:858
     do_group_exit+0x2fd/0x390 kernel/exit.c:1021
     __do_sys_exit_group kernel/exit.c:1032 [inline]
     __se_sys_exit_group kernel/exit.c:1030 [inline]
     __x64_sys_exit_group+0x3c/0x50 kernel/exit.c:1030
     do_syscall_x64 arch/x86/entry/common.c:52 [inline]
     do_syscall_64+0x44/0x110 arch/x86/entry/common.c:83
     entry_SYSCALL_64_after_hwframe+0x63/0x6b
    
    Bytes 3852-3903 of 3904 are uninitialized
    Memory access of size 3904 starts at ffff88812ea1e000
    Data copied to user address 0000000020003280
    
    CPU: 1 PID: 5043 Comm: syz-executor297 Not tainted 6.7.0-rc5-syzkaller-00047-g5bd7ef53ffe5 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
    
    Fixes: 1853c94 ("netlink, mmap: transform mmap skb into full skb on taps")
    Reported-and-tested-by: syzbot+34ad5fab48f7bf510349@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=34ad5fab48f7bf510349 [1]
    Signed-off-by: Ryosuke Yasuoka <ryasuoka@redhat.com>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20240221074053.1794118-1-ryasuoka@redhat.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    YsuOS authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0b27bf4 View commit details
    Browse the repository at this point in the history
  29. netlink: add nla be16/32 types to minlen array

    [ Upstream commit 9a0d188 ]
    
    BUG: KMSAN: uninit-value in nla_validate_range_unsigned lib/nlattr.c:222 [inline]
    BUG: KMSAN: uninit-value in nla_validate_int_range lib/nlattr.c:336 [inline]
    BUG: KMSAN: uninit-value in validate_nla lib/nlattr.c:575 [inline]
    BUG: KMSAN: uninit-value in __nla_validate_parse+0x2e20/0x45c0 lib/nlattr.c:631
     nla_validate_range_unsigned lib/nlattr.c:222 [inline]
     nla_validate_int_range lib/nlattr.c:336 [inline]
     validate_nla lib/nlattr.c:575 [inline]
    ...
    
    The message in question matches this policy:
    
     [NFTA_TARGET_REV]       = NLA_POLICY_MAX(NLA_BE32, 255),
    
    but because NLA_BE32 size in minlen array is 0, the validation
    code will read past the malformed (too small) attribute.
    
    Note: Other attributes, e.g. BITFIELD32, SINT, UINT.. are also missing:
    those likely should be added too.
    
    Reported-by: syzbot+3f497b07aa3baf2fb4d0@syzkaller.appspotmail.com
    Reported-by: xingwei lee <xrivendell7@gmail.com>
    Closes: https://lore.kernel.org/all/CABOYnLzFYHSnvTyS6zGa-udNX55+izqkOt2sB9WDqUcEGW6n8w@mail.gmail.com/raw
    Fixes: ecaf75f ("netlink: introduce bigendian integer types")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Link: https://lore.kernel.org/r/20240221172740.5092-1-fw@strlen.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Florian Westphal authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0ac219c View commit details
    Browse the repository at this point in the history
  30. net: ip_tunnel: prevent perpetual headroom growth

    [ Upstream commit 5ae1e99 ]
    
    syzkaller triggered following kasan splat:
    BUG: KASAN: use-after-free in __skb_flow_dissect+0x19d1/0x7a50 net/core/flow_dissector.c:1170
    Read of size 1 at addr ffff88812fb4000e by task syz-executor183/5191
    [..]
     kasan_report+0xda/0x110 mm/kasan/report.c:588
     __skb_flow_dissect+0x19d1/0x7a50 net/core/flow_dissector.c:1170
     skb_flow_dissect_flow_keys include/linux/skbuff.h:1514 [inline]
     ___skb_get_hash net/core/flow_dissector.c:1791 [inline]
     __skb_get_hash+0xc7/0x540 net/core/flow_dissector.c:1856
     skb_get_hash include/linux/skbuff.h:1556 [inline]
     ip_tunnel_xmit+0x1855/0x33c0 net/ipv4/ip_tunnel.c:748
     ipip_tunnel_xmit+0x3cc/0x4e0 net/ipv4/ipip.c:308
     __netdev_start_xmit include/linux/netdevice.h:4940 [inline]
     netdev_start_xmit include/linux/netdevice.h:4954 [inline]
     xmit_one net/core/dev.c:3548 [inline]
     dev_hard_start_xmit+0x13d/0x6d0 net/core/dev.c:3564
     __dev_queue_xmit+0x7c1/0x3d60 net/core/dev.c:4349
     dev_queue_xmit include/linux/netdevice.h:3134 [inline]
     neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1592
     ...
     ip_finish_output2+0x833/0x2550 net/ipv4/ip_output.c:235
     ip_finish_output+0x31/0x310 net/ipv4/ip_output.c:323
     ..
     iptunnel_xmit+0x5b4/0x9b0 net/ipv4/ip_tunnel_core.c:82
     ip_tunnel_xmit+0x1dbc/0x33c0 net/ipv4/ip_tunnel.c:831
     ipgre_xmit+0x4a1/0x980 net/ipv4/ip_gre.c:665
     __netdev_start_xmit include/linux/netdevice.h:4940 [inline]
     netdev_start_xmit include/linux/netdevice.h:4954 [inline]
     xmit_one net/core/dev.c:3548 [inline]
     dev_hard_start_xmit+0x13d/0x6d0 net/core/dev.c:3564
     ...
    
    The splat occurs because skb->data points past skb->head allocated area.
    This is because neigh layer does:
      __skb_pull(skb, skb_network_offset(skb));
    
    ... but skb_network_offset() returns a negative offset and __skb_pull()
    arg is unsigned.  IOW, we skb->data gets "adjusted" by a huge value.
    
    The negative value is returned because skb->head and skb->data distance is
    more than 64k and skb->network_header (u16) has wrapped around.
    
    The bug is in the ip_tunnel infrastructure, which can cause
    dev->needed_headroom to increment ad infinitum.
    
    The syzkaller reproducer consists of packets getting routed via a gre
    tunnel, and route of gre encapsulated packets pointing at another (ipip)
    tunnel.  The ipip encapsulation finds gre0 as next output device.
    
    This results in the following pattern:
    
    1). First packet is to be sent out via gre0.
    Route lookup found an output device, ipip0.
    
    2).
    ip_tunnel_xmit for gre0 bumps gre0->needed_headroom based on the future
    output device, rt.dev->needed_headroom (ipip0).
    
    3).
    ip output / start_xmit moves skb on to ipip0. which runs the same
    code path again (xmit recursion).
    
    4).
    Routing step for the post-gre0-encap packet finds gre0 as output device
    to use for ipip0 encapsulated packet.
    
    tunl0->needed_headroom is then incremented based on the (already bumped)
    gre0 device headroom.
    
    This repeats for every future packet:
    
    gre0->needed_headroom gets inflated because previous packets' ipip0 step
    incremented rt->dev (gre0) headroom, and ipip0 incremented because gre0
    needed_headroom was increased.
    
    For each subsequent packet, gre/ipip0->needed_headroom grows until
    post-expand-head reallocations result in a skb->head/data distance of
    more than 64k.
    
    Once that happens, skb->network_header (u16) wraps around when
    pskb_expand_head tries to make sure that skb_network_offset() is unchanged
    after the headroom expansion/reallocation.
    
    After this skb_network_offset(skb) returns a different (and negative)
    result post headroom expansion.
    
    The next trip to neigh layer (or anything else that would __skb_pull the
    network header) makes skb->data point to a memory location outside
    skb->head area.
    
    v2: Cap the needed_headroom update to an arbitarily chosen upperlimit to
    prevent perpetual increase instead of dropping the headroom increment
    completely.
    
    Reported-and-tested-by: syzbot+bfde3bef047a81b8fde6@syzkaller.appspotmail.com
    Closes: https://groups.google.com/g/syzkaller-bugs/c/fL9G6GtWskY/m/VKk_PR5FBAAJ
    Fixes: 243aad8 ("ip_gre: include route header_len in max_headroom calculation")
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://lore.kernel.org/r/20240220135606.4939-1-fw@strlen.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Florian Westphal authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    ab63de2 View commit details
    Browse the repository at this point in the history
  31. net: mctp: take ownership of skb in mctp_local_output

    [ Upstream commit 3773d65 ]
    
    Currently, mctp_local_output only takes ownership of skb on success, and
    we may leak an skb if mctp_local_output fails in specific states; the
    skb ownership isn't transferred until the actual output routing occurs.
    
    Instead, make mctp_local_output free the skb on all error paths up to
    the route action, so it always consumes the passed skb.
    
    Fixes: 833ef3b ("mctp: Populate socket implementation")
    Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://lore.kernel.org/r/20240220081053.1439104-1-jk@codeconstruct.com.au
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    jk-ozlabs authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    a3c8fa5 View commit details
    Browse the repository at this point in the history
  32. tun: Fix xdp_rxq_info's queue_index when detaching

    [ Upstream commit 2a770cd ]
    
    When a queue(tfile) is detached, we only update tfile's queue_index,
    but do not update xdp_rxq_info's queue_index. This patch fixes it.
    
    Fixes: 8bf5c4e ("tun: setup xdp_rxq_info")
    Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
    Link: https://lore.kernel.org/r/1708398727-46308-1-git-send-email-wangyunjian@huawei.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    wyjwang authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    29360fd View commit details
    Browse the repository at this point in the history
  33. cpufreq: intel_pstate: fix pstate limits enforcement for adjust_perf …

    …call back
    
    [ Upstream commit f0a0fc1 ]
    
    There is a loophole in pstate limit clamping for the intel_cpufreq CPU
    frequency scaling driver (intel_pstate in passive mode), schedutil CPU
    frequency scaling governor, HWP (HardWare Pstate) control enabled, when
    the adjust_perf call back path is used.
    
    Fix it.
    
    Fixes: a365ab6 cpufreq: intel_pstate: Implement the ->adjust_perf() callback
    Signed-off-by: Doug Smythies <dsmythies@telus.net>
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    DougSmythies authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e85b3c1 View commit details
    Browse the repository at this point in the history
  34. net: veth: clear GRO when clearing XDP even when down

    [ Upstream commit fe9f801 ]
    
    veth sets NETIF_F_GRO automatically when XDP is enabled,
    because both features use the same NAPI machinery.
    
    The logic to clear NETIF_F_GRO sits in veth_disable_xdp() which
    is called both on ndo_stop and when XDP is turned off.
    To avoid the flag from being cleared when the device is brought
    down, the clearing is skipped when IFF_UP is not set.
    Bringing the device down should indeed not modify its features.
    
    Unfortunately, this means that clearing is also skipped when
    XDP is disabled _while_ the device is down. And there's nothing
    on the open path to bring the device features back into sync.
    IOW if user enables XDP, disables it and then brings the device
    up we'll end up with a stray GRO flag set but no NAPI instances.
    
    We don't depend on the GRO flag on the datapath, so the datapath
    won't crash. We will crash (or hang), however, next time features
    are sync'ed (either by user via ethtool or peer changing its config).
    The GRO flag will go away, and veth will try to disable the NAPIs.
    But the open path never created them since XDP was off, the GRO flag
    was a stray. If NAPI was initialized before we'll hang in napi_disable().
    If it never was we'll crash trying to stop uninitialized hrtimer.
    
    Move the GRO flag updates to the XDP enable / disable paths,
    instead of mixing them with the ndo_open / ndo_close paths.
    
    Fixes: d3256ef ("veth: allow enabling NAPI even without XDP")
    Reported-by: Thomas Gleixner <tglx@linutronix.de>
    Reported-by: syzbot+039399a9b96297ddedca@syzkaller.appspotmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    kuba-moo authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    7985d73 View commit details
    Browse the repository at this point in the history
  35. ipv6: fix potential "struct net" leak in inet6_rtm_getaddr()

    [ Upstream commit 10bfd45 ]
    
    It seems that if userspace provides a correct IFA_TARGET_NETNSID value
    but no IFA_ADDRESS and IFA_LOCAL attributes, inet6_rtm_getaddr()
    returns -EINVAL with an elevated "struct net" refcount.
    
    Fixes: 6ecf4c3 ("ipv6: enable IFA_TARGET_NETNSID for RTM_GETADDR")
    Signed-off-by: Eric Dumazet <edumazet@google.com>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: David Ahern <dsahern@kernel.org>
    Reviewed-by: David Ahern <dsahern@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Eric Dumazet authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1b0998f View commit details
    Browse the repository at this point in the history
  36. lan78xx: enable auto speed configuration for LAN7850 if no EEPROM is …

    …detected
    
    [ Upstream commit 0e67899 ]
    
    Same as LAN7800, LAN7850 can be used without EEPROM. If EEPROM is not
    present or not flashed, LAN7850 will fail to sync the speed detected by the PHY
    with the MAC. In case link speed is 100Mbit, it will accidentally work,
    otherwise no data can be transferred.
    
    Better way would be to implement link_up callback, or set auto speed
    configuration unconditionally. But this changes would be more intrusive.
    So, for now, set it only if no EEPROM is found.
    
    Fixes: e69647a ("lan78xx: Set ASD in MAC_CR when EEE is enabled.")
    Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Link: https://lore.kernel.org/r/20240222123839.2816561-1-o.rempel@pengutronix.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    olerem authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c41548f View commit details
    Browse the repository at this point in the history
  37. veth: try harder when allocating queue memory

    [ Upstream commit 1ce7d30 ]
    
    struct veth_rq is pretty large, 832B total without debug
    options enabled. Since commit under Fixes we try to pre-allocate
    enough queues for every possible CPU. Miao Wang reports that
    this may lead to order-5 allocations which will fail in production.
    
    Let the allocation fallback to vmalloc() and try harder.
    These are the same flags we pass to netdev queue allocation.
    
    Reported-and-tested-by: Miao Wang <shankerwangmiao@gmail.com>
    Fixes: 9d3684c ("veth: create by default nr_possible_cpus queues")
    Link: https://lore.kernel.org/all/5F52CAE2-2FB7-4712-95F1-3312FBBFA8DD@gmail.com/
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Reviewed-by: Eric Dumazet <edumazet@google.com>
    Link: https://lore.kernel.org/r/20240223235908.693010-1-kuba@kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    kuba-moo authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    548ab66 View commit details
    Browse the repository at this point in the history
  38. net: usb: dm9601: fix wrong return value in dm9601_mdio_read

    [ Upstream commit c68b2c9 ]
    
    The MII code does not check the return value of mdio_read (among
    others), and therefore no error code should be sent. A previous fix to
    the use of an uninitialized variable propagates negative error codes,
    that might lead to wrong operations by the MII library.
    
    An example of such issues is the use of mii_nway_restart by the dm9601
    driver. The mii_nway_restart function does not check the value returned
    by mdio_read, which in this case might be a negative number which could
    contain the exact bit the function checks (BMCR_ANENABLE = 0x1000).
    
    Return zero in case of error, as it is common practice in users of
    mdio_read to avoid wrong uses of the return value.
    
    Fixes: 8f8abb8 ("net: usb: dm9601: fix uninitialized variable use in dm9601_mdio_read")
    Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Reviewed-by: Peter Korsgaard <peter@korsgaard.com>
    Link: https://lore.kernel.org/r/20240225-dm9601_ret_err-v1-1-02c1d959ea59@gmail.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    javiercarrascocruz authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    d77ab05 View commit details
    Browse the repository at this point in the history
  39. net: lan78xx: fix "softirq work is pending" error

    [ Upstream commit e3d5d70 ]
    
    Disable BH around the call to napi_schedule() to avoid following
    error:
    NOHZ tick-stop error: local softirq work is pending, handler #8!!!
    
    Fixes: ec4c7e1 ("lan78xx: Introduce NAPI polling support")
    Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Link: https://lore.kernel.org/r/20240226110820.2113584-1-o.rempel@pengutronix.de
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    olerem authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1b4223e View commit details
    Browse the repository at this point in the history
  40. uapi: in6: replace temporary label with rfc9486

    [ Upstream commit 6a20086 ]
    
    Not really a fix per se, but IPV6_TLV_IOAM is still tagged as "TEMPORARY
    IANA allocation for IOAM", while RFC 9486 is available for some time
    now. Just update the reference.
    
    Fixes: 9ee11f0 ("ipv6: ioam: Data plane support for Pre-allocated Trace")
    Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Link: https://lore.kernel.org/r/20240226124921.9097-1-justin.iurman@uliege.be
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    IurmanJ authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    aa58972 View commit details
    Browse the repository at this point in the history
  41. stmmac: Clear variable when destroying workqueue

    [ Upstream commit 8af411b ]
    
    Currently when suspending driver and stopping workqueue it is checked whether
    workqueue is not NULL and if so, it is destroyed.
    Function destroy_workqueue() does drain queue and does clear variable, but
    it does not set workqueue variable to NULL. This can cause kernel/module
    panic if code attempts to clear workqueue that was not initialized.
    
    This scenario is possible when resuming suspended driver in stmmac_resume(),
    because there is no handling for failed stmmac_hw_setup(),
    which can fail and return if DMA engine has failed to initialize,
    and workqueue is initialized after DMA engine.
    Should DMA engine fail to initialize, resume will proceed normally,
    but interface won't work and TX queue will eventually timeout,
    causing 'Reset adapter' error.
    This then does destroy workqueue during reset process.
    And since workqueue is initialized after DMA engine and can be skipped,
    it will cause kernel/module panic.
    
    To secure against this possible crash, set workqueue variable to NULL when
    destroying workqueue.
    
    Log/backtrace from crash goes as follows:
    [88.031977]------------[ cut here ]------------
    [88.031985]NETDEV WATCHDOG: eth0 (sxgmac): transmit queue 1 timed out
    [88.032017]WARNING: CPU: 0 PID: 0 at net/sched/sch_generic.c:477 dev_watchdog+0x390/0x398
               <Skipping backtrace for watchdog timeout>
    [88.032251]---[ end trace e70de432e4d5c2c0 ]---
    [88.032282]sxgmac 16d88000.ethernet eth0: Reset adapter.
    [88.036359]------------[ cut here ]------------
    [88.036519]Call trace:
    [88.036523] flush_workqueue+0x3e4/0x430
    [88.036528] drain_workqueue+0xc4/0x160
    [88.036533] destroy_workqueue+0x40/0x270
    [88.036537] stmmac_fpe_stop_wq+0x4c/0x70
    [88.036541] stmmac_release+0x278/0x280
    [88.036546] __dev_close_many+0xcc/0x158
    [88.036551] dev_close_many+0xbc/0x190
    [88.036555] dev_close.part.0+0x70/0xc0
    [88.036560] dev_close+0x24/0x30
    [88.036564] stmmac_service_task+0x110/0x140
    [88.036569] process_one_work+0x1d8/0x4a0
    [88.036573] worker_thread+0x54/0x408
    [88.036578] kthread+0x164/0x170
    [88.036583] ret_from_fork+0x10/0x20
    [88.036588]---[ end trace e70de432e4d5c2c1 ]---
    [88.036597]Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004
    
    Fixes: 5a55861 ("net: stmmac: support FPE link partner hand-shaking procedure")
    Signed-off-by: Jakub Raczynski <j.raczynski@samsung.com>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Jakub Raczynski authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    17ccd97 View commit details
    Browse the repository at this point in the history
  42. Bluetooth: hci_sync: Check the correct flag before starting a scan

    [ Upstream commit 6b3899b ]
    
    There's a very confusing mistake in the code starting a HCI inquiry: We're
    calling hci_dev_test_flag() to test for HCI_INQUIRY, but hci_dev_test_flag()
    checks hdev->dev_flags instead of hdev->flags. HCI_INQUIRY is a bit that's
    set on hdev->flags, not on hdev->dev_flags though.
    
    HCI_INQUIRY equals the integer 7, and in hdev->dev_flags, 7 means
    HCI_BONDABLE, so we were actually checking for HCI_BONDABLE here.
    
    The mistake is only present in the synchronous code for starting an inquiry,
    not in the async one. Also devices are typically bondable while doing an
    inquiry, so that might be the reason why nobody noticed it so far.
    
    Fixes: abfeea4 ("Bluetooth: hci_sync: Convert MGMT_OP_START_DISCOVERY")
    Signed-off-by: Jonas Dreßler <verdre@v0yd.nl>
    Reviewed-by: Simon Horman <horms@kernel.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    jonas2515 authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    cad0789 View commit details
    Browse the repository at this point in the history
  43. Bluetooth: Avoid potential use-after-free in hci_error_reset

    [ Upstream commit 2449007 ]
    
    While handling the HCI_EV_HARDWARE_ERROR event, if the underlying
    BT controller is not responding, the GPIO reset mechanism would
    free the hci_dev and lead to a use-after-free in hci_error_reset.
    
    Here's the call trace observed on a ChromeOS device with Intel AX201:
       queue_work_on+0x3e/0x6c
       __hci_cmd_sync_sk+0x2ee/0x4c0 [bluetooth <HASH:3b4a6>]
       ? init_wait_entry+0x31/0x31
       __hci_cmd_sync+0x16/0x20 [bluetooth <HASH:3b4a 6>]
       hci_error_reset+0x4f/0xa4 [bluetooth <HASH:3b4a 6>]
       process_one_work+0x1d8/0x33f
       worker_thread+0x21b/0x373
       kthread+0x13a/0x152
       ? pr_cont_work+0x54/0x54
       ? kthread_blkcg+0x31/0x31
        ret_from_fork+0x1f/0x30
    
    This patch holds the reference count on the hci_dev while processing
    a HCI_EV_HARDWARE_ERROR event to avoid potential crash.
    
    Fixes: c7741d1 ("Bluetooth: Perform a power cycle when receiving hardware error event")
    Signed-off-by: Ying Hsu <yinghsu@chromium.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Ying Hsu authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    4508568 View commit details
    Browse the repository at this point in the history
  44. Bluetooth: hci_sync: Fix accept_list when attempting to suspend

    [ Upstream commit e5469ad ]
    
    During suspend, only wakeable devices can be in acceptlist, so if the
    device was previously added it needs to be removed otherwise the device
    can end up waking up the system prematurely.
    
    Fixes: 3b42055 ("Bluetooth: hci_sync: Fix attempting to suspend with unfiltered passive scan")
    Signed-off-by: Clancy Shang <clancy.shang@quectel.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Vudentz authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    9264057 View commit details
    Browse the repository at this point in the history
  45. Bluetooth: hci_event: Fix wrongly recorded wakeup BD_ADDR

    [ Upstream commit 61a5ab7 ]
    
    hci_store_wake_reason() wrongly parses event HCI_Connection_Request
    as HCI_Connection_Complete and HCI_Connection_Complete as
    HCI_Connection_Request, so causes recording wakeup BD_ADDR error and
    potential stability issue, fix it by using the correct field.
    
    Fixes: 2f20216 ("Bluetooth: Emit controller suspend and resume events")
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    zijun-hu authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0b056a5 View commit details
    Browse the repository at this point in the history
  46. Bluetooth: hci_event: Fix handling of HCI_EV_IO_CAPA_REQUEST

    [ Upstream commit 7e74aa5 ]
    
    If we received HCI_EV_IO_CAPA_REQUEST while
    HCI_OP_READ_REMOTE_EXT_FEATURES is yet to be responded assume the remote
    does support SSP since otherwise this event shouldn't be generated.
    
    Link: https://lore.kernel.org/linux-bluetooth/CABBYNZ+9UdG1cMZVmdtN3U2aS16AKMCyTARZZyFX7xTEDWcMOw@mail.gmail.com/T/#t
    Fixes: c7f5946 ("Bluetooth: Fix a refcnt underflow problem for hci_conn")
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Vudentz authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    30a5e81 View commit details
    Browse the repository at this point in the history
  47. Bluetooth: Enforce validation on max value of connection interval

    [ Upstream commit e4b0195 ]
    
    Right now Linux BT stack cannot pass test case "GAP/CONN/CPUP/BV-05-C
    'Connection Parameter Update Procedure Invalid Parameters Central
    Responder'" in Bluetooth Test Suite revision GAP.TS.p44. [0]
    
    That was revoled by commit c49a868 ("Bluetooth: validate BLE
    connection interval updates"), but later got reverted due to devices
    like keyboards and mice may require low connection interval.
    
    So only validate the max value connection interval to pass the Test
    Suite, and let devices to request low connection interval if needed.
    
    [0] https://www.bluetooth.org/docman/handlers/DownloadDoc.ashx?doc_id=229869
    
    Fixes: 68d19d7 ("Revert "Bluetooth: validate BLE connection interval updates"")
    Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    khfeng authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2dc94c1 View commit details
    Browse the repository at this point in the history
  48. Bluetooth: qca: Fix wrong event type for patch config command

    [ Upstream commit c0dbc56 ]
    
    Vendor-specific command patch config has HCI_Command_Complete event as
    response, but qca_send_patch_config_cmd() wrongly expects vendor-specific
    event for the command, fixed by using right event type.
    
    Btmon log for the vendor-specific command are shown below:
    < HCI Command: Vendor (0x3f|0x0000) plen 5
            28 01 00 00 00
    > HCI Event: Command Complete (0x0e) plen 5
          Vendor (0x3f|0x0000) ncmd 1
            Status: Success (0x00)
            28
    
    Fixes: 4fac8a7 ("Bluetooth: btqca: sequential validation")
    Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    zijun-hu authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    7b41022 View commit details
    Browse the repository at this point in the history
  49. Bluetooth: hci_qca: mark OF related data as maybe unused

    [ Upstream commit 44fac8a ]
    
    The driver can be compile tested with !CONFIG_OF making certain data
    unused:
    
      drivers/bluetooth/hci_qca.c:1869:37: error: ‘qca_soc_data_wcn6750’
      defined but not used [-Werror=unused-const-variable=]
      drivers/bluetooth/hci_qca.c:1853:37: error: ‘qca_soc_data_wcn3998’
      defined but not used [-Werror=unused-const-variable=]
      drivers/bluetooth/hci_qca.c:1841:37: error: ‘qca_soc_data_wcn3991’
      defined but not used [-Werror=unused-const-variable=]
      drivers/bluetooth/hci_qca.c:1830:37: error: ‘qca_soc_data_wcn3990’
      defined but not used [-Werror=unused-const-variable=]
    
    Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: 7dcd3e0 ("Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    krzk authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    eb7b577 View commit details
    Browse the repository at this point in the history
  50. Bluetooth: hci_qca: Add support for QTI Bluetooth chip wcn6855

    [ Upstream commit 095327f ]
    
    Add regulators, GPIOs and changes required to power on/off wcn6855.
    Add support for firmware download for wcn6855 which is in the
    linux-firmware repository as hpbtfw21.tlv and hpnv21.bin.
    
    Based on the assumption that this is similar to the wcn6750
    
    Tested-on: BTFW.HSP.2.1.0-00538-VER_PATCHZ-1
    
    Signed-off-by: Steev Klimaszewski <steev@kali.org>
    Reviewed-by: Bjorn Andersson <andersson@kernel.org>
    Tested-by: Bjorn Andersson <andersson@kernel.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: 7dcd3e0 ("Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    0x011011110 authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e538366 View commit details
    Browse the repository at this point in the history
  51. Bluetooth: btqca: use le32_to_cpu for ver.soc_id

    [ Upstream commit 8153b73 ]
    
    Use le32_to_cpu for ver.soc_id to fix the following
    sparse warning.
    
    drivers/bluetooth/btqca.c:640:24: sparse: warning: restricted
    __le32 degrades to integer
    
    Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Stable-dep-of: 7dcd3e0 ("Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Min-Hua authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    29059d0 View commit details
    Browse the repository at this point in the history
  52. Bluetooth: btqca: Add WCN3988 support

    [ Upstream commit f904fee ]
    
    Add support for the Bluetooth chip codenamed APACHE which is part of
    WCN3988.
    
    The firmware for this chip has a slightly different naming scheme
    compared to most others. For ROM Version 0x0200 we need to use
    apbtfw10.tlv + apnv10.bin and for ROM version 0x201 apbtfw11.tlv +
    apnv11.bin
    
    Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: 7dcd3e0 ("Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    lweiss-fairphone authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    9409636 View commit details
    Browse the repository at this point in the history
  53. Bluetooth: qca: use switch case for soc type behavior

    [ Upstream commit 691d54d ]
    
    Use switch/case to handle soc type specific behaviour,
    the permit dropping the qca_is_xxx() inline functions
    and make the code clearer and easier to update for new
    SoCs.
    
    Suggested-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Suggested-by: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: 7dcd3e0 ("Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    superna9999 authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    fc47ed3 View commit details
    Browse the repository at this point in the history
  54. Bluetooth: qca: add support for WCN7850

    [ Upstream commit e0c1278 ]
    
    Add support for the WCN7850 Bluetooth chipset.
    
    Tested on the SM8550 QRD platform.
    
    Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Stable-dep-of: 7dcd3e0 ("Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    superna9999 authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    67ffc33 View commit details
    Browse the repository at this point in the history
  55. Bluetooth: hci_qca: Set BDA quirk bit if fwnode exists in DT

    [ Upstream commit 7dcd3e0 ]
    
    BT adapter going into UNCONFIGURED state during BT turn ON when
    devicetree has no local-bd-address node.
    
    Bluetooth will not work out of the box on such devices, to avoid this
    problem, added check to set HCI_QUIRK_USE_BDADDR_PROPERTY based on
    local-bd-address node entry.
    
    When this quirk is not set, the public Bluetooth address read by host
    from controller though HCI Read BD Address command is
    considered as valid.
    
    Fixes: e668eb1 ("Bluetooth: hci_core: Don't stop BT if the BD address missing in dts")
    Signed-off-by: Janaki Ramaiah Thota <quic_janathot@quicinc.com>
    Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Janaki Ramaiah Thota authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    92b8a32 View commit details
    Browse the repository at this point in the history
  56. netfilter: nf_tables: allow NFPROTO_INET in nft_(match/target)_valida…

    …te()
    
    [ Upstream commit 7e0f122 ]
    
    Commit d0009ef ("netfilter: nf_tables: validate NFPROTO_* family") added
    some validation of NFPROTO_* families in the nft_compat module, but it broke
    the ability to use legacy iptables modules in dual-stack nftables.
    
    While with legacy iptables one had to independently manage IPv4 and IPv6
    tables, with nftables it is possible to have dual-stack tables sharing the
    rules. Moreover, it was possible to use rules based on legacy iptables
    match/target modules in dual-stack nftables.
    
    As an example, the program from [2] creates an INET dual-stack family table
    using an xt_bpf based rule, which looks like the following (the actual output
    was generated with a patched nft tool as the current nft tool does not parse
    dual stack tables with legacy match rules, so consider it for illustrative
    purposes only):
    
    table inet testfw {
      chain input {
        type filter hook prerouting priority filter; policy accept;
        bytecode counter packets 0 bytes 0 accept
      }
    }
    
    After d0009ef ("netfilter: nf_tables: validate NFPROTO_* family") we get
    EOPNOTSUPP for the above program.
    
    Fix this by allowing NFPROTO_INET for nft_(match/target)_validate(), but also
    restrict the functions to classic iptables hooks.
    
    Changes in v3:
      * clarify that upstream nft will not display such configuration properly and
        that the output was generated with a patched nft tool
      * remove example program from commit description and link to it instead
      * no code changes otherwise
    
    Changes in v2:
      * restrict nft_(match/target)_validate() to classic iptables hooks
      * rewrite example program to use unmodified libnftnl
    
    Fixes: d0009ef ("netfilter: nf_tables: validate NFPROTO_* family")
    Link: https://lore.kernel.org/all/Zc1PfoWN38UuFJRI@calendula/T/#mc947262582c90fec044c7a3398cc92fac7afea72 [1]
    Link: https://lore.kernel.org/all/20240220145509.53357-1-ignat@cloudflare.com/ [2]
    Reported-by: Jordan Griege <jgriege@cloudflare.com>
    Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ignatk authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    ddf6ee3 View commit details
    Browse the repository at this point in the history
  57. netfilter: let reset rules clean out conntrack entries

    [ Upstream commit 2954fe6 ]
    
    iptables/nftables support responding to tcp packets with tcp resets.
    
    The generated tcp reset packet passes through both output and postrouting
    netfilter hooks, but conntrack will never see them because the generated
    skb has its ->nfct pointer copied over from the packet that triggered the
    reset rule.
    
    If the reset rule is used for established connections, this
    may result in the conntrack entry to be around for a very long
    time (default timeout is 5 days).
    
    One way to avoid this would be to not copy the nf_conn pointer
    so that the rest packet passes through conntrack too.
    
    Problem is that output rules might not have the same conntrack
    zone setup as the prerouting ones, so its possible that the
    reset skb won't find the correct entry.  Generating a template
    entry for the skb seems error prone as well.
    
    Add an explicit "closing" function that switches a confirmed
    conntrack entry to closed state and wire this up for tcp.
    
    If the entry isn't confirmed, no action is needed because
    the conntrack entry will never be committed to the table.
    
    Reported-by: Russel King <linux@armlinux.org.uk>
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Stable-dep-of: 62e7151 ("netfilter: bridge: confirm multicast packets before passing them up the stack")
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Florian Westphal authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    b8afc22 View commit details
    Browse the repository at this point in the history
  58. netfilter: bridge: confirm multicast packets before passing them up t…

    …he stack
    
    [ Upstream commit 62e7151 ]
    
    conntrack nf_confirm logic cannot handle cloned skbs referencing
    the same nf_conn entry, which will happen for multicast (broadcast)
    frames on bridges.
    
     Example:
        macvlan0
           |
          br0
         /  \
      ethX    ethY
    
     ethX (or Y) receives a L2 multicast or broadcast packet containing
     an IP packet, flow is not yet in conntrack table.
    
     1. skb passes through bridge and fake-ip (br_netfilter)Prerouting.
        -> skb->_nfct now references a unconfirmed entry
     2. skb is broad/mcast packet. bridge now passes clones out on each bridge
        interface.
     3. skb gets passed up the stack.
     4. In macvlan case, macvlan driver retains clone(s) of the mcast skb
        and schedules a work queue to send them out on the lower devices.
    
        The clone skb->_nfct is not a copy, it is the same entry as the
        original skb.  The macvlan rx handler then returns RX_HANDLER_PASS.
     5. Normal conntrack hooks (in NF_INET_LOCAL_IN) confirm the orig skb.
    
    The Macvlan broadcast worker and normal confirm path will race.
    
    This race will not happen if step 2 already confirmed a clone. In that
    case later steps perform skb_clone() with skb->_nfct already confirmed (in
    hash table).  This works fine.
    
    But such confirmation won't happen when eb/ip/nftables rules dropped the
    packets before they reached the nf_confirm step in postrouting.
    
    Pablo points out that nf_conntrack_bridge doesn't allow use of stateful
    nat, so we can safely discard the nf_conn entry and let inet call
    conntrack again.
    
    This doesn't work for bridge netfilter: skb could have a nat
    transformation. Also bridge nf prevents re-invocation of inet prerouting
    via 'sabotage_in' hook.
    
    Work around this problem by explicit confirmation of the entry at LOCAL_IN
    time, before upper layer has a chance to clone the unconfirmed entry.
    
    The downside is that this disables NAT and conntrack helpers.
    
    Alternative fix would be to add locking to all code parts that deal with
    unconfirmed packets, but even if that could be done in a sane way this
    opens up other problems, for example:
    
    -m physdev --physdev-out eth0 -j SNAT --snat-to 1.2.3.4
    -m physdev --physdev-out eth1 -j SNAT --snat-to 1.2.3.5
    
    For multicast case, only one of such conflicting mappings will be
    created, conntrack only handles 1:1 NAT mappings.
    
    Users should set create a setup that explicitly marks such traffic
    NOTRACK (conntrack bypass) to avoid this, but we cannot auto-bypass
    them, ruleset might have accept rules for untracked traffic already,
    so user-visible behaviour would change.
    
    Suggested-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Fixes: 1da177e ("Linux-2.6.12-rc2")
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217777
    Signed-off-by: Florian Westphal <fw@strlen.de>
    Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Florian Westphal authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2b1414d View commit details
    Browse the repository at this point in the history
  59. rtnetlink: fix error logic of IFLA_BRIDGE_FLAGS writing back

    [ Upstream commit 743ad09 ]
    
    In the commit d73ef2d ("rtnetlink: let rtnl_bridge_setlink checks
    IFLA_BRIDGE_MODE length"), an adjustment was made to the old loop logic
    in the function `rtnl_bridge_setlink` to enable the loop to also check
    the length of the IFLA_BRIDGE_MODE attribute. However, this adjustment
    removed the `break` statement and led to an error logic of the flags
    writing back at the end of this function.
    
    if (have_flags)
        memcpy(nla_data(attr), &flags, sizeof(flags));
        // attr should point to IFLA_BRIDGE_FLAGS NLA !!!
    
    Before the mentioned commit, the `attr` is granted to be IFLA_BRIDGE_FLAGS.
    However, this is not necessarily true fow now as the updated loop will let
    the attr point to the last NLA, even an invalid NLA which could cause
    overflow writes.
    
    This patch introduces a new variable `br_flag` to save the NLA pointer
    that points to IFLA_BRIDGE_FLAGS and uses it to resolve the mentioned
    error logic.
    
    Fixes: d73ef2d ("rtnetlink: let rtnl_bridge_setlink checks IFLA_BRIDGE_MODE length")
    Signed-off-by: Lin Ma <linma@zju.edu.cn>
    Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
    Link: https://lore.kernel.org/r/20240227121128.608110-1-linma@zju.edu.cn
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    f0rm2l1n authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f2261eb View commit details
    Browse the repository at this point in the history
  60. igb: extend PTP timestamp adjustments to i211

    [ Upstream commit 0bb7b09 ]
    
    The i211 requires the same PTP timestamp adjustments as the i210,
    according to its datasheet. To ensure consistent timestamping across
    different platforms, this change extends the existing adjustments to
    include the i211.
    
    The adjustment result are tested and comparable for i210 and i211 based
    systems.
    
    Fixes: 3f544d2 ("igb: adjust PTP timestamps for Tx/Rx latency")
    Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
    Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
    Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
    Link: https://lore.kernel.org/r/20240227184942.362710-1-anthony.l.nguyen@intel.com
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    olerem authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    a0222b4 View commit details
    Browse the repository at this point in the history
  61. net: hsr: Use correct offset for HSR TLV values in supervisory HSR fr…

    …ames
    
    [ Upstream commit 51dd4ee ]
    
    Current HSR implementation uses following supervisory frame (even for
    HSRv1 the HSR tag is not is not present):
    
    00000000: 01 15 4e 00 01 2d XX YY ZZ 94 77 10 88 fb 00 01
    00000010: 7e 1c 17 06 XX YY ZZ 94 77 10 1e 06 XX YY ZZ 94
    00000020: 77 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00
    00000030: 00 00 00 00 00 00 00 00 00 00 00 00
    
    The current code adds extra two bytes (i.e. sizeof(struct hsr_sup_tlv))
    when offset for skb_pull() is calculated.
    This is wrong, as both 'struct hsrv1_ethhdr_sp' and 'hsrv0_ethhdr_sp'
    already have 'struct hsr_sup_tag' defined in them, so there is no need
    for adding extra two bytes.
    
    This code was working correctly as with no RedBox support, the check for
    HSR_TLV_EOT (0x00) was off by two bytes, which were corresponding to
    zeroed padded bytes for minimal packet size.
    
    Fixes: eafaa88 ("net: hsr: Add support for redbox supervision frames")
    Signed-off-by: Lukasz Majewski <lukma@denx.de>
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Link: https://lore.kernel.org/r/20240228085644.3618044-1-lukma@denx.de
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Lukasz Majewski authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    7d4121b View commit details
    Browse the repository at this point in the history
  62. tls: decrement decrypt_pending if no async completion will be called

    [ Upstream commit f7fa16d ]
    
    With mixed sync/async decryption, or failures of crypto_aead_decrypt,
    we increment decrypt_pending but we never do the corresponding
    decrement since tls_decrypt_done will not be called. In this case, we
    should decrement decrypt_pending immediately to avoid getting stuck.
    
    For example, the prequeue prequeue test gets stuck with mixed
    modes (one async decrypt + one sync decrypt).
    
    Fixes: 94524d8 ("net/tls: Add support for async decryption of tls records")
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Link: https://lore.kernel.org/r/c56d5fc35543891d5319f834f25622360e1bfbec.1709132643.git.sd@queasysnail.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    qsn authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    40f0f32 View commit details
    Browse the repository at this point in the history
  63. tls: fix peeking with sync+async decryption

    [ Upstream commit 6caaf10 ]
    
    If we peek from 2 records with a currently empty rx_list, and the
    first record is decrypted synchronously but the second record is
    decrypted async, the following happens:
      1. decrypt record 1 (sync)
      2. copy from record 1 to the userspace's msg
      3. queue the decrypted record to rx_list for future read(!PEEK)
      4. decrypt record 2 (async)
      5. queue record 2 to rx_list
      6. call process_rx_list to copy data from the 2nd record
    
    We currently pass copied=0 as skip offset to process_rx_list, so we
    end up copying once again from the first record. We should skip over
    the data we've already copied.
    
    Seen with selftest tls.12_aes_gcm.recv_peek_large_buf_mult_recs
    
    Fixes: 692d7b5 ("tls: Fix recvmsg() to be able to peek across multiple records")
    Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
    Link: https://lore.kernel.org/r/1b132d2b2b99296bfde54e8a67672d90d6d16e71.1709132643.git.sd@queasysnail.net
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    qsn authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    08562ca View commit details
    Browse the repository at this point in the history
  64. efi/capsule-loader: fix incorrect allocation size

    [ Upstream commit fccfa64 ]
    
    gcc-14 notices that the allocation with sizeof(void) on 32-bit architectures
    is not enough for a 64-bit phys_addr_t:
    
    drivers/firmware/efi/capsule-loader.c: In function 'efi_capsule_open':
    drivers/firmware/efi/capsule-loader.c:295:24: error: allocation of insufficient size '4' for type 'phys_addr_t' {aka 'long long unsigned int'} with size '8' [-Werror=alloc-size]
      295 |         cap_info->phys = kzalloc(sizeof(void *), GFP_KERNEL);
          |                        ^
    
    Use the correct type instead here.
    
    Fixes: f24c4d4 ("efi/capsule-loader: Reinstate virtual capsule mapping")
    Signed-off-by: Arnd Bergmann <arnd@arndb.de>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    arndb authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    ddc547d View commit details
    Browse the repository at this point in the history
  65. power: supply: bq27xxx-i2c: Do not free non existing IRQ

    [ Upstream commit 2df7014 ]
    
    The bq27xxx i2c-client may not have an IRQ, in which case
    client->irq will be 0. bq27xxx_battery_i2c_probe() already has
    an if (client->irq) check wrapping the request_threaded_irq().
    
    But bq27xxx_battery_i2c_remove() unconditionally calls
    free_irq(client->irq) leading to:
    
    [  190.310742] ------------[ cut here ]------------
    [  190.310843] Trying to free already-free IRQ 0
    [  190.310861] WARNING: CPU: 2 PID: 1304 at kernel/irq/manage.c:1893 free_irq+0x1b8/0x310
    
    Followed by a backtrace when unbinding the driver. Add
    an if (client->irq) to bq27xxx_battery_i2c_remove() mirroring
    probe() to fix this.
    
    Fixes: 444ff00 ("power: supply: bq27xxx: Fix I2C IRQ race on remove")
    Signed-off-by: Hans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20240215155133.70537-1-hdegoede@redhat.com
    Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    jwrdegoede authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    cefe18e View commit details
    Browse the repository at this point in the history
  66. ALSA: Drop leftover snd-rtctimer stuff from Makefile

    [ Upstream commit 4df4971 ]
    
    We forgot to remove the line for snd-rtctimer from Makefile while
    dropping the functionality.  Get rid of the stale line.
    
    Fixes: 34ce71a ("ALSA: timer: remove legacy rtctimer")
    Link: https://lore.kernel.org/r/20240221092156.28695-1-tiwai@suse.de
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    tiwai authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    7f8644b View commit details
    Browse the repository at this point in the history
  67. drm/tegra: Remove existing framebuffer only if we support display

    [ Upstream commit 86bf8cf ]
    
    Tegra DRM doesn't support display on Tegra234 and later, so make sure
    not to remove any existing framebuffers in that case.
    
    v2: - add comments explaining how this situation can come about
        - clear DRIVER_MODESET and DRIVER_ATOMIC feature bits
    
    Fixes: 6848c29 ("drm/aperture: Convert drivers to aperture interfaces")
    Signed-off-by: Thierry Reding <treding@nvidia.com>
    Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
    Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
    Signed-off-by: Robert Foss <rfoss@kernel.org>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240223150333.1401582-1-thierry.reding@gmail.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    thierryreding authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    d36b9a1 View commit details
    Browse the repository at this point in the history
  68. fbcon: always restore the old font data in fbcon_do_set_font()

    [ Upstream commit 00d6a28 ]
    
    Commit a5a9230 (fbdev: fbcon: Properly revert changes when
    vc_resize() failed) started restoring old font data upon failure (of
    vc_resize()). But it performs so only for user fonts. It means that the
    "system"/internal fonts are not restored at all. So in result, the very
    first call to fbcon_do_set_font() performs no restore at all upon
    failing vc_resize().
    
    This can be reproduced by Syzkaller to crash the system on the next
    invocation of font_get(). It's rather hard to hit the allocation failure
    in vc_resize() on the first font_set(), but not impossible. Esp. if
    fault injection is used to aid the execution/failure. It was
    demonstrated by Sirius:
      BUG: unable to handle page fault for address: fffffffffffffff8
      #PF: supervisor read access in kernel mode
      #PF: error_code(0x0000) - not-present page
      PGD cb7b067 P4D cb7b067 PUD cb7d067 PMD 0
      Oops: 0000 [#1] PREEMPT SMP KASAN
      CPU: 1 PID: 8007 Comm: poc Not tainted 6.7.0-g9d1694dc91ce raspberrypi#20
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014
      RIP: 0010:fbcon_get_font+0x229/0x800 drivers/video/fbdev/core/fbcon.c:2286
      Call Trace:
       <TASK>
       con_font_get drivers/tty/vt/vt.c:4558 [inline]
       con_font_op+0x1fc/0xf20 drivers/tty/vt/vt.c:4673
       vt_k_ioctl drivers/tty/vt/vt_ioctl.c:474 [inline]
       vt_ioctl+0x632/0x2ec0 drivers/tty/vt/vt_ioctl.c:752
       tty_ioctl+0x6f8/0x1570 drivers/tty/tty_io.c:2803
       vfs_ioctl fs/ioctl.c:51 [inline]
      ...
    
    So restore the font data in any case, not only for user fonts. Note the
    later 'if' is now protected by 'old_userfont' and not 'old_data' as the
    latter is always set now. (And it is supposed to be non-NULL. Otherwise
    we would see the bug above again.)
    
    Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
    Fixes: a5a9230 ("fbdev: fbcon: Properly revert changes when vc_resize() failed")
    Reported-and-tested-by: Ubisectech Sirius <bugreport@ubisectech.com>
    Cc: Ubisectech Sirius <bugreport@ubisectech.com>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: Helge Deller <deller@gmx.de>
    Cc: linux-fbdev@vger.kernel.org
    Cc: dri-devel@lists.freedesktop.org
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240208114411.14604-1-jirislaby@kernel.org
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Jiri Slaby (SUSE) authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2f91a96 View commit details
    Browse the repository at this point in the history
  69. afs: Fix endless loop in directory parsing

    [ Upstream commit 5f7a076 ]
    
    If a directory has a block with only ".__afsXXXX" files in it (from
    uncompleted silly-rename), these .__afsXXXX files are skipped but without
    advancing the file position in the dir_context.  This leads to
    afs_dir_iterate() repeating the block again and again.
    
    Fix this by making the code that skips the .__afsXXXX file also manually
    advance the file position.
    
    The symptoms are a soft lookup:
    
            watchdog: BUG: soft lockup - CPU#3 stuck for 52s! [check:5737]
            ...
            RIP: 0010:afs_dir_iterate_block+0x39/0x1fd
            ...
             ? watchdog_timer_fn+0x1a6/0x213
            ...
             ? asm_sysvec_apic_timer_interrupt+0x16/0x20
             ? afs_dir_iterate_block+0x39/0x1fd
             afs_dir_iterate+0x10a/0x148
             afs_readdir+0x30/0x4a
             iterate_dir+0x93/0xd3
             __do_sys_getdents64+0x6b/0xd4
    
    This is almost certainly the actual fix for:
    
            https://bugzilla.kernel.org/show_bug.cgi?id=218496
    
    Fixes: 57e9d49 ("afs: Hide silly-rename files from userspace")
    Signed-off-by: David Howells <dhowells@redhat.com>
    Link: https://lore.kernel.org/r/786185.1708694102@warthog.procyon.org.uk
    Reviewed-by: Marc Dionne <marc.dionne@auristor.com>
    cc: Marc Dionne <marc.dionne@auristor.com>
    cc: Markus Suvanto <markus.suvanto@gmail.com>
    cc: linux-afs@lists.infradead.org
    Signed-off-by: Christian Brauner <brauner@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    dhowells authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    058ed71 View commit details
    Browse the repository at this point in the history
  70. riscv: Sparse-Memory/vmemmap out-of-bounds fix

    [ Upstream commit a11dd49 ]
    
    Offset vmemmap so that the first page of vmemmap will be mapped
    to the first page of physical memory in order to ensure that
    vmemmap’s bounds will be respected during
    pfn_to_page()/page_to_pfn() operations.
    The conversion macros will produce correct SV39/48/57 addresses
    for every possible/valid DRAM_BASE inside the physical memory limits.
    
    v2:Address Alex's comments
    
    Suggested-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Dimitris Vlachos <dvlachos@ics.forth.gr>
    Reported-by: Dimitris Vlachos <dvlachos@ics.forth.gr>
    Closes: https://lore.kernel.org/linux-riscv/20240202135030.42265-1-csd4492@csd.uoc.gr
    Fixes: d95f1a5 ("RISC-V: Implement sparsemem")
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Link: https://lore.kernel.org/r/20240229191723.32779-1-dvlachos@ics.forth.gr
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Jvlachos authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8310080 View commit details
    Browse the repository at this point in the history
  71. of: property: fw_devlink: Fix stupid bug in remote-endpoint parsing

    [ Upstream commit 7cb50f6 ]
    
    Introduced a stupid bug in commit 782bfd0 ("of: property: Improve
    finding the supplier of a remote-endpoint property") due to a last minute
    incorrect edit of "index !=0" into "!index". This patch fixes it to be
    "index > 0" to match the comment right next to it.
    
    Reported-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Link: https://lore.kernel.org/lkml/20240223171849.10f9901d@booty/
    Fixes: 782bfd0 ("of: property: Improve finding the supplier of a remote-endpoint property")
    Signed-off-by: Saravana Kannan <saravanak@google.com>
    Reviewed-by: Herve Codina <herve.codina@bootlin.com>
    Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
    Link: https://lore.kernel.org/r/20240224052436.3552333-1-saravanak@google.com
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Saravana Kannan authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8f62622 View commit details
    Browse the repository at this point in the history
  72. tomoyo: fix UAF write bug in tomoyo_write_control()

    commit 2f03fc3 upstream.
    
    Since tomoyo_write_control() updates head->write_buf when write()
    of long lines is requested, we need to fetch head->write_buf after
    head->io_sem is held.  Otherwise, concurrent write() requests can
    cause use-after-free-write and double-free problems.
    
    Reported-by: Sam Sun <samsun1006219@gmail.com>
    Closes: https://lkml.kernel.org/r/CAEkJfYNDspuGxYx5kym8Lvp--D36CMDUErg4rxfWFJuPbbji8g@mail.gmail.com
    Fixes: bd03a3e ("TOMOYO: Add policy namespace support.")
    Cc:  <stable@vger.kernel.org> # Linux 3.1+
    Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Tetsuo Handa authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    3bfe04c View commit details
    Browse the repository at this point in the history
  73. ALSA: firewire-lib: fix to check cycle continuity

    commit 77ce965 upstream.
    
    The local helper function to compare the given pair of cycle count
    evaluates them. If the left value is less than the right value, the
    function returns negative value.
    
    If the safe cycle is less than the current cycle, it is the case of
    cycle lost. However, it is not currently handled properly.
    
    This commit fixes the bug.
    
    Cc: <stable@vger.kernel.org>
    Fixes: 705794c ("ALSA: firewire-lib: check cycle continuity")
    Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
    Link: https://lore.kernel.org/r/20240218033026.72577-1-o-takashi@sakamocchi.jp
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    takaswie authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8cec41a View commit details
    Browse the repository at this point in the history
  74. ALSA: hda/realtek: Enable Mute LED on HP 840 G8 (MB 8AB8)

    commit 1fdf4e8 upstream.
    
    On my EliteBook 840 G8 Notebook PC (ProdId 5S7R6EC#ABD; built 2022 for
    german market) the Mute LED is always on. The mute button itself works
    as expected. alsa-info.sh shows a different subsystem-id 0x8ab9 for
    Realtek ALC285 Codec, thus the existing quirks for HP 840 G8 don't work.
    Therefore, add a new quirk for this type of EliteBook.
    
    Signed-off-by: Hans Peter <flurry123@gmx.ch>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20240219164518.4099-1-flurry123@gmx.ch
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Hans Peter authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    4cbbc2f View commit details
    Browse the repository at this point in the history
  75. ALSA: hda/realtek: fix mute/micmute LED For HP mt440

    commit 67c3d77 upstream.
    
    The HP mt440 Thin Client uses an ALC236 codec and needs the
    ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF quirk to make the mute and
    micmute LEDs work.
    
    There are two variants of the USB-C PD chip on this device. Each uses
    a different BIOS and board ID, hence the two entries.
    
    Signed-off-by: Eniac Zhang <eniac-xw.zhang@hp.com>
    Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@hp.com>
    Cc: <stable@vger.kernel.org>
    Link: https://lore.kernel.org/r/20240220175812.782687-1-alexandru.gagniuc@hp.com
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    eniachp authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    fd3289a View commit details
    Browse the repository at this point in the history
  76. landlock: Fix asymmetric private inodes referring

    commit d9818b3 upstream.
    
    When linking or renaming a file, if only one of the source or
    destination directory is backed by an S_PRIVATE inode, then the related
    set of layer masks would be used as uninitialized by
    is_access_to_paths_allowed().  This would result to indeterministic
    access for one side instead of always being allowed.
    
    This bug could only be triggered with a mounted filesystem containing
    both S_PRIVATE and !S_PRIVATE inodes, which doesn't seem possible.
    
    The collect_domain_accesses() calls return early if
    is_nouser_or_private() returns false, which means that the directory's
    superblock has SB_NOUSER or its inode has S_PRIVATE.  Because rename or
    link actions are only allowed on the same mounted filesystem, the
    superblock is always the same for both source and destination
    directories.  However, it might be possible in theory to have an
    S_PRIVATE parent source inode with an !S_PRIVATE parent destination
    inode, or vice versa.
    
    To make sure this case is not an issue, explicitly initialized both set
    of layer masks to 0, which means to allow all actions on the related
    side.  If at least on side has !S_PRIVATE, then
    collect_domain_accesses() and is_access_to_paths_allowed() check for the
    required access rights.
    
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Christian Brauner <brauner@kernel.org>
    Cc: Günther Noack <gnoack@google.com>
    Cc: Jann Horn <jannh@google.com>
    Cc: Shervin Oloumi <enlightened@chromium.org>
    Cc: stable@vger.kernel.org
    Fixes: b91c3e4 ("landlock: Add support for file reparenting with LANDLOCK_ACCESS_FS_REFER")
    Link: https://lore.kernel.org/r/20240219190345.2928627-1-mic@digikod.net
    Signed-off-by: Mickaël Salaün <mic@digikod.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    l0kod authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    59ed284 View commit details
    Browse the repository at this point in the history
  77. gtp: fix use-after-free and null-ptr-deref in gtp_newlink()

    commit 616d82c upstream.
    
    The gtp_link_ops operations structure for the subsystem must be
    registered after registering the gtp_net_ops pernet operations structure.
    
    Syzkaller hit 'general protection fault in gtp_genl_dump_pdp' bug:
    
    [ 1010.702740] gtp: GTP module unloaded
    [ 1010.715877] general protection fault, probably for non-canonical address 0xdffffc0000000001: 0000 [#1] SMP KASAN NOPTI
    [ 1010.715888] KASAN: null-ptr-deref in range [0x0000000000000008-0x000000000000000f]
    [ 1010.715895] CPU: 1 PID: 128616 Comm: a.out Not tainted 6.8.0-rc6-std-def-alt1 #1
    [ 1010.715899] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.0-alt1 04/01/2014
    [ 1010.715908] RIP: 0010:gtp_newlink+0x4d7/0x9c0 [gtp]
    [ 1010.715915] Code: 80 3c 02 00 0f 85 41 04 00 00 48 8b bb d8 05 00 00 e8 ed f6 ff ff 48 89 c2 48 89 c5 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f 85 4f 04 00 00 4c 89 e2 4c 8b 6d 00 48 b8 00 00 00
    [ 1010.715920] RSP: 0018:ffff888020fbf180 EFLAGS: 00010203
    [ 1010.715929] RAX: dffffc0000000000 RBX: ffff88800399c000 RCX: 0000000000000000
    [ 1010.715933] RDX: 0000000000000001 RSI: ffffffff84805280 RDI: 0000000000000282
    [ 1010.715938] RBP: 000000000000000d R08: 0000000000000001 R09: 0000000000000000
    [ 1010.715942] R10: 0000000000000001 R11: 0000000000000001 R12: ffff88800399cc80
    [ 1010.715947] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000400
    [ 1010.715953] FS:  00007fd1509ab5c0(0000) GS:ffff88805b300000(0000) knlGS:0000000000000000
    [ 1010.715958] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 1010.715962] CR2: 0000000000000000 CR3: 000000001c07a000 CR4: 0000000000750ee0
    [ 1010.715968] PKRU: 55555554
    [ 1010.715972] Call Trace:
    [ 1010.715985]  ? __die_body.cold+0x1a/0x1f
    [ 1010.715995]  ? die_addr+0x43/0x70
    [ 1010.716002]  ? exc_general_protection+0x199/0x2f0
    [ 1010.716016]  ? asm_exc_general_protection+0x1e/0x30
    [ 1010.716026]  ? gtp_newlink+0x4d7/0x9c0 [gtp]
    [ 1010.716034]  ? gtp_net_exit+0x150/0x150 [gtp]
    [ 1010.716042]  __rtnl_newlink+0x1063/0x1700
    [ 1010.716051]  ? rtnl_setlink+0x3c0/0x3c0
    [ 1010.716063]  ? is_bpf_text_address+0xc0/0x1f0
    [ 1010.716070]  ? kernel_text_address.part.0+0xbb/0xd0
    [ 1010.716076]  ? __kernel_text_address+0x56/0xa0
    [ 1010.716084]  ? unwind_get_return_address+0x5a/0xa0
    [ 1010.716091]  ? create_prof_cpu_mask+0x30/0x30
    [ 1010.716098]  ? arch_stack_walk+0x9e/0xf0
    [ 1010.716106]  ? stack_trace_save+0x91/0xd0
    [ 1010.716113]  ? stack_trace_consume_entry+0x170/0x170
    [ 1010.716121]  ? __lock_acquire+0x15c5/0x5380
    [ 1010.716139]  ? mark_held_locks+0x9e/0xe0
    [ 1010.716148]  ? kmem_cache_alloc_trace+0x35f/0x3c0
    [ 1010.716155]  ? __rtnl_newlink+0x1700/0x1700
    [ 1010.716160]  rtnl_newlink+0x69/0xa0
    [ 1010.716166]  rtnetlink_rcv_msg+0x43b/0xc50
    [ 1010.716172]  ? rtnl_fdb_dump+0x9f0/0x9f0
    [ 1010.716179]  ? lock_acquire+0x1fe/0x560
    [ 1010.716188]  ? netlink_deliver_tap+0x12f/0xd50
    [ 1010.716196]  netlink_rcv_skb+0x14d/0x440
    [ 1010.716202]  ? rtnl_fdb_dump+0x9f0/0x9f0
    [ 1010.716208]  ? netlink_ack+0xab0/0xab0
    [ 1010.716213]  ? netlink_deliver_tap+0x202/0xd50
    [ 1010.716220]  ? netlink_deliver_tap+0x218/0xd50
    [ 1010.716226]  ? __virt_addr_valid+0x30b/0x590
    [ 1010.716233]  netlink_unicast+0x54b/0x800
    [ 1010.716240]  ? netlink_attachskb+0x870/0x870
    [ 1010.716248]  ? __check_object_size+0x2de/0x3b0
    [ 1010.716254]  netlink_sendmsg+0x938/0xe40
    [ 1010.716261]  ? netlink_unicast+0x800/0x800
    [ 1010.716269]  ? __import_iovec+0x292/0x510
    [ 1010.716276]  ? netlink_unicast+0x800/0x800
    [ 1010.716284]  __sock_sendmsg+0x159/0x190
    [ 1010.716290]  ____sys_sendmsg+0x712/0x880
    [ 1010.716297]  ? sock_write_iter+0x3d0/0x3d0
    [ 1010.716304]  ? __ia32_sys_recvmmsg+0x270/0x270
    [ 1010.716309]  ? lock_acquire+0x1fe/0x560
    [ 1010.716315]  ? drain_array_locked+0x90/0x90
    [ 1010.716324]  ___sys_sendmsg+0xf8/0x170
    [ 1010.716331]  ? sendmsg_copy_msghdr+0x170/0x170
    [ 1010.716337]  ? lockdep_init_map_type+0x2c7/0x860
    [ 1010.716343]  ? lockdep_hardirqs_on_prepare+0x430/0x430
    [ 1010.716350]  ? debug_mutex_init+0x33/0x70
    [ 1010.716360]  ? percpu_counter_add_batch+0x8b/0x140
    [ 1010.716367]  ? lock_acquire+0x1fe/0x560
    [ 1010.716373]  ? find_held_lock+0x2c/0x110
    [ 1010.716384]  ? __fd_install+0x1b6/0x6f0
    [ 1010.716389]  ? lock_downgrade+0x810/0x810
    [ 1010.716396]  ? __fget_light+0x222/0x290
    [ 1010.716403]  __sys_sendmsg+0xea/0x1b0
    [ 1010.716409]  ? __sys_sendmsg_sock+0x40/0x40
    [ 1010.716419]  ? lockdep_hardirqs_on_prepare+0x2b3/0x430
    [ 1010.716425]  ? syscall_enter_from_user_mode+0x1d/0x60
    [ 1010.716432]  do_syscall_64+0x30/0x40
    [ 1010.716438]  entry_SYSCALL_64_after_hwframe+0x62/0xc7
    [ 1010.716444] RIP: 0033:0x7fd1508cbd49
    [ 1010.716452] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 8b 0d ef 70 0d 00 f7 d8 64 89 01 48
    [ 1010.716456] RSP: 002b:00007fff18872348 EFLAGS: 00000202 ORIG_RAX: 000000000000002e
    [ 1010.716463] RAX: ffffffffffffffda RBX: 000055f72bf0eac0 RCX: 00007fd1508cbd49
    [ 1010.716468] RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000006
    [ 1010.716473] RBP: 00007fff18872360 R08: 00007fff18872360 R09: 00007fff18872360
    [ 1010.716478] R10: 00007fff18872360 R11: 0000000000000202 R12: 000055f72bf0e1b0
    [ 1010.716482] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
    [ 1010.716491] Modules linked in: gtp(+) udp_tunnel ib_core uinput af_packet rfkill qrtr joydev hid_generic usbhid hid kvm_intel iTCO_wdt intel_pmc_bxt iTCO_vendor_support kvm snd_hda_codec_generic ledtrig_audio irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel snd_hda_intel nls_utf8 snd_intel_dspcfg nls_cp866 psmouse aesni_intel vfat crypto_simd fat cryptd glue_helper snd_hda_codec pcspkr snd_hda_core i2c_i801 snd_hwdep i2c_smbus xhci_pci snd_pcm lpc_ich xhci_pci_renesas xhci_hcd qemu_fw_cfg tiny_power_button button sch_fq_codel vboxvideo drm_vram_helper drm_ttm_helper ttm vboxsf vboxguest snd_seq_midi snd_seq_midi_event snd_seq snd_rawmidi snd_seq_device snd_timer snd soundcore msr fuse efi_pstore dm_mod ip_tables x_tables autofs4 virtio_gpu virtio_dma_buf drm_kms_helper cec rc_core drm virtio_rng virtio_scsi rng_core virtio_balloon virtio_blk virtio_net virtio_console net_failover failover ahci libahci libata evdev scsi_mod input_leds serio_raw virtio_pci intel_agp
    [ 1010.716674]  virtio_ring intel_gtt virtio [last unloaded: gtp]
    [ 1010.716693] ---[ end trace 04990a4ce61e174b ]---
    
    Cc: stable@vger.kernel.org
    Signed-off-by: Alexander Ofitserov <oficerovas@altlinux.org>
    Fixes: 459aa66 ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
    Reviewed-by: Jiri Pirko <jiri@nvidia.com>
    Link: https://lore.kernel.org/r/20240228114703.465107-1-oficerovas@altlinux.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Alexander Ofitserov authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    abd32d7 View commit details
    Browse the repository at this point in the history
  78. wifi: nl80211: reject iftype change with mesh ID change

    commit f78c137 upstream.
    
    It's currently possible to change the mesh ID when the
    interface isn't yet in mesh mode, at the same time as
    changing it into mesh mode. This leads to an overwrite
    of data in the wdev->u union for the interface type it
    currently has, causing cfg80211_change_iface() to do
    wrong things when switching.
    
    We could probably allow setting an interface to mesh
    while setting the mesh ID at the same time by doing a
    different order of operations here, but realistically
    there's no userspace that's going to do this, so just
    disallow changes in iftype when setting mesh ID.
    
    Cc: stable@vger.kernel.org
    Fixes: 29cbe68 ("cfg80211/mac80211: add mesh join/leave commands")
    Reported-by: syzbot+dd4779978217b1973180@syzkaller.appspotmail.com
    Signed-off-by: Johannes Berg <johannes.berg@intel.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jmberg-intel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    930e826 View commit details
    Browse the repository at this point in the history
  79. btrfs: fix double free of anonymous device after snapshot creation fa…

    …ilure
    
    commit e2b54ea upstream.
    
    When creating a snapshot we may do a double free of an anonymous device
    in case there's an error committing the transaction. The second free may
    result in freeing an anonymous device number that was allocated by some
    other subsystem in the kernel or another btrfs filesystem.
    
    The steps that lead to this:
    
    1) At ioctl.c:create_snapshot() we allocate an anonymous device number
       and assign it to pending_snapshot->anon_dev;
    
    2) Then we call btrfs_commit_transaction() and end up at
       transaction.c:create_pending_snapshot();
    
    3) There we call btrfs_get_new_fs_root() and pass it the anonymous device
       number stored in pending_snapshot->anon_dev;
    
    4) btrfs_get_new_fs_root() frees that anonymous device number because
       btrfs_lookup_fs_root() returned a root - someone else did a lookup
       of the new root already, which could some task doing backref walking;
    
    5) After that some error happens in the transaction commit path, and at
       ioctl.c:create_snapshot() we jump to the 'fail' label, and after
       that we free again the same anonymous device number, which in the
       meanwhile may have been reallocated somewhere else, because
       pending_snapshot->anon_dev still has the same value as in step 1.
    
    Recently syzbot ran into this and reported the following trace:
    
      ------------[ cut here ]------------
      ida_free called for id=51 which is not allocated.
      WARNING: CPU: 1 PID: 31038 at lib/idr.c:525 ida_free+0x370/0x420 lib/idr.c:525
      Modules linked in:
      CPU: 1 PID: 31038 Comm: syz-executor.2 Not tainted 6.8.0-rc4-syzkaller-00410-gc02197fc9076 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
      RIP: 0010:ida_free+0x370/0x420 lib/idr.c:525
      Code: 10 42 80 3c 28 (...)
      RSP: 0018:ffffc90015a67300 EFLAGS: 00010246
      RAX: be5130472f5dd000 RBX: 0000000000000033 RCX: 0000000000040000
      RDX: ffffc90009a7a000 RSI: 000000000003ffff RDI: 0000000000040000
      RBP: ffffc90015a673f0 R08: ffffffff81577992 R09: 1ffff92002b4cdb4
      R10: dffffc0000000000 R11: fffff52002b4cdb5 R12: 0000000000000246
      R13: dffffc0000000000 R14: ffffffff8e256b80 R15: 0000000000000246
      FS:  00007fca3f4b46c0(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f167a17b978 CR3: 000000001ed26000 CR4: 0000000000350ef0
      Call Trace:
       <TASK>
       btrfs_get_root_ref+0xa48/0xaf0 fs/btrfs/disk-io.c:1346
       create_pending_snapshot+0xff2/0x2bc0 fs/btrfs/transaction.c:1837
       create_pending_snapshots+0x195/0x1d0 fs/btrfs/transaction.c:1931
       btrfs_commit_transaction+0xf1c/0x3740 fs/btrfs/transaction.c:2404
       create_snapshot+0x507/0x880 fs/btrfs/ioctl.c:848
       btrfs_mksubvol+0x5d0/0x750 fs/btrfs/ioctl.c:998
       btrfs_mksnapshot+0xb5/0xf0 fs/btrfs/ioctl.c:1044
       __btrfs_ioctl_snap_create+0x387/0x4b0 fs/btrfs/ioctl.c:1306
       btrfs_ioctl_snap_create_v2+0x1ca/0x400 fs/btrfs/ioctl.c:1393
       btrfs_ioctl+0xa74/0xd40
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:871 [inline]
       __se_sys_ioctl+0xfe/0x170 fs/ioctl.c:857
       do_syscall_64+0xfb/0x240
       entry_SYSCALL_64_after_hwframe+0x6f/0x77
      RIP: 0033:0x7fca3e67dda9
      Code: 28 00 00 00 (...)
      RSP: 002b:00007fca3f4b40c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
      RAX: ffffffffffffffda RBX: 00007fca3e7abf80 RCX: 00007fca3e67dda9
      RDX: 00000000200005c0 RSI: 0000000050009417 RDI: 0000000000000003
      RBP: 00007fca3e6ca47a R08: 0000000000000000 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: 000000000000000b R14: 00007fca3e7abf80 R15: 00007fff6bf95658
       </TASK>
    
    Where we get an explicit message where we attempt to free an anonymous
    device number that is not currently allocated. It happens in a different
    code path from the example below, at btrfs_get_root_ref(), so this change
    may not fix the case triggered by syzbot.
    
    To fix at least the code path from the example above, change
    btrfs_get_root_ref() and its callers to receive a dev_t pointer argument
    for the anonymous device number, so that in case it frees the number, it
    also resets it to 0, so that up in the call chain we don't attempt to do
    the double free.
    
    CC: stable@vger.kernel.org # 5.10+
    Link: https://lore.kernel.org/linux-btrfs/000000000000f673a1061202f630@google.com/
    Fixes: e03ee2f ("btrfs: do not ASSERT() if the newly created subvolume already got read")
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    fdmanana authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c34adc2 View commit details
    Browse the repository at this point in the history
  80. btrfs: dev-replace: properly validate device names

    commit 9845664 upstream.
    
    There's a syzbot report that device name buffers passed to device
    replace are not properly checked for string termination which could lead
    to a read out of bounds in getname_kernel().
    
    Add a helper that validates both source and target device name buffers.
    For devid as the source initialize the buffer to empty string in case
    something tries to read it later.
    
    This was originally analyzed and fixed in a different way by Edward Adam
    Davis (see links).
    
    Link: https://lore.kernel.org/linux-btrfs/000000000000d1a1d1060cc9c5e7@google.com/
    Link: https://lore.kernel.org/linux-btrfs/tencent_44CA0665C9836EF9EEC80CB9E7E206DF5206@qq.com/
    CC: stable@vger.kernel.org # 4.19+
    CC: Edward Adam Davis <eadavis@qq.com>
    Reported-and-tested-by: syzbot+33f23b49ac24f986c9e8@syzkaller.appspotmail.com
    Reviewed-by: Boris Burkov <boris@bur.io>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    kdave authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f590040 View commit details
    Browse the repository at this point in the history
  81. btrfs: send: don't issue unnecessary zero writes for trailing hole

    commit 5897710 upstream.
    
    If we have a sparse file with a trailing hole (from the last extent's end
    to i_size) and then create an extent in the file that ends before the
    file's i_size, then when doing an incremental send we will issue a write
    full of zeroes for the range that starts immediately after the new extent
    ends up to i_size. While this isn't incorrect because the file ends up
    with exactly the same data, it unnecessarily results in using extra space
    at the destination with one or more extents full of zeroes instead of
    having a hole. In same cases this results in using megabytes or even
    gigabytes of unnecessary space.
    
    Example, reproducer:
    
       $ cat test.sh
       #!/bin/bash
    
       DEV=/dev/sdh
       MNT=/mnt/sdh
    
       mkfs.btrfs -f $DEV
       mount $DEV $MNT
    
       # Create 1G sparse file.
       xfs_io -f -c "truncate 1G" $MNT/foobar
    
       # Create base snapshot.
       btrfs subvolume snapshot -r $MNT $MNT/mysnap1
    
       # Create send stream (full send) for the base snapshot.
       btrfs send -f /tmp/1.snap $MNT/mysnap1
    
       # Now write one extent at the beginning of the file and one somewhere
       # in the middle, leaving a gap between the end of this second extent
       # and the file's size.
       xfs_io -c "pwrite -S 0xab 0 128K" \
              -c "pwrite -S 0xcd 512M 128K" \
              $MNT/foobar
    
       # Now create a second snapshot which is going to be used for an
       # incremental send operation.
       btrfs subvolume snapshot -r $MNT $MNT/mysnap2
    
       # Create send stream (incremental send) for the second snapshot.
       btrfs send -p $MNT/mysnap1 -f /tmp/2.snap $MNT/mysnap2
    
       # Now recreate the filesystem by receiving both send streams and
       # verify we get the same content that the original filesystem had
       # and file foobar has only two extents with a size of 128K each.
       umount $MNT
       mkfs.btrfs -f $DEV
       mount $DEV $MNT
    
       btrfs receive -f /tmp/1.snap $MNT
       btrfs receive -f /tmp/2.snap $MNT
    
       echo -e "\nFile fiemap in the second snapshot:"
       # Should have:
       #
       # 128K extent at file range [0, 128K[
       # hole at file range [128K, 512M[
       # 128K extent file range [512M, 512M + 128K[
       # hole at file range [512M + 128K, 1G[
       xfs_io -r -c "fiemap -v" $MNT/mysnap2/foobar
    
       # File should be using 256K of data (two 128K extents).
       echo -e "\nSpace used by the file: $(du -h $MNT/mysnap2/foobar | cut -f 1)"
    
       umount $MNT
    
    Running the test, we can see with fiemap that we get an extent for the
    range [512M, 1G[, while in the source filesystem we have an extent for
    the range [512M, 512M + 128K[ and a hole for the rest of the file (the
    range [512M + 128K, 1G[):
    
       $ ./test.sh
       (...)
       File fiemap in the second snapshot:
       /mnt/sdh/mysnap2/foobar:
        EXT: FILE-OFFSET        BLOCK-RANGE        TOTAL FLAGS
          0: [0..255]:          26624..26879         256   0x0
          1: [256..1048575]:    hole             1048320
          2: [1048576..2097151]: 2156544..3205119 1048576   0x1
    
       Space used by the file: 513M
    
    This happens because once we finish processing an inode, at
    finish_inode_if_needed(), we always issue a hole (write operations full
    of zeros) if there's a gap between the end of the last processed extent
    and the file's size, even if that range is already a hole in the parent
    snapshot. Fix this by issuing the hole only if the range is not already
    a hole.
    
    After this change, running the test above, we get the expected layout:
    
       $ ./test.sh
       (...)
       File fiemap in the second snapshot:
       /mnt/sdh/mysnap2/foobar:
        EXT: FILE-OFFSET        BLOCK-RANGE      TOTAL FLAGS
          0: [0..255]:          26624..26879       256   0x0
          1: [256..1048575]:    hole             1048320
          2: [1048576..1048831]: 26880..27135       256   0x1
          3: [1048832..2097151]: hole             1048320
    
       Space used by the file: 256K
    
    A test case for fstests will follow soon.
    
    CC: stable@vger.kernel.org # 6.1+
    Reported-by: Dorai Ashok S A <dash.btrfs@inix.me>
    Link: https://lore.kernel.org/linux-btrfs/c0bf7818-9c45-46a8-b3d3-513230d0c86e@inix.me/
    Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
    Reviewed-by: Josef Bacik <josef@toxicpanda.com>
    Signed-off-by: Filipe Manana <fdmanana@suse.com>
    Reviewed-by: David Sterba <dsterba@suse.com>
    Signed-off-by: David Sterba <dsterba@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    fdmanana authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    444d708 View commit details
    Browse the repository at this point in the history
  82. Revert "drm/amd/pm: resolve reboot exception for si oland"

    commit 9555580 upstream.
    
    This reverts commit e490d60.
    
    This causes hangs on SI when DC is enabled and errors on driver
    reboot and power off cycles.
    
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3216
    Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2755
    Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    alexdeucher authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2e443ed View commit details
    Browse the repository at this point in the history
  83. drm/buddy: fix range bias

    commit f41900e upstream.
    
    There is a corner case here where start/end is after/before the block
    range we are currently checking. If so we need to be sure that splitting
    the block will eventually give use the block size we need. To do that we
    should adjust the block range to account for the start/end, and only
    continue with the split if the size/alignment will fit the requested
    size. Not doing so can result in leaving split blocks unmerged when it
    eventually fails.
    
    Fixes: afea229 ("drm: improve drm_buddy_alloc function")
    Signed-off-by: Matthew Auld <matthew.auld@intel.com>
    Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
    Cc: Christian König <christian.koenig@amd.com>
    Cc: <stable@vger.kernel.org> # v5.18+
    Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240219121851.25774-4-matthew.auld@intel.com
    Signed-off-by: Christian König <christian.koenig@amd.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    matt-auld authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8dafc06 View commit details
    Browse the repository at this point in the history
  84. dmaengine: fsl-qdma: fix SoC may hang on 16 byte unaligned read

    commit 9d739bc upstream.
    
    There is chip (ls1028a) errata:
    
    The SoC may hang on 16 byte unaligned read transactions by QDMA.
    
    Unaligned read transactions initiated by QDMA may stall in the NOC
    (Network On-Chip), causing a deadlock condition. Stalled transactions will
    trigger completion timeouts in PCIe controller.
    
    Workaround:
    Enable prefetch by setting the source descriptor prefetchable bit
    ( SD[PF] = 1 ).
    
    Implement this workaround.
    
    Cc: stable@vger.kernel.org
    Fixes: b092529 ("dmaengine: fsl-qdma: Add qDMA controller driver for Layerscape SoCs")
    Signed-off-by: Peng Ma <peng.ma@nxp.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20240201215007.439503-1-Frank.Li@nxp.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Peng Ma authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    237ecf1 View commit details
    Browse the repository at this point in the history
  85. crypto: arm64/neonbs - fix out-of-bounds access on short input

    commit 1c0cf6d upstream.
    
    The bit-sliced implementation of AES-CTR operates on blocks of 128
    bytes, and will fall back to the plain NEON version for tail blocks or
    inputs that are shorter than 128 bytes to begin with.
    
    It will call straight into the plain NEON asm helper, which performs all
    memory accesses in granules of 16 bytes (the size of a NEON register).
    For this reason, the associated plain NEON glue code will copy inputs
    shorter than 16 bytes into a temporary buffer, given that this is a rare
    occurrence and it is not worth the effort to work around this in the asm
    code.
    
    The fallback from the bit-sliced NEON version fails to take this into
    account, potentially resulting in out-of-bounds accesses. So clone the
    same workaround, and use a temp buffer for short in/outputs.
    
    Fixes: fc074e1 ("crypto: arm64/aes-neonbs-ctr - fallback to plain NEON for final chunk")
    Cc: <stable@vger.kernel.org>
    Reported-by: syzbot+f1ceaa1a09ab891e1934@syzkaller.appspotmail.com
    Reviewed-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    034e2d7 View commit details
    Browse the repository at this point in the history
  86. dmaengine: ptdma: use consistent DMA masks

    commit df2515a upstream.
    
    The PTDMA driver sets DMA masks in two different places for the same
    device inconsistently. First call is in pt_pci_probe(), where it uses
    48bit mask. The second call is in pt_dmaengine_register(), where it
    uses a 64bit mask. Using 64bit dma mask causes IO_PAGE_FAULT errors
    on DMA transfers between main memory and other devices.
    Without the extra call it works fine. Additionally the second call
    doesn't check the return value so it can silently fail.
    Remove the superfluous dma_set_mask() call and only use 48bit mask.
    
    Cc: stable@vger.kernel.org
    Fixes: b0b4a6b ("dmaengine: ptdma: register PTDMA controller as a DMA resource")
    Reviewed-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
    Signed-off-by: Tadeusz Struk <tstruk@gigaio.com>
    Link: https://lore.kernel.org/r/20240222163053.13842-1-tstruk@gigaio.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    tstruk authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    300111c View commit details
    Browse the repository at this point in the history
  87. dmaengine: fsl-qdma: init irq after reg initialization

    commit 87a3907 upstream.
    
    Initialize the qDMA irqs after the registers are configured so that
    interrupts that may have been pending from a primary kernel don't get
    processed by the irq handler before it is ready to and cause panic with
    the following trace:
    
      Call trace:
       fsl_qdma_queue_handler+0xf8/0x3e8
       __handle_irq_event_percpu+0x78/0x2b0
       handle_irq_event_percpu+0x1c/0x68
       handle_irq_event+0x44/0x78
       handle_fasteoi_irq+0xc8/0x178
       generic_handle_irq+0x24/0x38
       __handle_domain_irq+0x90/0x100
       gic_handle_irq+0x5c/0xb8
       el1_irq+0xb8/0x180
       _raw_spin_unlock_irqrestore+0x14/0x40
       __setup_irq+0x4bc/0x798
       request_threaded_irq+0xd8/0x190
       devm_request_threaded_irq+0x74/0xe8
       fsl_qdma_probe+0x4d4/0xca8
       platform_drv_probe+0x50/0xa0
       really_probe+0xe0/0x3f8
       driver_probe_device+0x64/0x130
       device_driver_attach+0x6c/0x78
       __driver_attach+0xbc/0x158
       bus_for_each_dev+0x5c/0x98
       driver_attach+0x20/0x28
       bus_add_driver+0x158/0x220
       driver_register+0x60/0x110
       __platform_driver_register+0x44/0x50
       fsl_qdma_driver_init+0x18/0x20
       do_one_initcall+0x48/0x258
       kernel_init_freeable+0x1a4/0x23c
       kernel_init+0x10/0xf8
       ret_from_fork+0x10/0x18
    
    Cc: stable@vger.kernel.org
    Fixes: b092529 ("dmaengine: fsl-qdma: Add qDMA controller driver for Layerscape SoCs")
    Signed-off-by: Curtis Klein <curtis.klein@hpe.com>
    Signed-off-by: Yi Zhao <yi.zhao@nxp.com>
    Signed-off-by: Frank Li <Frank.Li@nxp.com>
    Link: https://lore.kernel.org/r/20240201220406.440145-1-Frank.Li@nxp.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    curtistklein authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    474d521 View commit details
    Browse the repository at this point in the history
  88. mmc: mmci: stm32: fix DMA API overlapping mappings warning

    commit 6b1ba3f upstream.
    
    Turning on CONFIG_DMA_API_DEBUG_SG results in the following warning:
    
    DMA-API: mmci-pl18x 48220000.mmc: cacheline tracking EEXIST,
    overlapping mappings aren't supported
    WARNING: CPU: 1 PID: 51 at kernel/dma/debug.c:568
    add_dma_entry+0x234/0x2f4
    Modules linked in:
    CPU: 1 PID: 51 Comm: kworker/1:2 Not tainted 6.1.28 #1
    Hardware name: STMicroelectronics STM32MP257F-EV1 Evaluation Board (DT)
    Workqueue: events_freezable mmc_rescan
    Call trace:
    add_dma_entry+0x234/0x2f4
    debug_dma_map_sg+0x198/0x350
    __dma_map_sg_attrs+0xa0/0x110
    dma_map_sg_attrs+0x10/0x2c
    sdmmc_idma_prep_data+0x80/0xc0
    mmci_prep_data+0x38/0x84
    mmci_start_data+0x108/0x2dc
    mmci_request+0xe4/0x190
    __mmc_start_request+0x68/0x140
    mmc_start_request+0x94/0xc0
    mmc_wait_for_req+0x70/0x100
    mmc_send_tuning+0x108/0x1ac
    sdmmc_execute_tuning+0x14c/0x210
    mmc_execute_tuning+0x48/0xec
    mmc_sd_init_uhs_card.part.0+0x208/0x464
    mmc_sd_init_card+0x318/0x89c
    mmc_attach_sd+0xe4/0x180
    mmc_rescan+0x244/0x320
    
    DMA API debug brings to light leaking dma-mappings as dma_map_sg and
    dma_unmap_sg are not correctly balanced.
    
    If an error occurs in mmci_cmd_irq function, only mmci_dma_error
    function is called and as this API is not managed on stm32 variant,
    dma_unmap_sg is never called in this error path.
    
    Signed-off-by: Christophe Kerello <christophe.kerello@foss.st.com>
    Fixes: 46b723d ("mmc: mmci: add stm32 sdmmc variant")
    Cc: stable@vger.kernel.org
    Link: https://lore.kernel.org/r/20240207143951.938144-1-christophe.kerello@foss.st.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Christophe Kerello authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    70af82b View commit details
    Browse the repository at this point in the history
  89. mmc: core: Fix eMMC initialization with 1-bit bus connection

    commit ff3206d upstream.
    
    Initializing an eMMC that's connected via a 1-bit bus is current failing,
    if the HW (DT) informs that 4-bit bus is supported. In fact this is a
    regression, as we were earlier capable of falling back to 1-bit mode, when
    switching to 4/8-bit bus failed. Therefore, let's restore the behaviour.
    
    Log for Samsung eMMC 5.1 chip connected via 1bit bus (only D0 pin)
    Before patch:
    [134509.044225] mmc0: switch to bus width 4 failed
    [134509.044509] mmc0: new high speed MMC card at address 0001
    [134509.054594] mmcblk0: mmc0:0001 BGUF4R 29.1 GiB
    [134509.281602] mmc0: switch to bus width 4 failed
    [134509.282638] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
    [134509.282657] Buffer I/O error on dev mmcblk0, logical block 0, async page read
    [134509.284598] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
    [134509.284602] Buffer I/O error on dev mmcblk0, logical block 0, async page read
    [134509.284609] ldm_validate_partition_table(): Disk read failed.
    [134509.286495] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
    [134509.286500] Buffer I/O error on dev mmcblk0, logical block 0, async page read
    [134509.288303] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
    [134509.288308] Buffer I/O error on dev mmcblk0, logical block 0, async page read
    [134509.289540] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
    [134509.289544] Buffer I/O error on dev mmcblk0, logical block 0, async page read
    [134509.289553]  mmcblk0: unable to read partition table
    [134509.289728] mmcblk0boot0: mmc0:0001 BGUF4R 31.9 MiB
    [134509.290283] mmcblk0boot1: mmc0:0001 BGUF4R 31.9 MiB
    [134509.294577] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x80700 phys_seg 1 prio class 2
    [134509.295835] I/O error, dev mmcblk0, sector 0 op 0x0:(READ) flags 0x0 phys_seg 1 prio class 2
    [134509.295841] Buffer I/O error on dev mmcblk0, logical block 0, async page read
    
    After patch:
    
    [134551.089613] mmc0: switch to bus width 4 failed
    [134551.090377] mmc0: new high speed MMC card at address 0001
    [134551.102271] mmcblk0: mmc0:0001 BGUF4R 29.1 GiB
    [134551.113365]  mmcblk0: p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11 p12 p13 p14 p15 p16 p17 p18 p19 p20 p21
    [134551.114262] mmcblk0boot0: mmc0:0001 BGUF4R 31.9 MiB
    [134551.114925] mmcblk0boot1: mmc0:0001 BGUF4R 31.9 MiB
    
    Fixes: 577fb13 ("mmc: rework selection of bus speed mode")
    Cc: stable@vger.kernel.org
    Signed-off-by: Ivan Semenov <ivan@semenov.dev>
    Link: https://lore.kernel.org/r/20240206172845.34316-1-ivan@semenov.dev
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ivan Semenov authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    bc9f87a View commit details
    Browse the repository at this point in the history
  90. mmc: sdhci-xenon: add timeout for PHY init complete

    commit 09e2382 upstream.
    
    AC5X spec says PHY init complete bit must be polled until zero.
    We see cases in which timeout can take longer than the standard
    calculation on AC5X, which is expected following the spec comment above.
    According to the spec, we must wait as long as it takes for that bit to
    toggle on AC5X.
    Cap that with 100 delay loops so we won't get stuck forever.
    
    Fixes: 06c8b66 ("mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC")
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Elad Nachman <enachman@marvell.com>
    Link: https://lore.kernel.org/r/20240222191714.1216470-3-enachman@marvell.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    eladnachman authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c65c475 View commit details
    Browse the repository at this point in the history
  91. mmc: sdhci-xenon: fix PHY init clock stability

    commit 8e9f25a upstream.
    
    Each time SD/mmc phy is initialized, at times, in some of
    the attempts, phy fails to completes its initialization
    which results into timeout error. Per the HW spec, it is
    a pre-requisite to ensure a stable SD clock before a phy
    initialization is attempted.
    
    Fixes: 06c8b66 ("mmc: sdhci-xenon: Add support to PHYs of Marvell Xenon SDHC")
    Acked-by: Adrian Hunter <adrian.hunter@intel.com>
    Cc: stable@vger.kernel.org
    Signed-off-by: Elad Nachman <enachman@marvell.com>
    Link: https://lore.kernel.org/r/20240222200930.1277665-1-enachman@marvell.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    eladnachman authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    4974d92 View commit details
    Browse the repository at this point in the history
  92. riscv: add CALLER_ADDRx support

    commit 6803413 upstream.
    
    CALLER_ADDRx returns caller's address at specified level, they are used
    for several tracers. These macros eventually use
    __builtin_return_address(n) to get the caller's address if arch doesn't
    define their own implementation.
    
    In RISC-V, __builtin_return_address(n) only works when n == 0, we need
    to walk the stack frame to get the caller's address at specified level.
    
    data.level started from 'level + 3' due to the call flow of getting
    caller's address in RISC-V implementation. If we don't have additional
    three iteration, the level is corresponding to follows:
    
    callsite -> return_address -> arch_stack_walk -> walk_stackframe
    |           |                 |                  |
    level 3     level 2           level 1            level 0
    
    Fixes: 10626c3 ("riscv/ftrace: Add basic support")
    Cc: stable@vger.kernel.org
    Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
    Signed-off-by: Zong Li <zong.li@sifive.com>
    Link: https://lore.kernel.org/r/20240202015102.26251-1-zong.li@sifive.com
    Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    zongbox authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    76109a2 View commit details
    Browse the repository at this point in the history
  93. efivarfs: Request at most 512 bytes for variable names

    commit f45812c upstream.
    
    Work around a quirk in a few old (2011-ish) UEFI implementations, where
    a call to `GetNextVariableName` with a buffer size larger than 512 bytes
    will always return EFI_INVALID_PARAMETER.
    
    There is some lore around EFI variable names being up to 1024 bytes in
    size, but this has no basis in the UEFI specification, and the upper
    bounds are typically platform specific, and apply to the entire variable
    (name plus payload).
    
    Given that Linux does not permit creating files with names longer than
    NAME_MAX (255) bytes, 512 bytes (== 256 UTF-16 characters) is a
    reasonable limit.
    
    Cc: <stable@vger.kernel.org> # 6.1+
    Signed-off-by: Tim Schumacher <timschumi@gmx.de>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    timschumi authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    249d6ca View commit details
    Browse the repository at this point in the history
  94. pmdomain: qcom: rpmhpd: Fix enabled_corner aggregation

    commit 2a93c6c upstream.
    
    Commit 'e3e56c050ab6 ("soc: qcom: rpmhpd: Make power_on actually enable
    the domain")' aimed to make sure that a power-domain that is being
    enabled without any particular performance-state requested will at least
    turn the rail on, to avoid filling DeviceTree with otherwise unnecessary
    required-opps properties.
    
    But in the event that aggregation happens on a disabled power-domain, with
    an enabled peer without performance-state, both the local and peer
    corner are 0. The peer's enabled_corner is not considered, with the
    result that the underlying (shared) resource is disabled.
    
    One case where this can be observed is when the display stack keeps mmcx
    enabled (but without a particular performance-state vote) in order to
    access registers and sync_state happens in the rpmhpd driver. As mmcx_ao
    is flushed the state of the peer (mmcx) is not considered and mmcx_ao
    ends up turning off "mmcx.lvl" underneath mmcx. This has been observed
    several times, but has been painted over in DeviceTree by adding an
    explicit vote for the lowest non-disabled performance-state.
    
    Fixes: e3e56c0 ("soc: qcom: rpmhpd: Make power_on actually enable the domain")
    Reported-by: Johan Hovold <johan@kernel.org>
    Closes: https://lore.kernel.org/linux-arm-msm/ZdMwZa98L23mu3u6@hovoldconsulting.com/
    Cc:  <stable@vger.kernel.org>
    Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
    Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
    Reviewed-by: Stephen Boyd <swboyd@chromium.org>
    Tested-by: Johan Hovold <johan+linaro@kernel.org>
    Link: https://lore.kernel.org/r/20240226-rpmhpd-enable-corner-fix-v1-1-68c004cec48c@quicinc.com
    Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    quic-bjorande authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    396a412 View commit details
    Browse the repository at this point in the history
  95. x86/e820: Don't reserve SETUP_RNG_SEED in e820

    commit 7fd817c upstream.
    
    SETUP_RNG_SEED in setup_data is supplied by kexec and should
    not be reserved in the e820 map.
    
    Doing so reserves 16 bytes of RAM when booting with kexec.
    (16 bytes because data->len is zeroed by parse_setup_data so only
    sizeof(setup_data) is reserved.)
    
    When kexec is used repeatedly, each boot adds two entries in the
    kexec-provided e820 map as the 16-byte range splits a larger
    range of usable memory. Eventually all of the 128 available entries
    get used up. The next split will result in losing usable memory
    as the new entries cannot be added to the e820 map.
    
    Fixes: 68b8e97 ("x86/setup: Use rng seeds from setup_data")
    Signed-off-by: Jiri Bohac <jbohac@suse.cz>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: <stable@kernel.org>
    Link: https://lore.kernel.org/r/ZbmOjKnARGiaYBd5@dwarf.suse.cz
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jiribohac authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c9fa51d View commit details
    Browse the repository at this point in the history
  96. x86/cpu/intel: Detect TME keyid bits before setting MTRR mask registers

    commit 6890cb1 upstream.
    
    MKTME repurposes the high bit of physical address to key id for encryption
    key and, even though MAXPHYADDR in CPUID[0x80000008] remains the same,
    the valid bits in the MTRR mask register are based on the reduced number
    of physical address bits.
    
    detect_tme() in arch/x86/kernel/cpu/intel.c detects TME and subtracts
    it from the total usable physical bits, but it is called too late.
    Move the call to early_init_intel() so that it is called in setup_arch(),
    before MTRRs are setup.
    
    This fixes boot on TDX-enabled systems, which until now only worked with
    "disable_mtrr_cleanup".  Without the patch, the values written to the
    MTRRs mask registers were 52-bit wide (e.g. 0x000fffff_80000800) and
    the writes failed; with the patch, the values are 46-bit wide, which
    matches the reduced MAXPHYADDR that is shown in /proc/cpuinfo.
    
    Reported-by: Zixi Chen <zixchen@redhat.com>
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc:stable@vger.kernel.org
    Link: https://lore.kernel.org/all/20240131230902.1867092-3-pbonzini%40redhat.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    bonzini authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    65742f4 View commit details
    Browse the repository at this point in the history
  97. mptcp: fix data races on local_id

    commit a7cfe77 upstream.
    
    The local address id is accessed lockless by the NL PM, add
    all the required ONCE annotation. There is a caveat: the local
    id can be initialized late in the subflow life-cycle, and its
    validity is controlled by the local_id_valid flag.
    
    Remove such flag and encode the validity in the local_id field
    itself with negative value before initialization. That allows
    accessing the field consistently with a single read operation.
    
    Fixes: 0ee4261 ("mptcp: implement mptcp_pm_remove_subflow")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Paolo Abeni authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e6e0484 View commit details
    Browse the repository at this point in the history
  98. mptcp: fix data races on remote_id

    commit 967d3c2 upstream.
    
    Similar to the previous patch, address the data race on
    remote_id, adding the suitable ONCE annotations.
    
    Fixes: bedee0b ("mptcp: address lookup improvements")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Paolo Abeni authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e641486 View commit details
    Browse the repository at this point in the history
  99. mptcp: fix duplicate subflow creation

    commit 045e9d8 upstream.
    
    Fullmesh endpoints could end-up unexpectedly generating duplicate
    subflows - same local and remote addresses - when multiple incoming
    ADD_ADDR are processed before the PM creates the subflow for the local
    endpoints.
    
    Address the issue explicitly checking for duplicates at subflow
    creation time.
    
    To avoid a quadratic computational complexity, track the unavailable
    remote address ids in a temporary bitmap and initialize such bitmap
    with the remote ids of all the existing subflows matching the local
    address currently processed.
    
    The above allows additionally replacing the existing code checking
    for duplicate entry in the current set with a simple bit test
    operation.
    
    Fixes: 2843ff6 ("mptcp: remote addresses fullmesh")
    Cc: stable@vger.kernel.org
    Closes: multipath-tcp/mptcp_net-next#435
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Paolo Abeni authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    fbccc5e View commit details
    Browse the repository at this point in the history
  100. mptcp: continue marking the first subflow as UNCONNECTED

    After the 'Fixes' commit mentioned below, which is a partial backport,
    the MPTCP worker was no longer marking the first subflow as "UNCONNECTED"
    when the socket was transitioning to TCP_CLOSE state.
    
    As a result, in v6.1, it was no longer possible to reconnect to the just
    disconnected socket. Continue to do that like before, only for the first
    subflow.
    
    A few refactoring have been done around the 'msk->subflow' in later
    versions, and it looks like this is not needed to do that there, but
    still needed in v6.1. Without that, the 'disconnect' tests from the
    mptcp_connect.sh selftest fail: they repeat the transfer 3 times by
    reconnecting to the server each time.
    
    Fixes: 7857e35 ("mptcp: get rid of msk->subflow")
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    matttbe authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    53e3f2e View commit details
    Browse the repository at this point in the history
  101. mptcp: map v4 address to v6 when destroying subflow

    commit 535d620 upstream.
    
    Address family of server side mismatches with that of client side, like
    in "userspace pm add & remove address" test:
    
        userspace_pm_add_addr $ns1 10.0.2.1 10
        userspace_pm_rm_sf $ns1 "::ffff:10.0.2.1" $SUB_ESTABLISHED
    
    That's because on the server side, the family is set to AF_INET6 and the
    v4 address is mapped in a v6 one.
    
    This patch fixes this issue. In mptcp_pm_nl_subflow_destroy_doit(), before
    checking local address family with remote address family, map an IPv4
    address to an IPv6 address if the pair is a v4-mapped address.
    
    Closes: multipath-tcp/mptcp_net-next#387
    Fixes: 702c2f6 ("mptcp: netlink: allow userspace-driven subflow establishment")
    Cc: stable@vger.kernel.org
    Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-1-162e87e48497@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Geliang Tang authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    fb7be5e View commit details
    Browse the repository at this point in the history
  102. mptcp: push at DSS boundaries

    commit b9cd26f upstream.
    
    when inserting not contiguous data in the subflow write queue,
    the protocol creates a new skb and prevent the TCP stack from
    merging it later with already queued skbs by setting the EOR marker.
    
    Still no push flag is explicitly set at the end of previous GSO
    packet, making the aggregation on the receiver side sub-optimal -
    and packetdrill self-tests less predictable.
    
    Explicitly mark the end of not contiguous DSS with the push flag.
    
    Fixes: 6d0060f ("mptcp: Write MPTCP DSS headers to outgoing data packets")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-4-162e87e48497@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Paolo Abeni authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    84a3c10 View commit details
    Browse the repository at this point in the history
  103. selftests: mptcp: join: add ss mptcp support check

    commit 9480f38 upstream.
    
    Commands 'ss -M' are used in script mptcp_join.sh to display only MPTCP
    sockets. So it must be checked if ss tool supports MPTCP in this script.
    
    Fixes: e274f71 ("selftests: mptcp: add subflow limits test-cases")
    Cc: stable@vger.kernel.org
    Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-7-162e87e48497@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Geliang Tang authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    03ad085 View commit details
    Browse the repository at this point in the history
  104. mptcp: fix snd_wnd initialization for passive socket

    commit adf1bb7 upstream.
    
    Such value should be inherited from the first subflow, but
    passive sockets always used 'rsk_rcv_wnd'.
    
    Fixes: 6f8a612 ("mptcp: keep track of advertised windows right edge")
    Cc: stable@vger.kernel.org
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-5-162e87e48497@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Paolo Abeni authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    a8722ce View commit details
    Browse the repository at this point in the history
  105. mptcp: fix double-free on socket dismantle

    commit 1004868 upstream.
    
    when MPTCP server accepts an incoming connection, it clones its listener
    socket. However, the pointer to 'inet_opt' for the new socket has the same
    value as the original one: as a consequence, on program exit it's possible
    to observe the following splat:
    
      BUG: KASAN: double-free in inet_sock_destruct+0x54f/0x8b0
      Free of addr ffff888485950880 by task swapper/25/0
    
      CPU: 25 PID: 0 Comm: swapper/25 Kdump: loaded Not tainted 6.8.0-rc1+ raspberrypi#609
      Hardware name: Supermicro SYS-6027R-72RF/X9DRH-7TF/7F/iTF/iF, BIOS 3.0  07/26/2013
      Call Trace:
       <IRQ>
       dump_stack_lvl+0x32/0x50
       print_report+0xca/0x620
       kasan_report_invalid_free+0x64/0x90
       __kasan_slab_free+0x1aa/0x1f0
       kfree+0xed/0x2e0
       inet_sock_destruct+0x54f/0x8b0
       __sk_destruct+0x48/0x5b0
       rcu_do_batch+0x34e/0xd90
       rcu_core+0x559/0xac0
       __do_softirq+0x183/0x5a4
       irq_exit_rcu+0x12d/0x170
       sysvec_apic_timer_interrupt+0x6b/0x80
       </IRQ>
       <TASK>
       asm_sysvec_apic_timer_interrupt+0x16/0x20
      RIP: 0010:cpuidle_enter_state+0x175/0x300
      Code: 30 00 0f 84 1f 01 00 00 83 e8 01 83 f8 ff 75 e5 48 83 c4 18 44 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc fb 45 85 ed <0f> 89 60 ff ff ff 48 c1 e5 06 48 c7 43 18 00 00 00 00 48 83 44 2b
      RSP: 0018:ffff888481cf7d90 EFLAGS: 00000202
      RAX: 0000000000000000 RBX: ffff88887facddc8 RCX: 0000000000000000
      RDX: 1ffff1110ff588b1 RSI: 0000000000000019 RDI: ffff88887fac4588
      RBP: 0000000000000004 R08: 0000000000000002 R09: 0000000000043080
      R10: 0009b02ea273363f R11: ffff88887fabf42b R12: ffffffff932592e0
      R13: 0000000000000004 R14: 0000000000000000 R15: 00000022c880ec80
       cpuidle_enter+0x4a/0xa0
       do_idle+0x310/0x410
       cpu_startup_entry+0x51/0x60
       start_secondary+0x211/0x270
       secondary_startup_64_no_verify+0x184/0x18b
       </TASK>
    
      Allocated by task 6853:
       kasan_save_stack+0x1c/0x40
       kasan_save_track+0x10/0x30
       __kasan_kmalloc+0xa6/0xb0
       __kmalloc+0x1eb/0x450
       cipso_v4_sock_setattr+0x96/0x360
       netlbl_sock_setattr+0x132/0x1f0
       selinux_netlbl_socket_post_create+0x6c/0x110
       selinux_socket_post_create+0x37b/0x7f0
       security_socket_post_create+0x63/0xb0
       __sock_create+0x305/0x450
       __sys_socket_create.part.23+0xbd/0x130
       __sys_socket+0x37/0xb0
       __x64_sys_socket+0x6f/0xb0
       do_syscall_64+0x83/0x160
       entry_SYSCALL_64_after_hwframe+0x6e/0x76
    
      Freed by task 6858:
       kasan_save_stack+0x1c/0x40
       kasan_save_track+0x10/0x30
       kasan_save_free_info+0x3b/0x60
       __kasan_slab_free+0x12c/0x1f0
       kfree+0xed/0x2e0
       inet_sock_destruct+0x54f/0x8b0
       __sk_destruct+0x48/0x5b0
       subflow_ulp_release+0x1f0/0x250
       tcp_cleanup_ulp+0x6e/0x110
       tcp_v4_destroy_sock+0x5a/0x3a0
       inet_csk_destroy_sock+0x135/0x390
       tcp_fin+0x416/0x5c0
       tcp_data_queue+0x1bc8/0x4310
       tcp_rcv_state_process+0x15a3/0x47b0
       tcp_v4_do_rcv+0x2c1/0x990
       tcp_v4_rcv+0x41fb/0x5ed0
       ip_protocol_deliver_rcu+0x6d/0x9f0
       ip_local_deliver_finish+0x278/0x360
       ip_local_deliver+0x182/0x2c0
       ip_rcv+0xb5/0x1c0
       __netif_receive_skb_one_core+0x16e/0x1b0
       process_backlog+0x1e3/0x650
       __napi_poll+0xa6/0x500
       net_rx_action+0x740/0xbb0
       __do_softirq+0x183/0x5a4
    
      The buggy address belongs to the object at ffff888485950880
       which belongs to the cache kmalloc-64 of size 64
      The buggy address is located 0 bytes inside of
       64-byte region [ffff888485950880, ffff8884859508c0)
    
      The buggy address belongs to the physical page:
      page:0000000056d1e95e refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888485950700 pfn:0x485950
      flags: 0x57ffffc0000800(slab|node=1|zone=2|lastcpupid=0x1fffff)
      page_type: 0xffffffff()
      raw: 0057ffffc0000800 ffff88810004c640 ffffea00121b8ac0 dead000000000006
      raw: ffff888485950700 0000000000200019 00000001ffffffff 0000000000000000
      page dumped because: kasan: bad access detected
    
      Memory state around the buggy address:
       ffff888485950780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
       ffff888485950800: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
      >ffff888485950880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
                         ^
       ffff888485950900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
       ffff888485950980: 00 00 00 00 00 01 fc fc fc fc fc fc fc fc fc fc
    
    Something similar (a refcount underflow) happens with CALIPSO/IPv6. Fix
    this by duplicating IP / IPv6 options after clone, so that
    ip{,6}_sock_destruct() doesn't end up freeing the same memory area twice.
    
    Fixes: cf7da0d ("mptcp: Create SUBFLOW socket for incoming connections")
    Cc: stable@vger.kernel.org
    Signed-off-by: Davide Caratti <dcaratti@redhat.com>
    Reviewed-by: Mat Martineau <martineau@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-8-162e87e48497@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    dcaratti authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    d93fd40 View commit details
    Browse the repository at this point in the history
  106. mptcp: fix possible deadlock in subflow diag

    commit d6a9608 upstream.
    
    Syzbot and Eric reported a lockdep splat in the subflow diag:
    
       WARNING: possible circular locking dependency detected
       6.8.0-rc4-syzkaller-00212-g40b9385dd8e6 #0 Not tainted
    
       syz-executor.2/24141 is trying to acquire lock:
       ffff888045870130 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at:
       tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
       ffff888045870130 (k-sk_lock-AF_INET6){+.+.}-{0:0}, at:
       tcp_diag_get_aux+0x738/0x830 net/ipv4/tcp_diag.c:137
    
       but task is already holding lock:
       ffffc9000135e488 (&h->lhash2[i].lock){+.+.}-{2:2}, at: spin_lock
       include/linux/spinlock.h:351 [inline]
       ffffc9000135e488 (&h->lhash2[i].lock){+.+.}-{2:2}, at:
       inet_diag_dump_icsk+0x39f/0x1f80 net/ipv4/inet_diag.c:1038
    
       which lock already depends on the new lock.
    
       the existing dependency chain (in reverse order) is:
    
       -> #1 (&h->lhash2[i].lock){+.+.}-{2:2}:
       lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
       __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
       _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
       spin_lock include/linux/spinlock.h:351 [inline]
       __inet_hash+0x335/0xbe0 net/ipv4/inet_hashtables.c:743
       inet_csk_listen_start+0x23a/0x320 net/ipv4/inet_connection_sock.c:1261
       __inet_listen_sk+0x2a2/0x770 net/ipv4/af_inet.c:217
       inet_listen+0xa3/0x110 net/ipv4/af_inet.c:239
       rds_tcp_listen_init+0x3fd/0x5a0 net/rds/tcp_listen.c:316
       rds_tcp_init_net+0x141/0x320 net/rds/tcp.c:577
       ops_init+0x352/0x610 net/core/net_namespace.c:136
       __register_pernet_operations net/core/net_namespace.c:1214 [inline]
       register_pernet_operations+0x2cb/0x660 net/core/net_namespace.c:1283
       register_pernet_device+0x33/0x80 net/core/net_namespace.c:1370
       rds_tcp_init+0x62/0xd0 net/rds/tcp.c:735
       do_one_initcall+0x238/0x830 init/main.c:1236
       do_initcall_level+0x157/0x210 init/main.c:1298
       do_initcalls+0x3f/0x80 init/main.c:1314
       kernel_init_freeable+0x42f/0x5d0 init/main.c:1551
       kernel_init+0x1d/0x2a0 init/main.c:1441
       ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
       ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:242
    
       -> #0 (k-sk_lock-AF_INET6){+.+.}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3134 [inline]
       check_prevs_add kernel/locking/lockdep.c:3253 [inline]
       validate_chain+0x18ca/0x58e0 kernel/locking/lockdep.c:3869
       __lock_acquire+0x1345/0x1fd0 kernel/locking/lockdep.c:5137
       lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
       lock_sock_fast include/net/sock.h:1723 [inline]
       subflow_get_info+0x166/0xd20 net/mptcp/diag.c:28
       tcp_diag_put_ulp net/ipv4/tcp_diag.c:100 [inline]
       tcp_diag_get_aux+0x738/0x830 net/ipv4/tcp_diag.c:137
       inet_sk_diag_fill+0x10ed/0x1e00 net/ipv4/inet_diag.c:345
       inet_diag_dump_icsk+0x55b/0x1f80 net/ipv4/inet_diag.c:1061
       __inet_diag_dump+0x211/0x3a0 net/ipv4/inet_diag.c:1263
       inet_diag_dump_compat+0x1c1/0x2d0 net/ipv4/inet_diag.c:1371
       netlink_dump+0x59b/0xc80 net/netlink/af_netlink.c:2264
       __netlink_dump_start+0x5df/0x790 net/netlink/af_netlink.c:2370
       netlink_dump_start include/linux/netlink.h:338 [inline]
       inet_diag_rcv_msg_compat+0x209/0x4c0 net/ipv4/inet_diag.c:1405
       sock_diag_rcv_msg+0xe7/0x410
       netlink_rcv_skb+0x1e3/0x430 net/netlink/af_netlink.c:2543
       sock_diag_rcv+0x2a/0x40 net/core/sock_diag.c:280
       netlink_unicast_kernel net/netlink/af_netlink.c:1341 [inline]
       netlink_unicast+0x7ea/0x980 net/netlink/af_netlink.c:1367
       netlink_sendmsg+0xa3b/0xd70 net/netlink/af_netlink.c:1908
       sock_sendmsg_nosec net/socket.c:730 [inline]
       __sock_sendmsg+0x221/0x270 net/socket.c:745
       ____sys_sendmsg+0x525/0x7d0 net/socket.c:2584
       ___sys_sendmsg net/socket.c:2638 [inline]
       __sys_sendmsg+0x2b0/0x3a0 net/socket.c:2667
       do_syscall_64+0xf9/0x240
       entry_SYSCALL_64_after_hwframe+0x6f/0x77
    
    As noted by Eric we can break the lock dependency chain avoid
    dumping any extended info for the mptcp subflow listener:
    nothing actually useful is presented there.
    
    Fixes: b8adb69 ("mptcp: fix lockless access in subflow ULP diag")
    Cc: stable@vger.kernel.org
    Reported-by: Eric Dumazet <edumazet@google.com>
    Closes: https://lore.kernel.org/netdev/CANn89iJ=Oecw6OZDwmSYc9HJKQ_G32uN11L+oUcMu+TOD5Xiaw@mail.gmail.com/
    Suggested-by: Eric Dumazet <edumazet@google.com>
    Signed-off-by: Paolo Abeni <pabeni@redhat.com>
    Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
    Link: https://lore.kernel.org/r/20240223-upstream-net-20240223-misc-fixes-v1-9-162e87e48497@kernel.org
    Signed-off-by: Jakub Kicinski <kuba@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Paolo Abeni authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f27d319 View commit details
    Browse the repository at this point in the history
  107. RDMA/core: Refactor rdma_bind_addr

    commit 8d03797 upstream.
    
    Refactor rdma_bind_addr function so that it doesn't require that the
    cma destination address be changed before calling it.
    
    So now it will update the destination address internally only when it is
    really needed and after passing all the required checks.
    
    Which in turn results in a cleaner and more sensible call and error
    handling flows for the functions that call it directly or indirectly.
    
    Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
    Reported-by: Wei Chen <harperchen1110@gmail.com>
    Reviewed-by: Mark Zhang <markzhang@nvidia.com>
    Link: https://lore.kernel.org/r/3d0e9a2fd62bc10ba02fed1c7c48a48638952320.1672819273.git.leonro@nvidia.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    PatrisiousHaddad authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8806719 View commit details
    Browse the repository at this point in the history
  108. RDMA/core: Update CMA destination address on rdma_resolve_addr

    commit 0e15863 upstream.
    
    8d03797 ("RDMA/core: Refactor rdma_bind_addr") intoduces as regression
    on irdma devices on certain tests which uses rdma CM, such as cmtime.
    
    No connections can be established with the MAD QP experiences a fatal
    error on the active side.
    
    The cma destination address is not updated with the dst_addr when ULP
    on active side calls rdma_bind_addr followed by rdma_resolve_addr.
    The id_priv state is 'bound' in resolve_prepare_src and update is skipped.
    
    This leaves the dgid passed into irdma driver to create an Address Handle
    (AH) for the MAD QP at 0. The create AH descriptor as well as the ARP cache
    entry is invalid and HW throws an asynchronous events as result.
    
    [ 1207.656888] resolve_prepare_src caller: ucma_resolve_addr+0xff/0x170 [rdma_ucm] daddr=200.0.4.28 id_priv->state=7
    [....]
    [ 1207.680362] ice 0000:07:00.1 rocep7s0f1: caller: irdma_create_ah+0x3e/0x70 [irdma] ah_id=0 arp_idx=0 dest_ip=0.0.0.0
    destMAC=00:00:64:ca:b7:52 ipvalid=1 raw=0000:0000:0000:0000:0000:ffff:0000:0000
    [ 1207.682077] ice 0000:07:00.1 rocep7s0f1: abnormal ae_id = 0x401 bool qp=1 qp_id = 1, ae_src=5
    [ 1207.691657] infiniband rocep7s0f1: Fatal error (1) on MAD QP (1)
    
    Fix this by updating the CMA destination address when the ULP calls
    a resolve address with the CM state already bound.
    
    Fixes: 8d03797 ("RDMA/core: Refactor rdma_bind_addr")
    Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
    Link: https://lore.kernel.org/r/20230712234133.1343-1-shiraz.saleem@intel.com
    Signed-off-by: Leon Romanovsky <leon@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    shirazsaleem authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2d9b3e1 View commit details
    Browse the repository at this point in the history
  109. efi: libstub: use EFI_LOADER_CODE region when moving the kernel in me…

    …mory
    
    commit 9cf42bc upstream.
    
    The EFI spec is not very clear about which permissions are being given
    when allocating pages of a certain type. However, it is quite obvious
    that EFI_LOADER_CODE is more likely to permit execution than
    EFI_LOADER_DATA, which becomes relevant once we permit booting the
    kernel proper with the firmware's 1:1 mapping still active.
    
    Ostensibly, recent systems such as the Surface Pro X grant executable
    permissions to EFI_LOADER_CODE regions but not EFI_LOADER_DATA regions.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e7945d9 View commit details
    Browse the repository at this point in the history
  110. x86/boot/compressed: Rename efi_thunk_64.S to efi-mixed.S

    commit cb8bda8 upstream.
    
    In preparation for moving the mixed mode specific code out of head_64.S,
    rename the existing file to clarify that it contains more than just the
    mixed mode thunk.
    
    While at it, clean up the Makefile rules that add it to the build.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-2-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    bad6e66 View commit details
    Browse the repository at this point in the history
  111. x86/boot/compressed: Move 32-bit entrypoint code into .text section

    commit e2ab9ea upstream.
    
    Move the code that stores the arguments passed to the EFI entrypoint
    into the .text section, so that it can be moved into a separate
    compilation unit in a subsequent patch.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-3-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    3bad8dc View commit details
    Browse the repository at this point in the history
  112. x86/boot/compressed: Move bootargs parsing out of 32-bit startup code

    commit 5c3a85f upstream.
    
    Move the logic that chooses between the different EFI entrypoints out of
    the 32-bit boot path, and into a 64-bit helper that can perform the same
    task much more cleanly. While at it, document the mixed mode boot flow
    in a code comment.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-4-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    d8950e8 View commit details
    Browse the repository at this point in the history
  113. x86/boot/compressed: Move efi32_pe_entry into .text section

    commit 91592b5 upstream.
    
    Move efi32_pe_entry() into the .text section, so that it can be moved
    out of head_64.S and into a separate compilation unit in a subsequent
    patch.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-5-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c577208 View commit details
    Browse the repository at this point in the history
  114. x86/boot/compressed: Move efi32_entry out of head_64.S

    commit 73a6dec upstream.
    
    Move the efi32_entry() routine out of head_64.S and into efi-mixed.S,
    which reduces clutter in the complicated startup routines. It also
    permits linkage of some symbols used by code to be made local.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-6-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    469b845 View commit details
    Browse the repository at this point in the history
  115. x86/boot/compressed: Move efi32_pe_entry() out of head_64.S

    commit 7f22ca3 upstream.
    
    Move the implementation of efi32_pe_entry() into efi-mixed.S, which is a
    more suitable location that only gets built if EFI mixed mode is
    actually enabled.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-7-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    beeeb46 View commit details
    Browse the repository at this point in the history
  116. x86/boot/compressed, efi: Merge multiple definitions of image_offset …

    …into one
    
    commit 4b52016 upstream.
    
    There is no need for head_32.S and head_64.S both declaring a copy of
    the global 'image_offset' variable, so drop those and make the extern C
    declaration the definition.
    
    When image_offset is moved to the .c file, it needs to be placed
    particularly in the .data section because it lands by default in the
    .bss section which is cleared too late, in .Lrelocated, before the first
    access to it and thus garbage gets read, leading to SEV guests exploding
    in early boot.
    
    This happens only when the SEV guest kernel is loaded through grub. If
    supplied with qemu's -kernel command line option, that memory is always
    cleared upfront by qemu and all is fine there.
    
      [ bp: Expand commit message with SEV aspect. ]
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-8-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    ef12d04 View commit details
    Browse the repository at this point in the history
  117. x86/boot/compressed: Simplify IDT/GDT preserve/restore in the EFI thunk

    commit 630f337 upstream.
    
    Tweak the asm and remove some redundant instructions. While at it,
    fix the associated comment for style and correctness.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-9-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8803574 View commit details
    Browse the repository at this point in the history
  118. x86/boot/compressed: Avoid touching ECX in startup32_set_idt_entry()

    commit 6aac80a upstream.
    
    Avoid touching register %ecx in startup32_set_idt_entry(), by folding
    the MOV, SHL and ORL instructions into a single ORL which no longer
    requires a temp register.
    
    This permits ECX to be used as a function argument in a subsequent
    patch.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-10-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    530a427 View commit details
    Browse the repository at this point in the history
  119. x86/boot/compressed: Pull global variable reference into startup32_lo…

    …ad_idt()
    
    commit d73a257 upstream.
    
    In preparation for moving startup32_load_idt() out of head_64.S and
    turning it into an ordinary function using the ordinary 32-bit calling
    convention, pull the global variable reference to boot32_idt up into
    startup32_load_idt() so that startup32_set_idt_entry() does not need to
    discover its own runtime physical address, which will no longer be
    correlated with startup_32 once this code is moved into .text.
    
    While at it, give startup32_set_idt_entry() static linkage.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-11-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2913496 View commit details
    Browse the repository at this point in the history
  120. x86/boot/compressed: Move startup32_load_idt() into .text section

    commit c635599 upstream.
    
    Convert startup32_load_idt() into an ordinary function and move it into
    the .text section. This involves turning the rva() immediates into ones
    derived from a local label, and preserving/restoring the %ebp and %ebx
    as per the calling convention.
    
    Also move the #ifdef to the only existing call site. This makes it clear
    that the function call does nothing if support for memory encryption is
    not compiled in.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-12-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2e47116 View commit details
    Browse the repository at this point in the history
  121. x86/boot/compressed: Move startup32_load_idt() out of head_64.S

    commit 9ea813b upstream.
    
    Now that startup32_load_idt() has been refactored into an ordinary
    callable function, move it into mem-encrypt.S where it belongs.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-13-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    801873f View commit details
    Browse the repository at this point in the history
  122. x86/boot/compressed: Move startup32_check_sev_cbit() into .text

    commit b5d854c upstream.
    
    Move startup32_check_sev_cbit() into the .text section and turn it into
    an ordinary function using the ordinary 32-bit calling convention,
    instead of saving/restoring the registers that are known to be live at
    the only call site. This improves maintainability, and makes it possible
    to move this function out of head_64.S and into a separate compilation
    unit that is specific to memory encryption.
    
    Note that this requires the call site to be moved before the mixed mode
    check, as %eax will be live otherwise.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-14-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e840ae3 View commit details
    Browse the repository at this point in the history
  123. x86/boot/compressed: Move startup32_check_sev_cbit() out of head_64.S

    commit 9d7eaae upstream.
    
    Now that the startup32_check_sev_cbit() routine can execute from
    anywhere and behaves like an ordinary function, it can be moved where it
    belongs.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-15-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0912dce View commit details
    Browse the repository at this point in the history
  124. x86/boot/compressed: Adhere to calling convention in get_sev_encrypti…

    …on_bit()
    
    commit 30c9ca1 upstream.
    
    Make get_sev_encryption_bit() follow the ordinary i386 calling
    convention, and only call it if CONFIG_AMD_MEM_ENCRYPT is actually
    enabled. This clarifies the calling code, and makes it more
    maintainable.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-16-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    cac22c9 View commit details
    Browse the repository at this point in the history
  125. x86/boot/compressed: Only build mem_encrypt.S if AMD_MEM_ENCRYPT=y

    commit 61de13d upstream.
    
    Avoid building the mem_encrypt.o object if memory encryption support is
    not enabled to begin with.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-17-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    71c43b7 View commit details
    Browse the repository at this point in the history
  126. efi: verify that variable services are supported

    commit bad267f upstream.
    
    Current Qualcomm UEFI firmware does not implement the variable services
    but not all revisions clear the corresponding bits in the RT_PROP table
    services mask and instead the corresponding calls return
    EFI_UNSUPPORTED.
    
    This leads to efi core registering the generic efivar ops even when the
    variable services are not supported or when they are accessed through
    some other interface (e.g. Google SMI or the upcoming Qualcomm SCM
    implementation).
    
    Instead of playing games with init call levels to make sure that the
    custom implementations are registered after the generic one, make sure
    that get_next_variable() is actually supported before registering the
    generic ops.
    
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jhovold authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    a8901f3 View commit details
    Browse the repository at this point in the history
  127. x86/efi: Make the deprecated EFI handover protocol optional

    commit cc3fdda upstream.
    
    The EFI handover protocol permits a bootloader to invoke the kernel as a
    EFI PE/COFF application, while passing a bootparams struct as a third
    argument to the entrypoint function call.
    
    This has no basis in the UEFI specification, and there are better ways
    to pass additional data to a UEFI application (UEFI configuration
    tables, UEFI variables, UEFI protocols) than going around the
    StartImage() boot service and jumping to a fixed offset in the loaded
    image, just to call a different function that takes a third parameter.
    
    The reason for handling struct bootparams in the bootloader was that the
    EFI stub could only load initrd images from the EFI system partition,
    and so passing it via struct bootparams was needed for loaders like
    GRUB, which pass the initrd in memory, and may load it from anywhere,
    including from the network. Another motivation was EFI mixed mode, which
    could not use the initrd loader in the EFI stub at all due to 32/64 bit
    incompatibilities (which will be fixed shortly [0]), and could not
    invoke the ordinary PE/COFF entry point either, for the same reasons.
    
    Given that loaders such as GRUB already carried the bootparams handling
    in order to implement non-EFI boot, retaining that code and just passing
    bootparams to the EFI stub was a reasonable choice (although defining an
    alternate entrypoint could have been avoided.) However, the GRUB side
    changes never made it upstream, and are only shipped by some of the
    distros in their downstream versions.
    
    In the meantime, EFI support has been added to other Linux architecture
    ports, as well as to U-boot and systemd, including arch-agnostic methods
    for passing initrd images in memory [1], and for doing mixed mode boot
    [2], none of them requiring anything like the EFI handover protocol. So
    given that only out-of-tree distro GRUB relies on this, let's permit it
    to be omitted from the build, in preparation for retiring it completely
    at a later date. (Note that systemd-boot does have an implementation as
    well, but only uses it as a fallback for booting images that do not
    implement the LoadFile2 based initrd loading method, i.e., v5.8 or older)
    
    [0] https://lore.kernel.org/all/20220927085842.2860715-1-ardb@kernel.org/
    [1] ec93fc3 ("efi/libstub: Add support for loading the initrd from a device path")
    [2] 97aa276 ("efi/x86: Add true mixed mode entry point into .compat section")
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov <bp@suse.de>
    Link: https://lore.kernel.org/r/20221122161017.2426828-18-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    7bc9533 View commit details
    Browse the repository at this point in the history
  128. x86/boot: Robustify calling startup_{32,64}() from the decompressor code

    commit 7734a0f upstream.
    
    After commit ce697cc ("kbuild: remove head-y syntax"), I
    started digging whether x86 is ready for removing this old cruft.
    Removing its objects from the list makes the kernel unbootable.
    This applies only to bzImage, vmlinux still works correctly.
    The reason is that with no strict object order determined by the
    linker arguments, not the linker script, startup_64 can be placed
    not right at the beginning of the kernel.
    Here's vmlinux.map's beginning before removing:
    
      ffffffff81000000         vmlinux.o:(.head.text)
      ffffffff81000000                 startup_64
      ffffffff81000070                 secondary_startup_64
      ffffffff81000075                 secondary_startup_64_no_verify
      ffffffff81000160                 verify_cpu
    
    and after:
    
      ffffffff81000000         vmlinux.o:(.head.text)
      ffffffff81000000                 pvh_start_xen
      ffffffff81000080                 startup_64
      ffffffff810000f0                 secondary_startup_64
      ffffffff810000f5                 secondary_startup_64_no_verify
    
    Not a problem itself, but the self-extractor code has the address of
    that function hardcoded the beginning, not looking onto the ELF
    header, which always contains the address of startup_{32,64}().
    
    So, instead of doing an "act of blind faith", just take the address
    from the ELF header and extract a relative offset to the entry
    point. The decompressor function already returns a pointer to the
    beginning of the kernel to the Asm code, which then jumps to it,
    so add that offset to the return value.
    This doesn't change anything for now, but allows to resign from the
    "head object list" for x86 and makes sure valid Kbuild or any other
    improvements won't break anything here in general.
    
    Signed-off-by: Alexander Lobakin <alexandr.lobakin@intel.com>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Tested-by: Jiri Slaby <jirislaby@kernel.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Link: https://lore.kernel.org/r/20230109170403.4117105-2-alexandr.lobakin@intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    alobakin authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    4f3077c View commit details
    Browse the repository at this point in the history
  129. x86/efistub: Branch straight to kernel entry point from C code

    commit d2d7a54 upstream.
    
    Instead of returning to the calling code in assembler that does nothing
    more than perform an indirect call with the boot_params pointer in
    register ESI/RSI, perform the jump directly from the EFI stub C code.
    This will allow the asm entrypoint code to be dropped entirely in
    subsequent patches.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-4-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    51a0710 View commit details
    Browse the repository at this point in the history
  130. x86/decompressor: Store boot_params pointer in callee save register

    commit 8b63cba upstream.
    
    Instead of pushing and popping %RSI several times to preserve the struct
    boot_params pointer across the execution of the startup code, move it
    into a callee save register before the first call into C, and copy it
    back when needed.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-8-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2cca5f5 View commit details
    Browse the repository at this point in the history
  131. x86/decompressor: Assign paging related global variables earlier

    commit 00c6b09 upstream.
    
    There is no need to defer the assignment of the paging related global
    variables 'pgdir_shift' and 'ptrs_per_p4d' until after the trampoline is
    cleaned up, so assign them as soon as it is clear that 5-level paging
    will be enabled.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-9-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    99a20f5 View commit details
    Browse the repository at this point in the history
  132. x86/decompressor: Call trampoline as a normal function

    commit e8972a7 upstream.
    
    Move the long return to switch to 32-bit mode into the trampoline code
    so it can be called as an ordinary function. This will allow it to be
    called directly from C code in a subsequent patch.
    
    While at it, reorganize the code somewhat to keep the prologue and
    epilogue of the function together, making the code a bit easier to
    follow. Also, given that the trampoline is now entered in 64-bit mode, a
    simple RIP-relative reference can be used to take the address of the
    exit point.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Link: https://lore.kernel.org/r/20230807162720.545787-10-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    640f27f View commit details
    Browse the repository at this point in the history
  133. x86/decompressor: Use standard calling convention for trampoline

    commit 918a7a0 upstream.
    
    Update the trampoline code so its arguments are passed via RDI and RSI,
    which matches the ordinary SysV calling convention for x86_64. This will
    allow this code to be called directly from C.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Link: https://lore.kernel.org/r/20230807162720.545787-11-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    6083b4c View commit details
    Browse the repository at this point in the history
  134. x86/decompressor: Avoid the need for a stack in the 32-bit trampoline

    commit bd328aa upstream.
    
    The 32-bit trampoline no longer uses the stack for anything except
    performing a far return back to long mode, and preserving the caller's
    stack pointer value. Currently, the trampoline stack is placed in the
    same page that carries the trampoline code, which means this page must
    be mapped writable and executable, and the stack is therefore executable
    as well.
    
    Replace the far return with a far jump, so that the return address can
    be pre-calculated and patched into the code before it is called. This
    removes the need for a 32-bit addressable stack entirely, and in a later
    patch, this will be taken advantage of by removing writable permissions
    from (and adding executable permissions to) the trampoline code page
    when booting via the EFI stub.
    
    Note that the value of RSP still needs to be preserved explicitly across
    the switch into 32-bit mode, as the register may get truncated to 32
    bits.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Link: https://lore.kernel.org/r/20230807162720.545787-12-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1523291 View commit details
    Browse the repository at this point in the history
  135. x86/decompressor: Call trampoline directly from C code

    commit 64ef578 upstream.
    
    Instead of returning to the asm calling code to invoke the trampoline,
    call it straight from the C code that sets it up. That way, the struct
    return type is no longer needed for returning two values, and the call
    can be made conditional more cleanly in a subsequent patch.
    
    This means that all callee save 64-bit registers need to be preserved
    and restored, as their contents may not survive the legacy mode switch.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Link: https://lore.kernel.org/r/20230807162720.545787-13-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    364d774 View commit details
    Browse the repository at this point in the history
  136. x86/decompressor: Only call the trampoline when changing paging levels

    commit f97b67a upstream.
    
    Since the current and desired number of paging levels are known when the
    trampoline is being prepared, avoid calling the trampoline at all if it
    is clear that calling it is not going to result in a change to the
    number of paging levels.
    
    Given that the CPU is already running in long mode, the PAE and LA57
    settings are necessarily consistent with the currently active page
    tables, and other fields in CR4 will be initialized by the startup code
    in the kernel proper. So limit the manipulation of CR4 to toggling the
    LA57 bit, which is the only thing that really needs doing at this point
    in the boot. This also means that there is no need to pass the value of
    l5_required to toggle_la57(), as it will not be called unless CR4.LA57
    needs to toggle.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Link: https://lore.kernel.org/r/20230807162720.545787-14-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e2fa53a View commit details
    Browse the repository at this point in the history
  137. x86/decompressor: Pass pgtable address to trampoline directly

    commit cb83cec upstream.
    
    The only remaining use of the trampoline address by the trampoline
    itself is deriving the page table address from it, and this involves
    adding an offset of 0x0. So simplify this, and pass the new CR3 value
    directly.
    
    This makes the fact that the page table happens to be at the start of
    the trampoline allocation an implementation detail of the caller.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-15-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    df3dec3 View commit details
    Browse the repository at this point in the history
  138. x86/decompressor: Merge trampoline cleanup with switching code

    commit 03dda95 upstream.
    
    Now that the trampoline setup code and the actual invocation of it are
    all done from the C routine, the trampoline cleanup can be merged into
    it as well, instead of returning to asm just to call another C function.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Link: https://lore.kernel.org/r/20230807162720.545787-16-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    463b51e View commit details
    Browse the repository at this point in the history
  139. x86/decompressor: Move global symbol references to C code

    commit 2438829 upstream.
    
    It is no longer necessary to be cautious when referring to global
    variables in the position independent decompressor code, now that it is
    built using PIE codegen and makes an assertion in the linker script that
    no GOT entries exist (which would require adjustment for the actual
    runtime load address of the decompressor binary).
    
    This means global variables can be referenced directly from C code,
    instead of having to pass their runtime addresses into C routines from
    asm code, which needs to happen at each call site. Do so for the code
    that will be called directly from the EFI stub after a subsequent patch,
    and avoid the need to duplicate this logic a third time.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-20-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    5c4fead View commit details
    Browse the repository at this point in the history
  140. decompress: Use 8 byte alignment

    commit 8217ad0 upstream.
    
    The ZSTD decompressor requires malloc() allocations to be 8 byte
    aligned, so ensure that this the case.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-19-ardb@kernel.org
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    bf0ca98 View commit details
    Browse the repository at this point in the history
  141. drm/amd/display: Increase frame warning limit with KASAN or KCSAN in dml

    commit 5b750b2 upstream.
    
    Does the same thing as:
    commit 6740ec9 ("drm/amd/display: Increase frame warning limit with KASAN or KCSAN in dml2")
    
    Reviewed-by: Harry Wentland <harry.wentland@amd.com>
    Reported-by: kernel test robot <lkp@intel.com>
    Closes: https://lore.kernel.org/oe-kbuild-all/202311302107.hUDXVyWT-lkp@intel.com/
    Fixes: 67e3887 ("drm/amd/display: Increase num voltage states to 40")
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Cc: Alvin Lee <alvin.lee2@amd.com>
    Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
    Cc: Samson Tam <samson.tam@amd.com>
    Cc: Harry Wentland <harry.wentland@amd.com>
    Cc: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    alexdeucher authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    04dd440 View commit details
    Browse the repository at this point in the history
  142. NFS: Fix data corruption caused by congestion.

    when AOP_WRITEPAGE_ACTIVATE is returned (as NFS does when it detects
    congestion) it is important that the page is redirtied.
    nfs_writepage_locked() doesn't do this, so files can become corrupted as
    writes can be lost.
    
    Note that this is not needed in v6.8 as AOP_WRITEPAGE_ACTIVATE cannot be
    returned.  It is needed for kernels v5.18..v6.7.  From 6.3 onward the patch
    is different as it needs to mention "folio", not "page".
    
    Reported-and-tested-by: Jacek Tomaka <Jacek.Tomaka@poczta.fm>
    Fixes: 6df25e5 ("nfs: remove reliance on bdi congestion")
    Signed-off-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    neilbrown authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    831e9e6 View commit details
    Browse the repository at this point in the history
  143. NFSD: Simplify READ_PLUS

    [ Upstream commit eeadcb7 ]
    
    Chuck had suggested reverting READ_PLUS so it returns a single DATA
    segment covering the requested read range. This prepares the server for
    a future "sparse read" function so support can easily be added without
    needing to rip out the old READ_PLUS code at the same time.
    
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    amschuma-ntap authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    d03a985 View commit details
    Browse the repository at this point in the history
  144. NFSD: Remove redundant assignment to variable host_err

    [ Upstream commit 69eed23 ]
    
    Variable host_err is assigned a value that is never read, it is being
    re-assigned a value in every different execution path in the following
    switch statement. The assignment is redundant and can be removed.
    
    Cleans up clang-scan warning:
    warning: Value stored to 'host_err' is never read [deadcode.DeadStores]
    
    Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ColinIanKing authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0a49efb View commit details
    Browse the repository at this point in the history
  145. nfsd: ignore requests to disable unsupported versions

    [ Upstream commit 8e823ba ]
    
    The kernel currently errors out if you attempt to enable or disable a
    version that it doesn't recognize. Change it to ignore attempts to
    disable an unrecognized version. If we don't support it, then there is
    no harm in doing so.
    
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: Tom Talpey <tom@talpey.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    bfef0cf View commit details
    Browse the repository at this point in the history
  146. nfsd: move nfserrno() to vfs.c

    [ Upstream commit cb12fae ]
    
    nfserrno() is common to all nfs versions, but nfsproc.c is specifically
    for NFSv2. Move it to vfs.c, and the prototype to vfs.h.
    
    While we're in here, remove the #ifdef EDQUOT check in this function.
    It's apparently a holdover from the initial merge of the nfsd code in
    1997. No other place in the kernel checks that that symbol is defined
    before using it, so I think we can dispense with it here.
    
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    850333a View commit details
    Browse the repository at this point in the history
  147. nfsd: allow disabling NFSv2 at compile time

    [ Upstream commit 2f3a4b2 ]
    
    rpc.nfsd stopped supporting NFSv2 a year ago. Take the next logical
    step toward deprecating it and allow NFSv2 support to be compiled out.
    
    Add a new CONFIG_NFSD_V2 option that can be turned off and rework the
    CONFIG_NFSD_V?_ACL option dependencies. Add a description that
    discourages enabling it.
    
    Also, change the description of CONFIG_NFSD to state that the always-on
    version is now 3 instead of 2.
    
    Finally, add an #ifdef around "case 2:" in __write_versions. When NFSv2
    is disabled at compile time, this should make the kernel ignore attempts
    to disable it at runtime, but still error out when trying to enable it.
    
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: Tom Talpey <tom@talpey.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f82865e View commit details
    Browse the repository at this point in the history
  148. exportfs: use pr_debug for unreachable debug statements

    [ Upstream commit 427505f ]
    
    expfs.c has a bunch of dprintk statements which are unusable due to:
     #define dprintk(fmt, args...) do{}while(0)
    Use pr_debug so that they can be enabled dynamically.
    Also make some minor changes to the debug statements to fix some
    incorrect types, and remove __func__ which can be handled by dynamic
    debug separately.
    
    Signed-off-by: David Disseldorp <ddiss@suse.de>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ddiss authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    137d20d View commit details
    Browse the repository at this point in the history
  149. NFSD: Flesh out a documenting comment for filecache.c

    [ Upstream commit b3276c1 ]
    
    Record what we've learned recently about the NFSD filecache in a
    documenting comment so our future selves don't forget what all this
    is for.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e62d8c1 View commit details
    Browse the repository at this point in the history
  150. NFSD: Clean up nfs4_preprocess_stateid_op() call sites

    [ Upstream commit eeff73f ]
    
    Remove the lame-duck dprintk()s around nfs4_preprocess_stateid_op()
    call sites.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Tested-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    519a80e View commit details
    Browse the repository at this point in the history
  151. NFSD: Trace stateids returned via DELEGRETURN

    [ Upstream commit 20eee31 ]
    
    Handing out a delegation stateid is recorded with the
    nfsd_deleg_read tracepoint, but there isn't a matching tracepoint
    for recording when the stateid is returned.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    9fbef7d View commit details
    Browse the repository at this point in the history
  152. NFSD: Trace delegation revocations

    [ Upstream commit a1c7456 ]
    
    Delegation revocation is an exceptional event that is not otherwise
    visible externally (eg, no network traffic is emitted). Generate a
    trace record when it occurs so that revocation can be observed or
    other activity can be triggered. Example:
    
    nfsd-1104  [005]  1912.002544: nfsd_stid_revoke:        client 633c9343:4e82788d stateid 00000003:00000001 ref=2 type=DELEG
    
    Trace infrastructure is provided for subsequent additional tracing
    related to nfs4_stid activity.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Tested-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    fae3f8b View commit details
    Browse the repository at this point in the history
  153. NFSD: Use const pointers as parameters to fh_ helpers

    [ Upstream commit b48f805 ]
    
    Enable callers to use const pointers where they are able to.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Tested-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    255ac53 View commit details
    Browse the repository at this point in the history
  154. NFSD: Update file_hashtbl() helpers

    [ Upstream commit 3fe828c ]
    
    Enable callers to use const pointers for type safety.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    6ee5c4e View commit details
    Browse the repository at this point in the history
  155. NFSD: Clean up nfsd4_init_file()

    [ Upstream commit 81a21fa ]
    
    Name this function more consistently. I'm going to use nfsd4_file_
    and nfsd4_file_hash_ for these helpers.
    
    Change the @fh parameter to be const pointer for better type safety.
    
    Finally, move the hash insertion operation to the caller. This is
    typical for most other "init_object" type helpers, and it is where
    most of the other nfs4_file hash table operations are located.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c8d8876 View commit details
    Browse the repository at this point in the history
  156. NFSD: Add a nfsd4_file_hash_remove() helper

    [ Upstream commit 3341678 ]
    
    Refactor to relocate hash deletion operation to a helper function
    that is close to most other nfs4_file data structure operations.
    
    The "noinline" annotation will become useful in a moment when the
    hlist_del_rcu() is replaced with a more complex rhash remove
    operation. It also guarantees that hash remove operations can be
    traced with "-p function -l remove_nfs4_file_locked".
    
    This also simplifies the organization of forward declarations: the
    to-be-added rhashtable and its param structure will be defined
    /after/ put_nfs4_file().
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    5aa0c56 View commit details
    Browse the repository at this point in the history
  157. NFSD: Clean up find_or_add_file()

    [ Upstream commit 9270fc5 ]
    
    Remove the call to find_file_locked() in insert_nfs4_file(). Tracing
    shows that over 99% of these calls return NULL. Thus it is not worth
    the expense of the extra bucket list traversal. insert_file() already
    deals correctly with the case where the item is already in the hash
    bucket.
    
    Since nfsd4_file_hash_insert() is now just a wrapper around
    insert_file(), move the meat of insert_file() into
    nfsd4_file_hash_insert() and get rid of it.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0d4150f View commit details
    Browse the repository at this point in the history
  158. NFSD: Refactor find_file()

    [ Upstream commit 1542474 ]
    
    find_file() is now the only caller of find_file_locked(), so just
    fold these two together.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    49e8d9f View commit details
    Browse the repository at this point in the history
  159. NFSD: Use rhashtable for managing nfs4_file objects

    [ Upstream commit d47b295 ]
    
    fh_match() is costly, especially when filehandles are large (as is
    the case for NFSv4). It needs to be used sparingly when searching
    data structures. Unfortunately, with common workloads, I see
    multiple thousands of objects stored in file_hashtbl[], which has
    just 256 buckets, making its bucket hash chains quite lengthy.
    
    Walking long hash chains with the state_lock held blocks other
    activity that needs that lock. Sizable hash chains are a common
    occurrance once the server has handed out some delegations, for
    example -- IIUC, each delegated file is held open on the server by
    an nfs4_file object.
    
    To help mitigate the cost of searching with fh_match(), replace the
    nfs4_file hash table with an rhashtable, which can dynamically
    resize its bucket array to minimize hash chain length.
    
    The result of this modification is an improvement in the latency of
    NFSv4 operations, and the reduction of nfsd CPU utilization due to
    eliminating the cost of multiple calls to fh_match() and reducing
    the CPU cache misses incurred while walking long hash chains in the
    nfs4_file hash table.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: NeilBrown <neilb@suse.de>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    5a1f615 View commit details
    Browse the repository at this point in the history
  160. NFSD: Fix licensing header in filecache.c

    [ Upstream commit 3f05421 ]
    
    Add a missing SPDX header.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    6b12589 View commit details
    Browse the repository at this point in the history
  161. filelock: add a new locks_inode_context accessor function

    [ Upstream commit 401a8b8 ]
    
    There are a number of places in the kernel that are accessing the
    inode->i_flctx field without smp_load_acquire. This is required to
    ensure that the caller doesn't see a partially-initialized structure.
    
    Add a new accessor function for it to make this clear and convert all of
    the relevant accesses in locks.c to use it. Also, convert
    locks_free_lock_context to use the helper as well instead of just doing
    a "bare" assignment.
    
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Stable-dep-of: 77c6753 ("nfsd: use locks_inode_context helper")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1f76cb6 View commit details
    Browse the repository at this point in the history
  162. lockd: use locks_inode_context helper

    [ Upstream commit 98b41ff ]
    
    lockd currently doesn't access i_flctx safely. This requires a
    smp_load_acquire, as the pointer is set via cmpxchg (a release
    operation).
    
    Cc: Trond Myklebust <trond.myklebust@hammerspace.com>
    Cc: Anna Schumaker <anna@kernel.org>
    Cc: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c66f9f2 View commit details
    Browse the repository at this point in the history
  163. nfsd: use locks_inode_context helper

    [ Upstream commit 77c6753 ]
    
    nfsd currently doesn't access i_flctx safely everywhere. This requires a
    smp_load_acquire, as the pointer is set via cmpxchg (a release
    operation).
    
    Acked-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e017486 View commit details
    Browse the repository at this point in the history
  164. nfsd: fix up the filecache laundrette scheduling

    [ Upstream commit 22ae4c1 ]
    
    We don't really care whether there are hashed entries when it comes to
    scheduling the laundrette. They might all be non-gc entries, after all.
    We only want to schedule it if there are entries on the LRU.
    
    Switch to using list_lru_count, and move the check into
    nfsd_file_gc_worker. The other callsite in nfsd_file_put doesn't need to
    count entries, since it only schedules the laundrette after adding an
    entry to the LRU.
    
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8b7be6e View commit details
    Browse the repository at this point in the history
  165. NFSD: Use struct_size() helper in alloc_session()

    [ Upstream commit 85a0d0c ]
    
    Use struct_size() helper to simplify the code, no functional changes.
    
    Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Xiu Jianfeng authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    12e6368 View commit details
    Browse the repository at this point in the history
  166. lockd: set missing fl_flags field when retrieving args

    [ Upstream commit 75c7940 ]
    
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8973a8f View commit details
    Browse the repository at this point in the history
  167. lockd: ensure we use the correct file descriptor when unlocking

    [ Upstream commit 69efce0 ]
    
    Shared locks are set on O_RDONLY descriptors and exclusive locks are set
    on O_WRONLY ones. nlmsvc_unlock however calls vfs_lock_file twice, once
    for each descriptor, but it doesn't reset fl_file. Ensure that it does.
    
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    ccbf6ef View commit details
    Browse the repository at this point in the history
  168. lockd: fix file selection in nlmsvc_cancel_blocked

    [ Upstream commit 9f27783 ]
    
    We currently do a lock_to_openmode call based on the arguments from the
    NLM_UNLOCK call, but that will always set the fl_type of the lock to
    F_UNLCK, and the O_RDONLY descriptor is always chosen.
    
    Fix it to use the file_lock from the block instead.
    
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0920dee View commit details
    Browse the repository at this point in the history
  169. trace: Relocate event helper files

    [ Upstream commit 247c01f ]
    
    Steven Rostedt says:
    > The include/trace/events/ directory should only hold files that
    > are to create events, not headers that hold helper functions.
    >
    > Can you please move them out of include/trace/events/ as that
    > directory is "special" in the creation of events.
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Acked-by: Leon Romanovsky <leonro@nvidia.com>
    Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
    Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
    Stable-dep-of: 638593b ("NFSD: add CB_RECALL_ANY tracepoints")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    371e1c1 View commit details
    Browse the repository at this point in the history
  170. NFSD: refactoring courtesy_client_reaper to a generic low memory shri…

    …nker
    
    [ Upstream commit a1049eb ]
    
    Refactoring courtesy_client_reaper to generic low memory
    shrinker so it can be used for other purposes.
    
    Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    daimngo authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    4481d72 View commit details
    Browse the repository at this point in the history
  171. NFSD: add support for sending CB_RECALL_ANY

    [ Upstream commit 3959066 ]
    
    Add XDR encode and decode function for CB_RECALL_ANY.
    
    Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    daimngo authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f30f07b View commit details
    Browse the repository at this point in the history
  172. NFSD: add delegation reaper to react to low memory condition

    [ Upstream commit 44df6f4 ]
    
    The delegation reaper is called by nfsd memory shrinker's on
    the 'count' callback. It scans the client list and sends the
    courtesy CB_RECALL_ANY to the clients that hold delegations.
    
    To avoid flooding the clients with CB_RECALL_ANY requests, the
    delegation reaper sends only one CB_RECALL_ANY request to each
    client per 5 seconds.
    
    Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
    [ cel: moved definition of RCA4_TYPE_MASK_RDATA_DLG ]
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    daimngo authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f28dae5 View commit details
    Browse the repository at this point in the history
  173. NFSD: add CB_RECALL_ANY tracepoints

    [ Upstream commit 638593b ]
    
    Add tracepoints to trace start and end of CB_RECALL_ANY operation.
    
    Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
    [ cel: added show_rca_mask() macro ]
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    daimngo authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    7b2b8a6 View commit details
    Browse the repository at this point in the history
  174. NFSD: Use only RQ_DROPME to signal the need to drop a reply

    [ Upstream commit 9315564 ]
    
    Clean up: NFSv2 has the only two usages of rpc_drop_reply in the
    NFSD code base. Since NFSv2 is going away at some point, replace
    these in order to simplify the "drop this reply?" check in
    nfsd_dispatch().
    
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    eb73733 View commit details
    Browse the repository at this point in the history
  175. NFSD: Avoid clashing function prototypes

    [ Upstream commit e78e274 ]
    
    When built with Control Flow Integrity, function prototypes between
    caller and function declaration must match. These mismatches are visible
    at compile time with the new -Wcast-function-type-strict in Clang[1].
    
    There were 97 warnings produced by NFS. For example:
    
    fs/nfsd/nfs4xdr.c:2228:17: warning: cast from '__be32 (*)(struct nfsd4_compoundargs *, struct nfsd4_access *)' (aka 'unsigned int (*)(struct nfsd4_compoundargs *, struct nfsd4_access *)') to 'nfsd4_dec' (aka 'unsigned int (*)(struct nfsd4_compoundargs *, void *)') converts to incompatible function type [-Wcast-function-type-strict]
            [OP_ACCESS]             = (nfsd4_dec)nfsd4_decode_access,
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The enc/dec callbacks were defined as passing "void *" as the second
    argument, but were being implicitly cast to a new type. Replace the
    argument with union nfsd4_op_u, and perform explicit member selection
    in the function body. There are no resulting binary differences.
    
    Changes were made mechanically using the following Coccinelle script,
    with minor by-hand fixes for members that didn't already match their
    existing argument name:
    
    @find@
    identifier func;
    type T, opsT;
    identifier ops, N;
    @@
    
     opsT ops[] = {
            [N] = (T) func,
     };
    
    @already_void@
    identifier find.func;
    identifier name;
    @@
    
     func(...,
    -void
    +union nfsd4_op_u
     *name)
     {
            ...
     }
    
    @proto depends on !already_void@
    identifier find.func;
    type T;
    identifier name;
    position p;
    @@
    
     func@p(...,
            T name
     ) {
            ...
       }
    
    @script:python get_member@
    type_name << proto.T;
    member;
    @@
    
    coccinelle.member = cocci.make_ident(type_name.split("_", 1)[1].split(' ',1)[0])
    
    @convert@
    identifier find.func;
    type proto.T;
    identifier proto.name;
    position proto.p;
    identifier get_member.member;
    @@
    
     func@p(...,
    -       T name
    +       union nfsd4_op_u *u
     ) {
    +       T name = &u->member;
            ...
       }
    
    @cast@
    identifier find.func;
    type T, opsT;
    identifier ops, N;
    @@
    
     opsT ops[] = {
            [N] =
    -       (T)
            func,
     };
    
    Cc: Chuck Lever <chuck.lever@oracle.com>
    Cc: Jeff Layton <jlayton@kernel.org>
    Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
    Cc: linux-nfs@vger.kernel.org
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    kees authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    5c6c2fb View commit details
    Browse the repository at this point in the history
  176. NFSD: Use set_bit(RQ_DROPME)

    [ Upstream commit 5304930 ]
    
    The premise that "Once an svc thread is scheduled and executing an
    RPC, no other processes will touch svc_rqst::rq_flags" is false.
    svc_xprt_enqueue() examines the RQ_BUSY flag in scheduled nfsd
    threads when determining which thread to wake up next.
    
    Fixes: 9315564 ("NFSD: Use only RQ_DROPME to signal the need to drop a reply")
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    chucklever authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    ce606d5 View commit details
    Browse the repository at this point in the history
  177. NFSD: register/unregister of nfsd-client shrinker at nfsd startup/shu…

    …tdown time
    
    [ Upstream commit f385f7d ]
    
    Currently the nfsd-client shrinker is registered and unregistered at
    the time the nfsd module is loaded and unloaded. The problem with this
    is the shrinker is being registered before all of the relevant fields
    in nfsd_net are initialized when nfsd is started. This can lead to an
    oops when memory is low and the shrinker is called while nfsd is not
    running.
    
    This patch moves the  register/unregister of nfsd-client shrinker from
    module load/unload time to nfsd startup/shutdown time.
    
    Fixes: 44df6f4 ("NFSD: add delegation reaper to react to low memory condition")
    Reported-by: Mike Galbraith <efault@gmx.de>
    Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    daimngo authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c479755 View commit details
    Browse the repository at this point in the history
  178. NFSD: replace delayed_work with work_struct for nfsd_client_shrinker

    [ Upstream commit 7c24fa2 ]
    
    Since nfsd4_state_shrinker_count always calls mod_delayed_work with
    0 delay, we can replace delayed_work with work_struct to save some
    space and overhead.
    
    Also add the call to cancel_work after unregister the shrinker
    in nfs4_state_shutdown_net.
    
    Signed-off-by: Dai Ngo <dai.ngo@oracle.com>
    Reviewed-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    daimngo authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f3ea5ec View commit details
    Browse the repository at this point in the history
  179. nfsd: don't destroy global nfs4_file table in per-net shutdown

    [ Upstream commit 4102db1 ]
    
    The nfs4_file table is global, so shutting it down when a containerized
    nfsd is shut down is wrong and can lead to double-frees. Tear down the
    nfs4_file_rhltable in nfs4_state_shutdown instead of
    nfs4_state_shutdown_net.
    
    Fixes: d47b295 ("NFSD: Use rhashtable for managing nfs4_file objects")
    Link: https://bugzilla.redhat.com/show_bug.cgi?id=2169017
    Reported-by: JianHong Yin <jiyin@redhat.com>
    Signed-off-by: Jeff Layton <jlayton@kernel.org>
    Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    jtlayton authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    56587af View commit details
    Browse the repository at this point in the history
  180. arm64: efi: Limit allocations to 48-bit addressable physical region

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit a37dac5 upstream ]
    
    The UEFI spec does not mention or reason about the configured size of
    the virtual address space at all, but it does mention that all memory
    should be identity mapped using a page size of 4 KiB.
    
    This means that a LPA2 capable system that has any system memory outside
    of the 48-bit addressable physical range and follows the spec to the
    letter may serve page allocation requests from regions of memory that
    the kernel cannot access unless it was built with LPA2 support and
    enables it at runtime.
    
    So let's ensure that all page allocations are limited to the 48-bit
    range.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    e58f286 View commit details
    Browse the repository at this point in the history
  181. efi: efivars: prevent double registration

    From: Johan Hovold <johan+linaro@kernel.org>
    
    [ Commit 0217a40 upstream ]
    
    Add the missing sanity check to efivars_register() so that it is no
    longer possible to override an already registered set of efivar ops
    (without first deregistering them).
    
    This can help debug initialisation ordering issues where drivers have so
    far unknowingly been relying on overriding the generic ops.
    
    Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    33d064a View commit details
    Browse the repository at this point in the history
  182. x86/efistub: Simplify and clean up handover entry code

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit df9215f upstream ]
    
    Now that the EFI entry code in assembler is only used by the optional
    and deprecated EFI handover protocol, and given that the EFI stub C code
    no longer returns to it, most of it can simply be dropped.
    
    While at it, clarify the symbol naming, by merging efi_main() and
    efi_stub_entry(), making the latter the shared entry point for all
    different boot modes that enter via the EFI stub.
    
    The efi32_stub_entry() and efi64_stub_entry() names are referenced
    explicitly by the tooling that populates the setup header, so these must
    be retained, but can be emitted as aliases of efi_stub_entry() where
    appropriate.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-5-ardb@kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    f0acafd View commit details
    Browse the repository at this point in the history
  183. x86/decompressor: Avoid magic offsets for EFI handover entrypoint

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit 1279206 upstream ]
    
    The native 32-bit or 64-bit EFI handover protocol entrypoint offset
    relative to the respective startup_32/64 address is described in
    boot_params as handover_offset, so that the special Linux/x86 aware EFI
    loader can find it there.
    
    When mixed mode is enabled, this single field has to describe this
    offset for both the 32-bit and 64-bit entrypoints, so their respective
    relative offsets have to be identical. Given that startup_32 and
    startup_64 are 0x200 bytes apart, and the EFI handover entrypoint
    resides at a fixed offset, the 32-bit and 64-bit versions of those
    entrypoints must be exactly 0x200 bytes apart as well.
    
    Currently, hard-coded fixed offsets are used to ensure this, but it is
    sufficient to emit the 64-bit entrypoint 0x200 bytes after the 32-bit
    one, wherever it happens to reside. This allows this code (which is now
    EFI mixed mode specific) to be moved into efi_mixed.S and out of the
    startup code in head_64.S.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-6-ardb@kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1f3fd81 View commit details
    Browse the repository at this point in the history
  184. x86/efistub: Clear BSS in EFI handover protocol entrypoint

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit d7156b9 upstream ]
    
    The so-called EFI handover protocol is value-add from the distros that
    permits a loader to simply copy a PE kernel image into memory and call
    an alternative entrypoint that is described by an embedded boot_params
    structure.
    
    Most implementations of this protocol do not bother to check the PE
    header for minimum alignment, section placement, etc, and therefore also
    don't clear the image's BSS, or even allocate enough memory for it.
    
    Allocating more memory on the fly is rather difficult, but at least
    clear the BSS region explicitly when entering in this manner, so that
    the EFI stub code does not get confused by global variables that were
    not zero-initialized correctly.
    
    When booting in mixed mode, this BSS clearing must occur before any
    global state is created, so clear it in the 32-bit asm entry point.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-7-ardb@kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    34378d7 View commit details
    Browse the repository at this point in the history
  185. efi/libstub: Add memory attribute protocol definitions

    From: Evgeniy Baskov <baskov@ispras.ru>
    
    [ Commit 79729f2 upstream ]
    
    EFI_MEMORY_ATTRIBUTE_PROTOCOL servers as a better alternative to
    DXE services for setting memory attributes in EFI Boot Services
    environment. This protocol is better since it is a part of UEFI
    specification itself and not UEFI PI specification like DXE
    services.
    
    Add EFI_MEMORY_ATTRIBUTE_PROTOCOL definitions.
    Support mixed mode properly for its calls.
    
    Tested-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Evgeniy Baskov <baskov@ispras.ru>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8ff6d88 View commit details
    Browse the repository at this point in the history
  186. efi/libstub: Add limit argument to efi_random_alloc()

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit bc5ddce upstream ]
    
    x86 will need to limit the kernel memory allocation to the lowest 512
    MiB of memory, to match the behavior of the existing bare metal KASLR
    physical randomization logic. So in preparation for that, add a limit
    parameter to efi_random_alloc() and wire it up.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-22-ardb@kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    476a48c View commit details
    Browse the repository at this point in the history
  187. x86/efistub: Perform 4/5 level paging switch from the stub

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit cb380000dd23cbbf8bd7d023b51896804c1f7e68 upstream ]
    
    In preparation for updating the EFI stub boot flow to avoid the bare
    metal decompressor code altogether, implement the support code for
    switching between 4 and 5 levels of paging before jumping to the kernel
    proper.
    
    This reuses the newly refactored trampoline that the bare metal
    decompressor uses, but relies on EFI APIs to allocate 32-bit addressable
    memory and remap it with the appropriate permissions. Given that the
    bare metal decompressor will no longer call into the trampoline if the
    number of paging levels is already set correctly, it is no longer needed
    to remove NX restrictions from the memory range where this trampoline
    may end up.
    
    Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    350265a View commit details
    Browse the repository at this point in the history
  188. x86/decompressor: Factor out kernel decompression and relocation

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit 8338151 upstream ]
    
    Factor out the decompressor sequence that invokes the decompressor,
    parses the ELF and applies the relocations so that it can be called
    directly from the EFI stub.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-21-ardb@kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    5a66458 View commit details
    Browse the repository at this point in the history
  189. x86/efistub: Prefer EFI memory attributes protocol over DXE services

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit 1107887 upstream ]
    
    Currently, the EFI stub relies on DXE services in some cases to clear
    non-execute restrictions from page allocations that need to be
    executable. This is dodgy, because DXE services are not specified by
    UEFI but by PI, and they are not intended for consumption by OS loaders.
    However, no alternative existed at the time.
    
    Now, there is a new UEFI protocol that should be used instead, so if it
    exists, prefer it over the DXE services calls.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-18-ardb@kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    77330c1 View commit details
    Browse the repository at this point in the history
  190. x86/efistub: Perform SNP feature test while running in the firmware

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit 31c77a5 upstream ]
    
    Before refactoring the EFI stub boot flow to avoid the legacy bare metal
    decompressor, duplicate the SNP feature check in the EFI stub before
    handing over to the kernel proper.
    
    The SNP feature check can be performed while running under the EFI boot
    services, which means it can force the boot to fail gracefully and
    return an error to the bootloader if the loaded kernel does not
    implement support for all the features that the hypervisor enabled.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-23-ardb@kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    fff7614 View commit details
    Browse the repository at this point in the history
  191. x86/efistub: Avoid legacy decompressor when doing EFI boot

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit a1b87d5 upstream ]
    
    The bare metal decompressor code was never really intended to run in a
    hosted environment such as the EFI boot services, and does a few things
    that are becoming problematic in the context of EFI boot now that the
    logo requirements are getting tighter: EFI executables will no longer be
    allowed to consist of a single executable section that is mapped with
    read, write and execute permissions if they are intended for use in a
    context where Secure Boot is enabled (and where Microsoft's set of
    certificates is used, i.e., every x86 PC built to run Windows).
    
    To avoid stepping on reserved memory before having inspected the E820
    tables, and to ensure the correct placement when running a kernel build
    that is non-relocatable, the bare metal decompressor moves its own
    executable image to the end of the allocation that was reserved for it,
    in order to perform the decompression in place. This means the region in
    question requires both write and execute permissions, which either need
    to be given upfront (which EFI will no longer permit), or need to be
    applied on demand using the existing page fault handling framework.
    
    However, the physical placement of the kernel is usually randomized
    anyway, and even if it isn't, a dedicated decompression output buffer
    can be allocated anywhere in memory using EFI APIs when still running in
    the boot services, given that EFI support already implies a relocatable
    kernel. This means that decompression in place is never necessary, nor
    is moving the compressed image from one end to the other.
    
    Since EFI already maps all of memory 1:1, it is also unnecessary to
    create new page tables or handle page faults when decompressing the
    kernel. That means there is also no need to replace the special
    exception handlers for SEV. Generally, there is little need to do
    any of the things that the decompressor does beyond
    
    - initialize SEV encryption, if needed,
    - perform the 4/5 level paging switch, if needed,
    - decompress the kernel
    - relocate the kernel
    
    So do all of this from the EFI stub code, and avoid the bare metal
    decompressor altogether.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-24-ardb@kernel.org
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2dfaeac View commit details
    Browse the repository at this point in the history
  192. efi/x86: Avoid physical KASLR on older Dell systems

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit 50d7cdf upstream ]
    
    River reports boot hangs with v6.6 and v6.7, and the bisect points to
    commit
    
      a1b87d5 ("x86/efistub: Avoid legacy decompressor when doing EFI boot")
    
    which moves the memory allocation and kernel decompression from the
    legacy decompressor (which executes *after* ExitBootServices()) to the
    EFI stub, using boot services for allocating the memory. The memory
    allocation succeeds but the subsequent call to decompress_kernel() never
    returns, resulting in a failed boot and a hanging system.
    
    As it turns out, this issue only occurs when physical address
    randomization (KASLR) is enabled, and given that this is a feature we
    can live without (virtual KASLR is much more important), let's disable
    the physical part of KASLR when booting on AMI UEFI firmware claiming to
    implement revision v2.0 of the specification (which was released in
    2006), as this is the version these systems advertise.
    
    Fixes: a1b87d5 ("x86/efistub: Avoid legacy decompressor when doing EFI boot")
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218173
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    1b54062 View commit details
    Browse the repository at this point in the history
  193. x86/efistub: Avoid placing the kernel below LOAD_PHYSICAL_ADDR

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit 2f77465 upstream ]
    
    The EFI stub's kernel placement logic randomizes the physical placement
    of the kernel by taking all available memory into account, and picking a
    region at random, based on a random seed.
    
    When KASLR is disabled, this seed is set to 0x0, and this results in the
    lowest available region of memory to be selected for loading the kernel,
    even if this is below LOAD_PHYSICAL_ADDR. Some of this memory is
    typically reserved for the GFP_DMA region, to accommodate masters that
    can only access the first 16 MiB of system memory.
    
    Even if such devices are rare these days, we may still end up with a
    warning in the kernel log, as reported by Tom:
    
     swapper/0: page allocation failure: order:10, mode:0xcc1(GFP_KERNEL|GFP_DMA), nodemask=(null),cpuset=/,mems_allowed=0
    
    Fix this by tweaking the random allocation logic to accept a low bound
    on the placement, and set it to LOAD_PHYSICAL_ADDR.
    
    Fixes: a1b87d5 ("x86/efistub: Avoid legacy decompressor when doing EFI boot")
    Reported-by: Tom Englund <tomenglund26@gmail.com>
    Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218404
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    86c909d View commit details
    Browse the repository at this point in the history
  194. x86/boot: Rename conflicting 'boot_params' pointer to 'boot_params_ptr'

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit b9e909f78e7e4b826f318cfe7bedf3ce229920e6 upstream ]
    
    The x86 decompressor is built and linked as a separate executable, but
    it shares components with the kernel proper, which are either #include'd
    as C files, or linked into the decompresor as a static library (e.g, the
    EFI stub)
    
    Both the kernel itself and the decompressor define a global symbol
    'boot_params' to refer to the boot_params struct, but in the former
    case, it refers to the struct directly, whereas in the decompressor, it
    refers to a global pointer variable referring to the struct boot_params
    passed by the bootloader or constructed from scratch.
    
    This ambiguity is unfortunate, and makes it impossible to assign this
    decompressor variable from the x86 EFI stub, given that declaring it as
    extern results in a clash. So rename the decompressor version (whose
    scope is limited) to boot_params_ptr.
    
    [ mingo: Renamed 'boot_params_p' to 'boot_params_ptr' for clarity ]
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8f05493 View commit details
    Browse the repository at this point in the history
  195. x86/boot: efistub: Assign global boot_params variable

    From: Ard Biesheuvel <ardb@kernel.org>
    
    [ Commit 50dcc2e upstream ]
    
    Now that the x86 EFI stub calls into some APIs exposed by the
    decompressor (e.g., kaslr_get_random_long()), it is necessary to ensure
    that the global boot_params variable is set correctly before doing so.
    
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    3a396c4 View commit details
    Browse the repository at this point in the history
  196. efi/x86: Fix the missing KASLR_FLAG bit in boot_params->hdr.loadflags

    From: Yuntao Wang <ytcoode@gmail.com>
    
    [ Commit 0163843 upstream ]
    
    When KASLR is enabled, the KASLR_FLAG bit in boot_params->hdr.loadflags
    should be set to 1 to propagate KASLR status from compressed kernel to
    kernel, just as the choose_random_location() function does.
    
    Currently, when the kernel is booted via the EFI stub, the KASLR_FLAG
    bit in boot_params->hdr.loadflags is not set, even though it should be.
    This causes some functions, such as kernel_randomize_memory(), not to
    execute as expected. Fix it.
    
    Fixes: a1b87d5 ("x86/efistub: Avoid legacy decompressor when doing EFI boot")
    Signed-off-by: Yuntao Wang <ytcoode@gmail.com>
    [ardb: drop 'else' branch clearing KASLR_FLAG]
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Ard Biesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2402392 View commit details
    Browse the repository at this point in the history
  197. af_unix: Drop oob_skb ref before purging queue in GC.

    commit aa82ac5 upstream.
    
    syzbot reported another task hung in __unix_gc().  [0]
    
    The current while loop assumes that all of the left candidates
    have oob_skb and calling kfree_skb(oob_skb) releases the remaining
    candidates.
    
    However, I missed a case that oob_skb has self-referencing fd and
    another fd and the latter sk is placed before the former in the
    candidate list.  Then, the while loop never proceeds, resulting
    the task hung.
    
    __unix_gc() has the same loop just before purging the collected skb,
    so we can call kfree_skb(oob_skb) there and let __skb_queue_purge()
    release all inflight sockets.
    
    [0]:
    Sending NMI from CPU 0 to CPUs 1:
    NMI backtrace for cpu 1
    CPU: 1 PID: 2784 Comm: kworker/u4:8 Not tainted 6.8.0-rc4-syzkaller-01028-g71b605d32017 #0
    Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
    Workqueue: events_unbound __unix_gc
    RIP: 0010:__sanitizer_cov_trace_pc+0x0/0x70 kernel/kcov.c:200
    Code: 89 fb e8 23 00 00 00 48 8b 3d 84 f5 1a 0c 48 89 de 5b e9 43 26 57 00 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 <f3> 0f 1e fa 48 8b 04 24 65 48 8b 0d 90 52 70 7e 65 8b 15 91 52 70
    RSP: 0018:ffffc9000a17fa78 EFLAGS: 00000287
    RAX: ffffffff8a0a6108 RBX: ffff88802b6c2640 RCX: ffff88802c0b3b80
    RDX: 0000000000000000 RSI: 0000000000000002 RDI: 0000000000000000
    RBP: ffffc9000a17fbf0 R08: ffffffff89383f1d R09: 1ffff1100ee5ff84
    R10: dffffc0000000000 R11: ffffed100ee5ff85 R12: 1ffff110056d84ee
    R13: ffffc9000a17fae0 R14: 0000000000000000 R15: ffffffff8f47b840
    FS:  0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
    CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    CR2: 00007ffef5687ff8 CR3: 0000000029b34000 CR4: 00000000003506f0
    DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
    DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
    Call Trace:
     <NMI>
     </NMI>
     <TASK>
     __unix_gc+0xe69/0xf40 net/unix/garbage.c:343
     process_one_work kernel/workqueue.c:2633 [inline]
     process_scheduled_works+0x913/0x1420 kernel/workqueue.c:2706
     worker_thread+0xa5f/0x1000 kernel/workqueue.c:2787
     kthread+0x2ef/0x390 kernel/kthread.c:388
     ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
     ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:242
     </TASK>
    
    Reported-and-tested-by: syzbot+ecab4d36f920c3574bf9@syzkaller.appspotmail.com
    Closes: https://syzkaller.appspot.com/bug?extid=ecab4d36f920c3574bf9
    Fixes: 25236c9 ("af_unix: Fix task hung while purging oob_skb in GC.")
    Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    q2ven authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c4c795b View commit details
    Browse the repository at this point in the history
  198. phy: freescale: phy-fsl-imx8-mipi-dphy: Fix alias name to use dashes

    [ Upstream commit 7936378 ]
    
    Devicetree spec lists only dashes as valid characters for alias names.
    Table 3.2: Valid characters for alias names, Devicee Specification,
    Release v0.4
    
    Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
    Fixes: 3fbae28 ("phy: freescale: phy-fsl-imx8-mipi-dphy: Add i.MX8qxp LVDS PHY mode support")
    Link: https://lore.kernel.org/r/20240110093343.468810-1-alexander.stein@ew.tq-group.com
    Signed-off-by: Vinod Koul <vkoul@kernel.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    tq-steina authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2c96f66 View commit details
    Browse the repository at this point in the history
  199. powerpc/pseries/iommu: IOMMU table is not initialized for kdump over …

    …SR-IOV
    
    [ Upstream commit 09a3c1e ]
    
    When kdump kernel tries to copy dump data over SR-IOV, LPAR panics due
    to NULL pointer exception:
    
      Kernel attempted to read user page (0) - exploit attempt? (uid: 0)
      BUG: Kernel NULL pointer dereference on read at 0x00000000
      Faulting instruction address: 0xc000000020847ad4
      Oops: Kernel access of bad area, sig: 11 [#1]
      LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
      Modules linked in: mlx5_core(+) vmx_crypto pseries_wdt papr_scm libnvdimm mlxfw tls psample sunrpc fuse overlay squashfs loop
      CPU: 12 PID: 315 Comm: systemd-udevd Not tainted 6.4.0-Test102+ raspberrypi#12
      Hardware name: IBM,9080-HEX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NH1060_008) hv:phyp pSeries
      NIP:  c000000020847ad4 LR: c00000002083b2dc CTR: 00000000006cd18c
      REGS: c000000029162ca0 TRAP: 0300   Not tainted  (6.4.0-Test102+)
      MSR:  800000000280b033 <SF,VEC,VSX,EE,FP,ME,IR,DR,RI,LE>  CR: 48288244  XER: 00000008
      CFAR: c00000002083b2d8 DAR: 0000000000000000 DSISR: 40000000 IRQMASK: 1
      ...
      NIP _find_next_zero_bit+0x24/0x110
      LR  bitmap_find_next_zero_area_off+0x5c/0xe0
      Call Trace:
        dev_printk_emit+0x38/0x48 (unreliable)
        iommu_area_alloc+0xc4/0x180
        iommu_range_alloc+0x1e8/0x580
        iommu_alloc+0x60/0x130
        iommu_alloc_coherent+0x158/0x2b0
        dma_iommu_alloc_coherent+0x3c/0x50
        dma_alloc_attrs+0x170/0x1f0
        mlx5_cmd_init+0xc0/0x760 [mlx5_core]
        mlx5_function_setup+0xf0/0x510 [mlx5_core]
        mlx5_init_one+0x84/0x210 [mlx5_core]
        probe_one+0x118/0x2c0 [mlx5_core]
        local_pci_probe+0x68/0x110
        pci_call_probe+0x68/0x200
        pci_device_probe+0xbc/0x1a0
        really_probe+0x104/0x540
        __driver_probe_device+0xb4/0x230
        driver_probe_device+0x54/0x130
        __driver_attach+0x158/0x2b0
        bus_for_each_dev+0xa8/0x130
        driver_attach+0x34/0x50
        bus_add_driver+0x16c/0x300
        driver_register+0xa4/0x1b0
        __pci_register_driver+0x68/0x80
        mlx5_init+0xb8/0x100 [mlx5_core]
        do_one_initcall+0x60/0x300
        do_init_module+0x7c/0x2b0
    
    At the time of LPAR dump, before kexec hands over control to kdump
    kernel, DDWs (Dynamic DMA Windows) are scanned and added to the FDT.
    For the SR-IOV case, default DMA window "ibm,dma-window" is removed from
    the FDT and DDW added, for the device.
    
    Now, kexec hands over control to the kdump kernel.
    
    When the kdump kernel initializes, PCI busses are scanned and IOMMU
    group/tables created, in pci_dma_bus_setup_pSeriesLP(). For the SR-IOV
    case, there is no "ibm,dma-window". The original commit: b1fc44e,
    fixes the path where memory is pre-mapped (direct mapped) to the DDW.
    When TCEs are direct mapped, there is no need to initialize IOMMU
    tables.
    
    iommu_table_setparms_lpar() only considers "ibm,dma-window" property
    when initiallizing IOMMU table. In the scenario where TCEs are
    dynamically allocated for SR-IOV, newly created IOMMU table is not
    initialized. Later, when the device driver tries to enter TCEs for the
    SR-IOV device, NULL pointer execption is thrown from iommu_area_alloc().
    
    The fix is to initialize the IOMMU table with DDW property stored in the
    FDT. There are 2 points to remember:
    
    	1. For the dedicated adapter, kdump kernel would encounter both
    	   default and DDW in FDT. In this case, DDW property is used to
    	   initialize the IOMMU table.
    
    	2. A DDW could be direct or dynamic mapped. kdump kernel would
    	   initialize IOMMU table and mark the existing DDW as
    	   "dynamic". This works fine since, at the time of table
    	   initialization, iommu_table_clear() makes some space in the
    	   DDW, for some predefined number of TCEs which are needed for
    	   kdump to succeed.
    
    Fixes: b1fc44e ("pseries/iommu/ddw: Fix kdump to work in absence of ibm,dma-window")
    Signed-off-by: Gaurav Batra <gbatra@linux.vnet.ibm.com>
    Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
    Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
    Link: https://msgid.link/20240125203017.61014-1-gbatra@linux.ibm.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Gaurav Batra authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    7eb95e0 View commit details
    Browse the repository at this point in the history
  200. gpio: 74x164: Enable output pins after registers are reset

    [ Upstream commit 530b1db ]
    
    Chip outputs are enabled[1] before actual reset is performed[2] which might
    cause pin output value to flip flop if previous pin value was set to 1.
    Fix that behavior by making sure chip is fully reset before all outputs are
    enabled.
    
    Flip-flop can be noticed when module is removed and inserted again and one of
    the pins was changed to 1 before removal. 100 microsecond flipping is
    noticeable on oscilloscope (100khz SPI bus).
    
    For a properly reset chip - output is enabled around 100 microseconds (on 100khz
    SPI bus) later during probing process hence should be irrelevant behavioral
    change.
    
    Fixes: 7ebc194 (gpio: 74x164: Introduce 'enable-gpios' property)
    Link: https://elixir.bootlin.com/linux/v6.7.4/source/drivers/gpio/gpio-74x164.c#L130 [1]
    Link: https://elixir.bootlin.com/linux/v6.7.4/source/drivers/gpio/gpio-74x164.c#L150 [2]
    Signed-off-by: Arturas Moskvinas <arturas.moskvinas@gmail.com>
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    artms authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    a3d369a View commit details
    Browse the repository at this point in the history
  201. gpiolib: Fix the error path order in gpiochip_add_data_with_key()

    [ Upstream commit e4aec4d ]
    
    After shuffling the code, error path wasn't updated correctly.
    Fix it here.
    
    Fixes: 2f4133b ("gpiolib: No need to call gpiochip_remove_pin_ranges() twice")
    Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    andy-shev authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    17acece View commit details
    Browse the repository at this point in the history
  202. gpio: fix resource unwinding order in error path

    [ Upstream commit ec5c54a ]
    
    Hogs are added *after* ACPI so should be removed *before* in error path.
    
    Fixes: a411e81 ("gpiolib: add hogs support for machine code")
    Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
    Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Bartosz Golaszewski authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    c6ff5fb View commit details
    Browse the repository at this point in the history
  203. block: define bvec_iter as __packed __aligned(4)

    [ Upstream commit 7838b46 ]
    
    In commit 1941612 ("block: define 'struct bvec_iter' as packed"),
    what we need is to save the 4byte padding, and avoid `bio` to spread on
    one extra cache line.
    
    It is enough to define it as '__packed __aligned(4)', as '__packed'
    alone means byte aligned, and can cause compiler to generate horrible
    code on architectures that don't support unaligned access in case that
    bvec_iter is embedded in other structures.
    
    Cc: Mikulas Patocka <mpatocka@redhat.com>
    Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
    Fixes: 1941612 ("block: define 'struct bvec_iter' as packed")
    Signed-off-by: Ming Lei <ming.lei@redhat.com>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    Ming Lei authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    0e351d1 View commit details
    Browse the repository at this point in the history
  204. Revert "interconnect: Fix locking for runpm vs reclaim"

    This reverts commit ee42bfc which is
    commit af42269 upstream.
    
    It is reported to cause boot crashes in Android systems, so revert it
    from the stable trees for now.
    
    Cc: Rob Clark <robdclark@chromium.org>
    Cc: Georgi Djakov <djakov@kernel.org>
    Cc: Sasha Levin <sashal@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    19ec82b View commit details
    Browse the repository at this point in the history
  205. Revert "interconnect: Teach lockdep about icc_bw_lock order"

    This reverts commit 0db211e which is
    commit 1361917 upstream.
    
    It is reported to cause boot crashes in Android systems, so revert it
    from the stable trees for now.
    
    Cc: Rob Clark <robdclark@chromium.org>
    Cc: Georgi Djakov <djakov@kernel.org>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Cc: Jon Hunter <jonathanh@nvidia.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    559035e View commit details
    Browse the repository at this point in the history
  206. x86/bugs: Add asm helpers for executing VERW

    commit baf8361 upstream.
    
    MDS mitigation requires clearing the CPU buffers before returning to
    user. This needs to be done late in the exit-to-user path. Current
    location of VERW leaves a possibility of kernel data ending up in CPU
    buffers for memory accesses done after VERW such as:
    
      1. Kernel data accessed by an NMI between VERW and return-to-user can
         remain in CPU buffers since NMI returning to kernel does not
         execute VERW to clear CPU buffers.
      2. Alyssa reported that after VERW is executed,
         CONFIG_GCC_PLUGIN_STACKLEAK=y scrubs the stack used by a system
         call. Memory accesses during stack scrubbing can move kernel stack
         contents into CPU buffers.
      3. When caller saved registers are restored after a return from
         function executing VERW, the kernel stack accesses can remain in
         CPU buffers(since they occur after VERW).
    
    To fix this VERW needs to be moved very late in exit-to-user path.
    
    In preparation for moving VERW to entry/exit asm code, create macros
    that can be used in asm. Also make VERW patching depend on a new feature
    flag X86_FEATURE_CLEAR_CPU_BUF.
    
      [pawan: - Runtime patch jmp instead of verw in macro CLEAR_CPU_BUFFERS
    	    due to lack of relative addressing support for relocations
    	    in kernels < v6.5.
    	  - Add UNWIND_HINT_EMPTY to avoid warning:
    	    arch/x86/entry/entry.o: warning: objtool: mds_verw_sel+0x0: unreachable instruction]
    
    Reported-by: Alyssa Milburn <alyssa.milburn@intel.com>
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Suggested-by: Peter Zijlstra <peterz@infradead.org>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Link: https://lore.kernel.org/all/20240213-delay-verw-v8-1-a6216d83edb7%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    pa1gupta authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    29d3e02 View commit details
    Browse the repository at this point in the history
  207. x86/entry_64: Add VERW just before userspace transition

    commit 3c75017 upstream.
    
    Mitigation for MDS is to use VERW instruction to clear any secrets in
    CPU Buffers. Any memory accesses after VERW execution can still remain
    in CPU buffers. It is safer to execute VERW late in return to user path
    to minimize the window in which kernel data can end up in CPU buffers.
    There are not many kernel secrets to be had after SWITCH_TO_USER_CR3.
    
    Add support for deploying VERW mitigation after user register state is
    restored. This helps minimize the chances of kernel data ending up into
    CPU buffers after executing VERW.
    
    Note that the mitigation at the new location is not yet enabled.
    
      Corner case not handled
      =======================
      Interrupts returning to kernel don't clear CPUs buffers since the
      exit-to-user path is expected to do that anyways. But, there could be
      a case when an NMI is generated in kernel after the exit-to-user path
      has cleared the buffers. This case is not handled and NMI returning to
      kernel don't clear CPU buffers because:
    
      1. It is rare to get an NMI after VERW, but before returning to user.
      2. For an unprivileged user, there is no known way to make that NMI
         less rare or target it.
      3. It would take a large number of these precisely-timed NMIs to mount
         an actual attack.  There's presumably not enough bandwidth.
      4. The NMI in question occurs after a VERW, i.e. when user state is
         restored and most interesting data is already scrubbed. Whats left
         is only the data that NMI touches, and that may or may not be of
         any interest.
    
      [ pawan: resolved conflict for hunk swapgs_restore_regs_and_return_to_usermode in backport ]
    
    Suggested-by: Dave Hansen <dave.hansen@intel.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Link: https://lore.kernel.org/all/20240213-delay-verw-v8-2-a6216d83edb7%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    pa1gupta authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    22444d0 View commit details
    Browse the repository at this point in the history
  208. x86/entry_32: Add VERW just before userspace transition

    commit a0e2dab upstream.
    
    As done for entry_64, add support for executing VERW late in exit to
    user path for 32-bit mode.
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Link: https://lore.kernel.org/all/20240213-delay-verw-v8-3-a6216d83edb7%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    pa1gupta authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2e30875 View commit details
    Browse the repository at this point in the history
  209. x86/bugs: Use ALTERNATIVE() instead of mds_user_clear static key

    commit 6613d82 upstream.
    
    The VERW mitigation at exit-to-user is enabled via a static branch
    mds_user_clear. This static branch is never toggled after boot, and can
    be safely replaced with an ALTERNATIVE() which is convenient to use in
    asm.
    
    Switch to ALTERNATIVE() to use the VERW mitigation late in exit-to-user
    path. Also remove the now redundant VERW in exc_nmi() and
    arch_exit_to_user_mode().
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Link: https://lore.kernel.org/all/20240213-delay-verw-v8-4-a6216d83edb7%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    pa1gupta authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    07946d9 View commit details
    Browse the repository at this point in the history
  210. KVM/VMX: Use BT+JNC, i.e. EFLAGS.CF to select VMRESUME vs. VMLAUNCH

    From: Sean Christopherson <seanjc@google.com>
    
    commit 706a189 upstream.
    
    Use EFLAGS.CF instead of EFLAGS.ZF to track whether to use VMRESUME versus
    VMLAUNCH.  Freeing up EFLAGS.ZF will allow doing VERW, which clobbers ZF,
    for MDS mitigations as late as possible without needing to duplicate VERW
    for both paths.
    
      [ pawan: resolved merge conflict in __vmx_vcpu_run in backport. ]
    
    Signed-off-by: Sean Christopherson <seanjc@google.com>
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
    Link: https://lore.kernel.org/all/20240213-delay-verw-v8-5-a6216d83edb7%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    pa1gupta authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    edfaad3 View commit details
    Browse the repository at this point in the history
  211. KVM/VMX: Move VERW closer to VMentry for MDS mitigation

    commit 43fb862 upstream.
    
    During VMentry VERW is executed to mitigate MDS. After VERW, any memory
    access like register push onto stack may put host data in MDS affected
    CPU buffers. A guest can then use MDS to sample host data.
    
    Although likelihood of secrets surviving in registers at current VERW
    callsite is less, but it can't be ruled out. Harden the MDS mitigation
    by moving the VERW mitigation late in VMentry path.
    
    Note that VERW for MMIO Stale Data mitigation is unchanged because of
    the complexity of per-guest conditional VERW which is not easy to handle
    that late in asm with no GPRs available. If the CPU is also affected by
    MDS, VERW is unconditionally executed late in asm regardless of guest
    having MMIO access.
    
      [ pawan: conflict resolved in backport ]
    
    Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Acked-by: Sean Christopherson <seanjc@google.com>
    Link: https://lore.kernel.org/all/20240213-delay-verw-v8-6-a6216d83edb7%40linux.intel.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    pa1gupta authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    da67116 View commit details
    Browse the repository at this point in the history
  212. bpf: Add table ID to bpf_fib_lookup BPF helper

    commit 8ad77e7 upstream.
    
    Add ability to specify routing table ID to the `bpf_fib_lookup` BPF
    helper.
    
    A new field `tbid` is added to `struct bpf_fib_lookup` used as
    parameters to the `bpf_fib_lookup` BPF helper.
    
    When the helper is called with the `BPF_FIB_LOOKUP_DIRECT` and
    `BPF_FIB_LOOKUP_TBID` flags the `tbid` field in `struct bpf_fib_lookup`
    will be used as the table ID for the fib lookup.
    
    If the `tbid` does not exist the fib lookup will fail with
    `BPF_FIB_LKUP_RET_NOT_FWDED`.
    
    The `tbid` field becomes a union over the vlan related output fields
    in `struct bpf_fib_lookup` and will be zeroed immediately after usage.
    
    This functionality is useful in containerized environments.
    
    For instance, if a CNI wants to dictate the next-hop for traffic leaving
    a container it can create a container-specific routing table and perform
    a fib lookup against this table in a "host-net-namespace-side" TC program.
    
    This functionality also allows `ip rule` like functionality at the TC
    layer, allowing an eBPF program to pick a routing table based on some
    aspect of the sk_buff.
    
    As a concrete use case, this feature will be used in Cilium's SRv6 L3VPN
    datapath.
    
    When egress traffic leaves a Pod an eBPF program attached by Cilium will
    determine which VRF the egress traffic should target, and then perform a
    FIB lookup in a specific table representing this VRF's FIB.
    
    Signed-off-by: Louis DeLosSantos <louis.delos.devel@gmail.com>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Link: https://lore.kernel.org/bpf/20230505-bpf-add-tbid-fib-lookup-v2-1-0a31c22c748c@gmail.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Louis DeLosSantos authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    5fafd82 View commit details
    Browse the repository at this point in the history
  213. bpf: Derive source IP addr via bpf_*_fib_lookup()

    commit dab4e1f upstream.
    
    Extend the bpf_fib_lookup() helper by making it to return the source
    IPv4/IPv6 address if the BPF_FIB_LOOKUP_SRC flag is set.
    
    For example, the following snippet can be used to derive the desired
    source IP address:
    
        struct bpf_fib_lookup p = { .ipv4_dst = ip4->daddr };
    
        ret = bpf_skb_fib_lookup(skb, p, sizeof(p),
                BPF_FIB_LOOKUP_SRC | BPF_FIB_LOOKUP_SKIP_NEIGH);
        if (ret != BPF_FIB_LKUP_RET_SUCCESS)
            return TC_ACT_SHOT;
    
        /* the p.ipv4_src now contains the source address */
    
    The inability to derive the proper source address may cause malfunctions
    in BPF-based dataplanes for hosts containing netdevs with more than one
    routable IP address or for multi-homed hosts.
    
    For example, Cilium implements packet masquerading in BPF. If an
    egressing netdev to which the Cilium's BPF prog is attached has
    multiple IP addresses, then only one [hardcoded] IP address can be used for
    masquerading. This breaks connectivity if any other IP address should have
    been selected instead, for example, when a public and private addresses
    are attached to the same egress interface.
    
    The change was tested with Cilium [1].
    
    Nikolay Aleksandrov helped to figure out the IPv6 addr selection.
    
    [1]: cilium/cilium#28283
    
    Signed-off-by: Martynas Pumputis <m@lambda.lt>
    Link: https://lore.kernel.org/r/20231007081415.33502-2-m@lambda.lt
    Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
    Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    brb authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    2d7ebcb View commit details
    Browse the repository at this point in the history
  214. x86/efistub: Give up if memory attribute protocol returns an error

    commit a7a6a01 upstream.
    
    The recently introduced EFI memory attributes protocol should be used
    if it exists to ensure that the memory allocation created for the kernel
    permits execution. This is needed for compatibility with tightened
    requirements related to Windows logo certification for x86 PCs.
    
    Currently, we simply strip the execute protect (XP) attribute from the
    entire range, but this might be rejected under some firmware security
    policies, and so in a subsequent patch, this will be changed to only
    strip XP from the executable region that runs early, and make it
    read-only (RO) as well.
    
    In order to catch any issues early, ensure that the memory attribute
    protocol works as intended, and give up if it produces spurious errors.
    
    Note that the DXE services based fallback was always based on best
    effort, so don't propagate any errors returned by that API.
    
    Fixes: a1b87d5 ("x86/efistub: Avoid legacy decompressor when doing EFI boot")
    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ardbiesheuvel authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    8866334 View commit details
    Browse the repository at this point in the history
  215. xen/events: close evtchn after mapping cleanup

    commit fa765c4 upstream.
    
    shutdown_pirq and startup_pirq are not taking the
    irq_mapping_update_lock because they can't due to lock inversion. Both
    are called with the irq_desc->lock being taking. The lock order,
    however, is first irq_mapping_update_lock and then irq_desc->lock.
    
    This opens multiple races:
    - shutdown_pirq can be interrupted by a function that allocates an event
      channel:
    
      CPU0                        CPU1
      shutdown_pirq {
        xen_evtchn_close(e)
                                  __startup_pirq {
                                    EVTCHNOP_bind_pirq
                                      -> returns just freed evtchn e
                                    set_evtchn_to_irq(e, irq)
                                  }
        xen_irq_info_cleanup() {
          set_evtchn_to_irq(e, -1)
        }
      }
    
      Assume here event channel e refers here to the same event channel
      number.
      After this race the evtchn_to_irq mapping for e is invalid (-1).
    
    - __startup_pirq races with __unbind_from_irq in a similar way. Because
      __startup_pirq doesn't take irq_mapping_update_lock it can grab the
      evtchn that __unbind_from_irq is currently freeing and cleaning up. In
      this case even though the event channel is allocated, its mapping can
      be unset in evtchn_to_irq.
    
    The fix is to first cleanup the mappings and then close the event
    channel. In this way, when an event channel gets allocated it's
    potential previous evtchn_to_irq mappings are guaranteed to be unset already.
    This is also the reverse order of the allocation where first the event
    channel is allocated and then the mappings are setup.
    
    On a 5.10 kernel prior to commit 3fcdaf3 ("xen/events: modify internal
    [un]bind interfaces"), we hit a BUG like the following during probing of NVMe
    devices. The issue is that during nvme_setup_io_queues, pci_free_irq
    is called for every device which results in a call to shutdown_pirq.
    With many nvme devices it's therefore likely to hit this race during
    boot because there will be multiple calls to shutdown_pirq and
    startup_pirq are running potentially in parallel.
    
      ------------[ cut here ]------------
      blkfront: xvda: barrier or flush: disabled; persistent grants: enabled; indirect descriptors: enabled; bounce buffer: enabled
      kernel BUG at drivers/xen/events/events_base.c:499!
      invalid opcode: 0000 [#1] SMP PTI
      CPU: 44 PID: 375 Comm: kworker/u257:23 Not tainted 5.10.201-191.748.amzn2.x86_64 #1
      Hardware name: Xen HVM domU, BIOS 4.11.amazon 08/24/2006
      Workqueue: nvme-reset-wq nvme_reset_work
      RIP: 0010:bind_evtchn_to_cpu+0xdf/0xf0
      Code: 5d 41 5e c3 cc cc cc cc 44 89 f7 e8 2b 55 ad ff 49 89 c5 48 85 c0 0f 84 64 ff ff ff 4c 8b 68 30 41 83 fe ff 0f 85 60 ff ff ff <0f> 0b 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 0f 1f 44 00 00
      RSP: 0000:ffffc9000d533b08 EFLAGS: 00010046
      RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
      RDX: 0000000000000028 RSI: 00000000ffffffff RDI: 00000000ffffffff
      RBP: ffff888107419680 R08: 0000000000000000 R09: ffffffff82d72b00
      R10: 0000000000000000 R11: 0000000000000000 R12: 00000000000001ed
      R13: 0000000000000000 R14: 00000000ffffffff R15: 0000000000000002
      FS:  0000000000000000(0000) GS:ffff88bc8b500000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000000 CR3: 0000000002610001 CR4: 00000000001706e0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
       ? show_trace_log_lvl+0x1c1/0x2d9
       ? show_trace_log_lvl+0x1c1/0x2d9
       ? set_affinity_irq+0xdc/0x1c0
       ? __die_body.cold+0x8/0xd
       ? die+0x2b/0x50
       ? do_trap+0x90/0x110
       ? bind_evtchn_to_cpu+0xdf/0xf0
       ? do_error_trap+0x65/0x80
       ? bind_evtchn_to_cpu+0xdf/0xf0
       ? exc_invalid_op+0x4e/0x70
       ? bind_evtchn_to_cpu+0xdf/0xf0
       ? asm_exc_invalid_op+0x12/0x20
       ? bind_evtchn_to_cpu+0xdf/0xf0
       ? bind_evtchn_to_cpu+0xc5/0xf0
       set_affinity_irq+0xdc/0x1c0
       irq_do_set_affinity+0x1d7/0x1f0
       irq_setup_affinity+0xd6/0x1a0
       irq_startup+0x8a/0xf0
       __setup_irq+0x639/0x6d0
       ? nvme_suspend+0x150/0x150
       request_threaded_irq+0x10c/0x180
       ? nvme_suspend+0x150/0x150
       pci_request_irq+0xa8/0xf0
       ? __blk_mq_free_request+0x74/0xa0
       queue_request_irq+0x6f/0x80
       nvme_create_queue+0x1af/0x200
       nvme_create_io_queues+0xbd/0xf0
       nvme_setup_io_queues+0x246/0x320
       ? nvme_irq_check+0x30/0x30
       nvme_reset_work+0x1c8/0x400
       process_one_work+0x1b0/0x350
       worker_thread+0x49/0x310
       ? process_one_work+0x350/0x350
       kthread+0x11b/0x140
       ? __kthread_bind_mask+0x60/0x60
       ret_from_fork+0x22/0x30
      Modules linked in:
      ---[ end trace a11715de1eee1873 ]---
    
    Fixes: d46a78b ("xen: implement pirq type event channels")
    Cc: stable@vger.kernel.org
    Co-debugged-by: Andrew Panyakin <apanyaki@amazon.com>
    Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Link: https://lore.kernel.org/r/20240124163130.31324-1-mheyne@amazon.de
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Signed-off-by: Maximilian Heyne <mheyne@amazon.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    heynemax authored and gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    585a344 View commit details
    Browse the repository at this point in the history
  216. Linux 6.1.81

    Link: https://lore.kernel.org/r/20240304211556.993132804@linuxfoundation.org
    Tested-by: SeongJae Park <sj@kernel.org>
    Tested-by: Ron Economos <re@w6rz.net>
    Tested-by: Salvatore Bonaccorso <carnil@debian.org>
    Tested-by: Jon Hunter <jonathanh@nvidia.com>
    Tested-by: Pavel Machek (CIP) <pavel@denx.de>
    Tested-by: Shuah Khan <skhan@linuxfoundation.org>
    Tested-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
    Tested-by: Florian Fainelli <florian.fainelli@broadcom.com>
    Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
    Tested-by: Yann Sionneau <ysionneau@kalrayinc.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    gregkh committed Mar 6, 2024
    Configuration menu
    Copy the full SHA
    61adba8 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2024

  1. Configuration menu
    Copy the full SHA
    f874d09 View commit details
    Browse the repository at this point in the history