1. 12 May, 2022 39 commits
    • Martin Habets's avatar
      siena: Make SRIOV support specific for Siena · dfb1cfbd
      Martin Habets authored
      Add a Siena Kconfig option and use it in stead of the sfc one.
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dfb1cfbd
    • Martin Habets's avatar
      siena: Make MTD support specific for Siena · 65d4b471
      Martin Habets authored
      Add a Siena Kconfig option and use it in stead of the sfc one.
      Signed-off-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      65d4b471
    • Jakub Kicinski's avatar
      Merge branch 'restructure-struct-ocelot_port' · 75db72de
      Jakub Kicinski authored
      Vladimir Oltean says:
      
      ====================
      Restructure struct ocelot_port
      
      This patch set represents preparation for further work. It adds an
      "index" field to struct ocelot_port, and populates it from the Felix DSA
      driver and Ocelot switchdev driver.
      
      The users of struct ocelot_port :: index are the same users as those of
      struct ocelot_port_private :: chip_port.
      ====================
      
      Link: https://lore.kernel.org/r/20220511100637.568950-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      75db72de
    • Vladimir Oltean's avatar
      net: mscc: ocelot: move ocelot_port_private :: chip_port to ocelot_port :: index · 7e708760
      Vladimir Oltean authored
      Currently the ocelot switch lib is unaware of the index of a struct
      ocelot_port, since that is kept in the encapsulating structures of outer
      drivers (struct dsa_port :: index, struct ocelot_port_private :: chip_port).
      
      With the upcoming increase in complexity associated with assigning DSA
      tag_8021q CPU ports to certain user ports, it becomes necessary for the
      switch lib to be able to retrieve the index of a certain ocelot_port.
      
      Therefore, introduce a new u8 to ocelot_port (same size as the chip_port
      used by the ocelot switchdev driver) and rework the existing code to
      populate and use it.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7e708760
    • Vladimir Oltean's avatar
      net: mscc: ocelot: minimize holes in struct ocelot_port · 6d0be600
      Vladimir Oltean authored
      Reorder members of struct ocelot_port to eliminate holes and reduce
      structure size. Pahole says:
      
      Before:
      
      struct ocelot_port {
              struct ocelot *            ocelot;               /*     0     8 */
              struct regmap *            target;               /*     8     8 */
              bool                       vlan_aware;           /*    16     1 */
      
              /* XXX 7 bytes hole, try to pack */
      
              const struct ocelot_bridge_vlan  * pvid_vlan;    /*    24     8 */
              unsigned int               ptp_skbs_in_flight;   /*    32     4 */
              u8                         ptp_cmd;              /*    36     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              struct sk_buff_head        tx_skbs;              /*    40    96 */
              /* --- cacheline 2 boundary (128 bytes) was 8 bytes ago --- */
              u8                         ts_id;                /*   136     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              phy_interface_t            phy_mode;             /*   140     4 */
              bool                       is_dsa_8021q_cpu;     /*   144     1 */
              bool                       learn_ena;            /*   145     1 */
      
              /* XXX 6 bytes hole, try to pack */
      
              struct net_device *        bond;                 /*   152     8 */
              bool                       lag_tx_active;        /*   160     1 */
      
              /* XXX 1 byte hole, try to pack */
      
              u16                        mrp_ring_id;          /*   162     2 */
      
              /* XXX 4 bytes hole, try to pack */
      
              struct net_device *        bridge;               /*   168     8 */
              int                        bridge_num;           /*   176     4 */
              u8                         stp_state;            /*   180     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              int                        speed;                /*   184     4 */
      
              /* size: 192, cachelines: 3, members: 18 */
              /* sum members: 161, holes: 7, sum holes: 27 */
              /* padding: 4 */
      };
      
      After:
      
      struct ocelot_port {
              struct ocelot *            ocelot;               /*     0     8 */
              struct regmap *            target;               /*     8     8 */
              struct net_device *        bond;                 /*    16     8 */
              struct net_device *        bridge;               /*    24     8 */
              const struct ocelot_bridge_vlan  * pvid_vlan;    /*    32     8 */
              phy_interface_t            phy_mode;             /*    40     4 */
              unsigned int               ptp_skbs_in_flight;   /*    44     4 */
              struct sk_buff_head        tx_skbs;              /*    48    96 */
              /* --- cacheline 2 boundary (128 bytes) was 16 bytes ago --- */
              u16                        mrp_ring_id;          /*   144     2 */
              u8                         ptp_cmd;              /*   146     1 */
              u8                         ts_id;                /*   147     1 */
              u8                         stp_state;            /*   148     1 */
              bool                       vlan_aware;           /*   149     1 */
              bool                       is_dsa_8021q_cpu;     /*   150     1 */
              bool                       learn_ena;            /*   151     1 */
              bool                       lag_tx_active;        /*   152     1 */
      
              /* XXX 3 bytes hole, try to pack */
      
              int                        bridge_num;           /*   156     4 */
              int                        speed;                /*   160     4 */
      
              /* size: 168, cachelines: 3, members: 18 */
              /* sum members: 161, holes: 1, sum holes: 3 */
              /* padding: 4 */
              /* last cacheline: 40 bytes */
      };
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      6d0be600
    • Vladimir Oltean's avatar
      net: mscc: ocelot: delete ocelot_port :: xmit_template · 15f6d01e
      Vladimir Oltean authored
      This is no longer used since commit 7c4bb540 ("net: dsa: tag_ocelot:
      create separate tagger for Seville").
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      15f6d01e
    • Jakub Kicinski's avatar
      Merge branch 'dsa-changes-for-multiple-cpu-ports-part-1' · 879c610c
      Jakub Kicinski authored
      Vladimir Oltean says:
      
      ====================
      DSA changes for multiple CPU ports (part 1)
      
      I am trying to enable the second internal port pair from the NXP LS1028A
      Felix switch for DSA-tagged traffic via "ocelot-8021q". This series
      represents part 1 (of an unknown number) of that effort.
      
      It does some preparation work, like managing host flooding in DSA via a
      dedicated method, and removing the CPU port as argument from the tagging
      protocol change procedure.
      
      In terms of driver-specific changes, it reworks the 2 tag protocol
      implementations in the Felix driver to have a structured data format.
      It enables host flooding towards all tag_8021q CPU ports. It dynamically
      updates the tag_8021q CPU port used for traps. It also fixes a bug
      introduced by a previous refactoring/oversimplification commit in
      net-next.
      ====================
      
      Link: https://lore.kernel.org/r/20220511095020.562461-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      879c610c
    • Vladimir Oltean's avatar
      net: dsa: felix: reimplement tagging protocol change with function pointers · 7a29d220
      Vladimir Oltean authored
      The error handling for the current tagging protocol change procedure is
      a bit brittle (we dismantle the previous tagging protocol entirely
      before setting up the new one). By identifying which parts of a tagging
      protocol are unique to itself and which parts are shared with the other,
      we can implement a protocol change procedure where error handling is a
      bit more robust, because we start setting up the new protocol first, and
      tear down the old one only after the setup of the specific and shared
      parts succeeded.
      
      The protocol change is a bit too open-coded too, in the area of
      migrating host flood settings and MDBs. By identifying what differs
      between tagging protocols (the forwarding masks for host flooding) we
      can implement a more straightforward migration procedure which is
      handled in the shared portion of the protocol change, rather than
      individually by each protocol.
      
      Therefore, a more structured approach calls for the introduction of a
      structure of function pointers per tagging protocol. This covers setup,
      teardown and the host forwarding mask. In the future it will also cover
      how to prepare for a new DSA master.
      
      The initial tagging protocol setup (at driver probe time) and the final
      teardown (at driver removal time) are also adapted to call into the
      structured methods of the specific protocol in current use. This is
      especially relevant for teardown, where we previously called
      felix_del_tag_protocol() only for the first CPU port. But by not
      specifying which CPU port this is for, we gain more flexibility to
      support multiple CPU ports in the future.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7a29d220
    • Vladimir Oltean's avatar
      net: dsa: felix: dynamically determine tag_8021q CPU port for traps · c352e5e8
      Vladimir Oltean authored
      Ocelot switches support a single active CPU port at a time (at least as
      a trapping destination, i.e. for control traffic). This is true
      regardless of whether we are using the native copy-to-CPU-port-module
      functionality, or a redirect action towards the software-defined
      tag_8021q CPU port.
      
      Currently we assume that the trapping destination in tag_8021q mode is
      the first CPU port, yet in the future we may want to migrate the user
      ports to the second CPU port.
      
      For that to work, we need to make sure that the tag_8021q trapping
      destination is a CPU port that is active, i.e. is used by at least some
      user port on which the trap was added. Otherwise, we may end up
      redirecting the traffic to a CPU port which isn't even up.
      
      Note that due to the current design where we simply choose the CPU port
      of the first port from the trap's ingress port mask, it may be that a
      CPU port absorbes control traffic from user ports which aren't affine to
      it as per user space's request. This isn't ideal, but is the lesser of
      two evils. Following the user-configured affinity for traps would mean
      that we can no longer reuse a single TCAM entry for multiple traps,
      which is what we actually do for e.g. PTP. Either we duplicate and
      deduplicate TCAM entries on the fly when user-to-CPU-port mappings
      change (which is unnecessarily complicated), or we redirect trapped
      traffic to all tag_8021q CPU ports if multiple such ports are in use.
      The latter would have actually been nice, if it actually worked, but it
      doesn't, since a OCELOT_MASK_MODE_REDIRECT action towards multiple ports
      would not take PGID_SRC into consideration, and it would just duplicate
      the packet towards each (CPU) port, leading to duplicates in software.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c352e5e8
    • Vladimir Oltean's avatar
      net: dsa: remove port argument from ->change_tag_protocol() · bacf93b0
      Vladimir Oltean authored
      DSA has not supported (and probably will not support in the future
      either) independent tagging protocols per CPU port.
      
      Different switch drivers have different requirements, some may need to
      replicate some settings for each CPU port, some may need to apply some
      settings on a single CPU port, while some may have to configure some
      global settings and then some per-CPU-port settings.
      
      In any case, the current model where DSA calls ->change_tag_protocol for
      each CPU port turns out to be impractical for drivers where there are
      global things to be done. For example, felix calls dsa_tag_8021q_register(),
      which makes no sense per CPU port, so it suppresses the second call.
      
      Let drivers deal with replication towards all CPU ports, and remove the
      CPU port argument from the function prototype.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Acked-by: default avatarLuiz Angelo Daros de Luca <luizluca@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bacf93b0
    • Vladimir Oltean's avatar
      net: dsa: felix: manage host flooding using a specific driver callback · 72c3b0c7
      Vladimir Oltean authored
      At the time - commit 7569459a ("net: dsa: manage flooding on the CPU
      ports") - not introducing a dedicated switch callback for host flooding
      made sense, because for the only user, the felix driver, there was
      nothing different to do for the CPU port than set the flood flags on the
      CPU port just like on any other bridge port.
      
      There are 2 reasons why this approach is not good enough, however.
      
      (1) Other drivers, like sja1105, support configuring flooding as a
          function of {ingress port, egress port}, whereas the DSA
          ->port_bridge_flags() function only operates on an egress port.
          So with that driver we'd have useless host flooding from user ports
          which don't need it.
      
      (2) Even with the felix driver, support for multiple CPU ports makes it
          difficult to piggyback on ->port_bridge_flags(). The way in which
          the felix driver is going to support host-filtered addresses with
          multiple CPU ports is that it will direct these addresses towards
          both CPU ports (in a sort of multicast fashion), then restrict the
          forwarding to only one of the two using the forwarding masks.
          Consequently, flooding will also be enabled towards both CPU ports.
          However, ->port_bridge_flags() gets passed the index of a single CPU
          port, and that leaves the flood settings out of sync between the 2
          CPU ports.
      
      This is to say, it's better to have a specific driver method for host
      flooding, which takes the user port as argument. This solves problem (1)
      by allowing the driver to do different things for different user ports,
      and problem (2) by abstracting the operation and letting the driver do
      whatever, rather than explicitly making the DSA core point to the CPU
      port it thinks needs to be touched.
      
      This new method also creates a problem, which is that cross-chip setups
      are not handled. However I don't have hardware right now where I can
      test what is the proper thing to do, and there isn't hardware compatible
      with multi-switch trees that supports host flooding. So it remains a
      problem to be tackled in the future.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      72c3b0c7
    • Vladimir Oltean's avatar
      net: dsa: introduce the dsa_cpu_ports() helper · 465c3de4
      Vladimir Oltean authored
      Similar to dsa_user_ports() which retrieves a port mask of all user
      ports, introduce dsa_cpu_ports() which retrieves the mask of all CPU
      ports of a switch.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      465c3de4
    • Vladimir Oltean's avatar
      net: dsa: felix: bring the NPI port indirection for host flooding to surface · 910ee6cc
      Vladimir Oltean authored
      For symmetry with host FDBs and MDBs where the indirection is now
      handled outside the ocelot switch lib, do the same for bridge port
      flags (unicast/multicast/broadcast flooding).
      
      The only caller of the ocelot switch lib which uses the NPI port is the
      Felix DSA driver.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      910ee6cc
    • Vladimir Oltean's avatar
      net: dsa: felix: bring the NPI port indirection for host MDBs to surface · 0ddf83cd
      Vladimir Oltean authored
      For symmetry with host FDBs where the indirection is now handled outside
      the ocelot switch lib, do the same for host MDB entries. The only caller
      of the ocelot switch lib which uses the NPI port is the Felix DSA driver.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0ddf83cd
    • Vladimir Oltean's avatar
      net: dsa: felix: program host FDB entries towards PGID_CPU for tag_8021q too · e9b3ba43
      Vladimir Oltean authored
      I remembered why we had the host FDB migration procedure in place.
      
      It is true that host FDB entry migration can be done by changing the
      value of PGID_CPU, but the problem is that only host FDB entries learned
      while operating in NPI mode go to PGID_CPU. When the CPU port operates
      in tag_8021q mode, the FDB entries are learned towards the unicast PGID
      equal to the physical port number of this CPU port, bypassing the
      PGID_CPU indirection.
      
      So host FDB entries learned in tag_8021q mode are not migrated any
      longer towards the NPI port.
      
      Fix this by extracting the NPI port -> PGID_CPU redirection from the
      ocelot switch lib, moving it to the Felix DSA driver, and applying it
      for any CPU port regardless of its kind (NPI or tag_8021q).
      
      Fixes: a51c1c3f ("net: dsa: felix: stop migrating FDBs back and forth on tag proto change")
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e9b3ba43
    • Horatiu Vultur's avatar
      net: lan966x: Fix use of pointer after being freed · f0a65f81
      Horatiu Vultur authored
      The smatch found the following warning:
      
      drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c:736 lan966x_fdma_reload()
      warn: 'rx_dcbs' was already freed.
      
      This issue can happen when changing the MTU on one of the ports and once
      the RX buffers are allocated and then the TX buffer allocation fails.
      In that case the RX buffers should not be restore. This fix this issue
      such that the RX buffers will not be restored if the TX buffers failed
      to be allocated.
      
      Fixes: 2ea1cbac ("net: lan966x: Update FDMA to change MTU.")
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Link: https://lore.kernel.org/r/20220511204059.2689199-1-horatiu.vultur@microchip.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f0a65f81
    • Jakub Kicinski's avatar
      net: update the register_netdevice() kdoc · fa926bb3
      Jakub Kicinski authored
      The BUGS section looks quite dated, the registration
      is under rtnl lock. Remove some obvious information
      while at it.
      
      Link: https://lore.kernel.org/r/20220511190720.1401356-1-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fa926bb3
    • Jakub Kicinski's avatar
      skbuff: replace a BUG_ON() with the new DEBUG_NET_WARN_ON_ONCE() · 0df65743
      Jakub Kicinski authored
      Very few drivers actually have Kconfig knobs for adding
      -DDEBUG. 8 according to a quick grep, while there are
      93 users of skb_checksum_none_assert(). Switch to the
      new DEBUG_NET_WARN_ON_ONCE() to catch bad skbs.
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Link: https://lore.kernel.org/r/20220511172305.1382810-1-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0df65743
    • David Thompson's avatar
      mlxbf_gige: remove driver-managed interrupt counts · f4826443
      David Thompson authored
      The driver currently has three interrupt counters,
      which are incremented every time each interrupt handler
      executes.  These driver-managed counters are not
      necessary as the kernel already has logic that manages
      interrupt counts and exposes them via /proc/interrupts.
      This patch removes the driver-managed counters.
      Signed-off-by: default avatarDavid Thompson <davthompson@nvidia.com>
      Signed-off-by: default avatarAsmaa Mnebhi <asmaa@nvidia.com>
      Link: https://lore.kernel.org/r/20220511135251.2989-1-davthompson@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f4826443
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 9b19e57a
      Jakub Kicinski authored
      No conflicts.
      
      Build issue in drivers/net/ethernet/sfc/ptp.c
        54fccfdd ("sfc: efx_default_channel_type APIs can be static")
        49e6123c ("net: sfc: fix memory leak due to ptp channel")
      https://lore.kernel.org/all/20220510130556.52598fe2@canb.auug.org.au/Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9b19e57a
    • Linus Torvalds's avatar
      Merge tag 'net-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · f3f19f93
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from wireless, and bluetooth.
      
        No outstanding fires.
      
        Current release - regressions:
      
         - eth: atlantic: always deep reset on pm op, fix null-deref
      
        Current release - new code bugs:
      
         - rds: use maybe_get_net() when acquiring refcount on TCP sockets
           [refinement of a previous fix]
      
         - eth: ocelot: mark traps with a bool instead of guessing type based
           on list membership
      
        Previous releases - regressions:
      
         - net: fix skipping features in for_each_netdev_feature()
      
         - phy: micrel: fix null-derefs on suspend/resume and probe
      
         - bcmgenet: check for Wake-on-LAN interrupt probe deferral
      
        Previous releases - always broken:
      
         - ipv4: drop dst in multicast routing path, prevent leaks
      
         - ping: fix address binding wrt vrf
      
         - net: fix wrong network header length when BPF protocol translation
           is used on skbs with a fraglist
      
         - bluetooth: fix the creation of hdev->name
      
         - rfkill: uapi: fix RFKILL_IOCTL_MAX_SIZE ioctl request definition
      
         - wifi: iwlwifi: iwl-dbg: use del_timer_sync() before freeing
      
         - wifi: ath11k: reduce the wait time of 11d scan and hw scan while
           adding an interface
      
         - mac80211: fix rx reordering with non explicit / psmp ack policy
      
         - mac80211: reset MBSSID parameters upon connection
      
         - nl80211: fix races in nl80211_set_tx_bitrate_mask()
      
         - tls: fix context leak on tls_device_down
      
         - sched: act_pedit: really ensure the skb is writable
      
         - batman-adv: don't skb_split skbuffs with frag_list
      
         - eth: ocelot: fix various issues with TC actions (null-deref; bad
           stats; ineffective drops; ineffective filter removal)"
      
      * tag 'net-5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (61 commits)
        tls: Fix context leak on tls_device_down
        net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe()
        net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending
        net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down()
        mlxsw: Avoid warning during ip6gre device removal
        net: bcmgenet: Check for Wake-on-LAN interrupt probe deferral
        net: ethernet: mediatek: ppe: fix wrong size passed to memset()
        Bluetooth: Fix the creation of hdev->name
        i40e: i40e_main: fix a missing check on list iterator
        net/sched: act_pedit: really ensure the skb is writable
        s390/lcs: fix variable dereferenced before check
        s390/ctcm: fix potential memory leak
        s390/ctcm: fix variable dereferenced before check
        net: atlantic: verify hw_head_ lies within TX buffer ring
        net: atlantic: add check for MAX_SKB_FRAGS
        net: atlantic: reduce scope of is_rsc_complete
        net: atlantic: fix "frag[0] not initialized"
        net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()
        net: phy: micrel: Fix incorrect variable type in micrel
        decnet: Use container_of() for struct dn_neigh casts
        ...
      f3f19f93
    • Linus Torvalds's avatar
      Merge branch 'for-5.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup · 0ac824f3
      Linus Torvalds authored
      Pull cgroup fix from Tejun Heo:
       "Waiman's fix for a cgroup2 cpuset bug where it could miss nodes which
        were hot-added"
      
      * 'for-5.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
        cgroup/cpuset: Remove cpus_allowed/mems_allowed setup in cpuset_init_smp()
      0ac824f3
    • Linus Torvalds's avatar
      Merge tag 'fixes_for_v5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · c37dba6a
      Linus Torvalds authored
      Pull fs fixes from Jan Kara:
       "Three fixes that I'd still like to get to 5.18:
      
         - add a missing sanity check in the fanotify FAN_RENAME feature
           (added in 5.17, let's fix it before it gets wider usage in
           userspace)
      
         - udf fix for recently introduced filesystem corruption issue
      
         - writeback fix for a race in inode list handling that can lead to
           delayed writeback and possible dirty throttling stalls"
      
      * tag 'fixes_for_v5.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        udf: Avoid using stale lengthOfImpUse
        writeback: Avoid skipping inode writeback
        fanotify: do not allow setting dirent events in mask of non-dir
      c37dba6a
    • Maxim Mikityanskiy's avatar
      tls: Fix context leak on tls_device_down · 3740651b
      Maxim Mikityanskiy authored
      The commit cited below claims to fix a use-after-free condition after
      tls_device_down. Apparently, the description wasn't fully accurate. The
      context stayed alive, but ctx->netdev became NULL, and the offload was
      torn down without a proper fallback, so a bug was present, but a
      different kind of bug.
      
      Due to misunderstanding of the issue, the original patch dropped the
      refcount_dec_and_test line for the context to avoid the alleged
      premature deallocation. That line has to be restored, because it matches
      the refcount_inc_not_zero from the same function, otherwise the contexts
      that survived tls_device_down are leaked.
      
      This patch fixes the described issue by restoring refcount_dec_and_test.
      After this change, there is no leak anymore, and the fallback to
      software kTLS still works.
      
      Fixes: c55dcdd4 ("net/tls: Fix use-after-free after the TLS device goes down and up")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
      Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
      Link: https://lore.kernel.org/r/20220512091830.678684-1-maximmi@nvidia.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3740651b
    • Taehee Yoo's avatar
      net: sfc: ef10: fix memory leak in efx_ef10_mtd_probe() · 1fa89ffb
      Taehee Yoo authored
      In the NIC ->probe() callback, ->mtd_probe() callback is called.
      If NIC has 2 ports, ->probe() is called twice and ->mtd_probe() too.
      In the ->mtd_probe(), which is efx_ef10_mtd_probe() it allocates and
      initializes mtd partiion.
      But mtd partition for sfc is shared data.
      So that allocated mtd partition data from last called
      efx_ef10_mtd_probe() will not be used.
      Therefore it must be freed.
      But it doesn't free a not used mtd partition data in efx_ef10_mtd_probe().
      
      kmemleak reports:
      unreferenced object 0xffff88811ddb0000 (size 63168):
        comm "systemd-udevd", pid 265, jiffies 4294681048 (age 348.586s)
        hex dump (first 32 bytes):
          00 00 00 00 00 00 00 00 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:
          [<ffffffffa3767749>] kmalloc_order_trace+0x19/0x120
          [<ffffffffa3873f0e>] __kmalloc+0x20e/0x250
          [<ffffffffc041389f>] efx_ef10_mtd_probe+0x11f/0x270 [sfc]
          [<ffffffffc0484c8a>] efx_pci_probe.cold.17+0x3df/0x53d [sfc]
          [<ffffffffa414192c>] local_pci_probe+0xdc/0x170
          [<ffffffffa4145df5>] pci_device_probe+0x235/0x680
          [<ffffffffa443dd52>] really_probe+0x1c2/0x8f0
          [<ffffffffa443e72b>] __driver_probe_device+0x2ab/0x460
          [<ffffffffa443e92a>] driver_probe_device+0x4a/0x120
          [<ffffffffa443f2ae>] __driver_attach+0x16e/0x320
          [<ffffffffa4437a90>] bus_for_each_dev+0x110/0x190
          [<ffffffffa443b75e>] bus_add_driver+0x39e/0x560
          [<ffffffffa4440b1e>] driver_register+0x18e/0x310
          [<ffffffffc02e2055>] 0xffffffffc02e2055
          [<ffffffffa3001af3>] do_one_initcall+0xc3/0x450
          [<ffffffffa33ca574>] do_init_module+0x1b4/0x700
      Acked-by: default avatarMartin Habets <habetsm.xilinx@gmail.com>
      Fixes: 8127d661 ("sfc: Add support for Solarflare SFC9100 family")
      Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
      Link: https://lore.kernel.org/r/20220512054709.12513-1-ap420073@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      1fa89ffb
    • Guangguan Wang's avatar
      net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending · f3c46e41
      Guangguan Wang authored
      Non blocking sendmsg will return -EAGAIN when any signal pending
      and no send space left, while non blocking recvmsg return -EINTR
      when signal pending and no data received. This may makes confused.
      As TCP returns -EAGAIN in the conditions described above. Align the
      behavior of smc with TCP.
      
      Fixes: 846e344e ("net/smc: add receive timeout check")
      Signed-off-by: default avatarGuangguan Wang <guangguan.wang@linux.alibaba.com>
      Reviewed-by: default avatarTony Lu <tonylu@linux.alibaba.com>
      Acked-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
      Link: https://lore.kernel.org/r/20220512030820.73848-1-guangguan.wang@linux.alibaba.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      f3c46e41
    • Florian Fainelli's avatar
      net: dsa: bcm_sf2: Fix Wake-on-LAN with mac_link_down() · b7be130c
      Florian Fainelli authored
      After commit 2d1f90f9 ("net: dsa/bcm_sf2: fix incorrect usage of
      state->link") the interface suspend path would call our mac_link_down()
      call back which would forcibly set the link down, thus preventing
      Wake-on-LAN packets from reaching our management port.
      
      Fix this by looking at whether the port is enabled for Wake-on-LAN and
      not clearing the link status in that case to let packets go through.
      
      Fixes: 2d1f90f9 ("net: dsa/bcm_sf2: fix incorrect usage of state->link")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Link: https://lore.kernel.org/r/20220512021731.2494261-1-f.fainelli@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b7be130c
    • Amit Cohen's avatar
      mlxsw: Avoid warning during ip6gre device removal · 810c2f0a
      Amit Cohen authored
      IPv6 addresses which are used for tunnels are stored in a hash table
      with reference counting. When a new GRE tunnel is configured, the driver
      is notified and configures it in hardware.
      
      Currently, any change in the tunnel is not applied in the driver. It
      means that if the remote address is changed, the driver is not aware of
      this change and the first address will be used.
      
      This behavior results in a warning [1] in scenarios such as the
      following:
      
       # ip link add name gre1 type ip6gre local 2000::3 remote 2000::fffe tos inherit ttl inherit
       # ip link set name gre1 type ip6gre local 2000::3 remote 2000::ffff ttl inherit
       # ip link delete gre1
      
      The change of the address is not applied in the driver. Currently, the
      driver uses the remote address which is stored in the 'parms' of the
      overlay device. When the tunnel is removed, the new IPv6 address is
      used, the driver tries to release it, but as it is not aware of the
      change, this address is not configured and it warns about releasing non
      existing IPv6 address.
      
      Fix it by using the IPv6 address which is cached in the IPIP entry, this
      address is the last one that the driver used, so even in cases such the
      above, the first address will be released, without any warning.
      
      [1]:
      
      WARNING: CPU: 1 PID: 2197 at drivers/net/ethernet/mellanox/mlxsw/spectrum.c:2920 mlxsw_sp_ipv6_addr_put+0x146/0x220 [mlxsw_spectrum]
      ...
      CPU: 1 PID: 2197 Comm: ip Not tainted 5.17.0-rc8-custom-95062-gc1e5ded51a9a #84
      Hardware name: Mellanox Technologies Ltd. MSN4700/VMOD0010, BIOS 5.11 07/12/2021
      RIP: 0010:mlxsw_sp_ipv6_addr_put+0x146/0x220 [mlxsw_spectrum]
      ...
      Call Trace:
       <TASK>
       mlxsw_sp2_ipip_rem_addr_unset_gre6+0xf1/0x120 [mlxsw_spectrum]
       mlxsw_sp_netdevice_ipip_ol_event+0xdb/0x640 [mlxsw_spectrum]
       mlxsw_sp_netdevice_event+0xc4/0x850 [mlxsw_spectrum]
       raw_notifier_call_chain+0x3c/0x50
       call_netdevice_notifiers_info+0x2f/0x80
       unregister_netdevice_many+0x311/0x6d0
       rtnl_dellink+0x136/0x360
       rtnetlink_rcv_msg+0x12f/0x380
       netlink_rcv_skb+0x49/0xf0
       netlink_unicast+0x233/0x340
       netlink_sendmsg+0x202/0x440
       ____sys_sendmsg+0x1f3/0x220
       ___sys_sendmsg+0x70/0xb0
       __sys_sendmsg+0x54/0xa0
       do_syscall_64+0x35/0x80
       entry_SYSCALL_64_after_hwframe+0x44/0xae
      
      Fixes: e846efe2 ("mlxsw: spectrum: Add hash table for IPv6 address mapping")
      Reported-by: default avatarMaksym Yaremchuk <maksymy@nvidia.com>
      Signed-off-by: default avatarAmit Cohen <amcohen@nvidia.com>
      Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
      Link: https://lore.kernel.org/r/20220511115747.238602-1-idosch@nvidia.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      810c2f0a
    • Paolo Abeni's avatar
      Merge branch 'nfp-vf-rate-limit-support' · b33177f1
      Paolo Abeni authored
      Simon Horman says:
      
      ====================
      *nfp: VF rate limit support
      
      this short series adds VF rate limiting to the NFP driver.
      
      The first patch, as suggested by Jakub Kicinski, adds a helper
      to check that ndo_set_vf_rate() rate parameters are sane.
      It also provides a place for further parameter checking to live,
      if needed in future.
      
      The second patch adds VF rate limit support to the NFP driver.
      It addresses several comments made on v1, including removing
      the parameter check that is now provided by the helper added
      in the first patch.
      ====================
      
      Link: https://lore.kernel.org/r/20220511113932.92114-1-simon.horman@corigine.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      b33177f1
    • Bin Chen's avatar
      nfp: VF rate limit support · e0d0e1fd
      Bin Chen authored
      Add VF rate limit feature
      
      This patch enhances the NFP driver to supports assignment of
      both max_tx_rate and min_tx_rate to VFs
      
      The template of configurations below is all supported.
      e.g.
       # ip link set $DEV vf $VF_NUM max_tx_rate $RATE_VALUE
       # ip link set $DEV vf $VF_NUM min_tx_rate $RATE_VALUE
       # ip link set $DEV vf $VF_NUM max_tx_rate $RATE_VALUE \
      			       min_tx_rate $RATE_VALUE
       # ip link set $DEV vf $VF_NUM min_tx_rate $RATE_VALUE \
      			       max_tx_rate $RATE_VALUE
      
      The max RATE_VALUE is limited to 0xFFFF which is about
      63Gbps (using 1024 for 1G)
      Signed-off-by: default avatarBin Chen <bin.chen@corigine.com>
      Signed-off-by: default avatarLouis Peens <louis.peens@corigine.com>
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      e0d0e1fd
    • Bin Chen's avatar
      rtnetlink: verify rate parameters for calls to ndo_set_vf_rate · a14857c2
      Bin Chen authored
      When calling ndo_set_vf_rate() the max_tx_rate parameter may be zero,
      in which case the setting is cleared, or it must be greater or equal to
      min_tx_rate.
      
      Enforce this requirement on all calls to ndo_set_vf_rate via a wrapper
      which also only calls ndo_set_vf_rate() if defined by the driver.
      
      Based on work by Jakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarBin Chen <bin.chen@corigine.com>
      Signed-off-by: default avatarBaowen Zheng <baowen.zheng@corigine.com>
      Signed-off-by: default avatarSimon Horman <simon.horman@corigine.com>
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      a14857c2
    • Colin Ian King's avatar
      982c97ee
    • Vladimir Oltean's avatar
      net: enetc: kill PHY-less mode for PFs · 0f84d403
      Vladimir Oltean authored
      Right now, a PHY-less port (no phy-mode, no fixed-link, no phy-handle)
      doesn't register with phylink, but calls netif_carrier_on() from
      enetc_start().
      
      This makes sense for a VF, but for a PF, this is braindead, because we
      never call enetc_mac_enable() so the MAC is left inoperational.
      Furthermore, commit 71b77a7a ("enetc: Migrate to PHYLINK and
      PCS_LYNX") put the nail in the coffin because it removed the initial
      netif_carrier_off() call done right after register_netdev().
      
      Without that call, netif_carrier_on() does not call
      linkwatch_fire_event(), so the operstate remains IF_OPER_UNKNOWN.
      
      Just deny the broken configuration by requiring that a phy-mode is
      present, and always register a PF with phylink.
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Reviewed-by: default avatarClaudiu Manoil <claudiu.manoil@nxp.com>
      Link: https://lore.kernel.org/r/20220511094200.558502-1-vladimir.oltean@nxp.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      0f84d403
    • Kees Cook's avatar
      fortify: Provide a memcpy trap door for sharp corners · 43213dae
      Kees Cook authored
      As we continue to narrow the scope of what the FORTIFY memcpy() will
      accept and build alternative APIs that give the compiler appropriate
      visibility into more complex memcpy scenarios, there is a need for
      "unfortified" memcpy use in rare cases where combinations of compiler
      behaviors, source code layout, etc, result in cases where the stricter
      memcpy checks need to be bypassed until appropriate solutions can be
      developed (i.e. fix compiler bugs, code refactoring, new API, etc). The
      intention is for this to be used only if there's no other reasonable
      solution, for its use to include a justification that can be used
      to assess future solutions, and for it to be temporary.
      
      Example usage included, based on analysis and discussion from:
      https://lore.kernel.org/netdev/CANn89iLS_2cshtuXPyNUGDPaic=sJiYfvTb_wNLgWrZRyBxZ_g@mail.gmail.com
      
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: Coco Li <lixiaoyan@google.com>
      Cc: Tariq Toukan <tariqt@nvidia.com>
      Cc: Saeed Mahameed <saeedm@nvidia.com>
      Cc: Leon Romanovsky <leon@kernel.org>
      Cc: netdev@vger.kernel.org
      Cc: linux-hardening@vger.kernel.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Link: https://lore.kernel.org/r/20220511025301.3636666-1-keescook@chromium.orgSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      43213dae
    • Florian Fainelli's avatar
      net: bcmgenet: Check for Wake-on-LAN interrupt probe deferral · 6b77c066
      Florian Fainelli authored
      The interrupt controller supplying the Wake-on-LAN interrupt line maybe
      modular on some platforms (irq-bcm7038-l1.c) and might be probed at a
      later time than the GENET driver. We need to specifically check for
      -EPROBE_DEFER and propagate that error to ensure that we eventually
      fetch the interrupt descriptor.
      
      Fixes: 9deb48b5 ("bcmgenet: add WOL IRQ check")
      Fixes: 5b1f0e62 ("net: bcmgenet: Avoid touching non-existent interrupt")
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
      Link: https://lore.kernel.org/r/20220511031752.2245566-1-f.fainelli@gmail.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      6b77c066
    • Yang Yingliang's avatar
      net: ethernet: mediatek: ppe: fix wrong size passed to memset() · 00832b1d
      Yang Yingliang authored
      'foe_table' is a pointer, the real size of struct mtk_foe_entry
      should be pass to memset().
      
      Fixes: ba37b7ca ("net: ethernet: mtk_eth_soc: add support for initializing the PPE")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Acked-by: default avatarFelix Fietkau <nbd@nbd.name>
      Link: https://lore.kernel.org/r/20220511030829.3308094-1-yangyingliang@huawei.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      00832b1d
    • Jakub Kicinski's avatar
      Merge tag 'for-net-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth · a48ab883
      Jakub Kicinski authored
      Luiz Augusto von Dentz says:
      
      ====================
      bluetooth pull request for net:
      
       - Fix the creation of hdev->name when index is greater than 9999
      
      * tag 'for-net-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth:
        Bluetooth: Fix the creation of hdev->name
      ====================
      
      Link: https://lore.kernel.org/r/20220512002901.823647-1-luiz.dentz@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a48ab883
    • Jakub Kicinski's avatar
      Merge tag 'wireless-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless · 8bf6008c
      Jakub Kicinski authored
      Kalle Valo says:
      
      ====================
      wireless fixes for v5.18
      
      Second set of fixes for v5.18 and hopefully the last one. We have a
      new iwlwifi maintainer, a fix to rfkill ioctl interface and important
      fixes to both stack and two drivers.
      
      * tag 'wireless-2022-05-11' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless:
        rfkill: uapi: fix RFKILL_IOCTL_MAX_SIZE ioctl request definition
        nl80211: fix locking in nl80211_set_tx_bitrate_mask()
        mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection
        mac80211_hwsim: fix RCU protected chanctx access
        mailmap: update Kalle Valo's email
        mac80211: Reset MBSSID parameters upon connection
        cfg80211: retrieve S1G operating channel number
        nl80211: validate S1G channel width
        mac80211: fix rx reordering with non explicit / psmp ack policy
        ath11k: reduce the wait time of 11d scan and hw scan while add interface
        MAINTAINERS: update iwlwifi driver maintainer
        iwlwifi: iwl-dbg: Use del_timer_sync() before freeing
      ====================
      
      Link: https://lore.kernel.org/r/20220511154535.A1A12C340EE@smtp.kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8bf6008c
    • Itay Iellin's avatar
      Bluetooth: Fix the creation of hdev->name · 103a2f32
      Itay Iellin authored
      Set a size limit of 8 bytes of the written buffer to "hdev->name"
      including the terminating null byte, as the size of "hdev->name" is 8
      bytes. If an id value which is greater than 9999 is allocated,
      then the "snprintf(hdev->name, sizeof(hdev->name), "hci%d", id)"
      function call would lead to a truncation of the id value in decimal
      notation.
      
      Set an explicit maximum id parameter in the id allocation function call.
      The id allocation function defines the maximum allocated id value as the
      maximum id parameter value minus one. Therefore, HCI_MAX_ID is defined
      as 10000.
      Signed-off-by: default avatarItay Iellin <ieitayie@gmail.com>
      Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
      103a2f32
  2. 11 May, 2022 1 commit