Skip to content
  1. Nov 30, 2023
    • Claudiu Beznea's avatar
      net: ravb: Check return value of reset_control_deassert() · d8eb6ea4
      Claudiu Beznea authored
      reset_control_deassert() could return an error. Some devices cannot work
      if reset signal de-assert operation fails. To avoid this check the return
      code of reset_control_deassert() in ravb_probe() and take proper action.
      
      Along with it, the free_netdev() call from the error path was moved after
      reset_control_assert() on its own label (out_free_netdev) to free
      netdev in case reset_control_deassert() fails.
      
      Fixes: 0d13a1a4
      
       ("ravb: Add reset support")
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: default avatarClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      d8eb6ea4
    • Jiawen Wu's avatar
      net: libwx: fix memory leak on msix entry · 91fdb30d
      Jiawen Wu authored
      Since pci_free_irq_vectors() set pdev->msix_enabled as 0 in the
      calling of pci_msix_shutdown(), wx->msix_entries is never freed.
      Reordering the lines to fix the memory leak.
      
      Cc: stable@vger.kernel.org
      Fixes: 3f703186
      
       ("net: libwx: Add irq flow functions")
      Signed-off-by: default avatarJiawen Wu <jiawenwu@trustnetic.com>
      Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
      Link: https://lore.kernel.org/r/20231128095928.1083292-1-jiawenwu@trustnetic.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      91fdb30d
    • Dave Ertman's avatar
      ice: Fix VF Reset paths when interface in a failed over aggregate · 9f74a3df
      Dave Ertman authored
      There is an error when an interface has the following conditions:
      - PF is in an aggregate (bond)
      - PF has VFs created on it
      - bond is in a state where it is failed-over to the secondary interface
      - A VF reset is issued on one or more of those VFs
      
      The issue is generated by the originating PF trying to rebuild or
      reconfigure the VF resources.  Since the bond is failed over to the
      secondary interface the queue contexts are in a modified state.
      
      To fix this issue, have the originating interface reclaim its resources
      prior to the tear-down and rebuild or reconfigure.  Then after the process
      is complete, move the resources back to the currently active interface.
      
      There are multiple paths that can be used depending on what triggered the
      event, so create a helper function to move the queues and use paired calls
      to the helper (back to origin, process, then move back to active interface)
      under the same lag_mutex lock.
      
      Fixes: 1e0f9881
      
       ("ice: Flesh out implementation of support for SRIOV on bonded interface")
      Signed-off-by: default avatarDave Ertman <david.m.ertman@intel.com>
      Tested-by: default avatarSujai Buvaneswaran <sujai.buvaneswaran@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
      Link: https://lore.kernel.org/r/20231127212340.1137657-1-anthony.l.nguyen@intel.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9f74a3df
    • Jakub Kicinski's avatar
      Merge tag 'wireless-2023-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless · 300fbb24
      Jakub Kicinski authored
      
      
      Johannes Berg says:
      
      ====================
      wireless fixes:
       - debugfs had a deadlock (removal vs. use of files),
         fixes going through wireless ACKed by Greg
       - support for HT STAs on 320 MHz channels, even if it's
         not clear that should ever happen (that's 6 GHz), best
         not to WARN()
       - fix for the previous CQM fix that broke most cases
       - various wiphy locking fixes
       - various small driver fixes
      
      * tag 'wireless-2023-11-29' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
        wifi: mac80211: use wiphy locked debugfs for sdata/link
        wifi: mac80211: use wiphy locked debugfs helpers for agg_status
        wifi: cfg80211: add locked debugfs wrappers
        debugfs: add API to allow debugfs operations cancellation
        debugfs: annotate debugfs handlers vs. removal with lockdep
        debugfs: fix automount d_fsdata usage
        wifi: mac80211: handle 320 MHz in ieee80211_ht_cap_ie_to_sta_ht_cap
        wifi: avoid offset calculation on NULL pointer
        wifi: cfg80211: hold wiphy mutex for send_interface
        wifi: cfg80211: lock wiphy mutex for rfkill poll
        wifi: cfg80211: fix CQM for non-range use
        wifi: mac80211: do not pass AP_VLAN vif pointer to drivers during flush
        wifi: iwlwifi: mvm: fix an error code in iwl_mvm_mld_add_sta()
        wifi: mt76: mt7925: fix typo in mt7925_init_he_caps
        wifi: mt76: mt7921: fix 6GHz disabled by the missing default CLC config
      ====================
      
      Link: https://lore.kernel.org/r/20231129150809.31083-3-johannes@sipsolutions.net
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      300fbb24
    • Jakub Kicinski's avatar
      Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · 0d47fa5c
      Jakub Kicinski authored
      
      
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf 2023-11-30
      
      We've added 5 non-merge commits during the last 7 day(s) which contain
      a total of 10 files changed, 66 insertions(+), 15 deletions(-).
      
      The main changes are:
      
      1) Fix AF_UNIX splat from use after free in BPF sockmap,
         from John Fastabend.
      
      2) Fix a syzkaller splat in netdevsim by properly handling offloaded
         programs (and not device-bound ones), from Stanislav Fomichev.
      
      3) Fix bpf_mem_cache_alloc_flags() to initialize the allocation hint,
         from Hou Tao.
      
      4) Fix netkit by rejecting IFLA_NETKIT_PEER_INFO in changelink,
         from Daniel Borkmann.
      
      * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
        bpf, sockmap: Add af_unix test with both sockets in map
        bpf, sockmap: af_unix stream sockets need to hold ref for pair sock
        netkit: Reject IFLA_NETKIT_PEER_INFO in netkit_change_link
        bpf: Add missed allocation hint for bpf_mem_cache_alloc_flags()
        netdevsim: Don't accept device bound programs
      ====================
      
      Link: https://lore.kernel.org/r/20231129234916.16128-1-daniel@iogearbox.net
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0d47fa5c
    • John Fastabend's avatar
      bpf, sockmap: Add af_unix test with both sockets in map · 51354f70
      John Fastabend authored
      
      
      This adds a test where both pairs of a af_unix paired socket are put into a
      BPF map. This ensures that when we tear down the af_unix pair we don't have
      any issues on sockmap side with ordering and reference counting.
      
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Reviewed-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Link: https://lore.kernel.org/bpf/20231129012557.95371-3-john.fastabend@gmail.com
      51354f70
    • John Fastabend's avatar
      bpf, sockmap: af_unix stream sockets need to hold ref for pair sock · 8866730a
      John Fastabend authored
      AF_UNIX stream sockets are a paired socket. So sending on one of the pairs
      will lookup the paired socket as part of the send operation. It is possible
      however to put just one of the pairs in a BPF map. This currently increments
      the refcnt on the sock in the sockmap to ensure it is not free'd by the
      stack before sockmap cleans up its state and stops any skbs being sent/recv'd
      to that socket.
      
      But we missed a case. If the peer socket is closed it will be free'd by the
      stack. However, the paired socket can still be referenced from BPF sockmap
      side because we hold a reference there. Then if we are sending traffic through
      BPF sockmap to that socket it will try to dereference the free'd pair in its
      send logic creating a use after free. And following splat:
      
         [59.900375] BUG: KASAN: slab-use-after-free in sk_wake_async+0x31/0x1b0
         [59.901211] Read of size 8 at addr ffff88811acbf060 by task kworker/1:2/954
         [...]
         [59.905468] Call Trace:
         [59.905787]  <TASK>
         [59.906066]  dump_stack_lvl+0x130/0x1d0
         [59.908877]  print_report+0x16f/0x740
         [59.910629]  kasan_report+0x118/0x160
         [59.912576]  sk_wake_async+0x31/0x1b0
         [59.913554]  sock_def_readable+0x156/0x2a0
         [59.914060]  unix_stream_sendmsg+0x3f9/0x12a0
         [59.916398]  sock_sendmsg+0x20e/0x250
         [59.916854]  skb_send_sock+0x236/0xac0
         [59.920527]  sk_psock_backlog+0x287/0xaa0
      
      To fix let BPF sockmap hold a refcnt on both the socket in the sockmap and its
      paired socket. It wasn't obvious how to contain the fix to bpf_unix logic. The
      primarily problem with keeping this logic in bpf_unix was: In the sock close()
      we could handle the deref by having a close handler. But, when we are destroying
      the psock through a map delete operation we wouldn't have gotten any signal
      thorugh the proto struct other than it being replaced. If we do the deref from
      the proto replace its too early because we need to deref the sk_pair after the
      backlog worker has been stopped.
      
      Given all this it seems best to just cache it at the end of the psock and eat 8B
      for the af_unix and vsock users. Notice dgram sockets are OK because they handle
      locking already.
      
      Fixes: 94531cfc
      
       ("af_unix: Add unix_stream_proto for sockmap")
      Signed-off-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Reviewed-by: default avatarJakub Sitnicki <jakub@cloudflare.com>
      Link: https://lore.kernel.org/bpf/20231129012557.95371-2-john.fastabend@gmail.com
      8866730a
    • Jakub Kicinski's avatar
      tools: ynl-gen: always construct struct ynl_req_state · 83f2df9d
      Jakub Kicinski authored
      struct ynl_req_state carries reply-related info from generated code
      into generic YNL code. While we don't need reply info to execute
      a request without a reply, we still need to pass in the struct, because
      it's also where we get the pointer to struct ynl_sock from. Passing NULL
      results in crashes if kernel returns an error or an unexpected reply.
      
      Fixes: dc0956c9
      
       ("tools: ynl-gen: move the response reading logic into YNL")
      Link: https://lore.kernel.org/r/20231126225858.2144136-1-kuba@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      83f2df9d
    • Jakub Kicinski's avatar
      ethtool: don't propagate EOPNOTSUPP from dumps · cbeb989e
      Jakub Kicinski authored
      The default dump handler needs to clear ret before returning.
      Otherwise if the last interface returns an inconsequential
      error this error will propagate to user space.
      
      This may confuse user space (ethtool CLI seems to ignore it,
      but YNL doesn't). It will also terminate the dump early
      for mutli-skb dump, because netlink core treats EOPNOTSUPP
      as a real error.
      
      Fixes: 728480f1
      
       ("ethtool: default handlers for GET requests")
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Link: https://lore.kernel.org/r/20231126225806.2143528-1-kuba@kernel.org
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cbeb989e
  2. Nov 29, 2023
    • Yoshihiro Shimoda's avatar
      ravb: Fix races between ravb_tx_timeout_work() and net related ops · 9870257a
      Yoshihiro Shimoda authored
      Fix races between ravb_tx_timeout_work() and functions of net_device_ops
      and ethtool_ops by using rtnl_trylock() and rtnl_unlock(). Note that
      since ravb_close() is under the rtnl lock and calls cancel_work_sync(),
      ravb_tx_timeout_work() should calls rtnl_trylock(). Otherwise, a deadlock
      may happen in ravb_tx_timeout_work() like below:
      
      CPU0			CPU1
      			ravb_tx_timeout()
      			schedule_work()
      ...
      __dev_close_many()
      // Under rtnl lock
      ravb_close()
      cancel_work_sync()
      // Waiting
      			ravb_tx_timeout_work()
      			rtnl_lock()
      			// This is possible to cause a deadlock
      
      If rtnl_trylock() fails, rescheduling the work with sleep for 1 msec.
      
      Fixes: c156633f
      
       ("Renesas Ethernet AVB driver proper")
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
      Link: https://lore.kernel.org/r/20231127122420.3706751-1-yoshihiro.shimoda.uh@renesas.com
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9870257a
  3. Nov 28, 2023
  4. Nov 27, 2023
  5. Nov 26, 2023
    • David S. Miller's avatar
      Merge branch 'dpaa2-eth-fixes' · ccf49ceb
      David S. Miller authored
      
      
      Ioana Ciornei says:
      
      ====================
      dpaa2-eth: various fixes
      
      The first patch fixes a memory corruption issue happening between the Tx
      and Tx confirmation of a packet by making the Tx alignment at 64bytes
      mandatory instead of optional as it was previously.
      
      The second patch fixes the Rx copybreak code path which recycled the
      initial data buffer before all processing was done on the packet.
      
      Changes in v2:
      - squashed patches #1 and #2
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ccf49ceb
    • Ioana Ciornei's avatar
      dpaa2-eth: recycle the RX buffer only after all processing done · beb1930f
      Ioana Ciornei authored
      The blamed commit added support for Rx copybreak. This meant that for
      certain frame sizes, a new skb was allocated and the initial data buffer
      was recycled. Instead of waiting to recycle the Rx buffer only after all
      processing was done on it (like accessing the parse results or timestamp
      information), the code path just went ahead and re-used the buffer right
      away.
      
      This sometimes lead to corrupted HW and SW annotation areas.
      Fix this by delaying the moment when the buffer is recycled.
      
      Fixes: 50f82699
      
       ("dpaa2-eth: add rx copybreak support")
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      beb1930f
    • Ioana Ciornei's avatar
      dpaa2-eth: increase the needed headroom to account for alignment · f422abe3
      Ioana Ciornei authored
      Increase the needed headroom to account for a 64 byte alignment
      restriction which, with this patch, we make mandatory on the Tx path.
      The case in which the amount of headroom needed is not available is
      already handled by the driver which instead sends a S/G frame with the
      first buffer only holding the SW and HW annotation areas.
      
      Without this patch, we can empirically see data corruption happening
      between Tx and Tx confirmation which sometimes leads to the SW
      annotation area being overwritten.
      
      Since this is an old IP where the hardware team cannot help to
      understand the underlying behavior, we make the Tx alignment mandatory
      for all frames to avoid the crash on Tx conf. Also, remove the comment
      that suggested that this is just an optimization.
      
      This patch also sets the needed_headroom net device field to the usual
      value that the driver would need on the Tx path:
      	- 64 bytes for the software annotation area
      	- 64 bytes to account for a 64 byte aligned buffer address
      
      Fixes: 6e2387e8
      
       ("staging: fsl-dpaa2/eth: Add Freescale DPAA2 Ethernet driver")
      Closes: https://lore.kernel.org/netdev/aa784d0c-85eb-4e5d-968b-c8f74fa86be6@gin.de/
      Signed-off-by: default avatarIoana Ciornei <ioana.ciornei@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f422abe3
    • Greg Ungerer's avatar
      net: dsa: mv88e6xxx: fix marvell 6350 probe crash · a524eabc
      Greg Ungerer authored
      As of commit b92143d4 ("net: dsa: mv88e6xxx: add infrastructure for
      phylink_pcs") probing of a Marvell 88e6350 switch causes a NULL pointer
      de-reference like this example:
      
          ...
          mv88e6085 d0072004.mdio-mii:11: switch 0x3710 detected: Marvell 88E6350, revision 2
          8<--- cut here ---
          Unable to handle kernel NULL pointer dereference at virtual address 00000000 when read
          [00000000] *pgd=00000000
          Internal error: Oops: 5 [#1] ARM
          Modules linked in:
          CPU: 0 PID: 8 Comm: kworker/u2:0 Not tainted 6.7.0-rc2-dirty #26
          Hardware name: Marvell Armada 370/XP (Device Tree)
          Workqueue: events_unbound deferred_probe_work_func
          PC is at mv88e6xxx_port_setup+0x1c/0x44
          LR is at dsa_port_devlink_setup+0x74/0x154
          pc : [<c057ea24>]    lr : [<c0819598>]    psr: a0000013
          sp : c184fce0  ip : c542b8f4  fp : 00000000
          r10: 00000001  r9 : c542a540  r8 : c542bc00
          r7 : c542b838  r6 : c5244580  r5 : 00000005  r4 : c5244580
          r3 : 00000000  r2 : c542b840  r1 : 00000005  r0 : c1a02040
          ...
      
      The Marvell 6350 switch has no SERDES interface and so has no
      corresponding pcs_ops defined for it. But during probing a call is made
      to mv88e6xxx_port_setup() which unconditionally expects pcs_ops to exist -
      though the presence of the pcs_ops->pcs_init function is optional.
      
      Modify code to check for pcs_ops first, before checking for and calling
      pcs_ops->pcs_init. Modify checking and use of pcs_ops->pcs_teardown
      which may potentially suffer the same problem.
      
      Fixes: b92143d4
      
       ("net: dsa: mv88e6xxx: add infrastructure for phylink_pcs")
      Signed-off-by: default avatarGreg Ungerer <gerg@kernel.org>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a524eabc
    • Greg Ungerer's avatar
      net: dsa: mv88e6xxx: fix marvell 6350 switch probing · b3f1a164
      Greg Ungerer authored
      As of commit de5c9bf4 ("net: phylink: require supported_interfaces to
      be filled") Marvell 88e6350 switches fail to be probed:
      
          ...
          mv88e6085 d0072004.mdio-mii:11: switch 0x3710 detected: Marvell 88E6350, revision 2
          mv88e6085 d0072004.mdio-mii:11: phylink: error: empty supported_interfaces
          error creating PHYLINK: -22
          mv88e6085: probe of d0072004.mdio-mii:11 failed with error -22
          ...
      
      The problem stems from the use of mv88e6185_phylink_get_caps() to get
      the device capabilities. Create a new dedicated phylink_get_caps for the
      6351 family (which the 6350 is one of) to properly support their set of
      capabilities.
      
      According to chip.h the 6351 switch family includes the 6171, 6175, 6350
      and 6351 switches, so update each of these to use the correct
      phylink_get_caps.
      
      Fixes: de5c9bf4
      
       ("net: phylink: require supported_interfaces to be filled")
      Signed-off-by: default avatarGreg Ungerer <gerg@kernel.org>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b3f1a164
  6. Nov 25, 2023