Skip to content
  1. Jun 14, 2023
    • Tvrtko Ursulin's avatar
      drm/i915/selftests: Add some missing error propagation · 76eef453
      Tvrtko Ursulin authored
      
      
      [ Upstream commit 79d0150d ]
      
      Add some missing error propagation in live_parallel_switch.
      
      To avoid needlessly burdening the various backport processes, note I am
      not marking it as a fix against any patches and not copying stable since
      it is debug/selftests only code.
      
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Cc: Andi Shyti <andi.shyti@linux.intel.com>
      Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
      Fixes: 50d16d44 ("drm/i915/selftests: Exercise context switching in parallel")
      Fixes: 6407cf53 ("drm/i915/selftests: Stop using kthread_stop()")
      Link: https://patchwork.freedesktop.org/patch/msgid/20230605131135.396854-1-tvrtko.ursulin@linux.intel.com
      
      
      (cherry picked from commit 412fa1f0)
      Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      76eef453
    • Tvrtko Ursulin's avatar
      drm/i915/selftests: Stop using kthread_stop() · 4e7f1f6d
      Tvrtko Ursulin authored
      
      
      [ Upstream commit 6407cf53 ]
      
      Since a7c01fa9 ("signal: break out of wait loops on kthread_stop()")
      kthread_stop() started asserting a pending signal which wreaks havoc with
      a few of our selftests. Mainly because they are not fully expecting to
      handle signals, but also cutting the intended test runtimes short due
      signal_pending() now returning true (via __igt_timeout), which therefore
      breaks both the patterns of:
      
        kthread_run()
        ..sleep for igt_timeout_ms to allow test to exercise stuff..
        kthread_stop()
      
      And check for errors recorded in the thread.
      
      And also:
      
          Main thread  |   Test thread
        ---------------+------------------------------
        kthread_run()  |
        kthread_stop() |  do stuff until __igt_timeout
      		 |  -- exits early due signal --
      
      Where this kthread_stop() was assume would have a "join" semantics, which
      it would have had if not the new signal assertion issue.
      
      To recap, threads are now likely to catch a previously impossible
      ERESTARTSYS or EINTR, marking the test as failed, or have a pointlessly
      short run time.
      
      To work around this start using kthread_work(er) API which provides
      an explicit way of waiting for threads to exit. And for cases where
      parent controls the test duration we add explicit signaling which threads
      will now use instead of relying on kthread_should_stop().
      
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
      Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
      Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20221020130841.3845791-1-tvrtko.ursulin@linux.intel.com
      
      
      Stable-dep-of: 79d0150d ("drm/i915/selftests: Add some missing error propagation")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4e7f1f6d
    • Eric Dumazet's avatar
      net: sched: add rcu annotations around qdisc->qdisc_sleeping · 9d9a38b5
      Eric Dumazet authored
      
      
      [ Upstream commit d636fc5d ]
      
      syzbot reported a race around qdisc->qdisc_sleeping [1]
      
      It is time we add proper annotations to reads and writes to/from
      qdisc->qdisc_sleeping.
      
      [1]
      BUG: KCSAN: data-race in dev_graft_qdisc / qdisc_lookup_rcu
      
      read to 0xffff8881286fc618 of 8 bytes by task 6928 on cpu 1:
      qdisc_lookup_rcu+0x192/0x2c0 net/sched/sch_api.c:331
      __tcf_qdisc_find+0x74/0x3c0 net/sched/cls_api.c:1174
      tc_get_tfilter+0x18f/0x990 net/sched/cls_api.c:2547
      rtnetlink_rcv_msg+0x7af/0x8c0 net/core/rtnetlink.c:6386
      netlink_rcv_skb+0x126/0x220 net/netlink/af_netlink.c:2546
      rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6413
      netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
      netlink_unicast+0x56f/0x640 net/netlink/af_netlink.c:1365
      netlink_sendmsg+0x665/0x770 net/netlink/af_netlink.c:1913
      sock_sendmsg_nosec net/socket.c:724 [inline]
      sock_sendmsg net/socket.c:747 [inline]
      ____sys_sendmsg+0x375/0x4c0 net/socket.c:2503
      ___sys_sendmsg net/socket.c:2557 [inline]
      __sys_sendmsg+0x1e3/0x270 net/socket.c:2586
      __do_sys_sendmsg net/socket.c:2595 [inline]
      __se_sys_sendmsg net/socket.c:2593 [inline]
      __x64_sys_sendmsg+0x46/0x50 net/socket.c:2593
      do_syscall_x64 arch/x86/entry/common.c:50 [inline]
      do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      write to 0xffff8881286fc618 of 8 bytes by task 6912 on cpu 0:
      dev_graft_qdisc+0x4f/0x80 net/sched/sch_generic.c:1115
      qdisc_graft+0x7d0/0xb60 net/sched/sch_api.c:1103
      tc_modify_qdisc+0x712/0xf10 net/sched/sch_api.c:1693
      rtnetlink_rcv_msg+0x807/0x8c0 net/core/rtnetlink.c:6395
      netlink_rcv_skb+0x126/0x220 net/netlink/af_netlink.c:2546
      rtnetlink_rcv+0x1c/0x20 net/core/rtnetlink.c:6413
      netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
      netlink_unicast+0x56f/0x640 net/netlink/af_netlink.c:1365
      netlink_sendmsg+0x665/0x770 net/netlink/af_netlink.c:1913
      sock_sendmsg_nosec net/socket.c:724 [inline]
      sock_sendmsg net/socket.c:747 [inline]
      ____sys_sendmsg+0x375/0x4c0 net/socket.c:2503
      ___sys_sendmsg net/socket.c:2557 [inline]
      __sys_sendmsg+0x1e3/0x270 net/socket.c:2586
      __do_sys_sendmsg net/socket.c:2595 [inline]
      __se_sys_sendmsg net/socket.c:2593 [inline]
      __x64_sys_sendmsg+0x46/0x50 net/socket.c:2593
      do_syscall_x64 arch/x86/entry/common.c:50 [inline]
      do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 6912 Comm: syz-executor.5 Not tainted 6.4.0-rc3-syzkaller-00190-g0d85b27b0cc6 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/16/2023
      
      Fixes: 3a7d0d07 ("net: sched: extend Qdisc with rcu")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Vlad Buslov <vladbu@nvidia.com>
      Acked-by: default avatarJamal Hadi <Salim&lt;jhs@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9d9a38b5
    • Eric Dumazet's avatar
      rfs: annotate lockless accesses to RFS sock flow table · 8a74ea37
      Eric Dumazet authored
      
      
      [ Upstream commit 5c3b74a9 ]
      
      Add READ_ONCE()/WRITE_ONCE() on accesses to the sock flow table.
      
      This also prevents a (smart ?) compiler to remove the condition in:
      
      if (table->ents[index] != newval)
              table->ents[index] = newval;
      
      We need the condition to avoid dirtying a shared cache line.
      
      Fixes: fec5e652 ("rfs: Receive Flow Steering")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8a74ea37
    • Eric Dumazet's avatar
      rfs: annotate lockless accesses to sk->sk_rxhash · 3d9eface
      Eric Dumazet authored
      
      
      [ Upstream commit 1e5c647c ]
      
      Add READ_ONCE()/WRITE_ONCE() on accesses to sk->sk_rxhash.
      
      This also prevents a (smart ?) compiler to remove the condition in:
      
      if (sk->sk_rxhash != newval)
      	sk->sk_rxhash = newval;
      
      We need the condition to avoid dirtying a shared cache line.
      
      Fixes: fec5e652 ("rfs: Receive Flow Steering")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Reviewed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3d9eface
    • Eric Dumazet's avatar
      tcp: gso: really support BIG TCP · f8e6aa0e
      Eric Dumazet authored
      
      
      [ Upstream commit 82a01ab3 ]
      
      We missed that tcp_gso_segment() was assuming skb->len was smaller than 65535 :
      
      oldlen = (u16)~skb->len;
      
      This part came with commit 0718bcc0 ("[NET]: Fix CHECKSUM_HW GSO problems.")
      
      This leads to wrong TCP checksum.
      
      Adapt the code to accept arbitrary packet length.
      
      v2:
        - use two csum_add() instead of csum_fold() (Alexander Duyck)
        - Change delta type to __wsum to reduce casts (Alexander Duyck)
      
      Fixes: 09f3d1a3 ("ipv6/gso: remove temporary HBH/jumbo header")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
      Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
      Link: https://lore.kernel.org/r/20230605161647.3624428-1-edumazet@google.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f8e6aa0e
    • Kuniyuki Iwashima's avatar
      ipv6: rpl: Fix Route of Death. · 251b5d68
      Kuniyuki Iwashima authored
      [ Upstream commit a2f4c143 ]
      
      A remote DoS vulnerability of RPL Source Routing is assigned CVE-2023-2156.
      
      The Source Routing Header (SRH) has the following format:
      
        0                   1                   2                   3
        0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |  Next Header  |  Hdr Ext Len  | Routing Type  | Segments Left |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        | CmprI | CmprE |  Pad  |               Reserved                |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
        |                                                               |
        .                                                               .
        .                        Addresses[1..n]                        .
        .                                                               .
        |                                                               |
        +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      
      The originator of an SRH places the first hop's IPv6 address in the IPv6
      header's IPv6 Destination Address and the second hop's IPv6 address as
      the first address in Addresses[1..n].
      
      The CmprI and CmprE fields indicate the number of prefix octets that are
      shared with the IPv6 Destination Address.  When CmprI or CmprE is not 0,
      Addresses[1..n] are compressed as follows:
      
        1..n-1 : (16 - CmprI) bytes
             n : (16 - CmprE) bytes
      
      Segments Left indicates the number of route segments remaining.  When the
      value is not zero, the SRH is forwarded to the next hop.  Its address
      is extracted from Addresses[n - Segment Left + 1] and swapped with IPv6
      Destination Address.
      
      When Segment Left is greater than or equal to 2, the size of SRH is not
      changed because Addresses[1..n-1] are decompressed and recompressed with
      CmprI.
      
      OTOH, when Segment Left changes from 1 to 0, the new SRH could have a
      different size because Addresses[1..n-1] are decompressed with CmprI and
      recompressed with CmprE.
      
      Let's say CmprI is 15 and CmprE is 0.  When we receive SRH with Segment
      Left >= 2, Addresses[1..n-1] have 1 byte for each, and Addresses[n] has
      16 bytes.  When Segment Left is 1, Addresses[1..n-1] is decompressed to
      16 bytes and not recompressed.  Finally, the new SRH will need more room
      in the header, and the size is (16 - 1) * (n - 1) bytes.
      
      Here the max value of n is 255 as Segment Left is u8, so in the worst case,
      we have to allocate 3825 bytes in the skb headroom.  However, now we only
      allocate a small fixed buffer that is IPV6_RPL_SRH_WORST_SWAP_SIZE (16 + 7
      bytes).  If the decompressed size overflows the room, skb_push() hits BUG()
      below [0].
      
      Instead of allocating the fixed buffer for every packet, let's allocate
      enough headroom only when we receive SRH with Segment Left 1.
      
      [0]:
      skbuff: skb_under_panic: text:ffffffff81c9f6e2 len:576 put:576 head:ffff8880070b5180 data:ffff8880070b4fb0 tail:0x70 end:0x140 dev:lo
      kernel BUG at net/core/skbuff.c:200!
      invalid opcode: 0000 [#1] PREEMPT SMP PTI
      CPU: 0 PID: 154 Comm: python3 Not tainted 6.4.0-rc4-00190-gc308e9ec0047 #7
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      RIP: 0010:skb_panic (net/core/skbuff.c:200)
      Code: 4f 70 50 8b 87 bc 00 00 00 50 8b 87 b8 00 00 00 50 ff b7 c8 00 00 00 4c 8b 8f c0 00 00 00 48 c7 c7 80 6e 77 82 e8 ad 8b 60 ff <0f> 0b 66 66 2e 0f 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90
      RSP: 0018:ffffc90000003da0 EFLAGS: 00000246
      RAX: 0000000000000085 RBX: ffff8880058a6600 RCX: 0000000000000000
      RDX: 0000000000000000 RSI: ffff88807dc1c540 RDI: ffff88807dc1c540
      RBP: ffffc90000003e48 R08: ffffffff82b392c8 R09: 00000000ffffdfff
      R10: ffffffff82a592e0 R11: ffffffff82b092e0 R12: ffff888005b1c800
      R13: ffff8880070b51b8 R14: ffff888005b1ca18 R15: ffff8880070b5190
      FS:  00007f4539f0b740(0000) GS:ffff88807dc00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 000055670baf3000 CR3: 0000000005b0e000 CR4: 00000000007506f0
      PKRU: 55555554
      Call Trace:
       <IRQ>
       skb_push (net/core/skbuff.c:210)
       ipv6_rthdr_rcv (./include/linux/skbuff.h:2880 net/ipv6/exthdrs.c:634 net/ipv6/exthdrs.c:718)
       ip6_protocol_deliver_rcu (net/ipv6/ip6_input.c:437 (discriminator 5))
       ip6_input_finish (./include/linux/rcupdate.h:805 net/ipv6/ip6_input.c:483)
       __netif_receive_skb_one_core (net/core/dev.c:5494)
       process_backlog (./include/linux/rcupdate.h:805 net/core/dev.c:5934)
       __napi_poll (net/core/dev.c:6496)
       net_rx_action (net/core/dev.c:6565 net/core/dev.c:6696)
       __do_softirq (./arch/x86/include/asm/jump_label.h:27 ./include/linux/jump_label.h:207 ./include/trace/events/irq.h:142 kernel/softirq.c:572)
       do_softirq (kernel/softirq.c:472 kernel/softirq.c:459)
       </IRQ>
       <TASK>
       __local_bh_enable_ip (kernel/softirq.c:396)
       __dev_queue_xmit (net/core/dev.c:4272)
       ip6_finish_output2 (./include/net/neighbour.h:544 net/ipv6/ip6_output.c:134)
       rawv6_sendmsg (./include/net/dst.h:458 ./include/linux/netfilter.h:303 net/ipv6/raw.c:656 net/ipv6/raw.c:914)
       sock_sendmsg (net/socket.c:724 net/socket.c:747)
       __sys_sendto (net/socket.c:2144)
       __x64_sys_sendto (net/socket.c:2156 net/socket.c:2152 net/socket.c:2152)
       do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
       entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)
      RIP: 0033:0x7f453a138aea
      Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb b8 0f 1f 00 f3 0f 1e fa 41 89 ca 64 8b 04 25 18 00 00 00 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 7e c3 0f 1f 44 00 00 41 54 48 83 ec 30 44 89
      RSP: 002b:00007ffcc212a1c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
      RAX: ffffffffffffffda RBX: 00007ffcc212a288 RCX: 00007f453a138aea
      RDX: 0000000000000060 RSI: 00007f4539084c20 RDI: 0000000000000003
      RBP: 00007f4538308e80 R08: 00007ffcc212a300 R09: 000000000000001c
      R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
      R13: ffffffffc4653600 R14: 0000000000000001 R15: 00007f4539712d1b
       </TASK>
      Modules linked in:
      
      Fixes: 8610c7c6 ("net: ipv6: add support for rpl sr exthdr")
      Reported-by: Max VA
      Closes: https://www.interruptlabs.co.uk/articles/linux-ipv6-route-of-death
      
      
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20230605180617.67284-1-kuniyu@amazon.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      251b5d68
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: out-of-bound check in chain blob · 65f2def2
      Pablo Neira Ayuso authored
      
      
      [ Upstream commit 08e42a0d ]
      
      Add current size of rule expressions to the boundary check.
      
      Fixes: 2c865a8a ("netfilter: nf_tables: add rule blob layout")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      65f2def2
    • Kuniyuki Iwashima's avatar
      netfilter: ipset: Add schedule point in call_ad(). · fea199db
      Kuniyuki Iwashima authored
      
      
      [ Upstream commit 24e22789 ]
      
      syzkaller found a repro that causes Hung Task [0] with ipset.  The repro
      first creates an ipset and then tries to delete a large number of IPs
      from the ipset concurrently:
      
        IPSET_ATTR_IPADDR_IPV4 : 172.20.20.187
        IPSET_ATTR_CIDR        : 2
      
      The first deleting thread hogs a CPU with nfnl_lock(NFNL_SUBSYS_IPSET)
      held, and other threads wait for it to be released.
      
      Previously, the same issue existed in set->variant->uadt() that could run
      so long under ip_set_lock(set).  Commit 5e29dc36 ("netfilter: ipset:
      Rework long task execution when adding/deleting entries") tried to fix it,
      but the issue still exists in the caller with another mutex.
      
      While adding/deleting many IPs, we should release the CPU periodically to
      prevent someone from abusing ipset to hang the system.
      
      Note we need to increment the ipset's refcnt to prevent the ipset from
      being destroyed while rescheduling.
      
      [0]:
      INFO: task syz-executor174:268 blocked for more than 143 seconds.
            Not tainted 6.4.0-rc1-00145-gba79e9a73284 #1
      "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
      task:syz-executor174 state:D stack:0     pid:268   ppid:260    flags:0x0000000d
      Call trace:
       __switch_to+0x308/0x714 arch/arm64/kernel/process.c:556
       context_switch kernel/sched/core.c:5343 [inline]
       __schedule+0xd84/0x1648 kernel/sched/core.c:6669
       schedule+0xf0/0x214 kernel/sched/core.c:6745
       schedule_preempt_disabled+0x58/0xf0 kernel/sched/core.c:6804
       __mutex_lock_common kernel/locking/mutex.c:679 [inline]
       __mutex_lock+0x6fc/0xdb0 kernel/locking/mutex.c:747
       __mutex_lock_slowpath+0x14/0x20 kernel/locking/mutex.c:1035
       mutex_lock+0x98/0xf0 kernel/locking/mutex.c:286
       nfnl_lock net/netfilter/nfnetlink.c:98 [inline]
       nfnetlink_rcv_msg+0x480/0x70c net/netfilter/nfnetlink.c:295
       netlink_rcv_skb+0x1c0/0x350 net/netlink/af_netlink.c:2546
       nfnetlink_rcv+0x18c/0x199c net/netfilter/nfnetlink.c:658
       netlink_unicast_kernel net/netlink/af_netlink.c:1339 [inline]
       netlink_unicast+0x664/0x8cc net/netlink/af_netlink.c:1365
       netlink_sendmsg+0x6d0/0xa4c net/netlink/af_netlink.c:1913
       sock_sendmsg_nosec net/socket.c:724 [inline]
       sock_sendmsg net/socket.c:747 [inline]
       ____sys_sendmsg+0x4b8/0x810 net/socket.c:2503
       ___sys_sendmsg net/socket.c:2557 [inline]
       __sys_sendmsg+0x1f8/0x2a4 net/socket.c:2586
       __do_sys_sendmsg net/socket.c:2595 [inline]
       __se_sys_sendmsg net/socket.c:2593 [inline]
       __arm64_sys_sendmsg+0x80/0x94 net/socket.c:2593
       __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
       invoke_syscall+0x84/0x270 arch/arm64/kernel/syscall.c:52
       el0_svc_common+0x134/0x24c arch/arm64/kernel/syscall.c:142
       do_el0_svc+0x64/0x198 arch/arm64/kernel/syscall.c:193
       el0_svc+0x2c/0x7c arch/arm64/kernel/entry-common.c:637
       el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
       el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:591
      
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Fixes: a7b4f989 ("netfilter: ipset: IP set core support")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Acked-by: default avatarJozsef Kadlecsik <kadlec@netfilter.org>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fea199db
    • Tijs Van Buggenhout's avatar
      netfilter: conntrack: fix NULL pointer dereference in nf_confirm_cthelper · f057da51
      Tijs Van Buggenhout authored
      
      
      [ Upstream commit e1f543dc ]
      
      An nf_conntrack_helper from nf_conn_help may become NULL after DNAT.
      
      Observed when TCP port 1720 (Q931_PORT), associated with h323 conntrack
      helper, is DNAT'ed to another destination port (e.g. 1730), while
      nfqueue is being used for final acceptance (e.g. snort).
      
      This happenned after transition from kernel 4.14 to 5.10.161.
      
      Workarounds:
       * keep the same port (1720) in DNAT
       * disable nfqueue
       * disable/unload h323 NAT helper
      
      $ linux-5.10/scripts/decode_stacktrace.sh vmlinux < /tmp/kernel.log
      BUG: kernel NULL pointer dereference, address: 0000000000000084
      [..]
      RIP: 0010:nf_conntrack_update (net/netfilter/nf_conntrack_core.c:2080 net/netfilter/nf_conntrack_core.c:2134) nf_conntrack
      [..]
      nfqnl_reinject (net/netfilter/nfnetlink_queue.c:237) nfnetlink_queue
      nfqnl_recv_verdict (net/netfilter/nfnetlink_queue.c:1230) nfnetlink_queue
      nfnetlink_rcv_msg (net/netfilter/nfnetlink.c:241) nfnetlink
      [..]
      
      Fixes: ee04805f ("netfilter: conntrack: make conntrack userspace helpers work again")
      Signed-off-by: default avatarTijs Van Buggenhout <tijs.van.buggenhout@axsguard.com>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f057da51
    • Jeremy Sowden's avatar
      netfilter: nft_bitwise: fix register tracking · 1f26ea49
      Jeremy Sowden authored
      
      
      [ Upstream commit 14e8b293 ]
      
      At the end of `nft_bitwise_reduce`, there is a loop which is intended to
      update the bitwise expression associated with each tracked destination
      register.  However, currently, it just updates the first register
      repeatedly.  Fix it.
      
      Fixes: 34cc9e52 ("netfilter: nf_tables: cancel tracking for clobbered destination registers")
      Signed-off-by: default avatarJeremy Sowden <jeremy@azazel.net>
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1f26ea49
    • Yonghong Song's avatar
      selftests/bpf: Fix sockopt_sk selftest · 81e11b6c
      Yonghong Song authored
      
      
      [ Upstream commit 69844e33 ]
      
      Commit f4e45348 ("net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report")
      fixed NETLINK_LIST_MEMBERSHIPS length report which caused
      selftest sockopt_sk failure. The failure log looks like
      
        test_sockopt_sk:PASS:join_cgroup /sockopt_sk 0 nsec
        run_test:PASS:skel_load 0 nsec
        run_test:PASS:setsockopt_link 0 nsec
        run_test:PASS:getsockopt_link 0 nsec
        getsetsockopt:FAIL:Unexpected NETLINK_LIST_MEMBERSHIPS value unexpected Unexpected NETLINK_LIST_MEMBERSHIPS value: actual 8 != expected 4
        run_test:PASS:getsetsockopt 0 nsec
        #201     sockopt_sk:FAIL
      
      In net/netlink/af_netlink.c, function netlink_getsockopt(), for NETLINK_LIST_MEMBERSHIPS,
      nlk->ngroups equals to 36. Before Commit f4e45348, the optlen is calculated as
        ALIGN(nlk->ngroups / 8, sizeof(u32)) = 4
      After that commit, the optlen is
        ALIGN(BITS_TO_BYTES(nlk->ngroups), sizeof(u32)) = 8
      
      Fix the test by setting the expected optlen to be 8.
      
      Fixes: f4e45348 ("net/netlink: fix NETLINK_LIST_MEMBERSHIPS length report")
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20230606172202.1606249-1-yhs@fb.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      81e11b6c
    • Stanislav Fomichev's avatar
      selftests/bpf: Verify optval=NULL case · 1ba03535
      Stanislav Fomichev authored
      
      
      [ Upstream commit 833d67ec ]
      
      Make sure we get optlen exported instead of getting EFAULT.
      
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20230418225343.553806-3-sdf@google.com
      
      
      Stable-dep-of: 69844e33 ("selftests/bpf: Fix sockopt_sk selftest")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1ba03535
    • Johannes Berg's avatar
      wifi: cfg80211: fix locking in sched scan stop work · 0d18f8b9
      Johannes Berg authored
      
      
      [ Upstream commit 3e54ed82 ]
      
      This should use wiphy_lock() now instead of acquiring the
      RTNL, since cfg80211_stop_sched_scan_req() now needs that.
      
      Fixes: a05829a7 ("cfg80211: avoid holding the RTNL when calling the driver")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      0d18f8b9
    • Manish Chopra's avatar
      qed/qede: Fix scheduling while atomic · 4a64e928
      Manish Chopra authored
      
      
      [ Upstream commit 42510dff ]
      
      Statistics read through bond interface via sysfs causes
      below bug and traces as it triggers the bonding module to
      collect the slave device statistics while holding the spinlock,
      beneath that qede->qed driver statistics flow gets scheduled out
      due to usleep_range() used in PTT acquire logic
      
      [ 3673.988874] Hardware name: HPE ProLiant DL365 Gen10 Plus/ProLiant DL365 Gen10 Plus, BIOS A42 10/29/2021
      [ 3673.988878] Call Trace:
      [ 3673.988891]  dump_stack_lvl+0x34/0x44
      [ 3673.988908]  __schedule_bug.cold+0x47/0x53
      [ 3673.988918]  __schedule+0x3fb/0x560
      [ 3673.988929]  schedule+0x43/0xb0
      [ 3673.988932]  schedule_hrtimeout_range_clock+0xbf/0x1b0
      [ 3673.988937]  ? __hrtimer_init+0xc0/0xc0
      [ 3673.988950]  usleep_range+0x5e/0x80
      [ 3673.988955]  qed_ptt_acquire+0x2b/0xd0 [qed]
      [ 3673.988981]  _qed_get_vport_stats+0x141/0x240 [qed]
      [ 3673.989001]  qed_get_vport_stats+0x18/0x80 [qed]
      [ 3673.989016]  qede_fill_by_demand_stats+0x37/0x400 [qede]
      [ 3673.989028]  qede_get_stats64+0x19/0xe0 [qede]
      [ 3673.989034]  dev_get_stats+0x5c/0xc0
      [ 3673.989045]  netstat_show.constprop.0+0x52/0xb0
      [ 3673.989055]  dev_attr_show+0x19/0x40
      [ 3673.989065]  sysfs_kf_seq_show+0x9b/0xf0
      [ 3673.989076]  seq_read_iter+0x120/0x4b0
      [ 3673.989087]  new_sync_read+0x118/0x1a0
      [ 3673.989095]  vfs_read+0xf3/0x180
      [ 3673.989099]  ksys_read+0x5f/0xe0
      [ 3673.989102]  do_syscall_64+0x3b/0x90
      [ 3673.989109]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [ 3673.989115] RIP: 0033:0x7f8467d0b082
      [ 3673.989119] Code: c0 e9 b2 fe ff ff 50 48 8d 3d ca 05 08 00 e8 35 e7 01 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 ec 28 48 89 54 24
      [ 3673.989121] RSP: 002b:00007ffffb21fd08 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
      [ 3673.989127] RAX: ffffffffffffffda RBX: 000000000100eca0 RCX: 00007f8467d0b082
      [ 3673.989128] RDX: 00000000000003ff RSI: 00007ffffb21fdc0 RDI: 0000000000000003
      [ 3673.989130] RBP: 00007f8467b96028 R08: 0000000000000010 R09: 00007ffffb21ec00
      [ 3673.989132] R10: 00007ffffb27b170 R11: 0000000000000246 R12: 00000000000000f0
      [ 3673.989134] R13: 0000000000000003 R14: 00007f8467b92000 R15: 0000000000045a05
      [ 3673.989139] CPU: 30 PID: 285188 Comm: read_all Kdump: loaded Tainted: G        W  OE
      
      Fix this by collecting the statistics asynchronously from a periodic
      delayed work scheduled at default stats coalescing interval and return
      the recent copy of statisitcs from .ndo_get_stats64(), also add ability
      to configure/retrieve stats coalescing interval using below commands -
      
      ethtool -C ethx stats-block-usecs <val>
      ethtool -c ethx
      
      Fixes: 133fac0e ("qede: Add basic ethtool support")
      Cc: Sudarsana Kalluru <skalluru@marvell.com>
      Cc: David Miller <davem@davemloft.net>
      Signed-off-by: default avatarManish Chopra <manishc@marvell.com>
      Link: https://lore.kernel.org/r/20230605112600.48238-1-manishc@marvell.com
      
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4a64e928
    • Johannes Berg's avatar
      wifi: mac80211: don't translate beacon/presp addrs · 79c97551
      Johannes Berg authored
      
      
      [ Upstream commit 47c171a4 ]
      
      Don't do link address translation for beacons and probe responses,
      this leads to reporting multiple scan list entries for the same AP
      (one with the MLD address) which just breaks things.
      
      We might need to extend this in the future for some other (action)
      frames that aren't MLD addressed.
      
      Fixes: 42fb9148 ("wifi: mac80211: do link->MLD address translation on RX")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
      Link: https://lore.kernel.org/r/20230604120651.62adead1b43a.Ifc25eed26ebf3b269f60b1ec10060156d0e7ec0d@changeid
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      79c97551
    • Johannes Berg's avatar
      wifi: mac80211: mlme: fix non-inheritence element · 4dd40fec
      Johannes Berg authored
      
      
      [ Upstream commit 68c22855 ]
      
      There were two bugs when creating the non-inheritence
      element:
       1) 'at_extension' needs to be declared outside the loop,
          otherwise the value resets every iteration and we
          can never really switch properly
       2) 'added' never got set to true, so we always cut off
          the extension element again at the end of the function
      
      This shows another issue that we might add a list but no
      extension list, but we need to make the extension list a
      zero-length one in that case.
      
      Fix all these issues. While at it, add a comment explaining
      the trim.
      
      Fixes: 81151ce4 ("wifi: mac80211: support MLO authentication/association with one link")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
      Link: https://lore.kernel.org/r/20230604120651.3addaa5c4782.If3a78f9305997ad7ef4ba7ffc17a8234c956f613@changeid
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4dd40fec
    • Johannes Berg's avatar
      wifi: cfg80211: reject bad AP MLD address · 8b6ab4bf
      Johannes Berg authored
      
      
      [ Upstream commit 727073ca ]
      
      When trying to authenticate, if the AP MLD address isn't
      a valid address, mac80211 can throw a warning. Avoid that
      by rejecting such addresses.
      
      Fixes: d648c230 ("wifi: nl80211: support MLO in auth/assoc")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
      Link: https://lore.kernel.org/r/20230604120651.89188912bd1d.I8dbc6c8ee0cb766138803eec59508ef4ce477709@changeid
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8b6ab4bf
    • Johannes Berg's avatar
      wifi: mac80211: use correct iftype HE cap · 434cf4fb
      Johannes Berg authored
      
      
      [ Upstream commit c37ab22b ]
      
      We already check that the right iftype capa exists,
      but then don't use it. Assign it to a variable so we
      can actually use it, and then do that.
      
      Fixes: bac2fd3d ("mac80211: remove use of ieee80211_get_he_sta_cap()")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarGregory Greenman <gregory.greenman@intel.com>
      Link: https://lore.kernel.org/r/20230604120651.0e908e5c5fdd.Iac142549a6144ac949ebd116b921a59ae5282735@changeid
      
      
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      434cf4fb
    • Sungwoo Kim's avatar
      Bluetooth: L2CAP: Add missing checks for invalid DCID · 3e8a7573
      Sungwoo Kim authored
      
      
      [ Upstream commit 75767213 ]
      
      When receiving a connect response we should make sure that the DCID is
      within the valid range and that we don't already have another channel
      allocated for the same DCID.
      Missing checks may violate the specification (BLUETOOTH CORE SPECIFICATION
      Version 5.4 | Vol 3, Part A, Page 1046).
      
      Fixes: 40624183 ("Bluetooth: L2CAP: Add missing checks for invalid LE DCID")
      Signed-off-by: default avatarSungwoo Kim <iam@sung-woo.kim>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3e8a7573
    • Pauli Virtanen's avatar
      Bluetooth: ISO: don't try to remove CIG if there are bound CIS left · 66b3f742
      Pauli Virtanen authored
      
      
      [ Upstream commit 6c242c64 ]
      
      Consider existing BOUND & CONNECT state CIS to block CIG removal.
      Otherwise, under suitable timing conditions we may attempt to remove CIG
      while Create CIS is pending, which fails.
      
      Fixes: 26afbd82 ("Bluetooth: Add initial implementation of CIS connections")
      Signed-off-by: default avatarPauli Virtanen <pav@iki.fi>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      66b3f742
    • Ying Hsu's avatar
      Bluetooth: Fix l2cap_disconnect_req deadlock · 9c7e51b9
      Ying Hsu authored
      
      
      [ Upstream commit 02c5ea52 ]
      
      L2CAP assumes that the locks conn->chan_lock and chan->lock are
      acquired in the order conn->chan_lock, chan->lock to avoid
      potential deadlock.
      For example, l2sock_shutdown acquires these locks in the order:
        mutex_lock(&conn->chan_lock)
        l2cap_chan_lock(chan)
      
      However, l2cap_disconnect_req acquires chan->lock in
      l2cap_get_chan_by_scid first and then acquires conn->chan_lock
      before calling l2cap_chan_del. This means that these locks are
      acquired in unexpected order, which leads to potential deadlock:
        l2cap_chan_lock(c)
        mutex_lock(&conn->chan_lock)
      
      This patch releases chan->lock before acquiring the conn_chan_lock
      to avoid the potential deadlock.
      
      Fixes: a2a9339e ("Bluetooth: L2CAP: Fix use-after-free in l2cap_disconnect_{req,rsp}")
      Signed-off-by: default avatarYing Hsu <yinghsu@chromium.org>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9c7e51b9
    • Zhengping Jiang's avatar
      Bluetooth: hci_sync: add lock to protect HCI_UNREGISTER · 17aac120
      Zhengping Jiang authored
      
      
      [ Upstream commit 1857c199 ]
      
      When the HCI_UNREGISTER flag is set, no jobs should be scheduled. Fix
      potential race when HCI_UNREGISTER is set after the flag is tested in
      hci_cmd_sync_queue.
      
      Fixes: 0b94f265 ("Bluetooth: hci_sync: Fix queuing commands when HCI_UNREGISTER is set")
      Signed-off-by: default avatarZhengping Jiang <jiangzp@google.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      17aac120
    • Jouni Högander's avatar
      drm/i915: Use 18 fast wake AUX sync len · 5f285409
      Jouni Högander authored
      
      
      [ Upstream commit 2d6f2f79 ]
      
      HW default for wake sync pulses is 18. 10 precharge and 8 preamble. There
      is no reason to change this especially as it is causing problems with
      certain eDP panels.
      
      v3: Change "Fixes:" commit
      v2: Remove "fast wake" repeat from subject
      
      Signed-off-by: default avatarJouni Högander <jouni.hogander@intel.com>
      Fixes: e1c71f8f ("drm/i915: Fix fast wake AUX sync len")
      Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/8475
      
      
      Reviewed-by: default avatarLuca Coelho <luciano.coelho@intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230530101649.2549949-1-jouni.hogander@intel.com
      
      
      (cherry picked from commit b29a20f7)
      Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5f285409
    • Ville Syrjälä's avatar
      drm/i915: Explain the magic numbers for AUX SYNC/precharge length · 7bf7bebd
      Ville Syrjälä authored
      
      
      [ Upstream commit 26bfc3f3 ]
      
      Replace the hardcoded final numbers in the AUX SYNC/precharge
      setup, and derive those from numbers from the (e)DP specs.
      
      The new functions can serve as the single point of truth for
      the number of SYNC pulses we use.
      
      Cc: Jouni Högander <jouni.hogander@intel.com>
      Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20230329172434.18744-2-ville.syrjala@linux.intel.com
      
      
      Reviewed-by: default avatarJouni Högander <jouni.hogander@intel.com>
      Stable-dep-of: 2d6f2f79 ("drm/i915: Use 18 fast wake AUX sync len")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7bf7bebd
    • Eric Dumazet's avatar
      net/sched: fq_pie: ensure reasonable TCA_FQ_PIE_QUANTUM values · 1d37434f
      Eric Dumazet authored
      
      
      [ Upstream commit cd2b8113 ]
      
      We got multiple syzbot reports, all duplicates of the following [1]
      
      syzbot managed to install fq_pie with a zero TCA_FQ_PIE_QUANTUM,
      thus triggering infinite loops.
      
      Use limits similar to sch_fq, with commits
      3725a269 ("pkt_sched: fq: avoid hang when quantum 0") and
      d9e15a27 ("pkt_sched: fq: do not accept silly TCA_FQ_QUANTUM")
      
      [1]
      watchdog: BUG: soft lockup - CPU#0 stuck for 26s! [swapper/0:0]
      Modules linked in:
      irq event stamp: 172817
      hardirqs last enabled at (172816): [<ffff80001242fde4>] __el1_irq arch/arm64/kernel/entry-common.c:476 [inline]
      hardirqs last enabled at (172816): [<ffff80001242fde4>] el1_interrupt+0x58/0x68 arch/arm64/kernel/entry-common.c:486
      hardirqs last disabled at (172817): [<ffff80001242fdb0>] __el1_irq arch/arm64/kernel/entry-common.c:468 [inline]
      hardirqs last disabled at (172817): [<ffff80001242fdb0>] el1_interrupt+0x24/0x68 arch/arm64/kernel/entry-common.c:486
      softirqs last enabled at (167634): [<ffff800008020c1c>] softirq_handle_end kernel/softirq.c:414 [inline]
      softirqs last enabled at (167634): [<ffff800008020c1c>] __do_softirq+0xac0/0xd54 kernel/softirq.c:600
      softirqs last disabled at (167701): [<ffff80000802a660>] ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:80
      CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.4.0-rc3-syzkaller-geb0f1697d729 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023
      pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      pc : fq_pie_qdisc_dequeue+0x10c/0x8ac net/sched/sch_fq_pie.c:246
      lr : fq_pie_qdisc_dequeue+0xe4/0x8ac net/sched/sch_fq_pie.c:240
      sp : ffff800008007210
      x29: ffff800008007280 x28: ffff0000c86f7890 x27: ffff0000cb20c2e8
      x26: ffff0000cb20c2f0 x25: dfff800000000000 x24: ffff0000cb20c2e0
      x23: ffff0000c86f7880 x22: 0000000000000040 x21: 1fffe000190def10
      x20: ffff0000cb20c2e0 x19: ffff0000cb20c2e0 x18: ffff800008006e60
      x17: 0000000000000000 x16: ffff80000850af6c x15: 0000000000000302
      x14: 0000000000000100 x13: 0000000000000000 x12: 0000000000000001
      x11: 0000000000000302 x10: 0000000000000100 x9 : 0000000000000000
      x8 : 0000000000000000 x7 : ffff80000841c468 x6 : 0000000000000000
      x5 : 0000000000000001 x4 : 0000000000000001 x3 : 0000000000000000
      x2 : ffff0000cb20c2e0 x1 : ffff0000cb20c2e0 x0 : 0000000000000001
      Call trace:
      fq_pie_qdisc_dequeue+0x10c/0x8ac net/sched/sch_fq_pie.c:246
      dequeue_skb net/sched/sch_generic.c:292 [inline]
      qdisc_restart net/sched/sch_generic.c:397 [inline]
      __qdisc_run+0x1fc/0x231c net/sched/sch_generic.c:415
      __dev_xmit_skb net/core/dev.c:3868 [inline]
      __dev_queue_xmit+0xc80/0x3318 net/core/dev.c:4210
      dev_queue_xmit include/linux/netdevice.h:3085 [inline]
      neigh_connected_output+0x2f8/0x38c net/core/neighbour.c:1581
      neigh_output include/net/neighbour.h:544 [inline]
      ip6_finish_output2+0xd60/0x1a1c net/ipv6/ip6_output.c:134
      __ip6_finish_output net/ipv6/ip6_output.c:195 [inline]
      ip6_finish_output+0x538/0x8c8 net/ipv6/ip6_output.c:206
      NF_HOOK_COND include/linux/netfilter.h:292 [inline]
      ip6_output+0x270/0x594 net/ipv6/ip6_output.c:227
      dst_output include/net/dst.h:458 [inline]
      NF_HOOK include/linux/netfilter.h:303 [inline]
      ndisc_send_skb+0xc30/0x1790 net/ipv6/ndisc.c:508
      ndisc_send_rs+0x47c/0x5d4 net/ipv6/ndisc.c:718
      addrconf_rs_timer+0x300/0x58c net/ipv6/addrconf.c:3936
      call_timer_fn+0x19c/0x8cc kernel/time/timer.c:1700
      expire_timers kernel/time/timer.c:1751 [inline]
      __run_timers+0x55c/0x734 kernel/time/timer.c:2022
      run_timer_softirq+0x7c/0x114 kernel/time/timer.c:2035
      __do_softirq+0x2d0/0xd54 kernel/softirq.c:571
      ____do_softirq+0x14/0x20 arch/arm64/kernel/irq.c:80
      call_on_irq_stack+0x24/0x4c arch/arm64/kernel/entry.S:882
      do_softirq_own_stack+0x20/0x2c arch/arm64/kernel/irq.c:85
      invoke_softirq kernel/softirq.c:452 [inline]
      __irq_exit_rcu+0x28c/0x534 kernel/softirq.c:650
      irq_exit_rcu+0x14/0x84 kernel/softirq.c:662
      __el1_irq arch/arm64/kernel/entry-common.c:472 [inline]
      el1_interrupt+0x38/0x68 arch/arm64/kernel/entry-common.c:486
      el1h_64_irq_handler+0x18/0x24 arch/arm64/kernel/entry-common.c:491
      el1h_64_irq+0x64/0x68 arch/arm64/kernel/entry.S:587
      __daif_local_irq_enable arch/arm64/include/asm/irqflags.h:33 [inline]
      arch_local_irq_enable+0x8/0xc arch/arm64/include/asm/irqflags.h:55
      cpuidle_idle_call kernel/sched/idle.c:170 [inline]
      do_idle+0x1f0/0x4e8 kernel/sched/idle.c:282
      cpu_startup_entry+0x24/0x28 kernel/sched/idle.c:379
      rest_init+0x2dc/0x2f4 init/main.c:735
      start_kernel+0x0/0x55c init/main.c:834
      start_kernel+0x3f0/0x55c init/main.c:1088
      __primary_switched+0xb8/0xc0 arch/arm64/kernel/head.S:523
      
      Fixes: ec97ecf1 ("net: sched: add Flow Queue PIE packet scheduler")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1d37434f
    • Wei Fang's avatar
      net: enetc: correct rx_bytes statistics of XDP · a22c0a03
      Wei Fang authored
      
      
      [ Upstream commit fdebd850 ]
      
      The rx_bytes statistics of XDP are always zero, because rx_byte_cnt
      is not updated after it is initialized to 0. So fix it.
      
      Fixes: d1b15102 ("net: enetc: add support for XDP_DROP and XDP_PASS")
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      a22c0a03
    • Wei Fang's avatar
      net: enetc: correct the statistics of rx bytes · b3fc768a
      Wei Fang authored
      
      
      [ Upstream commit 7190d0ff ]
      
      The rx_bytes of struct net_device_stats should count the length of
      ethernet frames excluding the FCS. However, there are two problems
      with the rx_bytes statistics of the current enetc driver. one is
      that the length of VLAN header is not counted if the VLAN extraction
      feature is enabled. The other is that the length of L2 header is not
      counted, because eth_type_trans() is invoked before updating rx_bytes
      which will subtract the length of L2 header from skb->len.
      BTW, the rx_bytes statistics of XDP path also have similar problem,
      I will fix it in another patch.
      
      Fixes: a800abd3 ("net: enetc: move skb creation into enetc_build_skb")
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Reviewed-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b3fc768a
    • Wen Gu's avatar
      net/smc: Avoid to access invalid RMBs' MRs in SMCRv1 ADD LINK CONT · 7a5cdd4b
      Wen Gu authored
      [ Upstream commit c308e9ec ]
      
      SMCRv1 has a similar issue to SMCRv2 (see link below) that may access
      invalid MRs of RMBs when construct LLC ADD LINK CONT messages.
      
       BUG: kernel NULL pointer dereference, address: 0000000000000014
       #PF: supervisor read access in kernel mode
       #PF: error_code(0x0000) - not-present page
       PGD 0 P4D 0
       Oops: 0000 [#1] PREEMPT SMP PTI
       CPU: 5 PID: 48 Comm: kworker/5:0 Kdump: loaded Tainted: G W   E      6.4.0-rc3+ #49
       Workqueue: events smc_llc_add_link_work [smc]
       RIP: 0010:smc_llc_add_link_cont+0x160/0x270 [smc]
       RSP: 0018:ffffa737801d3d50 EFLAGS: 00010286
       RAX: ffff964f82144000 RBX: ffffa737801d3dd8 RCX: 0000000000000000
       RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff964f81370c30
       RBP: ffffa737801d3dd4 R08: ffff964f81370000 R09: ffffa737801d3db0
       R10: 0000000000000001 R11: 0000000000000060 R12: ffff964f82e70000
       R13: ffff964f81370c38 R14: ffffa737801d3dd3 R15: 0000000000000001
       FS:  0000000000000000(0000) GS:ffff9652bfd40000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000014 CR3: 000000008fa20004 CR4: 00000000003706e0
       DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
       DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
       Call Trace:
        <TASK>
        smc_llc_srv_rkey_exchange+0xa7/0x190 [smc]
        smc_llc_srv_add_link+0x3ae/0x5a0 [smc]
        smc_llc_add_link_work+0xb8/0x140 [smc]
        process_one_work+0x1e5/0x3f0
        worker_thread+0x4d/0x2f0
        ? __pfx_worker_thread+0x10/0x10
        kthread+0xe5/0x120
        ? __pfx_kthread+0x10/0x10
        ret_from_fork+0x2c/0x50
        </TASK>
      
      When an alernate RNIC is available in system, SMC will try to add a new
      link based on the RNIC for resilience. All the RMBs in use will be mapped
      to the new link. Then the RMBs' MRs corresponding to the new link will
      be filled into LLC messages. For SMCRv1, they are ADD LINK CONT messages.
      
      However smc_llc_add_link_cont() may mistakenly access to unused RMBs which
      haven't been mapped to the new link and have no valid MRs, thus causing a
      crash. So this patch fixes it.
      
      Fixes: 87f88cda ("net/smc: rkey processing for a new link as SMC client")
      Link: https://lore.kernel.org/r/1685101741-74826-3-git-send-email-guwen@linux.alibaba.com
      
      
      Signed-off-by: default avatarWen Gu <guwen@linux.alibaba.com>
      Reviewed-by: default avatarWenjia Zhang <wenjia@linux.ibm.com>
      Reviewed-by: default avatarTony Lu <tonylu@linux.alibaba.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7a5cdd4b
    • Eric Dumazet's avatar
      net/ipv6: fix bool/int mismatch for skip_notify_on_dev_down · 76e38e6e
      Eric Dumazet authored
      
      
      [ Upstream commit edf2e1d2 ]
      
      skip_notify_on_dev_down ctl table expects this field
      to be an int (4 bytes), not a bool (1 byte).
      
      Because proc_dou8vec_minmax() was added in 5.13,
      this patch converts skip_notify_on_dev_down to an int.
      
      Following patch then converts the field to u8 and use proc_dou8vec_minmax().
      
      Fixes: 7c6bb7d2 ("net/ipv6: Add knob to skip DELROUTE message on device down")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Acked-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      76e38e6e
    • Rhys Rustad-Elliott's avatar
      bpf: Fix elem_size not being set for inner maps · 3849e7fc
      Rhys Rustad-Elliott authored
      
      
      [ Upstream commit cba41bb7 ]
      
      Commit d937bc34 ("bpf: make uniform use of array->elem_size
      everywhere in arraymap.c") changed array_map_gen_lookup to use
      array->elem_size instead of round_up(map->value_size, 8) as the element
      size when generating code to access a value in an array map.
      
      array->elem_size, however, is not set by bpf_map_meta_alloc when
      initializing an BPF_MAP_TYPE_ARRAY_OF_MAPS or BPF_MAP_TYPE_HASH_OF_MAPS.
      This results in array_map_gen_lookup incorrectly outputting code that
      always accesses index 0 in the array (as the index will be calculated
      via a multiplication with the element size, which is incorrectly set to
      0).
      
      Set elem_size on the bpf_array object when allocating an array or hash
      of maps to fix this.
      
      Fixes: d937bc34 ("bpf: make uniform use of array->elem_size everywhere in arraymap.c")
      Signed-off-by: default avatarRhys Rustad-Elliott <me@rhysre.net>
      Link: https://lore.kernel.org/r/20230602190110.47068-2-me@rhysre.net
      
      
      Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3849e7fc
    • KP Singh's avatar
      bpf: Fix UAF in task local storage · d7612a92
      KP Singh authored
      
      
      [ Upstream commit b0fd1852 ]
      
      When task local storage was generalized for tracing programs, the
      bpf_task_local_storage callback was moved from a BPF LSM hook
      callback for security_task_free LSM hook to it's own callback. But a
      failure case in bad_fork_cleanup_security was missed which, when
      triggered, led to a dangling task owner pointer and a subsequent
      use-after-free. Move the bpf_task_storage_free to the very end of
      free_task to handle all failure cases.
      
      This issue was noticed when a BPF LSM program was attached to the
      task_alloc hook on a kernel with KASAN enabled. The program used
      bpf_task_storage_get to copy the task local storage from the current
      task to the new task being created.
      
      Fixes: a10787e6 ("bpf: Enable task local storage for tracing programs")
      Reported-by: default avatarKuba Piecuch <jpiecuch@google.com>
      Signed-off-by: default avatarKP Singh <kpsingh@kernel.org>
      Acked-by: default avatarSong Liu <song@kernel.org>
      Link: https://lore.kernel.org/r/20230602002612.1117381-1-kpsingh@kernel.org
      
      
      Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d7612a92
    • Akihiro Suda's avatar
      net/ipv4: ping_group_range: allow GID from 2147483648 to 4294967294 · 9166225c
      Akihiro Suda authored
      
      
      [ Upstream commit e209fee4 ]
      
      With this commit, all the GIDs ("0 4294967294") can be written to the
      "net.ipv4.ping_group_range" sysctl.
      
      Note that 4294967295 (0xffffffff) is an invalid GID (see gid_valid() in
      include/linux/uidgid.h), and an attempt to register this number will cause
      -EINVAL.
      
      Prior to this commit, only up to GID 2147483647 could be covered.
      Documentation/networking/ip-sysctl.rst had "0 4294967295" as an example
      value, but this example was wrong and causing -EINVAL.
      
      Fixes: c319b4d7 ("net: ipv4: add IPPROTO_ICMP socket kind")
      Co-developed-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarAkihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9166225c
    • Alexander Sverdlin's avatar
      net: dsa: lan9303: allow vid != 0 in port_fdb_{add|del} methods · 332f36a0
      Alexander Sverdlin authored
      [ Upstream commit 5a59a58e ]
      
      LAN9303 doesn't associate FDB (ALR) entries with VLANs, it has just one
      global Address Logic Resolution table [1].
      
      Ignore VID in port_fdb_{add|del} methods, go on with the global table. This
      is the same semantics as hellcreek or RZ/N1 implement.
      
      Visible symptoms:
      LAN9303_MDIO 5b050000.ethernet-1:00: port 2 failed to delete 00:xx:xx:xx:xx:cf vid 1 from fdb: -2
      LAN9303_MDIO 5b050000.ethernet-1:00: port 2 failed to add 00:xx:xx:xx:xx:cf vid 1 to fdb: -95
      
      [1] https://ww1.microchip.com/downloads/en/DeviceDoc/00002308A.pdf
      
      
      
      Fixes: 0620427e ("net: dsa: lan9303: Add fdb/mdb manipulation")
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@siemens.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Link: https://lore.kernel.org/r/20230531143826.477267-1-alexander.sverdlin@siemens.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      332f36a0
    • Qingfang DENG's avatar
      neighbour: fix unaligned access to pneigh_entry · 8af31193
      Qingfang DENG authored
      
      
      [ Upstream commit ed779fe4 ]
      
      After the blamed commit, the member key is longer 4-byte aligned. On
      platforms that do not support unaligned access, e.g., MIPS32R2 with
      unaligned_action set to 1, this will trigger a crash when accessing
      an IPv6 pneigh_entry, as the key is cast to an in6_addr pointer.
      
      Change the type of the key to u32 to make it aligned.
      
      Fixes: 62dd9318 ("[IPV6] NDISC: Set per-entry is_router flag in Proxy NA.")
      Signed-off-by: default avatarQingfang DENG <qingfang.deng@siflower.com.cn>
      Link: https://lore.kernel.org/r/20230601015432.159066-1-dqfext@gmail.com
      
      
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8af31193
    • Eric Dumazet's avatar
      bpf, sockmap: Avoid potential NULL dereference in sk_psock_verdict_data_ready() · 898c9a0e
      Eric Dumazet authored
      
      
      [ Upstream commit b320a456 ]
      
      syzbot found sk_psock(sk) could return NULL when called
      from sk_psock_verdict_data_ready().
      
      Just make sure to handle this case.
      
      [1]
      general protection fault, probably for non-canonical address 0xdffffc000000005c: 0000 [#1] PREEMPT SMP KASAN
      KASAN: null-ptr-deref in range [0x00000000000002e0-0x00000000000002e7]
      CPU: 0 PID: 15 Comm: ksoftirqd/0 Not tainted 6.4.0-rc3-syzkaller-00588-g4781e965e655 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/16/2023
      RIP: 0010:sk_psock_verdict_data_ready+0x19f/0x3c0 net/core/skmsg.c:1213
      Code: 4c 89 e6 e8 63 70 5e f9 4d 85 e4 75 75 e8 19 74 5e f9 48 8d bb e0 02 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 07 02 00 00 48 89 ef ff 93 e0 02 00 00 e8 29 fd
      RSP: 0018:ffffc90000147688 EFLAGS: 00010206
      RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 0000000000000100
      RDX: 000000000000005c RSI: ffffffff8825ceb7 RDI: 00000000000002e0
      RBP: ffff888076518c40 R08: 0000000000000007 R09: 0000000000000000
      R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000000
      R13: 0000000000000000 R14: 0000000000008000 R15: ffff888076518c40
      FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
      CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007f901375bab0 CR3: 000000004bf26000 CR4: 00000000003506f0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      Call Trace:
      <TASK>
      tcp_data_ready+0x10a/0x520 net/ipv4/tcp_input.c:5006
      tcp_data_queue+0x25d3/0x4c50 net/ipv4/tcp_input.c:5080
      tcp_rcv_established+0x829/0x1f90 net/ipv4/tcp_input.c:6019
      tcp_v4_do_rcv+0x65a/0x9c0 net/ipv4/tcp_ipv4.c:1726
      tcp_v4_rcv+0x2cbf/0x3340 net/ipv4/tcp_ipv4.c:2148
      ip_protocol_deliver_rcu+0x9f/0x480 net/ipv4/ip_input.c:205
      ip_local_deliver_finish+0x2ec/0x520 net/ipv4/ip_input.c:233
      NF_HOOK include/linux/netfilter.h:303 [inline]
      NF_HOOK include/linux/netfilter.h:297 [inline]
      ip_local_deliver+0x1ae/0x200 net/ipv4/ip_input.c:254
      dst_input include/net/dst.h:468 [inline]
      ip_rcv_finish+0x1cf/0x2f0 net/ipv4/ip_input.c:449
      NF_HOOK include/linux/netfilter.h:303 [inline]
      NF_HOOK include/linux/netfilter.h:297 [inline]
      ip_rcv+0xae/0xd0 net/ipv4/ip_input.c:569
      __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5491
      __netif_receive_skb+0x1f/0x1c0 net/core/dev.c:5605
      process_backlog+0x101/0x670 net/core/dev.c:5933
      __napi_poll+0xb7/0x6f0 net/core/dev.c:6499
      napi_poll net/core/dev.c:6566 [inline]
      net_rx_action+0x8a9/0xcb0 net/core/dev.c:6699
      __do_softirq+0x1d4/0x905 kernel/softirq.c:571
      run_ksoftirqd kernel/softirq.c:939 [inline]
      run_ksoftirqd+0x31/0x60 kernel/softirq.c:931
      smpboot_thread_fn+0x659/0x9e0 kernel/smpboot.c:164
      kthread+0x344/0x440 kernel/kthread.c:379
      ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308
      </TASK>
      
      Fixes: 6df7f764 ("bpf, sockmap: Wake up polling after data copy")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Reviewed-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Link: https://lore.kernel.org/bpf/20230530195149.68145-1-edumazet@google.com
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      898c9a0e
    • Lorenzo Bianconi's avatar
      wifi: mt76: mt7615: fix possible race in mt7615_mac_sta_poll · e783f639
      Lorenzo Bianconi authored
      
      
      [ Upstream commit 30bc32c7 ]
      
      Grab sta_poll_lock spinlock in mt7615_mac_sta_poll routine in order to
      avoid possible races with mt7615_mac_add_txs() or mt7615_mac_fill_rx()
      removing msta pointer from sta_poll_list.
      
      Fixes: a621372a ("mt76: mt7615: rework mt7615_mac_sta_poll for usb code")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarKalle Valo <kvalo@kernel.org>
      Link: https://lore.kernel.org/r/48b23404b759de4f1db2ef85975c72a4aeb1097c.1684938695.git.lorenzo@kernel.org
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e783f639
    • David Howells's avatar
      afs: Fix setting of mtime when creating a file/dir/symlink · 84c69968
      David Howells authored
      
      
      [ Upstream commit a27648c7 ]
      
      kafs incorrectly passes a zero mtime (ie. 1st Jan 1970) to the server when
      creating a file, dir or symlink because the mtime recorded in the
      afs_operation struct gets passed to the server by the marshalling routines,
      but the afs_mkdir(), afs_create() and afs_symlink() functions don't set it.
      
      This gets masked if a file or directory is subsequently modified.
      
      Fix this by filling in op->mtime before calling the create op.
      
      Fixes: e49c7b2f ("afs: Build an abstraction around an "operation" concept")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Reviewed-by: default avatarJeffrey Altman <jaltman@auristor.com>
      Reviewed-by: default avatarMarc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      cc: linux-fsdevel@vger.kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      84c69968
    • Stephan Gerhold's avatar
      spi: qup: Request DMA before enabling clocks · fb7058dd
      Stephan Gerhold authored
      
      
      [ Upstream commit 0c331fd1 ]
      
      It is usually better to request all necessary resources (clocks,
      regulators, ...) before starting to make use of them. That way they do
      not change state in case one of the resources is not available yet and
      probe deferral (-EPROBE_DEFER) is necessary. This is particularly
      important for DMA channels and IOMMUs which are not enforced by
      fw_devlink yet (unless you use fw_devlink.strict=1).
      
      spi-qup does this in the wrong order, the clocks are enabled and
      disabled again when the DMA channels are not available yet.
      
      This causes issues in some cases: On most SoCs one of the SPI QUP
      clocks is shared with the UART controller. When using earlycon UART is
      actively used during boot but might not have probed yet, usually for
      the same reason (waiting for the DMA controller). In this case, the
      brief enable/disable cycle ends up gating the clock and further UART
      console output will halt the system completely.
      
      Avoid this by requesting the DMA channels before changing the clock
      state.
      
      Fixes: 612762e8 ("spi: qup: Add DMA capabilities")
      Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Link: https://lore.kernel.org/r/20230518-spi-qup-clk-defer-v1-1-f49fc9ca4e02@gerhold.net
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fb7058dd
    • Maximilian Luz's avatar
      platform/surface: aggregator_tabletsw: Add support for book mode in KIP subsystem · ec2e12b1
      Maximilian Luz authored
      
      
      [ Upstream commit 9bed6670 ]
      
      Devices with a type-cover have an additional "book" mode, deactivating
      type-cover input and turning off its backlight. This is currently
      unsupported, leading to the warning
      
        surface_aggregator_tablet_mode_switch 01:0e:01:00:01: unknown KIP cover state: 6
      
      Therefore, add support for this state and map it to enable tablet-mode.
      
      Fixes: 9f794056 ("platform/surface: Add KIP/POS tablet-mode switch driver")
      Signed-off-by: default avatarMaximilian Luz <luzmaximilian@gmail.com>
      Link: https://lore.kernel.org/r/20230525213218.2797480-2-luzmaximilian@gmail.com
      
      
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ec2e12b1