Skip to content
  1. Jun 12, 2024
    • Mathieu Othacehe's avatar
      net: phy: micrel: set soft_reset callback to genphy_soft_reset for KSZ8061 · 25222a98
      Mathieu Othacehe authored
      [ Upstream commit 128d54fb ]
      
      Following a similar reinstate for the KSZ8081 and KSZ9031.
      
      Older kernels would use the genphy_soft_reset if the PHY did not implement
      a .soft_reset.
      
      The KSZ8061 errata described here:
      https://ww1.microchip.com/downloads/en/DeviceDoc/KSZ8061-Errata-DS80000688B.pdf
      and worked around with 232ba3a5 ("net: phy: Micrel KSZ8061: link failure after cable connect")
      is back again without this soft reset.
      
      Fixes: 6e2d85ec
      
       ("net: phy: Stop with excessive soft reset")
      Tested-by: default avatarKarim Ben Houcine <karim.benhoucine@landisgyr.com>
      Signed-off-by: default avatarMathieu Othacehe <othacehe@gnu.org>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Reviewed-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      25222a98
    • Sagi Grimberg's avatar
      nvmet: fix ns enable/disable possible hang · ca7ad37b
      Sagi Grimberg authored
      [ Upstream commit f97914e3 ]
      
      When disabling an nvmet namespace, there is a period where the
      subsys->lock is released, as the ns disable waits for backend IO to
      complete, and the ns percpu ref to be properly killed. The original
      intent was to avoid taking the subsystem lock for a prolong period as
      other processes may need to acquire it (for example new incoming
      connections).
      
      However, it opens up a window where another process may come in and
      enable the ns, (re)intiailizing the ns percpu_ref, causing the disable
      sequence to hang.
      
      Solve this by taking the global nvmet_config_sem over the entire configfs
      enable/disable sequence.
      
      Fixes: a07b4970
      
       ("nvmet: add a generic NVMe target")
      Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
      Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      ca7ad37b
    • Fedor Pchelkin's avatar
      dma-mapping: benchmark: handle NUMA_NO_NODE correctly · 8e1ba9df
      Fedor Pchelkin authored
      [ Upstream commit e64746e7 ]
      
      cpumask_of_node() can be called for NUMA_NO_NODE inside do_map_benchmark()
      resulting in the following sanitizer report:
      
      UBSAN: array-index-out-of-bounds in ./arch/x86/include/asm/topology.h:72:28
      index -1 is out of range for type 'cpumask [64][1]'
      CPU: 1 PID: 990 Comm: dma_map_benchma Not tainted 6.9.0-rc6 #29
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
      Call Trace:
       <TASK>
      dump_stack_lvl (lib/dump_stack.c:117)
      ubsan_epilogue (lib/ubsan.c:232)
      __ubsan_handle_out_of_bounds (lib/ubsan.c:429)
      cpumask_of_node (arch/x86/include/asm/topology.h:72) [inline]
      do_map_benchmark (kernel/dma/map_benchmark.c:104)
      map_benchmark_ioctl (kernel/dma/map_benchmark.c:246)
      full_proxy_unlocked_ioctl (fs/debugfs/file.c:333)
      __x64_sys_ioctl (fs/ioctl.c:890)
      do_syscall_64 (arch/x86/entry/common.c:83)
      entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
      
      Use cpumask_of_node() in place when binding a kernel thread to a cpuset
      of a particular node.
      
      Note that the provided node id is checked inside map_benchmark_ioctl().
      It's just a NUMA_NO_NODE case which is not handled properly later.
      
      Found by Linux Verification Center (linuxtesting.org).
      
      Fixes: 65789daa
      
       ("dma-mapping: add benchmark support for streaming DMA APIs")
      Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
      Acked-by: default avatarBarry Song <baohua@kernel.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8e1ba9df
    • Fedor Pchelkin's avatar
      dma-mapping: benchmark: fix node id validation · c5787426
      Fedor Pchelkin authored
      [ Upstream commit 1ff05e72 ]
      
      While validating node ids in map_benchmark_ioctl(), node_possible() may
      be provided with invalid argument outside of [0,MAX_NUMNODES-1] range
      leading to:
      
      BUG: KASAN: wild-memory-access in map_benchmark_ioctl (kernel/dma/map_benchmark.c:214)
      Read of size 8 at addr 1fffffff8ccb6398 by task dma_map_benchma/971
      CPU: 7 PID: 971 Comm: dma_map_benchma Not tainted 6.9.0-rc6 #37
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
      Call Trace:
       <TASK>
      dump_stack_lvl (lib/dump_stack.c:117)
      kasan_report (mm/kasan/report.c:603)
      kasan_check_range (mm/kasan/generic.c:189)
      variable_test_bit (arch/x86/include/asm/bitops.h:227) [inline]
      arch_test_bit (arch/x86/include/asm/bitops.h:239) [inline]
      _test_bit at (include/asm-generic/bitops/instrumented-non-atomic.h:142) [inline]
      node_state (include/linux/nodemask.h:423) [inline]
      map_benchmark_ioctl (kernel/dma/map_benchmark.c:214)
      full_proxy_unlocked_ioctl (fs/debugfs/file.c:333)
      __x64_sys_ioctl (fs/ioctl.c:890)
      do_syscall_64 (arch/x86/entry/common.c:83)
      entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
      
      Compare node ids with sane bounds first. NUMA_NO_NODE is considered a
      special valid case meaning that benchmarking kthreads won't be bound to a
      cpuset of a given node.
      
      Found by Linux Verification Center (linuxtesting.org).
      
      Fixes: 65789daa
      
       ("dma-mapping: add benchmark support for streaming DMA APIs")
      Signed-off-by: default avatarFedor Pchelkin <pchelkin@ispras.ru>
      Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5787426
    • Andy Shevchenko's avatar
      spi: Don't mark message DMA mapped when no transfer in it is · 729fdbfc
      Andy Shevchenko authored
      [ Upstream commit 9f788ba4 ]
      
      There is no need to set the DMA mapped flag of the message if it has
      no mapped transfers. Moreover, it may give the code a chance to take
      the wrong paths, i.e. to exercise DMA related APIs on unmapped data.
      Make __spi_map_msg() to bail earlier on the above mentioned cases.
      
      Fixes: 99adef31
      
       ("spi: Provide core support for DMA mapping transfers")
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Link: https://msgid.link/r/20240522171018.3362521-2-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      729fdbfc
    • Pablo Neira Ayuso's avatar
      netfilter: nft_payload: restore vlan q-in-q match support · 8dfcd778
      Pablo Neira Ayuso authored
      [ Upstream commit aff5c01f ]
      
      Revert f6ae9f12 ("netfilter: nft_payload: add C-VLAN support").
      
      f41f72d0 ("netfilter: nft_payload: simplify vlan header handling")
      already allows to match on inner vlan tags by subtract the vlan header
      size to the payload offset which has been popped and stored in skbuff
      metadata fields.
      
      Fixes: f6ae9f12
      
       ("netfilter: nft_payload: add C-VLAN support")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8dfcd778
    • Eric Dumazet's avatar
      netfilter: nfnetlink_queue: acquire rcu_read_lock() in instance_destroy_rcu() · 68f40354
      Eric Dumazet authored
      [ Upstream commit dc21c6cc ]
      
      syzbot reported that nf_reinject() could be called without rcu_read_lock() :
      
      WARNING: suspicious RCU usage
      6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0 Not tainted
      
      net/netfilter/nfnetlink_queue.c:263 suspicious rcu_dereference_check() usage!
      
      other info that might help us debug this:
      
      rcu_scheduler_active = 2, debug_locks = 1
      2 locks held by syz-executor.4/13427:
        #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:329 [inline]
        #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_do_batch kernel/rcu/tree.c:2190 [inline]
        #0: ffffffff8e334f60 (rcu_callback){....}-{0:0}, at: rcu_core+0xa86/0x1830 kernel/rcu/tree.c:2471
        #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: spin_lock_bh include/linux/spinlock.h:356 [inline]
        #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: nfqnl_flush net/netfilter/nfnetlink_queue.c:405 [inline]
        #1: ffff88801ca92958 (&inst->lock){+.-.}-{2:2}, at: instance_destroy_rcu+0x30/0x220 net/netfilter/nfnetlink_queue.c:172
      
      stack backtrace:
      CPU: 0 PID: 13427 Comm: syz-executor.4 Not tainted 6.9.0-rc7-syzkaller-02060-g5c1672705a1a #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/02/2024
      Call Trace:
       <IRQ>
        __dump_stack lib/dump_stack.c:88 [inline]
        dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
        lockdep_rcu_suspicious+0x221/0x340 kernel/locking/lockdep.c:6712
        nf_reinject net/netfilter/nfnetlink_queue.c:323 [inline]
        nfqnl_reinject+0x6ec/0x1120 net/netfilter/nfnetlink_queue.c:397
        nfqnl_flush net/netfilter/nfnetlink_queue.c:410 [inline]
        instance_destroy_rcu+0x1ae/0x220 net/netfilter/nfnetlink_queue.c:172
        rcu_do_batch kernel/rcu/tree.c:2196 [inline]
        rcu_core+0xafd/0x1830 kernel/rcu/tree.c:2471
        handle_softirqs+0x2d6/0x990 kernel/softirq.c:554
        __do_softirq kernel/softirq.c:588 [inline]
        invoke_softirq kernel/softirq.c:428 [inline]
        __irq_exit_rcu+0xf4/0x1c0 kernel/softirq.c:637
        irq_exit_rcu+0x9/0x30 kernel/softirq.c:649
        instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1043 [inline]
        sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1043
       </IRQ>
       <TASK>
      
      Fixes: 9872bec7
      
       ("[NETFILTER]: nfnetlink: use RCU for queue instances hash")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-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>
      68f40354
    • Larysa Zaremba's avatar
      ice: Interpret .set_channels() input differently · 5ef3a27c
      Larysa Zaremba authored
      [ Upstream commit 05d6f442 ]
      
      A bug occurs because a safety check guarding AF_XDP-related queues in
      ethnl_set_channels(), does not trigger. This happens, because kernel and
      ice driver interpret the ethtool command differently.
      
      How the bug occurs:
      1. ethtool -l <IFNAME> -> combined: 40
      2. Attach AF_XDP to queue 30
      3. ethtool -L <IFNAME> rx 15 tx 15
         combined number is not specified, so command becomes {rx_count = 15,
         tx_count = 15, combined_count = 40}.
      4. ethnl_set_channels checks, if there are any AF_XDP of queues from the
         new (combined_count + rx_count) to the old one, so from 55 to 40, check
         does not trigger.
      5. ice interprets `rx 15 tx 15` as 15 combined channels and deletes the
         queue that AF_XDP is attached to.
      
      Interpret the command in a way that is more consistent with ethtool
      manual [0] (--show-channels and --set-channels).
      
      Considering that in the ice driver only the difference between RX and TX
      queues forms dedicated channels, change the correct way to set number of
      channels to:
      
      ethtool -L <IFNAME> combined 10 /* For symmetric queues */
      ethtool -L <IFNAME> combined 8 tx 2 rx 0 /* For asymmetric queues */
      
      [0] https://man7.org/linux/man-pages/man8/ethtool.8.html
      
      Fixes: 87324e74
      
       ("ice: Implement ethtool ops for channels")
      Reviewed-by: default avatarMichal Swiatkowski <michal.swiatkowski@linux.intel.com>
      Signed-off-by: default avatarLarysa Zaremba <larysa.zaremba@intel.com>
      Tested-by: default avatarChandan Kumar Rout <chandanx.rout@intel.com>
      Tested-by: default avatarPucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
      Acked-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5ef3a27c
    • Henry Wang's avatar
      drivers/xen: Improve the late XenStore init protocol · 5d626f2b
      Henry Wang authored
      [ Upstream commit a3607581 ]
      
      Currently, the late XenStore init protocol is only triggered properly
      for the case that HVM_PARAM_STORE_PFN is ~0ULL (invalid). For the
      case that XenStore interface is allocated but not ready (the connection
      status is not XENSTORE_CONNECTED), Linux should also wait until the
      XenStore is set up properly.
      
      Introduce a macro to describe the XenStore interface is ready, use
      it in xenbus_probe_initcall() to select the code path of doing the
      late XenStore init protocol or not. Since now we have more than one
      condition for XenStore late init, rework the check in xenbus_probe()
      for the free_irq().
      
      Take the opportunity to enhance the check of the allocated XenStore
      interface can be properly mapped, and return error early if the
      memremap() fails.
      
      Fixes: 5b335394
      
       ("xen: add support for initializing xenstore later as HVM domain")
      Signed-off-by: default avatarHenry Wang <xin.wang2@amd.com>
      Signed-off-by: default avatarMichal Orzel <michal.orzel@amd.com>
      Reviewed-by: default avatarStefano Stabellini <sstabellini@kernel.org>
      Link: https://lore.kernel.org/r/20240517011516.1451087-1-xin.wang2@amd.com
      Signed-off-by: default avatarJuergen Gross <jgross@suse.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      5d626f2b
    • Ryosuke Yasuoka's avatar
      nfc: nci: Fix handling of zero-length payload packets in nci_rx_work() · 8d65890c
      Ryosuke Yasuoka authored
      [ Upstream commit 6671e352 ]
      
      When nci_rx_work() receives a zero-length payload packet, it should not
      discard the packet and exit the loop. Instead, it should continue
      processing subsequent packets.
      
      Fixes: d24b0353
      
       ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet")
      Signed-off-by: default avatarRyosuke Yasuoka <ryasuoka@redhat.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Link: https://lore.kernel.org/r/20240521153444.535399-1-ryasuoka@redhat.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8d65890c
    • Tetsuo Handa's avatar
      nfc: nci: Fix kcov check in nci_rx_work() · 20c4691a
      Tetsuo Handa authored
      [ Upstream commit 19e35f24 ]
      
      Commit 7e8cdc97 ("nfc: Add KCOV annotations") added
      kcov_remote_start_common()/kcov_remote_stop() pair into nci_rx_work(),
      with an assumption that kcov_remote_stop() is called upon continue of
      the for loop. But commit d24b0353
      
       ("nfc: nci: Fix uninit-value in
      nci_dev_up and nci_ntf_packet") forgot to call kcov_remote_stop() before
      break of the for loop.
      
      Reported-by: default avatarsyzbot <syzbot+0438378d6f157baae1a2@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=0438378d6f157baae1a2
      Fixes: d24b0353
      
       ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet")
      Suggested-by: default avatarAndrey Konovalov <andreyknvl@gmail.com>
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Link: https://lore.kernel.org/r/6d10f829-5a0c-405a-b39a-d7266f3a1a0b@I-love.SAKURA.ne.jp
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Stable-dep-of: 6671e352
      
       ("nfc: nci: Fix handling of zero-length payload packets in nci_rx_work()")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      20c4691a
    • Paolo Abeni's avatar
      net: relax socket state check at accept time. · c09ddc60
      Paolo Abeni authored
      [ Upstream commit 26afda78 ]
      
      Christoph reported the following splat:
      
      WARNING: CPU: 1 PID: 772 at net/ipv4/af_inet.c:761 __inet_accept+0x1f4/0x4a0
      Modules linked in:
      CPU: 1 PID: 772 Comm: syz-executor510 Not tainted 6.9.0-rc7-g7da7119fe22b #56
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
      RIP: 0010:__inet_accept+0x1f4/0x4a0 net/ipv4/af_inet.c:759
      Code: 04 38 84 c0 0f 85 87 00 00 00 41 c7 04 24 03 00 00 00 48 83 c4 10 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 ec b7 da fd <0f> 0b e9 7f fe ff ff e8 e0 b7 da fd 0f 0b e9 fe fe ff ff 89 d9 80
      RSP: 0018:ffffc90000c2fc58 EFLAGS: 00010293
      RAX: ffffffff836bdd14 RBX: 0000000000000000 RCX: ffff888104668000
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
      RBP: dffffc0000000000 R08: ffffffff836bdb89 R09: fffff52000185f64
      R10: dffffc0000000000 R11: fffff52000185f64 R12: dffffc0000000000
      R13: 1ffff92000185f98 R14: ffff88810754d880 R15: ffff8881007b7800
      FS:  000000001c772880(0000) GS:ffff88811b280000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007fb9fcf2e178 CR3: 00000001045d2002 CR4: 0000000000770ef0
      DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      PKRU: 55555554
      Call Trace:
       <TASK>
       inet_accept+0x138/0x1d0 net/ipv4/af_inet.c:786
       do_accept+0x435/0x620 net/socket.c:1929
       __sys_accept4_file net/socket.c:1969 [inline]
       __sys_accept4+0x9b/0x110 net/socket.c:1999
       __do_sys_accept net/socket.c:2016 [inline]
       __se_sys_accept net/socket.c:2013 [inline]
       __x64_sys_accept+0x7d/0x90 net/socket.c:2013
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0x58/0x100 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x76/0x7e
      RIP: 0033:0x4315f9
      Code: fd ff 48 81 c4 80 00 00 00 e9 f1 fe ff ff 0f 1f 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 0f 83 ab b4 fd ff c3 66 2e 0f 1f 84 00 00 00 00
      RSP: 002b:00007ffdb26d9c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
      RAX: ffffffffffffffda RBX: 0000000000400300 RCX: 00000000004315f9
      RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
      RBP: 00000000006e1018 R08: 0000000000400300 R09: 0000000000400300
      R10: 0000000000400300 R11: 0000000000000246 R12: 0000000000000000
      R13: 000000000040cdf0 R14: 000000000040ce80 R15: 0000000000000055
       </TASK>
      
      The reproducer invokes shutdown() before entering the listener status.
      After commit 94062790
      
       ("tcp: defer shutdown(SEND_SHUTDOWN) for
      TCP_SYN_RECV sockets"), the above causes the child to reach the accept
      syscall in FIN_WAIT1 status.
      
      Eric noted we can relax the existing assertion in __inet_accept()
      
      Reported-by: default avatarChristoph Paasch <cpaasch@apple.com>
      Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/490
      Suggested-by: default avatarEric Dumazet <edumazet@google.com>
      Fixes: 94062790
      
       ("tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets")
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/23ab880a44d8cfd967e84de8b93dbf48848e3d8c.1716299669.git.pabeni@redhat.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c09ddc60
    • Paolo Abeni's avatar
      inet: factor out locked section of inet_accept() in a new helper · e1e80e7f
      Paolo Abeni authored
      [ Upstream commit 711bdd51
      
       ]
      
      No functional changes intended. The new helper will be used
      by the MPTCP protocol in the next patch to avoid duplicating
      a few LoC.
      
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Signed-off-by: default avatarMat Martineau <martineau@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Stable-dep-of: 26afda78
      
       ("net: relax socket state check at accept time.")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e1e80e7f
    • Dae R. Jeong's avatar
      tls: fix missing memory barrier in tls_init · 335c8f15
      Dae R. Jeong authored
      [ Upstream commit 91e61dd7 ]
      
      In tls_init(), a write memory barrier is missing, and store-store
      reordering may cause NULL dereference in tls_{setsockopt,getsockopt}.
      
      CPU0                               CPU1
      -----                              -----
      // In tls_init()
      // In tls_ctx_create()
      ctx = kzalloc()
      ctx->sk_proto = READ_ONCE(sk->sk_prot) -(1)
      
      // In update_sk_prot()
      WRITE_ONCE(sk->sk_prot, tls_prots)     -(2)
      
                                         // In sock_common_setsockopt()
                                         READ_ONCE(sk->sk_prot)->setsockopt()
      
                                         // In tls_{setsockopt,getsockopt}()
                                         ctx->sk_proto->setsockopt()    -(3)
      
      In the above scenario, when (1) and (2) are reordered, (3) can observe
      the NULL value of ctx->sk_proto, causing NULL dereference.
      
      To fix it, we rely on rcu_assign_pointer() which implies the release
      barrier semantic. By moving rcu_assign_pointer() after ctx->sk_proto is
      initialized, we can ensure that ctx->sk_proto are visible when
      changing sk->sk_prot.
      
      Fixes: d5bee737
      
       ("net/tls: Annotate access to sk_prot with READ_ONCE/WRITE_ONCE")
      Signed-off-by: default avatarYewon Choi <woni9911@gmail.com>
      Signed-off-by: default avatarDae R. Jeong <threeearcat@gmail.com>
      Link: https://lore.kernel.org/netdev/ZU4OJG56g2V9z_H7@dragonet/T/
      Link: https://lore.kernel.org/r/Zkx4vjSFp0mfpjQ2@libra05
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      335c8f15
    • Wei Fang's avatar
      net: fec: avoid lock evasion when reading pps_enable · 4f11834e
      Wei Fang authored
      [ Upstream commit 3b1c92f8 ]
      
      The assignment of pps_enable is protected by tmreg_lock, but the read
      operation of pps_enable is not. So the Coverity tool reports a lock
      evasion warning which may cause data race to occur when running in a
      multithread environment. Although this issue is almost impossible to
      occur, we'd better fix it, at least it seems more logically reasonable,
      and it also prevents Coverity from continuing to issue warnings.
      
      Fixes: 278d2404
      
       ("net: fec: ptp: Enable PPS output based on ptp clock")
      Signed-off-by: default avatarWei Fang <wei.fang@nxp.com>
      Link: https://lore.kernel.org/r/20240521023800.17102-1-wei.fang@nxp.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4f11834e
    • Jacob Keller's avatar
      Revert "ixgbe: Manual AN-37 for troublesome link partners for X550 SFI" · eeae2526
      Jacob Keller authored
      [ Upstream commit b35b1c0b ]
      
      This reverts commit 56573604.
      
      According to the commit, it implements a manual AN-37 for some
      "troublesome" Juniper MX5 switches. This appears to be a workaround for a
      particular switch.
      
      It has been reported that this causes a severe breakage for other switches,
      including a Cisco 3560CX-12PD-S.
      
      The code appears to be a workaround for a specific switch which fails to
      link in SFI mode. It expects to see AN-37 auto negotiation in order to
      link. The Cisco switch is not expecting AN-37 auto negotiation. When the
      device starts the manual AN-37, the Cisco switch decides that the port is
      confused and stops attempting to link with it. This persists until a power
      cycle. A simple driver unload and reload does not resolve the issue, even
      if loading with a version of the driver which lacks this workaround.
      
      The authors of the workaround commit have not responded with
      clarifications, and the result of the workaround is complete failure to
      connect with other switches.
      
      This appears to be a case where the driver can either "correctly" link with
      the Juniper MX5 switch, at the cost of bricking the link with the Cisco
      switch, or it can behave properly for the Cisco switch, but fail to link
      with the Junipir MX5 switch. I do not know enough about the standards
      involved to clearly determine whether either switch is at fault or behaving
      incorrectly. Nor do I know whether there exists some alternative fix which
      corrects behavior with both switches.
      
      Revert the workaround for the Juniper switch.
      
      Fixes: 56573604
      
       ("ixgbe: Manual AN-37 for troublesome link partners for X550 SFI")
      Link: https://lore.kernel.org/netdev/cbe874db-9ac9-42b8-afa0-88ea910e1e99@intel.com/T/
      Link: https://forum.proxmox.com/threads/intel-x553-sfp-ixgbe-no-go-on-pve8.135129/#post-612291
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Jeff Daly <jeffd@silicom-usa.com>
      Cc: kernel.org-fo5k2w@ycharbi.fr
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20240520-net-2024-05-20-revert-silicom-switch-workaround-v1-1-50f80f261c94@intel.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      eeae2526
    • Matthew Bystrin's avatar
      riscv: stacktrace: fixed walk_stackframe() · 2ae3749f
      Matthew Bystrin authored
      [ Upstream commit a2a4d4a6 ]
      
      If the load access fault occures in a leaf function (with
      CONFIG_FRAME_POINTER=y), when wrong stack trace will be displayed:
      
      [<ffffffff804853c2>] regmap_mmio_read32le+0xe/0x1c
      ---[ end trace 0000000000000000 ]---
      
      Registers dump:
          ra     0xffffffff80485758 <regmap_mmio_read+36>
          sp     0xffffffc80200b9a0
          fp     0xffffffc80200b9b0
          pc     0xffffffff804853ba <regmap_mmio_read32le+6>
      
      Stack dump:
          0xffffffc80200b9a0:  0xffffffc80200b9e0  0xffffffc80200b9e0
          0xffffffc80200b9b0:  0xffffffff8116d7e8  0x0000000000000100
          0xffffffc80200b9c0:  0xffffffd8055b9400  0xffffffd8055b9400
          0xffffffc80200b9d0:  0xffffffc80200b9f0  0xffffffff8047c526
          0xffffffc80200b9e0:  0xffffffc80200ba30  0xffffffff8047fe9a
      
      The assembler dump of the function preambula:
          add     sp,sp,-16
          sd      s0,8(sp)
          add     s0,sp,16
      
      In the fist stack frame, where ra is not stored on the stack we can
      observe:
      
              0(sp)                  8(sp)
              .---------------------------------------------.
          sp->|       frame->fp      | frame->ra (saved fp) |
              |---------------------------------------------|
          fp->|         ....         |         ....         |
              |---------------------------------------------|
              |                      |                      |
      
      and in the code check is performed:
      	if (regs && (regs->epc == pc) && (frame->fp & 0x7))
      
      I see no reason to check frame->fp value at all, because it is can be
      uninitialized value on the stack. A better way is to check frame->ra to
      be an address on the stack. After the stacktrace shows as expect:
      
      [<ffffffff804853c2>] regmap_mmio_read32le+0xe/0x1c
      [<ffffffff80485758>] regmap_mmio_read+0x24/0x52
      [<ffffffff8047c526>] _regmap_bus_reg_read+0x1a/0x22
      [<ffffffff8047fe9a>] _regmap_read+0x5c/0xea
      [<ffffffff80480376>] _regmap_update_bits+0x76/0xc0
      ...
      ---[ end trace 0000000000000000 ]---
      As pointed by Samuel Holland it is incorrect to remove check of the stackframe
      entirely.
      
      Changes since v2 [2]:
       - Add accidentally forgotten curly brace
      
      Changes since v1 [1]:
       - Instead of just dropping frame->fp check, replace it with validation of
         frame->ra, which should be a stack address.
       - Move frame pointer validation into the separate function.
      
      [1] https://lore.kernel.org/linux-riscv/20240426072701.6463-1-dev.mbstr@gmail.com/
      [2] https://lore.kernel.org/linux-riscv/20240521131314.48895-1-dev.mbstr@gmail.com/
      
      Fixes: f766f77a
      
       ("riscv/stacktrace: Fix stack output without ra on the stack top")
      Signed-off-by: default avatarMatthew Bystrin <dev.mbstr@gmail.com>
      Reviewed-by: default avatarSamuel Holland <samuel.holland@sifive.com>
      Link: https://lore.kernel.org/r/20240521191727.62012-1-dev.mbstr@gmail.com
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2ae3749f
    • Guo Ren's avatar
      riscv: stacktrace: Make walk_stackframe cross pt_regs frame · 62bcc5c9
      Guo Ren authored
      [ Upstream commit 7ecdadf7
      
       ]
      
      The current walk_stackframe with FRAME_POINTER would stop unwinding at
      ret_from_exception:
        BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1518
        in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1, name: init
        CPU: 0 PID: 1 Comm: init Not tainted 5.10.113-00021-g15c15974895c-dirty #192
        Call Trace:
        [<ffffffe0002038c8>] walk_stackframe+0x0/0xee
        [<ffffffe000aecf48>] show_stack+0x32/0x4a
        [<ffffffe000af1618>] dump_stack_lvl+0x72/0x8e
        [<ffffffe000af1648>] dump_stack+0x14/0x1c
        [<ffffffe000239ad2>] ___might_sleep+0x12e/0x138
        [<ffffffe000239aec>] __might_sleep+0x10/0x18
        [<ffffffe000afe3fe>] down_read+0x22/0xa4
        [<ffffffe000207588>] do_page_fault+0xb0/0x2fe
        [<ffffffe000201b80>] ret_from_exception+0x0/0xc
      
      The optimization would help walk_stackframe cross the pt_regs frame and
      get more backtrace of debug info:
        BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1518
        in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 1, name: init
        CPU: 0 PID: 1 Comm: init Not tainted 5.10.113-00021-g15c15974895c-dirty #192
        Call Trace:
        [<ffffffe0002038c8>] walk_stackframe+0x0/0xee
        [<ffffffe000aecf48>] show_stack+0x32/0x4a
        [<ffffffe000af1618>] dump_stack_lvl+0x72/0x8e
        [<ffffffe000af1648>] dump_stack+0x14/0x1c
        [<ffffffe000239ad2>] ___might_sleep+0x12e/0x138
        [<ffffffe000239aec>] __might_sleep+0x10/0x18
        [<ffffffe000afe3fe>] down_read+0x22/0xa4
        [<ffffffe000207588>] do_page_fault+0xb0/0x2fe
        [<ffffffe000201b80>] ret_from_exception+0x0/0xc
        [<ffffffe000613c06>] riscv_intc_irq+0x1a/0x72
        [<ffffffe000201b80>] ret_from_exception+0x0/0xc
        [<ffffffe00033f44a>] vma_link+0x54/0x160
        [<ffffffe000341d7a>] mmap_region+0x2cc/0x4d0
        [<ffffffe000342256>] do_mmap+0x2d8/0x3ac
        [<ffffffe000326318>] vm_mmap_pgoff+0x70/0xb8
        [<ffffffe00032638a>] vm_mmap+0x2a/0x36
        [<ffffffe0003cfdde>] elf_map+0x72/0x84
        [<ffffffe0003d05f8>] load_elf_binary+0x69a/0xec8
        [<ffffffe000376240>] bprm_execve+0x246/0x53a
        [<ffffffe00037786c>] kernel_execve+0xe8/0x124
        [<ffffffe000aecdf2>] run_init_process+0xfa/0x10c
        [<ffffffe000aece16>] try_to_run_init_process+0x12/0x3c
        [<ffffffe000afa920>] kernel_init+0xb4/0xf8
        [<ffffffe000201b80>] ret_from_exception+0x0/0xc
      
      Here is the error injection test code for the above output:
       drivers/irqchip/irq-riscv-intc.c:
       static asmlinkage void riscv_intc_irq(struct pt_regs *regs)
       {
              unsigned long cause = regs->cause & ~CAUSE_IRQ_FLAG;
      +       u32 tmp; __get_user(tmp, (u32 *)0);
      
      Signed-off-by: default avatarGuo Ren <guoren@linux.alibaba.com>
      Signed-off-by: default avatarGuo Ren <guoren@kernel.org>
      Link: https://lore.kernel.org/r/20221109064937.3643993-3-guoren@kernel.org
      [Palmer: use SYM_CODE_*]
      Signed-off-by: default avatarPalmer Dabbelt <palmer@rivosinc.com>
      Stable-dep-of: a2a4d4a6
      
       ("riscv: stacktrace: fixed walk_stackframe()")
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      62bcc5c9
    • Jiri Pirko's avatar
      virtio: delete vq in vp_find_vqs_msix() when request_irq() fails · abf00165
      Jiri Pirko authored
      [ Upstream commit 89875151 ]
      
      When request_irq() fails, error path calls vp_del_vqs(). There, as vq is
      present in the list, free_irq() is called for the same vector. That
      causes following splat:
      
      [    0.414355] Trying to free already-free IRQ 27
      [    0.414403] WARNING: CPU: 1 PID: 1 at kernel/irq/manage.c:1899 free_irq+0x1a1/0x2d0
      [    0.414510] Modules linked in:
      [    0.414540] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc4+ #27
      [    0.414540] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-1.fc39 04/01/2014
      [    0.414540] RIP: 0010:free_irq+0x1a1/0x2d0
      [    0.414540] Code: 1e 00 48 83 c4 08 48 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 90 8b 74 24 04 48 c7 c7 98 80 6c b1 e8 00 c9 f7 ff 90 <0f> 0b 90 90 48 89 ee 4c 89 ef e8 e0 20 b8 00 49 8b 47 40 48 8b 40
      [    0.414540] RSP: 0000:ffffb71480013ae0 EFLAGS: 00010086
      [    0.414540] RAX: 0000000000000000 RBX: ffffa099c2722000 RCX: 0000000000000000
      [    0.414540] RDX: 0000000000000000 RSI: ffffb71480013998 RDI: 0000000000000001
      [    0.414540] RBP: 0000000000000246 R08: 00000000ffffdfff R09: 0000000000000001
      [    0.414540] R10: 00000000ffffdfff R11: ffffffffb18729c0 R12: ffffa099c1c91760
      [    0.414540] R13: ffffa099c1c916a4 R14: ffffa099c1d2f200 R15: ffffa099c1c91600
      [    0.414540] FS:  0000000000000000(0000) GS:ffffa099fec40000(0000) knlGS:0000000000000000
      [    0.414540] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [    0.414540] CR2: 0000000000000000 CR3: 0000000008e3e001 CR4: 0000000000370ef0
      [    0.414540] Call Trace:
      [    0.414540]  <TASK>
      [    0.414540]  ? __warn+0x80/0x120
      [    0.414540]  ? free_irq+0x1a1/0x2d0
      [    0.414540]  ? report_bug+0x164/0x190
      [    0.414540]  ? handle_bug+0x3b/0x70
      [    0.414540]  ? exc_invalid_op+0x17/0x70
      [    0.414540]  ? asm_exc_invalid_op+0x1a/0x20
      [    0.414540]  ? free_irq+0x1a1/0x2d0
      [    0.414540]  vp_del_vqs+0xc1/0x220
      [    0.414540]  vp_find_vqs_msix+0x305/0x470
      [    0.414540]  vp_find_vqs+0x3e/0x1a0
      [    0.414540]  vp_modern_find_vqs+0x1b/0x70
      [    0.414540]  init_vqs+0x387/0x600
      [    0.414540]  virtnet_probe+0x50a/0xc80
      [    0.414540]  virtio_dev_probe+0x1e0/0x2b0
      [    0.414540]  really_probe+0xc0/0x2c0
      [    0.414540]  ? __pfx___driver_attach+0x10/0x10
      [    0.414540]  __driver_probe_device+0x73/0x120
      [    0.414540]  driver_probe_device+0x1f/0xe0
      [    0.414540]  __driver_attach+0x88/0x180
      [    0.414540]  bus_for_each_dev+0x85/0xd0
      [    0.414540]  bus_add_driver+0xec/0x1f0
      [    0.414540]  driver_register+0x59/0x100
      [    0.414540]  ? __pfx_virtio_net_driver_init+0x10/0x10
      [    0.414540]  virtio_net_driver_init+0x90/0xb0
      [    0.414540]  do_one_initcall+0x58/0x230
      [    0.414540]  kernel_init_freeable+0x1a3/0x2d0
      [    0.414540]  ? __pfx_kernel_init+0x10/0x10
      [    0.414540]  kernel_init+0x1a/0x1c0
      [    0.414540]  ret_from_fork+0x31/0x50
      [    0.414540]  ? __pfx_kernel_init+0x10/0x10
      [    0.414540]  ret_from_fork_asm+0x1a/0x30
      [    0.414540]  </TASK>
      
      Fix this by calling deleting the current vq when request_irq() fails.
      
      Fixes: 0b0f9dc5
      
       ("Revert "virtio_pci: use shared interrupts for virtqueues"")
      Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
      Message-Id: <20240426150845.3999481-1-jiri@resnulli.us>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      abf00165
    • Yang Li's avatar
      rv: Update rv_en(dis)able_monitor doc to match kernel-doc · e63c1085
      Yang Li authored
      [ Upstream commit 1e8b7b3d ]
      
      The patch updates the function documentation comment for
      rv_en(dis)able_monitor to adhere to the kernel-doc specification.
      
      Link: https://lore.kernel.org/linux-trace-kernel/20240520054239.61784-1-yang.lee@linux.alibaba.com
      
      Fixes: 102227b9
      
       ("rv: Add Runtime Verification (RV) interface")
      Signed-off-by: default avatarYang Li <yang.lee@linux.alibaba.com>
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e63c1085
    • Jiangfeng Xiao's avatar
      arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY · 3fd487ff
      Jiangfeng Xiao authored
      [ Upstream commit ffbf4fb9 ]
      
      When CONFIG_DEBUG_BUGVERBOSE=n, we fail to add necessary padding bytes
      to bug_table entries, and as a result the last entry in a bug table will
      be ignored, potentially leading to an unexpected panic(). All prior
      entries in the table will be handled correctly.
      
      The arm64 ABI requires that struct fields of up to 8 bytes are
      naturally-aligned, with padding added within a struct such that struct
      are suitably aligned within arrays.
      
      When CONFIG_DEBUG_BUGVERPOSE=y, the layout of a bug_entry is:
      
      	struct bug_entry {
      		signed int      bug_addr_disp;	// 4 bytes
      		signed int      file_disp;	// 4 bytes
      		unsigned short  line;		// 2 bytes
      		unsigned short  flags;		// 2 bytes
      	}
      
      ... with 12 bytes total, requiring 4-byte alignment.
      
      When CONFIG_DEBUG_BUGVERBOSE=n, the layout of a bug_entry is:
      
      	struct bug_entry {
      		signed int      bug_addr_disp;	// 4 bytes
      		unsigned short  flags;		// 2 bytes
      		< implicit padding >		// 2 bytes
      	}
      
      ... with 8 bytes total, with 6 bytes of data and 2 bytes of trailing
      padding, requiring 4-byte alginment.
      
      When we create a bug_entry in assembly, we align the start of the entry
      to 4 bytes, which implicitly handles padding for any prior entries.
      However, we do not align the end of the entry, and so when
      CONFIG_DEBUG_BUGVERBOSE=n, the final entry lacks the trailing padding
      bytes.
      
      For the main kernel image this is not a problem as find_bug() doesn't
      depend on the trailing padding bytes when searching for entries:
      
      	for (bug = __start___bug_table; bug < __stop___bug_table; ++bug)
      		if (bugaddr == bug_addr(bug))
      			return bug;
      
      However for modules, module_bug_finalize() depends on the trailing
      bytes when calculating the number of entries:
      
      	mod->num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
      
      ... and as the last bug_entry lacks the necessary padding bytes, this entry
      will not be counted, e.g. in the case of a single entry:
      
      	sechdrs[i].sh_size == 6
      	sizeof(struct bug_entry) == 8;
      
      	sechdrs[i].sh_size / sizeof(struct bug_entry) == 0;
      
      Consequently module_find_bug() will miss the last bug_entry when it does:
      
      	for (i = 0; i < mod->num_bugs; ++i, ++bug)
      		if (bugaddr == bug_addr(bug))
      			goto out;
      
      ... which can lead to a kenrel panic due to an unhandled bug.
      
      This can be demonstrated with the following module:
      
      	static int __init buginit(void)
      	{
      		WARN(1, "hello\n");
      		return 0;
      	}
      
      	static void __exit bugexit(void)
      	{
      	}
      
      	module_init(buginit);
      	module_exit(bugexit);
      	MODULE_LICENSE("GPL");
      
      ... which will trigger a kernel panic when loaded:
      
      	------------[ cut here ]------------
      	hello
      	Unexpected kernel BRK exception at EL1
      	Internal error: BRK handler: 00000000f2000800 [#1] PREEMPT SMP
      	Modules linked in: hello(O+)
      	CPU: 0 PID: 50 Comm: insmod Tainted: G           O       6.9.1 #8
      	Hardware name: linux,dummy-virt (DT)
      	pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
      	pc : buginit+0x18/0x1000 [hello]
      	lr : buginit+0x18/0x1000 [hello]
      	sp : ffff800080533ae0
      	x29: ffff800080533ae0 x28: 0000000000000000 x27: 0000000000000000
      	x26: ffffaba8c4e70510 x25: ffff800080533c30 x24: ffffaba8c4a28a58
      	x23: 0000000000000000 x22: 0000000000000000 x21: ffff3947c0eab3c0
      	x20: ffffaba8c4e3f000 x19: ffffaba846464000 x18: 0000000000000006
      	x17: 0000000000000000 x16: ffffaba8c2492834 x15: 0720072007200720
      	x14: 0720072007200720 x13: ffffaba8c49b27c8 x12: 0000000000000312
      	x11: 0000000000000106 x10: ffffaba8c4a0a7c8 x9 : ffffaba8c49b27c8
      	x8 : 00000000ffffefff x7 : ffffaba8c4a0a7c8 x6 : 80000000fffff000
      	x5 : 0000000000000107 x4 : 0000000000000000 x3 : 0000000000000000
      	x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff3947c0eab3c0
      	Call trace:
      	 buginit+0x18/0x1000 [hello]
      	 do_one_initcall+0x80/0x1c8
      	 do_init_module+0x60/0x218
      	 load_module+0x1ba4/0x1d70
      	 __do_sys_init_module+0x198/0x1d0
      	 __arm64_sys_init_module+0x1c/0x28
      	 invoke_syscall+0x48/0x114
      	 el0_svc_common.constprop.0+0x40/0xe0
      	 do_el0_svc+0x1c/0x28
      	 el0_svc+0x34/0xd8
      	 el0t_64_sync_handler+0x120/0x12c
      	 el0t_64_sync+0x190/0x194
      	Code: d0ffffe0 910003fd 91000000 9400000b (d4210000)
      	---[ end trace 0000000000000000 ]---
      	Kernel panic - not syncing: BRK handler: Fatal exception
      
      Fix this by always aligning the end of a bug_entry to 4 bytes, which is
      correct regardless of CONFIG_DEBUG_BUGVERBOSE.
      
      Fixes: 9fb7410f
      
       ("arm64/BUG: Use BRK instruction for generic BUG traps")
      
      Signed-off-by: default avatarYuanbin Xie <xieyuanbin1@huawei.com>
      Signed-off-by: default avatarJiangfeng Xiao <xiaojiangfeng@huawei.com>
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Link: https://lore.kernel.org/r/1716212077-43826-1-git-send-email-xiaojiangfeng@huawei.com
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3fd487ff
    • Aaron Conole's avatar
      openvswitch: Set the skbuff pkt_type for proper pmtud support. · b4ff9af8
      Aaron Conole authored
      [ Upstream commit 30a92c9e
      
       ]
      
      Open vSwitch is originally intended to switch at layer 2, only dealing with
      Ethernet frames.  With the introduction of l3 tunnels support, it crossed
      into the realm of needing to care a bit about some routing details when
      making forwarding decisions.  If an oversized packet would need to be
      fragmented during this forwarding decision, there is a chance for pmtu
      to get involved and generate a routing exception.  This is gated by the
      skbuff->pkt_type field.
      
      When a flow is already loaded into the openvswitch module this field is
      set up and transitioned properly as a packet moves from one port to
      another.  In the case that a packet execute is invoked after a flow is
      newly installed this field is not properly initialized.  This causes the
      pmtud mechanism to omit sending the required exception messages across
      the tunnel boundary and a second attempt needs to be made to make sure
      that the routing exception is properly setup.  To fix this, we set the
      outgoing packet's pkt_type to PACKET_OUTGOING, since it can only get
      to the openvswitch module via a port device or packet command.
      
      Even for bridge ports as users, the pkt_type needs to be reset when
      doing the transmit as the packet is truly outgoing and routing needs
      to get involved post packet transformations, in the case of
      VXLAN/GENEVE/udp-tunnel packets.  In general, the pkt_type on output
      gets ignored, since we go straight to the driver, but in the case of
      tunnel ports they go through IP routing layer.
      
      This issue is periodically encountered in complex setups, such as large
      openshift deployments, where multiple sets of tunnel traversal occurs.
      A way to recreate this is with the ovn-heater project that can setup
      a networking environment which mimics such large deployments.  We need
      larger environments for this because we need to ensure that flow
      misses occur.  In these environment, without this patch, we can see:
      
        ./ovn_cluster.sh start
        podman exec ovn-chassis-1 ip r a 170.168.0.5/32 dev eth1 mtu 1200
        podman exec ovn-chassis-1 ip netns exec sw01p1 ip r flush cache
        podman exec ovn-chassis-1 ip netns exec sw01p1 \
               ping 21.0.0.3 -M do -s 1300 -c2
        PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data.
        From 21.0.0.3 icmp_seq=2 Frag needed and DF set (mtu = 1142)
      
        --- 21.0.0.3 ping statistics ---
        ...
      
      Using tcpdump, we can also see the expected ICMP FRAG_NEEDED message is not
      sent into the server.
      
      With this patch, setting the pkt_type, we see the following:
      
        podman exec ovn-chassis-1 ip netns exec sw01p1 \
               ping 21.0.0.3 -M do -s 1300 -c2
        PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data.
        From 21.0.0.3 icmp_seq=1 Frag needed and DF set (mtu = 1222)
        ping: local error: message too long, mtu=1222
      
        --- 21.0.0.3 ping statistics ---
        ...
      
      In this case, the first ping request receives the FRAG_NEEDED message and
      a local routing exception is created.
      
      Tested-by: default avatarJaime Caamano <jcaamano@redhat.com>
      Reported-at: https://issues.redhat.com/browse/FDP-164
      Fixes: 58264848
      
       ("openvswitch: Add vxlan tunneling support.")
      Signed-off-by: default avatarAaron Conole <aconole@redhat.com>
      Acked-by: default avatarEelco Chaudron <echaudro@redhat.com>
      Link: https://lore.kernel.org/r/20240516200941.16152-1-aconole@redhat.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b4ff9af8
    • Olga Kornievskaia's avatar
      pNFS/filelayout: fixup pNfs allocation modes · 1d20ba60
      Olga Kornievskaia authored
      [ Upstream commit 3ebcb246 ]
      
      Change left over allocation flags.
      
      Fixes: a245832a
      
       ("pNFS/files: Ensure pNFS allocation modes are consistent with nfsiod")
      Signed-off-by: default avatarOlga Kornievskaia <kolga@netapp.com>
      Reviewed-by: default avatarBenjamin Coddington <bcodding@redhat.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      1d20ba60
    • Kuniyuki Iwashima's avatar
      tcp: Fix shift-out-of-bounds in dctcp_update_alpha(). · e65d13ec
      Kuniyuki Iwashima authored
      [ Upstream commit 3ebc46ca
      
       ]
      
      In dctcp_update_alpha(), we use a module parameter dctcp_shift_g
      as follows:
      
        alpha -= min_not_zero(alpha, alpha >> dctcp_shift_g);
        ...
        delivered_ce <<= (10 - dctcp_shift_g);
      
      It seems syzkaller started fuzzing module parameters and triggered
      shift-out-of-bounds [0] by setting 100 to dctcp_shift_g:
      
        memcpy((void*)0x20000080,
               "/sys/module/tcp_dctcp/parameters/dctcp_shift_g\000", 47);
        res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul,
                      /*flags=*/2ul, /*mode=*/0ul);
        memcpy((void*)0x20000000, "100\000", 4);
        syscall(__NR_write, /*fd=*/r[0], /*val=*/0x20000000ul, /*len=*/4ul);
      
      Let's limit the max value of dctcp_shift_g by param_set_uint_minmax().
      
      With this patch:
      
        # echo 10 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g
        # cat /sys/module/tcp_dctcp/parameters/dctcp_shift_g
        10
        # echo 11 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g
        -bash: echo: write error: Invalid argument
      
      [0]:
      UBSAN: shift-out-of-bounds in net/ipv4/tcp_dctcp.c:143:12
      shift exponent 100 is too large for 32-bit type 'u32' (aka 'unsigned int')
      CPU: 0 PID: 8083 Comm: syz-executor345 Not tainted 6.9.0-05151-g1b294a1f3561 #2
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
      1.13.0-1ubuntu1.1 04/01/2014
      Call Trace:
       <TASK>
       __dump_stack lib/dump_stack.c:88 [inline]
       dump_stack_lvl+0x201/0x300 lib/dump_stack.c:114
       ubsan_epilogue lib/ubsan.c:231 [inline]
       __ubsan_handle_shift_out_of_bounds+0x346/0x3a0 lib/ubsan.c:468
       dctcp_update_alpha+0x540/0x570 net/ipv4/tcp_dctcp.c:143
       tcp_in_ack_event net/ipv4/tcp_input.c:3802 [inline]
       tcp_ack+0x17b1/0x3bc0 net/ipv4/tcp_input.c:3948
       tcp_rcv_state_process+0x57a/0x2290 net/ipv4/tcp_input.c:6711
       tcp_v4_do_rcv+0x764/0xc40 net/ipv4/tcp_ipv4.c:1937
       sk_backlog_rcv include/net/sock.h:1106 [inline]
       __release_sock+0x20f/0x350 net/core/sock.c:2983
       release_sock+0x61/0x1f0 net/core/sock.c:3549
       mptcp_subflow_shutdown+0x3d0/0x620 net/mptcp/protocol.c:2907
       mptcp_check_send_data_fin+0x225/0x410 net/mptcp/protocol.c:2976
       __mptcp_close+0x238/0xad0 net/mptcp/protocol.c:3072
       mptcp_close+0x2a/0x1a0 net/mptcp/protocol.c:3127
       inet_release+0x190/0x1f0 net/ipv4/af_inet.c:437
       __sock_release net/socket.c:659 [inline]
       sock_close+0xc0/0x240 net/socket.c:1421
       __fput+0x41b/0x890 fs/file_table.c:422
       task_work_run+0x23b/0x300 kernel/task_work.c:180
       exit_task_work include/linux/task_work.h:38 [inline]
       do_exit+0x9c8/0x2540 kernel/exit.c:878
       do_group_exit+0x201/0x2b0 kernel/exit.c:1027
       __do_sys_exit_group kernel/exit.c:1038 [inline]
       __se_sys_exit_group kernel/exit.c:1036 [inline]
       __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1036
       do_syscall_x64 arch/x86/entry/common.c:52 [inline]
       do_syscall_64+0xe4/0x240 arch/x86/entry/common.c:83
       entry_SYSCALL_64_after_hwframe+0x67/0x6f
      RIP: 0033:0x7f6c2b5005b6
      Code: Unable to access opcode bytes at 0x7f6c2b50058c.
      RSP: 002b:00007ffe883eb948 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
      RAX: ffffffffffffffda RBX: 00007f6c2b5862f0 RCX: 00007f6c2b5005b6
      RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
      RBP: 0000000000000001 R08: 00000000000000e7 R09: ffffffffffffffc0
      R10: 0000000000000006 R11: 0000000000000246 R12: 00007f6c2b5862f0
      R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
       </TASK>
      
      Reported-by: default avatarsyzkaller <syzkaller@googlegroups.com>
      Reported-by: default avatarYue Sun <samsun1006219@gmail.com>
      Reported-by: default avatarxingwei lee <xrivendell7@gmail.com>
      Closes: https://lore.kernel.org/netdev/CAEkJfYNJM=cw-8x7_Vmj1J6uYVCWMbbvD=EFmDPVBGpTsqOxEA@mail.gmail.com/
      Fixes: e3118e83
      
       ("net: tcp: add DCTCP congestion control algorithm")
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20240517091626.32772-1-kuniyu@amazon.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e65d13ec
    • Hangbin Liu's avatar
      ipv6: sr: fix memleak in seg6_hmac_init_algo · 599a5654
      Hangbin Liu authored
      [ Upstream commit efb9f4f1 ]
      
      seg6_hmac_init_algo returns without cleaning up the previous allocations
      if one fails, so it's going to leak all that memory and the crypto tfms.
      
      Update seg6_hmac_exit to only free the memory when allocated, so we can
      reuse the code directly.
      
      Fixes: bf355b8d
      
       ("ipv6: sr: add core files for SR HMAC support")
      Reported-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Closes: https://lore.kernel.org/netdev/Zj3bh-gE7eT6V6aH@hog/
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarSabrina Dubroca <sd@queasysnail.net>
      Link: https://lore.kernel.org/r/20240517005435.2600277-1-liuhangbin@gmail.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      599a5654
    • Kuniyuki Iwashima's avatar
      af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock. · 4bf69644
      Kuniyuki Iwashima authored
      [ Upstream commit 9841991a ]
      
      Billy Jheng Bing-Jhong reported a race between __unix_gc() and
      queue_oob().
      
      __unix_gc() tries to garbage-collect close()d inflight sockets,
      and then if the socket has MSG_OOB in unix_sk(sk)->oob_skb, GC
      will drop the reference and set NULL to it locklessly.
      
      However, the peer socket still can send MSG_OOB message and
      queue_oob() can update unix_sk(sk)->oob_skb concurrently, leading
      NULL pointer dereference. [0]
      
      To fix the issue, let's update unix_sk(sk)->oob_skb under the
      sk_receive_queue's lock and take it everywhere we touch oob_skb.
      
      Note that we defer kfree_skb() in manage_oob() to silence lockdep
      false-positive (See [1]).
      
      [0]:
      BUG: kernel NULL pointer dereference, address: 0000000000000008
       PF: supervisor write access in kernel mode
       PF: error_code(0x0002) - not-present page
      PGD 8000000009f5e067 P4D 8000000009f5e067 PUD 9f5d067 PMD 0
      Oops: 0002 [#1] PREEMPT SMP PTI
      CPU: 3 PID: 50 Comm: kworker/3:1 Not tainted 6.9.0-rc5-00191-gd091e579b864 #110
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
      Workqueue: events delayed_fput
      RIP: 0010:skb_dequeue (./include/linux/skbuff.h:2386 ./include/linux/skbuff.h:2402 net/core/skbuff.c:3847)
      Code: 39 e3 74 3e 8b 43 10 48 89 ef 83 e8 01 89 43 10 49 8b 44 24 08 49 c7 44 24 08 00 00 00 00 49 8b 14 24 49 c7 04 24 00 00 00 00 <48> 89 42 08 48 89 10 e8 e7 c5 42 00 4c 89 e0 5b 5d 41 5c c3 cc cc
      RSP: 0018:ffffc900001bfd48 EFLAGS: 00000002
      RAX: 0000000000000000 RBX: ffff8880088f5ae8 RCX: 00000000361289f9
      RDX: 0000000000000000 RSI: 0000000000000206 RDI: ffff8880088f5b00
      RBP: ffff8880088f5b00 R08: 0000000000080000 R09: 0000000000000001
      R10: 0000000000000003 R11: 0000000000000001 R12: ffff8880056b6a00
      R13: ffff8880088f5280 R14: 0000000000000001 R15: ffff8880088f5a80
      FS:  0000000000000000(0000) GS:ffff88807dd80000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 0000000000000008 CR3: 0000000006314000 CR4: 00000000007506f0
      PKRU: 55555554
      Call Trace:
       <TASK>
       unix_release_sock (net/unix/af_unix.c:654)
       unix_release (net/unix/af_unix.c:1050)
       __sock_release (net/socket.c:660)
       sock_close (net/socket.c:1423)
       __fput (fs/file_table.c:423)
       delayed_fput (fs/file_table.c:444 (discriminator 3))
       process_one_work (kernel/workqueue.c:3259)
       worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416)
       kthread (kernel/kthread.c:388)
       ret_from_fork (arch/x86/kernel/process.c:153)
       ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
       </TASK>
      Modules linked in:
      CR2: 0000000000000008
      
      Link: https://lore.kernel.org/netdev/a00d3993-c461-43f2-be6d-07259c98509a@rbox.co/ [1]
      Fixes: 1279f9d9
      
       ("af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.")
      Reported-by: default avatarBilly Jheng Bing-Jhong <billy@starlabs.sg>
      Signed-off-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Link: https://lore.kernel.org/r/20240516134835.8332-1-kuniyu@amazon.com
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      4bf69644
    • Dan Aloni's avatar
      rpcrdma: fix handling for RDMA_CM_EVENT_DEVICE_REMOVAL · cdc02349
      Dan Aloni authored
      [ Upstream commit 4836da21 ]
      
      Under the scenario of IB device bonding, when bringing down one of the
      ports, or all ports, we saw xprtrdma entering a non-recoverable state
      where it is not even possible to complete the disconnect and shut it
      down the mount, requiring a reboot. Following debug, we saw that
      transport connect never ended after receiving the
      RDMA_CM_EVENT_DEVICE_REMOVAL callback.
      
      The DEVICE_REMOVAL callback is irrespective of whether the CM_ID is
      connected, and ESTABLISHED may not have happened. So need to work with
      each of these states accordingly.
      
      Fixes: 2acc5cae
      
       ('xprtrdma: Prevent dereferencing r_xprt->rx_ep after it is freed')
      Cc: Sagi Grimberg <sagi.grimberg@vastdata.com>
      Signed-off-by: default avatarDan Aloni <dan.aloni@vastdata.com>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      cdc02349
    • Dan Aloni's avatar
      sunrpc: fix NFSACL RPC retry on soft mount · 3c92f3a5
      Dan Aloni authored
      [ Upstream commit 0dc9f430 ]
      
      It used to be quite awhile ago since 1b63a751 ('SUNRPC: Refactor
      rpc_clone_client()'), in 2012, that `cl_timeout` was copied in so that
      all mount parameters propagate to NFSACL clients. However since that
      change, if mount options as follows are given:
      
          soft,timeo=50,retrans=16,vers=3
      
      The resultant NFSACL client receives:
      
          cl_softrtry: 1
          cl_timeout: to_initval=60000, to_maxval=60000, to_increment=0, to_retries=2, to_exponential=0
      
      These values lead to NFSACL operations not being retried under the
      condition of transient network outages with soft mount. Instead, getacl
      call fails after 60 seconds with EIO.
      
      The simple fix is to pass the existing client's `cl_timeout` as the new
      client timeout.
      
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Cc: Benjamin Coddington <bcodding@redhat.com>
      Link: https://lore.kernel.org/all/20231105154857.ryakhmgaptq3hb6b@gmail.com/T/
      Fixes: 1b63a751
      
       ('SUNRPC: Refactor rpc_clone_client()')
      Signed-off-by: default avatarDan Aloni <dan.aloni@vastdata.com>
      Reviewed-by: default avatarBenjamin Coddington <bcodding@redhat.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3c92f3a5
    • Martin Kaiser's avatar
      nfs: keep server info for remounts · 99530e42
      Martin Kaiser authored
      [ Upstream commit b322bf9e ]
      
      With newer kernels that use fs_context for nfs mounts, remounts fail with
      -EINVAL.
      
      $ mount -t nfs -o nolock 10.0.0.1:/tmp/test /mnt/test/
      $ mount -t nfs -o remount /mnt/test/
      mount: mounting 10.0.0.1:/tmp/test on /mnt/test failed: Invalid argument
      
      For remounts, the nfs server address and port are populated by
      nfs_init_fs_context and later overwritten with 0x00 bytes by
      nfs23_parse_monolithic. The remount then fails as the server address is
      invalid.
      
      Fix this by not overwriting nfs server info in nfs23_parse_monolithic if
      we're doing a remount.
      
      Fixes: f2aedb71
      
       ("NFS: Add fs_context support.")
      Signed-off-by: default avatarMartin Kaiser <martin@kaiser.cx>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      99530e42
    • Benjamin Coddington's avatar
      NFSv4: Fixup smatch warning for ambiguous return · b72a3a25
      Benjamin Coddington authored
      [ Upstream commit 37ffe065
      
       ]
      
      Dan Carpenter reports smatch warning for nfs4_try_migration() when a memory
      allocation failure results in a zero return value.  In this case, a
      transient allocation failure error will likely be retried the next time the
      server responds with NFS4ERR_MOVED.
      
      We can fixup the smatch warning with a small refactor: attempt all three
      allocations before testing and returning on a failure.
      
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Fixes: c3ed2227
      
       ("NFSv4: Fix free of uninitialized nfs4_label on referral lookup.")
      Signed-off-by: default avatarBenjamin Coddington <bcodding@redhat.com>
      Reviewed-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      b72a3a25
    • Shenghao Ding's avatar
      ASoC: tas2552: Add TX path for capturing AUDIO-OUT data · 7995b66f
      Shenghao Ding authored
      [ Upstream commit 7078ac4f ]
      
      TAS2552 is a Smartamp with I/V sense data, add TX path
      to support capturing I/V data.
      
      Fixes: 38803ce7
      
       ("ASoC: codecs: tas*: merge .digital_mute() into .mute_stream()")
      Signed-off-by: default avatarShenghao Ding <shenghao-ding@ti.com>
      Link: https://msgid.link/r/20240518033515.866-1-shenghao-ding@ti.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      7995b66f
    • Ryosuke Yasuoka's avatar
      nfc: nci: Fix uninit-value in nci_rx_work · e8c8e0d0
      Ryosuke Yasuoka authored
      [ Upstream commit e4a87abf ]
      
      syzbot reported the following uninit-value access issue [1]
      
      nci_rx_work() parses received packet from ndev->rx_q. It should be
      validated header size, payload size and total packet size before
      processing the packet. If an invalid packet is detected, it should be
      silently discarded.
      
      Fixes: d24b0353
      
       ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet")
      Reported-and-tested-by: default avatar <syzbot+d7b4dc6cd50410152534@syzkaller.appspotmail.com>
      Closes: https://syzkaller.appspot.com/bug?extid=d7b4dc6cd50410152534 [1]
      Signed-off-by: default avatarRyosuke Yasuoka <ryasuoka@redhat.com>
      Reviewed-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e8c8e0d0
    • Taehee Yoo's avatar
      selftests: net: kill smcrouted in the cleanup logic in amt.sh · 47c5707d
      Taehee Yoo authored
      [ Upstream commit cc563e74 ]
      
      The amt.sh requires smcrouted for multicasting routing.
      So, it starts smcrouted before forwarding tests.
      It must be stopped after all tests, but it isn't.
      
      To fix this issue, it kills smcrouted in the cleanup logic.
      
      Fixes: c08e8bae
      
       ("selftests: add amt interface selftest script")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      47c5707d
    • Andrea Mayer's avatar
      ipv6: sr: fix missing sk_buff release in seg6_input_core · 8f1fc3b8
      Andrea Mayer authored
      [ Upstream commit 5447f970 ]
      
      The seg6_input() function is responsible for adding the SRH into a
      packet, delegating the operation to the seg6_input_core(). This function
      uses the skb_cow_head() to ensure that there is sufficient headroom in
      the sk_buff for accommodating the link-layer header.
      In the event that the skb_cow_header() function fails, the
      seg6_input_core() catches the error but it does not release the sk_buff,
      which will result in a memory leak.
      
      This issue was introduced in commit af3b5158 ("ipv6: sr: fix BUG due
      to headroom too small after SRH push") and persists even after commit
      7a3f5b0d ("netfilter: add netfilter hooks to SRv6 data plane"),
      where the entire seg6_input() code was refactored to deal with netfilter
      hooks.
      
      The proposed patch addresses the identified memory leak by requiring the
      seg6_input_core() function to release the sk_buff in the event that
      skb_cow_head() fails.
      
      Fixes: af3b5158
      
       ("ipv6: sr: fix BUG due to headroom too small after SRH push")
      Signed-off-by: default avatarAndrea Mayer <andrea.mayer@uniroma2.it>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8f1fc3b8
    • Florian Fainelli's avatar
      net: Always descend into dsa/ folder with CONFIG_NET_DSA enabled · d2223fd3
      Florian Fainelli authored
      [ Upstream commit b1fa60ec ]
      
      Stephen reported that he was unable to get the dsa_loop driver to get
      probed, and the reason ended up being because he had CONFIG_FIXED_PHY=y
      in his kernel configuration. As Masahiro explained it:
      
        "obj-m += dsa/" means everything under dsa/ must be modular.
      
        If there is a built-in object under dsa/ with CONFIG_NET_DSA=m,
        you cannot do  "obj-$(CONFIG_NET_DSA) += dsa/".
      
        You need to change it back to "obj-y += dsa/".
      
      This was the case here whereby CONFIG_NET_DSA=m, and so the
      obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o rule is not executed and
      the DSA loop mdio_board info structure is not registered with the
      kernel, and eventually the device is simply not found.
      
      To preserve the intention of the original commit of limiting the amount
      of folder descending, conditionally descend into drivers/net/dsa when
      CONFIG_NET_DSA is enabled.
      
      Fixes: 227d7206
      
       ("dsa: simplify Kconfig symbols and dependencies")
      Reported-by: default avatarStephen Langstaff <stephenlangstaff1@gmail.com>
      Signed-off-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
      Reviewed-by: default avatarVladimir Oltean <olteanv@gmail.com>
      Reviewed-by: default avatarAlexander Lobakin <aleksander.lobakin@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      d2223fd3
    • Masahiro Yamada's avatar
      x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when UNWINDER_FRAME_POINTER=y · fde26c4a
      Masahiro Yamada authored
      [ Upstream commit 66ee3636 ]
      
      It took me some time to understand the purpose of the tricky code at
      the end of arch/x86/Kconfig.debug.
      
      Without it, the following would be shown:
      
        WARNING: unmet direct dependencies detected for FRAME_POINTER
      
      because
      
        81d38719 ("x86/kconfig: Consolidate unwinders into multiple choice selection")
      
      removed 'select ARCH_WANT_FRAME_POINTERS'.
      
      The correct and more straightforward approach should have been to move
      it where 'select FRAME_POINTER' is located.
      
      Several architectures properly handle the conditional selection of
      ARCH_WANT_FRAME_POINTERS. For example, 'config UNWINDER_FRAME_POINTER'
      in arch/arm/Kconfig.debug.
      
      Fixes: 81d38719
      
       ("x86/kconfig: Consolidate unwinders into multiple choice selection")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Acked-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Link: https://lore.kernel.org/r/20240204122003.53795-1-masahiroy@kernel.org
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      fde26c4a
    • Namhyung Kim's avatar
      perf/arm-dmc620: Fix lockdep assert in ->event_init() · f23f182b
      Namhyung Kim authored
      [ Upstream commit a4c5a457
      
       ]
      
      for_each_sibling_event() checks leader's ctx but it doesn't have the ctx
      yet if it's the leader.  Like in perf_event_validate_size(), we should
      skip checking siblings in that case.
      
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Fixes: f3c0eba2
      
       ("perf: Add a few assertions")
      Reported-by: default avatarGreg Thelen <gthelen@google.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Cc: Tuan Phan <tuanphan@os.amperecomputing.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Link: https://lore.kernel.org/r/20240514180050.182454-1-namhyung@kernel.org
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      f23f182b
    • Matti Vaittinen's avatar
      regulator: bd71828: Don't overwrite runtime voltages · e9774d15
      Matti Vaittinen authored
      [ Upstream commit 0f9f7c63
      
       ]
      
      Some of the regulators on the BD71828 have common voltage setting for
      RUN/SUSPEND/IDLE/LPSR states. The enable control can be set for each
      state though.
      
      The driver allows setting the voltage values for these states via
      device-tree. As a side effect, setting the voltages for
      SUSPEND/IDLE/LPSR will also change the RUN level voltage which is not
      desired and can break the system.
      
      The comment in code reflects this behaviour, but it is likely to not
      make people any happier. The right thing to do is to allow setting the
      enable/disable state at SUSPEND/IDLE/LPSR via device-tree, but to
      disallow setting state specific voltages for those regulators.
      
      BUCK1 is a bit different. It only shares the SUSPEND and LPSR state
      voltages. The former behaviour of allowing to silently overwrite the
      SUSPEND state voltage by LPSR state voltage is also changed here so that
      the SUSPEND voltage is prioritized over LPSR voltage.
      
      Prevent setting PMIC state specific voltages for regulators which do not
      support it.
      
      Signed-off-by: default avatarMatti Vaittinen <mazziesaccount@gmail.com>
      Fixes: 522498f8
      
       ("regulator: bd71828: Basic support for ROHM bd71828 PMIC regulators")
      Link: https://msgid.link/r/e1883ae1e3ae5668f1030455d4750923561f3d68.1715848512.git.mazziesaccount@gmail.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e9774d15
    • Hsin-Te Yuan's avatar
      ASoC: mediatek: mt8192: fix register configuration for tdm · 60c406bb
      Hsin-Te Yuan authored
      [ Upstream commit a85ed162 ]
      
      For DSP_A, data is a BCK cycle behind LRCK trigger edge. For DSP_B, this
      delay doesn't exist. Fix the delay configuration to match the standard.
      
      Fixes: 52fcd654
      
       ("ASoC: mediatek: mt8192: support tdm in platform driver")
      Signed-off-by: default avatarHsin-Te Yuan <yuanhsinte@chromium.org>
      Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
      Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
      Link: https://lore.kernel.org/r/20240509-8192-tdm-v1-1-530b54645763@chromium.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      60c406bb
    • Richard Fitzgerald's avatar
      ALSA: hda/cs_dsp_ctl: Use private_free for control cleanup · 191dc1b2
      Richard Fitzgerald authored
      [ Upstream commit 172811e3
      
       ]
      
      Use the control private_free callback to free the associated data
      block. This ensures that the memory won't leak, whatever way the
      control gets destroyed.
      
      The original implementation didn't actually remove the ALSA
      controls in hda_cs_dsp_control_remove(). It only freed the internal
      tracking structure. This meant it was possible to remove/unload the
      amp driver while leaving its ALSA controls still present in the
      soundcard. Obviously attempting to access them could cause segfaults
      or at least dereferencing stale pointers.
      
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Fixes: 3233b978
      
       ("ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls")
      Link: https://lore.kernel.org/r/20240508095627.44476-1-rf@opensource.cirrus.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      191dc1b2