1. 13 Sep, 2023 22 commits
  2. 12 Sep, 2023 10 commits
  3. 11 Sep, 2023 8 commits
    • Brett Creeley's avatar
      iavf: Fix promiscuous mode configuration flow messages · 221465de
      Brett Creeley authored
      Currently when configuring promiscuous mode on the AVF we detect a
      change in the netdev->flags. We use IFF_PROMISC and IFF_ALLMULTI to
      determine whether or not we need to request/release promiscuous mode
      and/or multicast promiscuous mode. The problem is that the AQ calls for
      setting/clearing promiscuous/multicast mode are treated separately. This
      leads to a case where we can trigger two promiscuous mode AQ calls in
      a row with the incorrect state. To fix this make a few changes.
      
      Use IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE instead of the previous
      IAVF_FLAG_AQ_[REQUEST|RELEASE]_[PROMISC|ALLMULTI] flags.
      
      In iavf_set_rx_mode() detect if there is a change in the
      netdev->flags in comparison with adapter->flags and set the
      IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE aq_required bit. Then in
      iavf_process_aq_command() only check for IAVF_FLAG_CONFIGURE_PROMISC_MODE
      and call iavf_set_promiscuous() if it's set.
      
      In iavf_set_promiscuous() check again to see which (if any) promiscuous
      mode bits have changed when comparing the netdev->flags with the
      adapter->flags. Use this to set the flags which get sent to the PF
      driver.
      
      Add a spinlock that is used for updating current_netdev_promisc_flags
      and only allows one promiscuous mode AQ at a time.
      
      [1] Fixes the fact that we will only have one AQ call in the aq_required
      queue at any one time.
      
      [2] Streamlines the change in promiscuous mode to only set one AQ
      required bit.
      
      [3] This allows us to keep track of the current state of the flags and
      also makes it so we can take the most recent netdev->flags promiscuous
      mode state.
      
      [4] This fixes the problem where a change in the netdev->flags can cause
      IAVF_FLAG_AQ_CONFIGURE_PROMISC_MODE to be set in iavf_set_rx_mode(),
      but cleared in iavf_set_promiscuous() before the change is ever made via
      AQ call.
      
      Fixes: 47d34839 ("i40evf: Add driver support for promiscuous mode")
      Signed-off-by: default avatarBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: default avatarAhmed Zaki <ahmed.zaki@intel.com>
      Tested-by: default avatarRafal Romanowski <rafal.romanowski@intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      221465de
    • Andrii Staikov's avatar
      i40e: fix potential memory leaks in i40e_remove() · 5ca636d9
      Andrii Staikov authored
      Instead of freeing memory of a single VSI, make sure
      the memory for all VSIs is cleared before releasing VSIs.
      Add releasing of their resources in a loop with the iteration
      number equal to the number of allocated VSIs.
      
      Fixes: 41c445ff ("i40e: main driver core")
      Signed-off-by: default avatarAndrii Staikov <andrii.staikov@intel.com>
      Signed-off-by: default avatarAleksandr Loktionov <aleksandr.loktionov@intel.com>
      Reviewed-by: default avatarSimon Horman <horms@kernel.org>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      5ca636d9
    • Lorenzo Bianconi's avatar
      net: ethernet: mtk_eth_soc: fix pse_port configuration for MT7988 · 5a124b1f
      Lorenzo Bianconi authored
      MT7988 SoC support 3 NICs. Fix pse_port configuration in
      mtk_flow_set_output_device routine if the traffic is offloaded to eth2.
      Rely on mtk_pse_port definitions.
      
      Fixes: 88efedf5 ("net: ethernet: mtk_eth_soc: enable nft hw flowtable_offload for MT7988 SoC")
      Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a124b1f
    • Daniel Golle's avatar
      net: ethernet: mtk_eth_soc: fix uninitialized variable · e10a35ab
      Daniel Golle authored
      Variable dma_addr in function mtk_poll_rx can be uninitialized on
      some of the error paths. In practise this doesn't matter, even random
      data present in uninitialized stack memory can safely be used in the
      way it happens in the error path.
      
      However, in order to make Smatch happy make sure the variable is
      always initialized.
      Signed-off-by: default avatarDaniel Golle <daniel@makrotopia.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e10a35ab
    • Shigeru Yoshida's avatar
      kcm: Fix memory leak in error path of kcm_sendmsg() · c821a88b
      Shigeru Yoshida authored
      syzbot reported a memory leak like below:
      
      BUG: memory leak
      unreferenced object 0xffff88810b088c00 (size 240):
        comm "syz-executor186", pid 5012, jiffies 4294943306 (age 13.680s)
        hex dump (first 32 bytes):
          00 89 08 0b 81 88 ff ff 00 00 00 00 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<ffffffff83e5d5ff>] __alloc_skb+0x1ef/0x230 net/core/skbuff.c:634
          [<ffffffff84606e59>] alloc_skb include/linux/skbuff.h:1289 [inline]
          [<ffffffff84606e59>] kcm_sendmsg+0x269/0x1050 net/kcm/kcmsock.c:815
          [<ffffffff83e479c6>] sock_sendmsg_nosec net/socket.c:725 [inline]
          [<ffffffff83e479c6>] sock_sendmsg+0x56/0xb0 net/socket.c:748
          [<ffffffff83e47f55>] ____sys_sendmsg+0x365/0x470 net/socket.c:2494
          [<ffffffff83e4c389>] ___sys_sendmsg+0xc9/0x130 net/socket.c:2548
          [<ffffffff83e4c536>] __sys_sendmsg+0xa6/0x120 net/socket.c:2577
          [<ffffffff84ad7bb8>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
          [<ffffffff84ad7bb8>] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
          [<ffffffff84c0008b>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      In kcm_sendmsg(), kcm_tx_msg(head)->last_skb is used as a cursor to append
      newly allocated skbs to 'head'. If some bytes are copied, an error occurred,
      and jumped to out_error label, 'last_skb' is left unmodified. A later
      kcm_sendmsg() will use an obsoleted 'last_skb' reference, corrupting the
      'head' frag_list and causing the leak.
      
      This patch fixes this issue by properly updating the last allocated skb in
      'last_skb'.
      
      Fixes: ab7ac4eb ("kcm: Kernel Connection Multiplexor module")
      Reported-and-tested-by: syzbot+6f98de741f7dbbfc4ccb@syzkaller.appspotmail.com
      Closes: https://syzkaller.appspot.com/bug?extid=6f98de741f7dbbfc4ccbSigned-off-by: default avatarShigeru Yoshida <syoshida@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c821a88b
    • Hayes Wang's avatar
      r8152: check budget for r8152_poll() · a7b8d60b
      Hayes Wang authored
      According to the document of napi, there is no rx process when the
      budget is 0. Therefore, r8152_poll() has to return 0 directly when the
      budget is equal to 0.
      
      Fixes: d2187f8e ("r8152: divide the tx and rx bottom functions")
      Signed-off-by: default avatarHayes Wang <hayeswang@realtek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a7b8d60b
    • David S. Miller's avatar
      Merge branch 'sha1105-regressions' · 904de985
      David S. Miller authored
      Vladimir Oltean says:
      
      ====================
      Fixes for SJA1105 DSA FDB regressions
      
      A report by Yanan Yang has prompted an investigation into the sja1105
      driver's behavior w.r.t. multicast. The report states that when adding
      multicast L2 addresses with "bridge mdb add", only the most recently
      added address works - the others seem to be overwritten. This is solved
      by patch 3/5 (with patch 2/5 as a dependency for it).
      
      Patches 4/5 and 5/5 fix a series of race conditions introduced during
      the same patch set as the bug above, namely this one:
      https://patchwork.kernel.org/project/netdevbpf/cover/20211024171757.3753288-1-vladimir.oltean@nxp.com/
      
      Finally, patch 1/5 fixes an issue found ever since the introduction of
      multicast forwarding offload in sja1105, which is that the multicast
      addresses are visible (with the "self" flag) in "bridge fdb show".
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      904de985
    • Vladimir Oltean's avatar
      net: dsa: sja1105: block FDB accesses that are concurrent with a switch reset · 86899e9e
      Vladimir Oltean authored
      Currently, when we add the first sja1105 port to a bridge with
      vlan_filtering 1, then we sometimes see this output:
      
      sja1105 spi2.2: port 4 failed to read back entry for be:79:b4:9e:9e:96 vid 3088: -ENOENT
      sja1105 spi2.2: Reset switch and programmed static config. Reason: VLAN filtering
      sja1105 spi2.2: port 0 failed to add be:79:b4:9e:9e:96 vid 0 to fdb: -2
      
      It is because sja1105_fdb_add() runs from the dsa_owq which is no longer
      serialized with switch resets since it dropped the rtnl_lock() in the
      blamed commit.
      
      Either performing the FDB accesses before the reset, or after the reset,
      is equally fine, because sja1105_static_fdb_change() backs up those
      changes in the static config, but FDB access during reset isn't ok.
      
      Make sja1105_static_config_reload() take the fdb_lock to fix that.
      
      Fixes: 0faf890f ("net: dsa: drop rtnl_lock from dsa_slave_switchdev_event_work")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      86899e9e