1. 03 Oct, 2024 35 commits
    • Jakub Kicinski's avatar
      Merge branch 'rxrpc-miscellaneous-fixes' · 35f12108
      Jakub Kicinski authored
      David Howells says:
      
      ====================
      rxrpc: Miscellaneous fixes
      
      Here some miscellaneous fixes for AF_RXRPC:
      
       (1) Fix a race in the I/O thread vs UDP socket setup.
      
       (2) Fix an uninitialised variable.
      ====================
      
      Link: https://patch.msgid.link/20241001132702.3122709-1-dhowells@redhat.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      35f12108
    • David Howells's avatar
      rxrpc: Fix uninitialised variable in rxrpc_send_data() · 7a310f8d
      David Howells authored
      Fix the uninitialised txb variable in rxrpc_send_data() by moving the code
      that loads it above all the jumps to maybe_error, txb being stored back
      into call->tx_pending right before the normal return.
      
      Fixes: b0f571ec ("rxrpc: Fix locking in rxrpc's sendmsg")
      Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Closes: https://lists.infradead.org/pipermail/linux-afs/2024-October/008896.htmlSigned-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: linux-afs@lists.infradead.org
      Link: https://patch.msgid.link/20241001132702.3122709-3-dhowells@redhat.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7a310f8d
    • David Howells's avatar
      rxrpc: Fix a race between socket set up and I/O thread creation · bc212465
      David Howells authored
      In rxrpc_open_socket(), it sets up the socket and then sets up the I/O
      thread that will handle it.  This is a problem, however, as there's a gap
      between the two phases in which a packet may come into rxrpc_encap_rcv()
      from the UDP packet but we oops when trying to wake the not-yet created I/O
      thread.
      
      As a quick fix, just make rxrpc_encap_rcv() discard the packet if there's
      no I/O thread yet.
      
      A better, but more intrusive fix would perhaps be to rearrange things such
      that the socket creation is done by the I/O thread.
      
      Fixes: a275da62 ("rxrpc: Create a per-local endpoint receive queue and I/O thread")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      cc: yuxuanzhe@outlook.com
      cc: Marc Dionne <marc.dionne@auristor.com>
      cc: Simon Horman <horms@kernel.org>
      cc: linux-afs@lists.infradead.org
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20241001132702.3122709-2-dhowells@redhat.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bc212465
    • Jakub Kicinski's avatar
      Merge branch 'tcp-3-fixes-for-retrans_stamp-and-undo-logic' · 9af25dd9
      Jakub Kicinski authored
      Neal Cardwell says:
      
      ====================
      tcp: 3 fixes for retrans_stamp and undo logic
      
      Geumhwan Yu <geumhwan.yu@samsung.com> recently reported and diagnosed
      a regression in TCP loss recovery undo logic in the case where a TCP
      connection enters fast recovery, is unable to retransmit anything due to
      TSQ, and then receives an ACK allowing forward progress. The sender should
      be able to undo the spurious loss recovery in this case, but was not doing
      so. The first patch fixes this regression.
      
      Running our suite of packetdrill tests with the first fix, the tests
      highlighted two other small bugs in the way retrans_stamp is updated in
      some rare corner cases. The second two patches fix those other two small
      bugs.
      
      Thanks to Geumhwan Yu for the bug report!
      ====================
      
      Link: https://patch.msgid.link/20241001200517.2756803-1-ncardwell.sw@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9af25dd9
    • Neal Cardwell's avatar
      tcp: fix TFO SYN_RECV to not zero retrans_stamp with retransmits out · 27c80efc
      Neal Cardwell authored
      Fix tcp_rcv_synrecv_state_fastopen() to not zero retrans_stamp
      if retransmits are outstanding.
      
      tcp_fastopen_synack_timer() sets retrans_stamp, so typically we'll
      need to zero retrans_stamp here to prevent spurious
      retransmits_timed_out(). The logic to zero retrans_stamp is from this
      2019 commit:
      
      commit cd736d8b ("tcp: fix retrans timestamp on passive Fast Open")
      
      However, in the corner case where the ACK of our TFO SYNACK carried
      some SACK blocks that caused us to enter TCP_CA_Recovery then that
      non-zero retrans_stamp corresponds to the active fast recovery, and we
      need to leave retrans_stamp with its current non-zero value, for
      correct ETIMEDOUT and undo behavior.
      
      Fixes: cd736d8b ("tcp: fix retrans timestamp on passive Fast Open")
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20241001200517.2756803-4-ncardwell.sw@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      27c80efc
    • Neal Cardwell's avatar
      tcp: fix tcp_enter_recovery() to zero retrans_stamp when it's safe · b41b4cbd
      Neal Cardwell authored
      Fix tcp_enter_recovery() so that if there are no retransmits out then
      we zero retrans_stamp when entering fast recovery. This is necessary
      to fix two buggy behaviors.
      
      Currently a non-zero retrans_stamp value can persist across multiple
      back-to-back loss recovery episodes. This is because we generally only
      clears retrans_stamp if we are completely done with loss recoveries,
      and get to tcp_try_to_open() and find !tcp_any_retrans_done(sk). This
      behavior causes two bugs:
      
      (1) When a loss recovery episode (CA_Loss or CA_Recovery) is followed
      immediately by a new CA_Recovery, the retrans_stamp value can persist
      and can be a time before this new CA_Recovery episode starts. That
      means that timestamp-based undo will be using the wrong retrans_stamp
      (a value that is too old) when comparing incoming TS ecr values to
      retrans_stamp to see if the current fast recovery episode can be
      undone.
      
      (2) If there is a roughly minutes-long sequence of back-to-back fast
      recovery episodes, one after another (e.g. in a shallow-buffered or
      policed bottleneck), where each fast recovery successfully makes
      forward progress and recovers one window of sequence space (but leaves
      at least one retransmit in flight at the end of the recovery),
      followed by several RTOs, then the ETIMEDOUT check may be using the
      wrong retrans_stamp (a value set at the start of the first fast
      recovery in the sequence). This can cause a very premature ETIMEDOUT,
      killing the connection prematurely.
      
      This commit changes the code to zero retrans_stamp when entering fast
      recovery, when this is known to be safe (no retransmits are out in the
      network). That ensures that when starting a fast recovery episode, and
      it is safe to do so, retrans_stamp is set when we send the fast
      retransmit packet. That addresses both bug (1) and bug (2) by ensuring
      that (if no retransmits are out when we start a fast recovery) we use
      the initial fast retransmit of this fast recovery as the time value
      for undo and ETIMEDOUT calculations.
      
      This makes intuitive sense, since the start of a new fast recovery
      episode (in a scenario where no lost packets are out in the network)
      means that the connection has made forward progress since the last RTO
      or fast recovery, and we should thus "restart the clock" used for both
      undo and ETIMEDOUT logic.
      
      Note that if when we start fast recovery there *are* retransmits out
      in the network, there can still be undesirable (1)/(2) issues. For
      example, after this patch we can still have the (1) and (2) problems
      in cases like this:
      
      + round 1: sender sends flight 1
      
      + round 2: sender receives SACKs and enters fast recovery 1,
        retransmits some packets in flight 1 and then sends some new data as
        flight 2
      
      + round 3: sender receives some SACKs for flight 2, notes losses, and
        retransmits some packets to fill the holes in flight 2
      
      + fast recovery has some lost retransmits in flight 1 and continues
        for one or more rounds sending retransmits for flight 1 and flight 2
      
      + fast recovery 1 completes when snd_una reaches high_seq at end of
        flight 1
      
      + there are still holes in the SACK scoreboard in flight 2, so we
        enter fast recovery 2, but some retransmits in the flight 2 sequence
        range are still in flight (retrans_out > 0), so we can't execute the
        new retrans_stamp=0 added here to clear retrans_stamp
      
      It's not yet clear how to fix these remaining (1)/(2) issues in an
      efficient way without breaking undo behavior, given that retrans_stamp
      is currently used for undo and ETIMEDOUT. Perhaps the optimal (but
      expensive) strategy would be to set retrans_stamp to the timestamp of
      the earliest outstanding retransmit when entering fast recovery. But
      at least this commit makes things better.
      
      Note that this does not change the semantics of retrans_stamp; it
      simply makes retrans_stamp accurate in some cases where it was not
      before:
      
      (1) Some loss recovery, followed by an immediate entry into a fast
      recovery, where there are no retransmits out when entering the fast
      recovery.
      
      (2) When a TFO server has a SYNACK retransmit that sets retrans_stamp,
      and then the ACK that completes the 3-way handshake has SACK blocks
      that trigger a fast recovery. In this case when entering fast recovery
      we want to zero out the retrans_stamp from the TFO SYNACK retransmit,
      and set the retrans_stamp based on the timestamp of the fast recovery.
      
      We introduce a tcp_retrans_stamp_cleanup() helper, because this
      two-line sequence already appears in 3 places and is about to appear
      in 2 more as a result of this bug fix patch series. Once this bug fix
      patches series in the net branch makes it into the net-next branch
      we'll update the 3 other call sites to use the new helper.
      
      This is a long-standing issue. The Fixes tag below is chosen to be the
      oldest commit at which the patch will apply cleanly, which is from
      Linux v3.5 in 2012.
      
      Fixes: 1fbc3405 ("tcp: early retransmit: tcp_enter_recovery()")
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20241001200517.2756803-3-ncardwell.sw@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b41b4cbd
    • Neal Cardwell's avatar
      tcp: fix to allow timestamp undo if no retransmits were sent · e37ab737
      Neal Cardwell authored
      Fix the TCP loss recovery undo logic in tcp_packet_delayed() so that
      it can trigger undo even if TSQ prevents a fast recovery episode from
      reaching tcp_retransmit_skb().
      
      Geumhwan Yu <geumhwan.yu@samsung.com> recently reported that after
      this commit from 2019:
      
      commit bc9f38c8 ("tcp: avoid unconditional congestion window undo
      on SYN retransmit")
      
      ...and before this fix we could have buggy scenarios like the
      following:
      
      + Due to reordering, a TCP connection receives some SACKs and enters a
        spurious fast recovery.
      
      + TSQ prevents all invocations of tcp_retransmit_skb(), because many
        skbs are queued in lower layers of the sending machine's network
        stack; thus tp->retrans_stamp remains 0.
      
      + The connection receives a TCP timestamp ECR value echoing a
        timestamp before the fast recovery, indicating that the fast
        recovery was spurious.
      
      + The connection fails to undo the spurious fast recovery because
        tp->retrans_stamp is 0, and thus tcp_packet_delayed() returns false,
        due to the new logic in the 2019 commit: commit bc9f38c8 ("tcp:
        avoid unconditional congestion window undo on SYN retransmit")
      
      This fix tweaks the logic to be more similar to the
      tcp_packet_delayed() logic before bc9f38c8, except that we take
      care not to be fooled by the FLAG_SYN_ACKED code path zeroing out
      tp->retrans_stamp (the bug noted and fixed by Yuchung in
      bc9f38c8).
      
      Note that this returns the high-level behavior of tcp_packet_delayed()
      to again match the comment for the function, which says: "Nothing was
      retransmitted or returned timestamp is less than timestamp of the
      first retransmission." Note that this comment is in the original
      2005-04-16 Linux git commit, so this is evidently long-standing
      behavior.
      
      Fixes: bc9f38c8 ("tcp: avoid unconditional congestion window undo on SYN retransmit")
      Reported-by: default avatarGeumhwan Yu <geumhwan.yu@samsung.com>
      Diagnosed-by: default avatarGeumhwan Yu <geumhwan.yu@samsung.com>
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Signed-off-by: default avatarYuchung Cheng <ycheng@google.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://patch.msgid.link/20241001200517.2756803-2-ncardwell.sw@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e37ab737
    • Jakub Kicinski's avatar
      Merge branch 'fix-aqr-pma-capabilities' · ec636707
      Jakub Kicinski authored
      Abhishek Chauhan says:
      
      ====================
      Fix AQR PMA capabilities
      
      Patch 1:-
      AQR115c reports incorrect PMA capabilities which includes
      10G/5G and also incorrectly disables capabilities like autoneg
      and 10Mbps support.
      
      AQR115c as per the Marvell databook supports speeds up to 2.5Gbps
      with autonegotiation.
      
      Patch 2:-
      Remove the use of phy_set_max_speed in phy driver as the
      function is mainly used in MAC driver to set the max
      speed.
      
      Instead use get_features to fix up Phy PMA capabilities for
      AQR111, AQR111B0, AQR114C and AQCS109
      ====================
      
      Link: https://patch.msgid.link/20241001224626.2400222-1-quic_abchauha@quicinc.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ec636707
    • Abhishek Chauhan's avatar
      net: phy: aquantia: remove usage of phy_set_max_speed · 8f61d733
      Abhishek Chauhan authored
      Remove the use of phy_set_max_speed in phy driver as the
      function is mainly used in MAC driver to set the max
      speed.
      
      Instead use get_features to fix up Phy PMA capabilities for
      AQR111, AQR111B0, AQR114C and AQCS109
      
      Fixes: 038ba1dc ("net: phy: aquantia: add AQR111 and AQR111B0 PHY ID")
      Fixes: 0974f1f0 ("net: phy: aquantia: remove false 5G and 10G speed ability for AQCS109")
      Fixes: c278ec64 ("net: phy: aquantia: add support for AQR114C PHY ID")
      Link: https://lore.kernel.org/all/20240913011635.1286027-1-quic_abchauha@quicinc.com/T/Signed-off-by: default avatarAbhishek Chauhan <quic_abchauha@quicinc.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Link: https://patch.msgid.link/20241001224626.2400222-3-quic_abchauha@quicinc.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8f61d733
    • Abhishek Chauhan's avatar
      net: phy: aquantia: AQR115c fix up PMA capabilities · 17cbfcdd
      Abhishek Chauhan authored
      AQR115c reports incorrect PMA capabilities which includes
      10G/5G and also incorrectly disables capabilities like autoneg
      and 10Mbps support.
      
      AQR115c as per the Marvell databook supports speeds up to 2.5Gbps
      with autonegotiation.
      
      Fixes: 0ebc581f ("net: phy: aquantia: add support for aqr115c")
      Link: https://lore.kernel.org/all/20240913011635.1286027-1-quic_abchauha@quicinc.com/T/Signed-off-by: default avatarAbhishek Chauhan <quic_abchauha@quicinc.com>
      Reviewed-by: default avatarRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Link: https://patch.msgid.link/20241001224626.2400222-2-quic_abchauha@quicinc.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      17cbfcdd
    • Sebastian Andrzej Siewior's avatar
      sfc: Don't invoke xdp_do_flush() from netpoll. · 55e80246
      Sebastian Andrzej Siewior authored
      Yury reported a crash in the sfc driver originated from
      netpoll_send_udp(). The netconsole sends a message and then netpoll
      invokes the driver's NAPI function with a budget of zero. It is
      dedicated to allow driver to free TX resources, that it may have used
      while sending the packet.
      
      In the netpoll case the driver invokes xdp_do_flush() unconditionally,
      leading to crash because bpf_net_context was never assigned.
      
      Invoke xdp_do_flush() only if budget is not zero.
      
      Fixes: 401cb7da ("net: Reference bpf_redirect_info via task_struct on PREEMPT_RT.")
      Reported-by: default avatarYury Vostrikov <mon@unformed.ru>
      Closes: https://lore.kernel.org/5627f6d1-5491-4462-9d75-bc0612c26a22@app.fastmail.comSigned-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Reviewed-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
      Link: https://patch.msgid.link/20241002125837.utOcRo6Y@linutronix.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      55e80246
    • Ingo van Lil's avatar
      net: phy: dp83869: fix memory corruption when enabling fiber · a842e443
      Ingo van Lil authored
      When configuring the fiber port, the DP83869 PHY driver incorrectly
      calls linkmode_set_bit() with a bit mask (1 << 10) rather than a bit
      number (10). This corrupts some other memory location -- in case of
      arm64 the priv pointer in the same structure.
      
      Since the advertising flags are updated from supported at the end of the
      function the incorrect line isn't needed at all and can be removed.
      
      Fixes: a29de52b ("net: dp83869: Add ability to advertise Fiber connection")
      Signed-off-by: default avatarIngo van Lil <inguin@gmx.de>
      Reviewed-by: default avatarAlexander Sverdlin <alexander.sverdlin@siemens.com>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Link: https://patch.msgid.link/20241002161807.440378-1-inguin@gmx.deSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a842e443
    • Linus Torvalds's avatar
      Merge tag 'net-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 8c245fe7
      Linus Torvalds authored
      Pull networking fixes from Paolo Abeni:
       "Including fixes from ieee802154, bluetooth and netfilter.
      
        Current release - regressions:
      
         - eth: mlx5: fix wrong reserved field in hca_cap_2 in mlx5_ifc
      
         - eth: am65-cpsw: fix forever loop in cleanup code
      
        Current release - new code bugs:
      
         - eth: mlx5: HWS, fixed double-free in error flow of creating SQ
      
        Previous releases - regressions:
      
         - core: avoid potential underflow in qdisc_pkt_len_init() with UFO
      
         - core: test for not too small csum_start in virtio_net_hdr_to_skb()
      
         - vrf: revert "vrf: remove unnecessary RCU-bh critical section"
      
         - bluetooth:
             - fix uaf in l2cap_connect
             - fix possible crash on mgmt_index_removed
      
         - dsa: improve shutdown sequence
      
         - eth: mlx5e: SHAMPO, fix overflow of hd_per_wq
      
         - eth: ip_gre: fix drops of small packets in ipgre_xmit
      
        Previous releases - always broken:
      
         - core: fix gso_features_check to check for both
           dev->gso_{ipv4_,}max_size
      
         - core: fix tcp fraglist segmentation after pull from frag_list
      
         - netfilter: nf_tables: prevent nf_skb_duplicated corruption
      
         - sctp: set sk_state back to CLOSED if autobind fails in
           sctp_listen_start
      
         - mac802154: fix potential RCU dereference issue in
           mac802154_scan_worker
      
         - eth: fec: restart PPS after link state change"
      
      * tag 'net-6.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (48 commits)
        sctp: set sk_state back to CLOSED if autobind fails in sctp_listen_start
        dt-bindings: net: xlnx,axi-ethernet: Add missing reg minItems
        doc: net: napi: Update documentation for napi_schedule_irqoff
        net/ncsi: Disable the ncsi work before freeing the associated structure
        net: phy: qt2025: Fix warning: unused import DeviceId
        gso: fix udp gso fraglist segmentation after pull from frag_list
        bridge: mcast: Fail MDB get request on empty entry
        vrf: revert "vrf: Remove unnecessary RCU-bh critical section"
        net: ethernet: ti: am65-cpsw: Fix forever loop in cleanup code
        net: phy: realtek: Check the index value in led_hw_control_get
        ppp: do not assume bh is held in ppp_channel_bridge_input()
        selftests: rds: move include.sh to TEST_FILES
        net: test for not too small csum_start in virtio_net_hdr_to_skb()
        net: gso: fix tcp fraglist segmentation after pull from frag_list
        ipv4: ip_gre: Fix drops of small packets in ipgre_xmit
        net: stmmac: dwmac4: extend timeout for VLAN Tag register busy bit check
        net: add more sanity checks to qdisc_pkt_len_init()
        net: avoid potential underflow in qdisc_pkt_len_init() with UFO
        net: ethernet: ti: cpsw_ale: Fix warning on some platforms
        net: microchip: Make FDMA config symbol invisible
        ...
      8c245fe7
    • Linus Torvalds's avatar
      Merge tag 'v6.12-rc1-ksmbd-fixes' of git://git.samba.org/ksmbd · 9c02404b
      Linus Torvalds authored
      Pull smb server fixes from Steve French:
      
       - small cleanup patches leveraging struct size to improve access bounds checking
      
      * tag 'v6.12-rc1-ksmbd-fixes' of git://git.samba.org/ksmbd:
        ksmbd: Use struct_size() to improve smb_direct_rdma_xmit()
        ksmbd: Annotate struct copychunk_ioctl_req with __counted_by_le()
        ksmbd: Use struct_size() to improve get_file_alternate_info()
      9c02404b
    • Linus Torvalds's avatar
      Merge tag 'vfs-6.12-rc2.fixes.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs · 20c2474f
      Linus Torvalds authored
      Pull vfs fixes from Christian Brauner:
       "vfs:
      
         - Ensure that iter_folioq_get_pages() advances to the next slot
           otherwise it will end up using the same folio with an out-of-bound
           offset.
      
        iomap:
      
         - Dont unshare delalloc extents which can't be reflinked, and thus
           can't be shared.
      
         - Constrain the file range passed to iomap_file_unshare() directly in
           iomap instead of requiring the callers to do it.
      
        netfs:
      
         - Use folioq_count instead of folioq_nr_slot to prevent an
           unitialized value warning in netfs_clear_buffer().
      
         - Fix missing wakeup after issuing writes by scheduling the write
           collector only if all the subrequest queues are empty and thus no
           writes are pending.
      
         - Fix two minor documentation bugs"
      
      * tag 'vfs-6.12-rc2.fixes.2' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
        iomap: constrain the file range passed to iomap_file_unshare
        iomap: don't bother unsharing delalloc extents
        netfs: Fix missing wakeup after issuing writes
        Documentation: add missing folio_queue entry
        folio_queue: fix documentation
        netfs: Fix a KMSAN uninit-value error in netfs_clear_buffer
        iov_iter: fix advancing slot in iter_folioq_get_pages()
      20c2474f
    • Xin Long's avatar
      sctp: set sk_state back to CLOSED if autobind fails in sctp_listen_start · 8beee4d8
      Xin Long authored
      In sctp_listen_start() invoked by sctp_inet_listen(), it should set the
      sk_state back to CLOSED if sctp_autobind() fails due to whatever reason.
      
      Otherwise, next time when calling sctp_inet_listen(), if sctp_sk(sk)->reuse
      is already set via setsockopt(SCTP_REUSE_PORT), sctp_sk(sk)->bind_hash will
      be dereferenced as sk_state is LISTENING, which causes a crash as bind_hash
      is NULL.
      
        KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
        RIP: 0010:sctp_inet_listen+0x7f0/0xa20 net/sctp/socket.c:8617
        Call Trace:
         <TASK>
         __sys_listen_socket net/socket.c:1883 [inline]
         __sys_listen+0x1b7/0x230 net/socket.c:1894
         __do_sys_listen net/socket.c:1902 [inline]
      
      Fixes: 5e8f3f70 ("sctp: simplify sctp listening code")
      Reported-by: syzbot+f4e0f821e3a3b7cee51d@syzkaller.appspotmail.com
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Link: https://patch.msgid.link/a93e655b3c153dc8945d7a812e6d8ab0d52b7aa0.1727729391.git.lucien.xin@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      8beee4d8
    • Ravikanth Tuniki's avatar
      dt-bindings: net: xlnx,axi-ethernet: Add missing reg minItems · c6929644
      Ravikanth Tuniki authored
      Add missing reg minItems as based on current binding document
      only ethernet MAC IO space is a supported configuration.
      
      There is a bug in schema, current examples contain 64-bit
      addressing as well as 32-bit addressing. The schema validation
      does pass incidentally considering one 64-bit reg address as
      two 32-bit reg address entries. If we change axi_ethernet_eth1
      example node reg addressing to 32-bit schema validation reports:
      
      Documentation/devicetree/bindings/net/xlnx,axi-ethernet.example.dtb:
      ethernet@40000000: reg: [[1073741824, 262144]] is too short
      
      To fix it add missing reg minItems constraints and to make things clearer
      stick to 32-bit addressing in examples.
      
      Fixes: cbb1ca6d ("dt-bindings: net: xlnx,axi-ethernet: convert bindings document to yaml")
      Signed-off-by: default avatarRavikanth Tuniki <ravikanth.tuniki@amd.com>
      Signed-off-by: default avatarRadhey Shyam Pandey <radhey.shyam.pandey@amd.com>
      Acked-by: default avatarConor Dooley <conor.dooley@microchip.com>
      Link: https://patch.msgid.link/1727723615-2109795-1-git-send-email-radhey.shyam.pandey@amd.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      c6929644
    • Sean Anderson's avatar
      doc: net: napi: Update documentation for napi_schedule_irqoff · b63ad06d
      Sean Anderson authored
      Since commit 8380c81d ("net: Treat __napi_schedule_irqoff() as
      __napi_schedule() on PREEMPT_RT"), napi_schedule_irqoff will do the
      right thing if IRQs are threaded. Therefore, there is no need to use
      IRQF_NO_THREAD.
      Signed-off-by: default avatarSean Anderson <sean.anderson@linux.dev>
      Reviewed-by: default avatarBagas Sanjaya <bagasdotme@gmail.com>
      Reviewed-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Link: https://patch.msgid.link/20240930153955.971657-1-sean.anderson@linux.devSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b63ad06d
    • Paolo Abeni's avatar
      Merge tag 'nf-24-10-02' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf · 1127c73a
      Paolo Abeni authored
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      The following patchset contains Netfilter fixes for net:
      
      1) Fix incorrect documentation in uapi/linux/netfilter/nf_tables.h
         regarding flowtable hooks, from Phil Sutter.
      
      2) Fix nft_audit.sh selftests with newer nft binaries, due to different
         (valid) audit output, also from Phil.
      
      3) Disable BH when duplicating packets via nf_dup infrastructure,
         otherwise race on nf_skb_duplicated for locally generated traffic.
         From Eric.
      
      4) Missing return in callback of selftest C program, from zhang jiao.
      
      netfilter pull request 24-10-02
      
      * tag 'nf-24-10-02' of git://git.kernel.org/pub/scm/linux/kernel/git/netfilter/nf:
        selftests: netfilter: Add missing return value
        netfilter: nf_tables: prevent nf_skb_duplicated corruption
        selftests: netfilter: Fix nft_audit.sh for newer nft binaries
        netfilter: uapi: NFTA_FLOWTABLE_HOOK is NLA_NESTED
      ====================
      
      Link: https://patch.msgid.link/20241002202421.1281311-1-pablo@netfilter.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      1127c73a
    • Darrick J. Wong's avatar
      iomap: constrain the file range passed to iomap_file_unshare · a311a08a
      Darrick J. Wong authored
      File contents can only be shared (i.e. reflinked) below EOF, so it makes
      no sense to try to unshare ranges beyond EOF.  Constrain the file range
      parameters here so that we don't have to do that in the callers.
      
      Fixes: 5f4e5752 ("fs: add iomap_file_dirty")
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Link: https://lore.kernel.org/r/20241002150213.GC21853@frogsfrogsfrogsReviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      a311a08a
    • Darrick J. Wong's avatar
      iomap: don't bother unsharing delalloc extents · f7a4874d
      Darrick J. Wong authored
      If unshare encounters a delalloc reservation in the srcmap, that means
      that the file range isn't shared because delalloc reservations cannot be
      reflinked.  Therefore, don't try to unshare them.
      Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
      Link: https://lore.kernel.org/r/20241002150040.GB21853@frogsfrogsfrogsReviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
      Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
      f7a4874d
    • Eddie James's avatar
      net/ncsi: Disable the ncsi work before freeing the associated structure · a0ffa68c
      Eddie James authored
      The work function can run after the ncsi device is freed, resulting
      in use-after-free bugs or kernel panic.
      
      Fixes: 2d283bdd ("net/ncsi: Resource management")
      Signed-off-by: default avatarEddie James <eajames@linux.ibm.com>
      Link: https://patch.msgid.link/20240925155523.1017097-1-eajames@linux.ibm.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      a0ffa68c
    • FUJITA Tomonori's avatar
      net: phy: qt2025: Fix warning: unused import DeviceId · fa7dfeae
      FUJITA Tomonori authored
      Fix the following warning when the driver is compiled as built-in:
      
            warning: unused import: `DeviceId`
            --> drivers/net/phy/qt2025.rs:18:5
            |
         18 |     DeviceId, Driver,
            |     ^^^^^^^^
            |
            = note: `#[warn(unused_imports)]` on by default
      
      device_table in module_phy_driver macro is defined only when the
      driver is built as a module. Use phy::DeviceId in the macro instead of
      importing `DeviceId` since `phy` is always used.
      
      Fixes: fd3eaad8 ("net: phy: add Applied Micro QT2025 PHY driver")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202409190717.i135rfVo-lkp@intel.com/Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Reviewed-by: default avatarTrevor Gross <tmgross@umich.edu>
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@gmail.com>
      Reviewed-by: default avatarFiona Behrens <me@kloenk.dev>
      Acked-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Link: https://patch.msgid.link/20240926121404.242092-1-fujita.tomonori@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fa7dfeae
    • Willem de Bruijn's avatar
      gso: fix udp gso fraglist segmentation after pull from frag_list · a1e40ac5
      Willem de Bruijn authored
      Detect gso fraglist skbs with corrupted geometry (see below) and
      pass these to skb_segment instead of skb_segment_list, as the first
      can segment them correctly.
      
      Valid SKB_GSO_FRAGLIST skbs
      - consist of two or more segments
      - the head_skb holds the protocol headers plus first gso_size
      - one or more frag_list skbs hold exactly one segment
      - all but the last must be gso_size
      
      Optional datapath hooks such as NAT and BPF (bpf_skb_pull_data) can
      modify these skbs, breaking these invariants.
      
      In extreme cases they pull all data into skb linear. For UDP, this
      causes a NULL ptr deref in __udpv4_gso_segment_list_csum at
      udp_hdr(seg->next)->dest.
      
      Detect invalid geometry due to pull, by checking head_skb size.
      Don't just drop, as this may blackhole a destination. Convert to be
      able to pass to regular skb_segment.
      
      Link: https://lore.kernel.org/netdev/20240428142913.18666-1-shiming.cheng@mediatek.com/
      Fixes: 9fd1ff5d ("udp: Support UDP fraglist GRO/GSO.")
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Cc: stable@vger.kernel.org
      Link: https://patch.msgid.link/20241001171752.107580-1-willemdebruijn.kernel@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a1e40ac5
    • Ido Schimmel's avatar
      bridge: mcast: Fail MDB get request on empty entry · 555f45d2
      Ido Schimmel authored
      When user space deletes a port from an MDB entry, the port is removed
      synchronously. If this was the last port in the entry and the entry is
      not joined by the host itself, then the entry is scheduled for deletion
      via a timer.
      
      The above means that it is possible for the MDB get netlink request to
      retrieve an empty entry which is scheduled for deletion. This is
      problematic as after deleting the last port in an entry, user space
      cannot rely on a non-zero return code from the MDB get request as an
      indication that the port was successfully removed.
      
      Fix by returning an error when the entry's port list is empty and the
      entry is not joined by the host.
      
      Fixes: 68b380a3 ("bridge: mcast: Add MDB get support")
      Reported-by: default avatarJamie Bainbridge <jamie.bainbridge@gmail.com>
      Closes: https://lore.kernel.org/netdev/c92569919307749f879b9482b0f3e125b7d9d2e3.1726480066.git.jamie.bainbridge@gmail.com/Tested-by: default avatarJamie Bainbridge <jamie.bainbridge@gmail.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Acked-by: default avatarNikolay Aleksandrov <razor@blackwall.org>
      Link: https://patch.msgid.link/20240929123640.558525-1-idosch@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      555f45d2
    • Willem de Bruijn's avatar
      vrf: revert "vrf: Remove unnecessary RCU-bh critical section" · b04c4d9e
      Willem de Bruijn authored
      This reverts commit 504fc6f4.
      
      dev_queue_xmit_nit is expected to be called with BH disabled.
      __dev_queue_xmit has the following:
      
              /* Disable soft irqs for various locks below. Also
               * stops preemption for RCU.
               */
              rcu_read_lock_bh();
      
      VRF must follow this invariant. The referenced commit removed this
      protection. Which triggered a lockdep warning:
      
      	================================
      	WARNING: inconsistent lock state
      	6.11.0 #1 Tainted: G        W
      	--------------------------------
      	inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
      	btserver/134819 [HC0[0]:SC0[0]:HE1:SE1] takes:
      	ffff8882da30c118 (rlock-AF_PACKET){+.?.}-{2:2}, at: tpacket_rcv+0x863/0x3b30
      	{IN-SOFTIRQ-W} state was registered at:
      	  lock_acquire+0x19a/0x4f0
      	  _raw_spin_lock+0x27/0x40
      	  packet_rcv+0xa33/0x1320
      	  __netif_receive_skb_core.constprop.0+0xcb0/0x3a90
      	  __netif_receive_skb_list_core+0x2c9/0x890
      	  netif_receive_skb_list_internal+0x610/0xcc0
                [...]
      
      	other info that might help us debug this:
      	 Possible unsafe locking scenario:
      
      	       CPU0
      	       ----
      	  lock(rlock-AF_PACKET);
      	  <Interrupt>
      	    lock(rlock-AF_PACKET);
      
      	 *** DEADLOCK ***
      
      	Call Trace:
      	 <TASK>
      	 dump_stack_lvl+0x73/0xa0
      	 mark_lock+0x102e/0x16b0
      	 __lock_acquire+0x9ae/0x6170
      	 lock_acquire+0x19a/0x4f0
      	 _raw_spin_lock+0x27/0x40
      	 tpacket_rcv+0x863/0x3b30
      	 dev_queue_xmit_nit+0x709/0xa40
      	 vrf_finish_direct+0x26e/0x340 [vrf]
      	 vrf_l3_out+0x5f4/0xe80 [vrf]
      	 __ip_local_out+0x51e/0x7a0
                [...]
      
      Fixes: 504fc6f4 ("vrf: Remove unnecessary RCU-bh critical section")
      Link: https://lore.kernel.org/netdev/20240925185216.1990381-1-greearb@candelatech.com/Reported-by: default avatarBen Greear <greearb@candelatech.com>
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Tested-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
      Link: https://patch.msgid.link/20240929061839.1175300-1-willemdebruijn.kernel@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b04c4d9e
    • Dan Carpenter's avatar
      net: ethernet: ti: am65-cpsw: Fix forever loop in cleanup code · 3c97fe4f
      Dan Carpenter authored
      This error handling has a typo.  It should i++ instead of i--.  In the
      original code the error handling will loop until it crashes.
      
      Fixes: da70d184 ("net: ethernet: ti: am65-cpsw: Introduce multi queue Rx")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
      Reviewed-by: default avatarAlexander Sverdlin <alexander.sverdlin@siemens.com>
      Reviewed-by: default avatarRoger Quadros <rogerq@kernel.org>
      Link: https://patch.msgid.link/8e7960cc-415d-48d7-99ce-f623022ec7b5@stanley.mountainSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3c97fe4f
    • Hui Wang's avatar
      net: phy: realtek: Check the index value in led_hw_control_get · c283782f
      Hui Wang authored
      Just like rtl8211f_led_hw_is_supported() and
      rtl8211f_led_hw_control_set(), the rtl8211f_led_hw_control_get() also
      needs to check the index value, otherwise the caller is likely to get
      an incorrect rules.
      
      Fixes: 17784801 ("net: phy: realtek: Add support for PHY LEDs on RTL8211F")
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Reviewed-by: default avatarMarek Vasut <marex@denx.de>
      Link: https://patch.msgid.link/20240927114610.1278935-1-hui.wang@canonical.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c283782f
    • Eric Dumazet's avatar
      ppp: do not assume bh is held in ppp_channel_bridge_input() · aec72910
      Eric Dumazet authored
      Networking receive path is usually handled from BH handler.
      However, some protocols need to acquire the socket lock, and
      packets might be stored in the socket backlog is the socket was
      owned by a user process.
      
      In this case, release_sock(), __release_sock(), and sk_backlog_rcv()
      might call the sk->sk_backlog_rcv() handler in process context.
      
      sybot caught ppp was not considering this case in
      ppp_channel_bridge_input() :
      
      WARNING: inconsistent lock state
      6.11.0-rc7-syzkaller-g5f5673607153 #0 Not tainted
      --------------------------------
      inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage.
      ksoftirqd/1/24 [HC0[0]:SC1[1]:HE1:SE0] takes:
       ffff0000db7f11e0 (&pch->downl){+.?.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
       ffff0000db7f11e0 (&pch->downl){+.?.}-{2:2}, at: ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
       ffff0000db7f11e0 (&pch->downl){+.?.}-{2:2}, at: ppp_input+0x16c/0x854 drivers/net/ppp/ppp_generic.c:2304
      {SOFTIRQ-ON-W} state was registered at:
         lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5759
         __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
         _raw_spin_lock+0x48/0x60 kernel/locking/spinlock.c:154
         spin_lock include/linux/spinlock.h:351 [inline]
         ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
         ppp_input+0x16c/0x854 drivers/net/ppp/ppp_generic.c:2304
         pppoe_rcv_core+0xfc/0x314 drivers/net/ppp/pppoe.c:379
         sk_backlog_rcv include/net/sock.h:1111 [inline]
         __release_sock+0x1a8/0x3d8 net/core/sock.c:3004
         release_sock+0x68/0x1b8 net/core/sock.c:3558
         pppoe_sendmsg+0xc8/0x5d8 drivers/net/ppp/pppoe.c:903
         sock_sendmsg_nosec net/socket.c:730 [inline]
         __sock_sendmsg net/socket.c:745 [inline]
         __sys_sendto+0x374/0x4f4 net/socket.c:2204
         __do_sys_sendto net/socket.c:2216 [inline]
         __se_sys_sendto net/socket.c:2212 [inline]
         __arm64_sys_sendto+0xd8/0xf8 net/socket.c:2212
         __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
         invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49
         el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132
         do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151
         el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:712
         el0t_64_sync_handler+0x84/0xfc arch/arm64/kernel/entry-common.c:730
         el0t_64_sync+0x190/0x194 arch/arm64/kernel/entry.S:598
      irq event stamp: 282914
       hardirqs last  enabled at (282914): [<ffff80008b42e30c>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
       hardirqs last  enabled at (282914): [<ffff80008b42e30c>] _raw_spin_unlock_irqrestore+0x38/0x98 kernel/locking/spinlock.c:194
       hardirqs last disabled at (282913): [<ffff80008b42e13c>] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline]
       hardirqs last disabled at (282913): [<ffff80008b42e13c>] _raw_spin_lock_irqsave+0x2c/0x7c kernel/locking/spinlock.c:162
       softirqs last  enabled at (282904): [<ffff8000801f8e88>] softirq_handle_end kernel/softirq.c:400 [inline]
       softirqs last  enabled at (282904): [<ffff8000801f8e88>] handle_softirqs+0xa3c/0xbfc kernel/softirq.c:582
       softirqs last disabled at (282909): [<ffff8000801fbdf8>] run_ksoftirqd+0x70/0x158 kernel/softirq.c:928
      
      other info that might help us debug this:
       Possible unsafe locking scenario:
      
             CPU0
             ----
        lock(&pch->downl);
        <Interrupt>
          lock(&pch->downl);
      
       *** DEADLOCK ***
      
      1 lock held by ksoftirqd/1/24:
        #0: ffff80008f74dfa0 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire+0x10/0x4c include/linux/rcupdate.h:325
      
      stack backtrace:
      CPU: 1 UID: 0 PID: 24 Comm: ksoftirqd/1 Not tainted 6.11.0-rc7-syzkaller-g5f5673607153 #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024
      Call trace:
        dump_backtrace+0x1b8/0x1e4 arch/arm64/kernel/stacktrace.c:319
        show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:326
        __dump_stack lib/dump_stack.c:93 [inline]
        dump_stack_lvl+0xe4/0x150 lib/dump_stack.c:119
        dump_stack+0x1c/0x28 lib/dump_stack.c:128
        print_usage_bug+0x698/0x9ac kernel/locking/lockdep.c:4000
       mark_lock_irq+0x980/0xd2c
        mark_lock+0x258/0x360 kernel/locking/lockdep.c:4677
        __lock_acquire+0xf48/0x779c kernel/locking/lockdep.c:5096
        lock_acquire+0x240/0x728 kernel/locking/lockdep.c:5759
        __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
        _raw_spin_lock+0x48/0x60 kernel/locking/spinlock.c:154
        spin_lock include/linux/spinlock.h:351 [inline]
        ppp_channel_bridge_input drivers/net/ppp/ppp_generic.c:2272 [inline]
        ppp_input+0x16c/0x854 drivers/net/ppp/ppp_generic.c:2304
        ppp_async_process+0x98/0x150 drivers/net/ppp/ppp_async.c:495
        tasklet_action_common+0x318/0x3f4 kernel/softirq.c:785
        tasklet_action+0x68/0x8c kernel/softirq.c:811
        handle_softirqs+0x2e4/0xbfc kernel/softirq.c:554
        run_ksoftirqd+0x70/0x158 kernel/softirq.c:928
        smpboot_thread_fn+0x4b0/0x90c kernel/smpboot.c:164
        kthread+0x288/0x310 kernel/kthread.c:389
        ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:860
      
      Fixes: 4cf476ce ("ppp: add PPPIOCBRIDGECHAN and PPPIOCUNBRIDGECHAN ioctls")
      Reported-by: syzbot+bd8d55ee2acd0a71d8ce@syzkaller.appspotmail.com
      Closes: https://lore.kernel.org/netdev/66f661e2.050a0220.38ace9.000f.GAE@google.com/T/#uSigned-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Tom Parkin <tparkin@katalix.com>
      Cc: James Chapman <jchapman@katalix.com>
      Link: https://patch.msgid.link/20240927074553.341910-1-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      aec72910
    • Hangbin Liu's avatar
      selftests: rds: move include.sh to TEST_FILES · 8ed7cf66
      Hangbin Liu authored
      The include.sh file is generated for inclusion and should not be executable.
      Otherwise, it will be added to kselftest-list.txt. Additionally, add the
      executable bit for test.py at the same time to ensure proper functionality.
      
      Fixes: 3ade6ce1 ("selftests: rds: add testing infrastructure")
      Signed-off-by: default avatarHangbin Liu <liuhangbin@gmail.com>
      Link: https://patch.msgid.link/20240927041349.81216-1-liuhangbin@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8ed7cf66
    • Eric Dumazet's avatar
      net: test for not too small csum_start in virtio_net_hdr_to_skb() · 49d14b54
      Eric Dumazet authored
      syzbot was able to trigger this warning [1], after injecting a
      malicious packet through af_packet, setting skb->csum_start and thus
      the transport header to an incorrect value.
      
      We can at least make sure the transport header is after
      the end of the network header (with a estimated minimal size).
      
      [1]
      [   67.873027] skb len=4096 headroom=16 headlen=14 tailroom=0
      mac=(-1,-1) mac_len=0 net=(16,-6) trans=10
      shinfo(txflags=0 nr_frags=1 gso(size=0 type=0 segs=0))
      csum(0xa start=10 offset=0 ip_summed=3 complete_sw=0 valid=0 level=0)
      hash(0x0 sw=0 l4=0) proto=0x0800 pkttype=0 iif=0
      priority=0x0 mark=0x0 alloc_cpu=10 vlan_all=0x0
      encapsulation=0 inner(proto=0x0000, mac=0, net=0, trans=0)
      [   67.877172] dev name=veth0_vlan feat=0x000061164fdd09e9
      [   67.877764] sk family=17 type=3 proto=0
      [   67.878279] skb linear:   00000000: 00 00 10 00 00 00 00 00 0f 00 00 00 08 00
      [   67.879128] skb frag:     00000000: 0e 00 07 00 00 00 28 00 08 80 1c 00 04 00 00 02
      [   67.879877] skb frag:     00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.880647] skb frag:     00000020: 00 00 02 00 00 00 08 00 1b 00 00 00 00 00 00 00
      [   67.881156] skb frag:     00000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.881753] skb frag:     00000040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.882173] skb frag:     00000050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.882790] skb frag:     00000060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.883171] skb frag:     00000070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.883733] skb frag:     00000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.884206] skb frag:     00000090: 00 00 00 00 00 00 00 00 00 00 69 70 76 6c 61 6e
      [   67.884704] skb frag:     000000a0: 31 00 00 00 00 00 00 00 00 00 2b 00 00 00 00 00
      [   67.885139] skb frag:     000000b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.885677] skb frag:     000000c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.886042] skb frag:     000000d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.886408] skb frag:     000000e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.887020] skb frag:     000000f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.887384] skb frag:     00000100: 00 00
      [   67.887878] ------------[ cut here ]------------
      [   67.887908] offset (-6) >= skb_headlen() (14)
      [   67.888445] WARNING: CPU: 10 PID: 2088 at net/core/dev.c:3332 skb_checksum_help (net/core/dev.c:3332 (discriminator 2))
      [   67.889353] Modules linked in: macsec macvtap macvlan hsr wireguard curve25519_x86_64 libcurve25519_generic libchacha20poly1305 chacha_x86_64 libchacha poly1305_x86_64 dummy bridge sr_mod cdrom evdev pcspkr i2c_piix4 9pnet_virtio 9p 9pnet netfs
      [   67.890111] CPU: 10 UID: 0 PID: 2088 Comm: b363492833 Not tainted 6.11.0-virtme #1011
      [   67.890183] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
      [   67.890309] RIP: 0010:skb_checksum_help (net/core/dev.c:3332 (discriminator 2))
      [   67.891043] Call Trace:
      [   67.891173]  <TASK>
      [   67.891274] ? __warn (kernel/panic.c:741)
      [   67.891320] ? skb_checksum_help (net/core/dev.c:3332 (discriminator 2))
      [   67.891333] ? report_bug (lib/bug.c:180 lib/bug.c:219)
      [   67.891348] ? handle_bug (arch/x86/kernel/traps.c:239)
      [   67.891363] ? exc_invalid_op (arch/x86/kernel/traps.c:260 (discriminator 1))
      [   67.891372] ? asm_exc_invalid_op (./arch/x86/include/asm/idtentry.h:621)
      [   67.891388] ? skb_checksum_help (net/core/dev.c:3332 (discriminator 2))
      [   67.891399] ? skb_checksum_help (net/core/dev.c:3332 (discriminator 2))
      [   67.891416] ip_do_fragment (net/ipv4/ip_output.c:777 (discriminator 1))
      [   67.891448] ? __ip_local_out (./include/linux/skbuff.h:1146 ./include/net/l3mdev.h:196 ./include/net/l3mdev.h:213 net/ipv4/ip_output.c:113)
      [   67.891459] ? __pfx_ip_finish_output2 (net/ipv4/ip_output.c:200)
      [   67.891470] ? ip_route_output_flow (./arch/x86/include/asm/preempt.h:84 (discriminator 13) ./include/linux/rcupdate.h:96 (discriminator 13) ./include/linux/rcupdate.h:871 (discriminator 13) net/ipv4/route.c:2625 (discriminator 13) ./include/net/route.h:141 (discriminator 13) net/ipv4/route.c:2852 (discriminator 13))
      [   67.891484] ipvlan_process_v4_outbound (drivers/net/ipvlan/ipvlan_core.c:445 (discriminator 1))
      [   67.891581] ipvlan_queue_xmit (drivers/net/ipvlan/ipvlan_core.c:542 drivers/net/ipvlan/ipvlan_core.c:604 drivers/net/ipvlan/ipvlan_core.c:670)
      [   67.891596] ipvlan_start_xmit (drivers/net/ipvlan/ipvlan_main.c:227)
      [   67.891607] dev_hard_start_xmit (./include/linux/netdevice.h:4916 ./include/linux/netdevice.h:4925 net/core/dev.c:3588 net/core/dev.c:3604)
      [   67.891620] __dev_queue_xmit (net/core/dev.h:168 (discriminator 25) net/core/dev.c:4425 (discriminator 25))
      [   67.891630] ? skb_copy_bits (./include/linux/uaccess.h:233 (discriminator 1) ./include/linux/uaccess.h:260 (discriminator 1) ./include/linux/highmem-internal.h:230 (discriminator 1) net/core/skbuff.c:3018 (discriminator 1))
      [   67.891645] ? __pskb_pull_tail (net/core/skbuff.c:2848 (discriminator 4))
      [   67.891655] ? skb_partial_csum_set (net/core/skbuff.c:5657)
      [   67.891666] ? virtio_net_hdr_to_skb.constprop.0 (./include/linux/skbuff.h:2791 (discriminator 3) ./include/linux/skbuff.h:2799 (discriminator 3) ./include/linux/virtio_net.h:109 (discriminator 3))
      [   67.891684] packet_sendmsg (net/packet/af_packet.c:3145 (discriminator 1) net/packet/af_packet.c:3177 (discriminator 1))
      [   67.891700] ? _raw_spin_lock_bh (./arch/x86/include/asm/atomic.h:107 (discriminator 4) ./include/linux/atomic/atomic-arch-fallback.h:2170 (discriminator 4) ./include/linux/atomic/atomic-instrumented.h:1302 (discriminator 4) ./include/asm-generic/qspinlock.h:111 (discriminator 4) ./include/linux/spinlock.h:187 (discriminator 4) ./include/linux/spinlock_api_smp.h:127 (discriminator 4) kernel/locking/spinlock.c:178 (discriminator 4))
      [   67.891716] __sys_sendto (net/socket.c:730 (discriminator 1) net/socket.c:745 (discriminator 1) net/socket.c:2210 (discriminator 1))
      [   67.891734] ? do_sock_setsockopt (net/socket.c:2335)
      [   67.891747] ? __sys_setsockopt (./include/linux/file.h:34 net/socket.c:2355)
      [   67.891761] __x64_sys_sendto (net/socket.c:2222 (discriminator 1) net/socket.c:2218 (discriminator 1) net/socket.c:2218 (discriminator 1))
      [   67.891772] do_syscall_64 (arch/x86/entry/common.c:52 (discriminator 1) arch/x86/entry/common.c:83 (discriminator 1))
      [   67.891785] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130)
      
      Fixes: 9181d6f8 ("net: add more sanity check in virtio_net_hdr_to_skb()")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://patch.msgid.link/20240926165836.3797406-1-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      49d14b54
    • Felix Fietkau's avatar
      net: gso: fix tcp fraglist segmentation after pull from frag_list · 17bd3bd8
      Felix Fietkau authored
      Detect tcp gso fraglist skbs with corrupted geometry (see below) and
      pass these to skb_segment instead of skb_segment_list, as the first
      can segment them correctly.
      
      Valid SKB_GSO_FRAGLIST skbs
      - consist of two or more segments
      - the head_skb holds the protocol headers plus first gso_size
      - one or more frag_list skbs hold exactly one segment
      - all but the last must be gso_size
      
      Optional datapath hooks such as NAT and BPF (bpf_skb_pull_data) can
      modify these skbs, breaking these invariants.
      
      In extreme cases they pull all data into skb linear. For TCP, this
      causes a NULL ptr deref in __tcpv4_gso_segment_list_csum at
      tcp_hdr(seg->next).
      
      Detect invalid geometry due to pull, by checking head_skb size.
      Don't just drop, as this may blackhole a destination. Convert to be
      able to pass to regular skb_segment.
      
      Approach and description based on a patch by Willem de Bruijn.
      
      Link: https://lore.kernel.org/netdev/20240428142913.18666-1-shiming.cheng@mediatek.com/
      Link: https://lore.kernel.org/netdev/20240922150450.3873767-1-willemdebruijn.kernel@gmail.com/
      Fixes: bee88cd5 ("net: add support for segmenting TCP fraglist GSO packets")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
      Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
      Link: https://patch.msgid.link/20240926085315.51524-1-nbd@nbd.nameSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      17bd3bd8
    • Jakub Kicinski's avatar
      Merge tag 'mlx5-fixes-2024-09-25' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux · 854e9bf5
      Jakub Kicinski authored
      Saeed Mahameed says:
      
      ====================
      mlx5 fixes 2024-09-25
      
      * tag 'mlx5-fixes-2024-09-25' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux:
        net/mlx5e: Fix crash caused by calling __xfrm_state_delete() twice
        net/mlx5e: SHAMPO, Fix overflow of hd_per_wq
        net/mlx5: HWS, changed E2BIG error to a negative return code
        net/mlx5: HWS, fixed double-free in error flow of creating SQ
        net/mlx5: Fix wrong reserved field in hca_cap_2 in mlx5_ifc
        net/mlx5e: Fix NULL deref in mlx5e_tir_builder_alloc()
        net/mlx5: Added cond_resched() to crdump collection
        net/mlx5: Fix error path in multi-packet WQE transmit
      ====================
      
      Link: https://patch.msgid.link/20240925202013.45374-1-saeed@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      854e9bf5
    • Jakub Kicinski's avatar
      Merge tag 'for-net-2024-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth · e5e3f369
      Jakub Kicinski authored
      Luiz Augusto von Dentz says:
      
      ====================
      bluetooth pull request for net:
      
       - btmrvl: Use IRQF_NO_AUTOEN flag in request_irq()
       - MGMT: Fix possible crash on mgmt_index_removed
       - L2CAP: Fix uaf in l2cap_connect
       - Bluetooth: hci_event: Align BR/EDR JUST_WORKS paring with LE
      
      * tag 'for-net-2024-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth:
        Bluetooth: hci_event: Align BR/EDR JUST_WORKS paring with LE
        Bluetooth: btmrvl: Use IRQF_NO_AUTOEN flag in request_irq()
        Bluetooth: L2CAP: Fix uaf in l2cap_connect
        Bluetooth: MGMT: Fix possible crash on mgmt_index_removed
      ====================
      
      Link: https://patch.msgid.link/20240927145730.2452175-1-luiz.dentz@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e5e3f369
    • Jakub Kicinski's avatar
      Merge tag 'ieee802154-for-net-2024-09-27' of... · cb3ad113
      Jakub Kicinski authored
      Merge tag 'ieee802154-for-net-2024-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/wpan/wpan
      
      Stefan Schmidt says:
      
      ====================
      pull-request: ieee802154 for net 2024-09-27
      
      Jinjie Ruan added the use of IRQF_NO_AUTOEN in the mcr20a driver and fixed
      and addiotinal build dependency problem while doing so.
      
      Jiawei Ye, ensured a correct RCU handling in mac802154_scan_worker.
      
      * tag 'ieee802154-for-net-2024-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/wpan/wpan:
        net: ieee802154: mcr20a: Use IRQF_NO_AUTOEN flag in request_irq()
        mac802154: Fix potential RCU dereference issue in mac802154_scan_worker
        ieee802154: Fix build error
      ====================
      
      Link: https://patch.msgid.link/20240927094351.3865511-1-stefan@datenfreihafen.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cb3ad113
  2. 02 Oct, 2024 5 commits
    • Linus Torvalds's avatar
      Merge tag 'pull-work.unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 7ec46210
      Linus Torvalds authored
      Pull generic unaligned.h cleanups from Al Viro:
       "Get rid of architecture-specific <asm/unaligned.h> includes, replacing
        them with a single generic <linux/unaligned.h> header file.
      
        It's the second largest (after asm/io.h) class of asm/* includes, and
        all but two architectures actually end up using exact same file.
      
        Massage the remaining two (arc and parisc) to do the same and just
        move the thing to from asm-generic/unaligned.h to linux/unaligned.h"
      
      [ This is one of those things that we're better off doing outside the
        merge window, and would only cause extra conflict noise if it was in
        linux-next for the next release due to all the trivial #include line
        updates.  Rip off the band-aid.   - Linus ]
      
      * tag 'pull-work.unaligned' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        move asm/unaligned.h to linux/unaligned.h
        arc: get rid of private asm/unaligned.h
        parisc: get rid of private asm/unaligned.h
      7ec46210
    • Al Viro's avatar
      move asm/unaligned.h to linux/unaligned.h · 5f60d5f6
      Al Viro authored
      asm/unaligned.h is always an include of asm-generic/unaligned.h;
      might as well move that thing to linux/unaligned.h and include
      that - there's nothing arch-specific in that header.
      
      auto-generated by the following:
      
      for i in `git grep -l -w asm/unaligned.h`; do
      	sed -i -e "s/asm\/unaligned.h/linux\/unaligned.h/" $i
      done
      for i in `git grep -l -w asm-generic/unaligned.h`; do
      	sed -i -e "s/asm-generic\/unaligned.h/linux\/unaligned.h/" $i
      done
      git mv include/asm-generic/unaligned.h include/linux/unaligned.h
      git mv tools/include/asm-generic/unaligned.h tools/include/linux/unaligned.h
      sed -i -e "/unaligned.h/d" include/asm-generic/Kbuild
      sed -i -e "s/__ASM_GENERIC/__LINUX/" include/linux/unaligned.h tools/include/linux/unaligned.h
      5f60d5f6
    • Al Viro's avatar
      arc: get rid of private asm/unaligned.h · 00429083
      Al Viro authored
      Declarations local to arch/*/kernel/*.c are better off *not* in a public
      header - arch/arc/kernel/unaligned.h is just fine for those
      bits.
      
      Unlike the parisc case, here we have an extra twist - asm/mmu.h
      has an implicit dependency on struct pt_regs, and in some users
      that used to be satisfied by include of asm/ptrace.h from
      asm/unaligned.h (note that asm/mmu.h itself did _not_ pull asm/unaligned.h
      - it relied upon the users having pulled asm/unaligned.h before asm/mmu.h
      got there).
      
      Seeing that asm/mmu.h only wants struct pt_regs * arguments in
      an extern, just pre-declare it there - less brittle that way.
      
      With that done _all_ asm/unaligned.h instances are reduced to include
      of asm-generic/unaligned.h and can be removed - unaligned.h is in
      mandatory-y in include/asm-generic/Kbuild.
      
      What's more, we can move asm-generic/unaligned.h to linux/unaligned.h
      and switch includes of <asm/unaligned.h> to <linux/unaligned.h>; that's
      better off as an auto-generated commit, though, to be done by Linus
      at -rc1 time next cycle.
      Acked-by: default avatarVineet Gupta <vgupta@kernel.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      00429083
    • Linus Torvalds's avatar
      Merge tag 'hid-for-linus-2024090201' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · f23aa4c0
      Linus Torvalds authored
      Pull HID fix from Benjamin Tissoires:
      
       - A small fix from the new HID-BPF code.
      
         The HID-BPF CI started failing completely because the BPF tree is now
         stricter, exposing a problem in the hid_bpf_ops.
      
      * tag 'hid-for-linus-2024090201' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: bpf: fix cfi stubs for hid_bpf_ops
      f23aa4c0
    • Linus Torvalds's avatar
      Merge tag 'input-for-v6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input · 0d2746a2
      Linus Torvalds authored
      Pull input fixes from Dmitry Torokhov:
      
       - a couple fixups for adp5589-keys driver
      
       - recently added driver for PixArt PS/2 touchpads is dropped
         temporarily because its detection routine is too greedy and
         mis-identifies devices from other vendors as PixArt devices
      
      * tag 'input-for-v6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
        Input: adp5589-keys - fix adp5589_gpio_get_value()
        Input: adp5589-keys - fix NULL pointer dereference
        Revert "Input: Add driver for PixArt PS/2 touchpad"
      0d2746a2