1. 09 Oct, 2020 21 commits
    • Jakub Kicinski's avatar
      Merge branch 'devlink-add-reload-action-and-limit-options' · 91bca7f7
      Jakub Kicinski authored
      Moshe Shemesh says:
      
      ====================
      Add devlink reload action and limit options
      
      Introduce new options on devlink reload API to enable the user to select
      the reload action required and constrains limits on these actions that he
      may want to ensure. Complete support for reload actions in mlx5.
      The following reload actions are supported:
        driver_reinit: driver entities re-initialization, applying devlink-param
                       and devlink-resource values.
        fw_activate: firmware activate.
      
      The uAPI is backward compatible, if the reload action option is omitted
      from the reload command, the driver reinit action will be used.
      Note that when required to do firmware activation some drivers may need
      to reload the driver. On the other hand some drivers may need to reset
      the firmware to reinitialize the driver entities. Therefore, the devlink
      reload command returns the actions which were actually performed.
      
      By default reload actions are not limited and driver implementation may
      include reset or downtime as needed to perform the actions.
      However, if reload limit is selected, the driver should perform only if
      it can do it while keeping the limit constraints.
      Reload limit added:
        no_reset: No reset allowed, no down time allowed, no link flap and no
                  configuration is lost.
      
      Each driver which supports devlink reload command should expose the
      reload actions and limits supported.
      
      Add reload stats to hold the history per reload action per limit.
      For example, the number of times fw_activate has been done on this
      device since the driver module was added or if the firmware activation
      was done with or without reset.
      
      Patch 1 changes devlink_reload_supported() param type to enable using
              it before allocating devlink.
      Patch 2-3 add the new API reload action and reload limit options to
                devlink reload.
      Patch 4-5 add reload stats and remote reload stats. These stats are
                exposed through devlink dev get.
      Patches 6-11 add support on mlx5 for devlink reload action fw_activate
                  and handle the firmware reset events.
      Patches 12-13 add devlink enable remote dev reset parameter and use it
                   in mlx5.
      Patches 14-15 mlx5 add devlink reload limit no_reset support for
                    fw_activate reload action.
      Patch 16 adds documentation file devlink-reload.rst
      ====================
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      91bca7f7
    • Moshe Shemesh's avatar
      devlink: Add Documentation/networking/devlink/devlink-reload.rst · eb79d754
      Moshe Shemesh authored
      Add devlink reload rst documentation file.
      Update index file to include it.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      eb79d754
    • Moshe Shemesh's avatar
      net/mlx5: Add support for devlink reload limit no reset · bef878e8
      Moshe Shemesh authored
      Add support for devlink reload action fw_activate with reload limit
      no_reset which does firmware live patching, updating the firmware image
      without reset, no downtime and no configuration lose. The driver checks
      if the firmware is capable of handling the pending firmware changes as a
      live patch. If it is then it triggers firmware live patching flow.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      bef878e8
    • Moshe Shemesh's avatar
      net/mlx5: Add support for fw live patch event · 2d693567
      Moshe Shemesh authored
      Firmware live patch event notifies the driver that the firmware was just
      updated using live patch. In such case the driver should not reload or
      re-initiate entities, part to updating the firmware version and
      re-initiate the firmware tracer which can be updated by live patch with
      new strings database to help debugging an issue.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      2d693567
    • Moshe Shemesh's avatar
      net/mlx5: Add devlink param enable_remote_dev_reset support · b4f7cbb3
      Moshe Shemesh authored
      The enable_remote_dev_reset devlink param flags that the host admin
      allows resets by other hosts. In case it is cleared mlx5 host PF driver
      will send NACK on pci sync for firmware update reset request and the
      command will fail.
      By default enable_remote_dev_reset parameter is true, so pci sync for
      firmware update reset is enabled.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b4f7cbb3
    • Moshe Shemesh's avatar
      devlink: Add enable_remote_dev_reset generic parameter · 195d9dec
      Moshe Shemesh authored
      The enable_remote_dev_reset devlink param flags that the host admin
      allows device resets that can be initiated by other hosts. This
      parameter is useful for setups where a device is shared by different
      hosts, such as multi-host setup. Once the user set this parameter to
      false, the driver should NACK any attempt to reset the device while the
      driver is loaded.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      195d9dec
    • Moshe Shemesh's avatar
      net/mlx5: Add support for devlink reload action fw activate · 5ec69744
      Moshe Shemesh authored
      Add support for devlink reload action fw_activate. To activate firmware
      image the mlx5 driver resets the firmware and reloads it from flash. If
      a new image was stored on flash it will be loaded. Once this reload
      command is executed the driver initiates fw sync reset flow, where the
      firmware synchronizes all PFs on coming reset and driver reload.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      5ec69744
    • Moshe Shemesh's avatar
      net/mlx5: Handle sync reset abort event · 7dd6df32
      Moshe Shemesh authored
      If firmware sends sync_reset_abort to driver the driver should clear the
      reset requested mode as reset is not expected any more.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      7dd6df32
    • Moshe Shemesh's avatar
      net/mlx5: Handle sync reset now event · eabe8e5e
      Moshe Shemesh authored
      On sync_reset_now event the driver does reload and PCI link toggle to
      activate firmware upgrade reset. When the firmware sends this event it
      syncs the event on all PFs, so all PFs will do PCI link toggle at once.
      To do PCI link toggle, the driver ensures that no other device ID under
      the same bridge by checking that all the PF functions under the same PCI
      bridge have same device ID. If no other device it uses PCI bridge link
      control to turn link down and up.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      eabe8e5e
    • Moshe Shemesh's avatar
      net/mlx5: Handle sync reset request event · 38b9f903
      Moshe Shemesh authored
      Once the driver gets sync_reset_request from firmware it prepares for the
      coming reset and sends acknowledge.
      After getting this event the driver expects device reset, either it will
      trigger PCI reset on sync_reset_now event or such PCI reset will be
      triggered by another PF of the same device. So it moves to reset
      requested mode and if it gets PCI reset triggered by the other PF it
      detect the reset and reloads.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      38b9f903
    • Moshe Shemesh's avatar
      net/mlx5: Set cap for pci sync for fw update event · e7f4d0bc
      Moshe Shemesh authored
      Set capability to notify the firmware that this host driver is capable
      of handling pci sync for firmware update events.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e7f4d0bc
    • Moshe Shemesh's avatar
      net/mlx5: Add functions to set/query MFRL register · 3180472f
      Moshe Shemesh authored
      Add functions to query and set the MFRL reset options supported by
      firmware.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3180472f
    • Moshe Shemesh's avatar
      devlink: Add remote reload stats · 77069ba2
      Moshe Shemesh authored
      Add remote reload stats to hold the history of actions performed due
      devlink reload commands initiated by remote host. For example, in case
      firmware activation with reset finished successfully but was initiated
      by remote host.
      
      The function devlink_remote_reload_actions_performed() is exported to
      enable drivers update on remote reload actions performed as it was not
      initiated by their own devlink instance.
      
      Expose devlink remote reload stats to the user through devlink dev get
      command.
      
      Examples:
      $ devlink dev show
      pci/0000:82:00.0:
        stats:
            reload:
              driver_reinit 2 fw_activate 1 fw_activate_no_reset 0
            remote_reload:
              driver_reinit 0 fw_activate 0 fw_activate_no_reset 0
      pci/0000:82:00.1:
        stats:
            reload:
              driver_reinit 1 fw_activate 0 fw_activate_no_reset 0
            remote_reload:
              driver_reinit 1 fw_activate 1 fw_activate_no_reset 0
      
      $ devlink dev show -jp
      {
          "dev": {
              "pci/0000:82:00.0": {
                  "stats": {
                      "reload": {
                          "driver_reinit": 2,
                          "fw_activate": 1,
                          "fw_activate_no_reset": 0
                      },
                      "remote_reload": {
                          "driver_reinit": 0,
                          "fw_activate": 0,
                          "fw_activate_no_reset": 0
                      }
                  }
              },
              "pci/0000:82:00.1": {
                  "stats": {
                      "reload": {
                          "driver_reinit": 1,
                          "fw_activate": 0,
                          "fw_activate_no_reset": 0
                      },
                      "remote_reload": {
                          "driver_reinit": 1,
                          "fw_activate": 1,
                          "fw_activate_no_reset": 0
                      }
                  }
              }
          }
      }
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      77069ba2
    • Moshe Shemesh's avatar
      devlink: Add reload stats · a254c264
      Moshe Shemesh authored
      Add reload stats to hold the history per reload action type and limit.
      
      For example, the number of times fw_activate has been performed on this
      device since the driver module was added or if the firmware activation
      was performed with or without reset.
      
      Add devlink notification on stats update.
      
      Expose devlink reload stats to the user through devlink dev get command.
      
      Examples:
      $ devlink dev show
      pci/0000:82:00.0:
        stats:
            reload:
              driver_reinit 2 fw_activate 1 fw_activate_no_reset 0
      pci/0000:82:00.1:
        stats:
            reload:
              driver_reinit 1 fw_activate 0 fw_activate_no_reset 0
      
      $ devlink dev show -jp
      {
          "dev": {
              "pci/0000:82:00.0": {
                  "stats": {
                      "reload": {
                          "driver_reinit": 2,
                          "fw_activate": 1,
                          "fw_activate_no_reset": 0
                      }
                  }
              },
              "pci/0000:82:00.1": {
                  "stats": {
                      "reload": {
                          "driver_reinit": 1,
                          "fw_activate": 0,
                          "fw_activate_no_reset": 0
                      }
                  }
              }
          }
      }
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a254c264
    • Moshe Shemesh's avatar
      devlink: Add devlink reload limit option · dc64cc7c
      Moshe Shemesh authored
      Add reload limit to demand restrictions on reload actions.
      Reload limits supported:
      no_reset: No reset allowed, no down time allowed, no link flap and no
                configuration is lost.
      
      By default reload limit is unspecified and so no constraints on reload
      actions are required.
      
      Some combinations of action and limit are invalid. For example, driver
      can not reinitialize its entities without any downtime.
      
      The no_reset reload limit will have usecase in this patchset to
      implement restricted fw_activate on mlx5.
      
      Have the uapi parameter of reload limit ready for future support of
      multiselection.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      dc64cc7c
    • Moshe Shemesh's avatar
      devlink: Add reload action option to devlink reload command · ccdf0721
      Moshe Shemesh authored
      Add devlink reload action to allow the user to request a specific reload
      action. The action parameter is optional, if not specified then devlink
      driver re-init action is used (backward compatible).
      Note that when required to do firmware activation some drivers may need
      to reload the driver. On the other hand some drivers may need to reset
      the firmware to reinitialize the driver entities. Therefore, the devlink
      reload command returns the actions which were actually performed.
      Reload actions supported are:
      driver_reinit: driver entities re-initialization, applying devlink-param
                     and devlink-resource values.
      fw_activate: firmware activate.
      
      command examples:
      $devlink dev reload pci/0000:82:00.0 action driver_reinit
      reload_actions_performed:
        driver_reinit
      
      $devlink dev reload pci/0000:82:00.0 action fw_activate
      reload_actions_performed:
        driver_reinit fw_activate
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      ccdf0721
    • Moshe Shemesh's avatar
      devlink: Change devlink_reload_supported() param type · 69d56e0e
      Moshe Shemesh authored
      Change devlink_reload_supported() function to get devlink_ops pointer
      param instead of devlink pointer param.
      This change will be used in the next patch to check if devlink reload is
      supported before devlink instance is allocated.
      Signed-off-by: default avatarMoshe Shemesh <moshe@mellanox.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
      Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      69d56e0e
    • Eric Dumazet's avatar
      net/sched: get rid of qdisc->padded · 846e463a
      Eric Dumazet authored
      kmalloc() of sufficiently big portion of memory is cache-aligned
      in regular conditions. If some debugging options are used,
      there is no reason qdisc structures would need 64-byte alignment
      if most other kernel structures are not aligned.
      
      This get rid of QDISC_ALIGN and QDISC_ALIGNTO.
      
      Addition of privdata field will help implementing
      the reverse of qdisc_priv() and documents where
      the private data is.
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Allen Pais <allen.lkml@gmail.com>
      Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      846e463a
    • Matthieu Baerts's avatar
      selftests: mptcp: interpret \n as a new line · 036dfd83
      Matthieu Baerts authored
      In case of errors, this message was printed:
      
        (...)
        balanced bwidth with unbalanced delay       5233 max 5005  [ fail ]
        client exit code 0, server 0
        \nnetns ns3-0-EwnkPH socket stat for 10003:
        (...)
      
      Obviously, the idea was to add a new line before the socket stat and not
      print "\nnetns".
      
      The commit 8b974778 ("selftests: mptcp: interpret \n as a new line")
      is very similar to this one. But the modification in simult_flows.sh was
      missed because this commit above was done in parallel to one here below.
      
      Fixes: 1a418cb8 ("mptcp: simult flow self-tests")
      Signed-off-by: default avatarMatthieu Baerts <matthieu.baerts@tessares.net>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      036dfd83
    • Vladimir Oltean's avatar
      net: mscc: ocelot: add missing VCAP ES0 and IS1 regmaps for VSC7514 · de997e54
      Vladimir Oltean authored
      Without these definitions, the driver will crash in:
      mscc_ocelot_probe
      -> ocelot_init
         -> ocelot_vcap_init
           -> __ocelot_target_read_ix
      
      I missed this because I did not have the VSC7514 hardware to test, only
      the VSC9959 and VSC9953, and the probing part is different.
      
      Fixes: e3aea296 ("net: mscc: ocelot: add definitions for VCAP ES0 keys, actions and target")
      Fixes: a61e365d ("net: mscc: ocelot: add definitions for VCAP IS1 keys, actions and target")
      Reported-by: default avatarDivya Koppera <Divya.Koppera@microchip.com>
      Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      de997e54
    • Paolo Abeni's avatar
      mptcp: fix infinite loop on recvmsg()/worker() race. · d9fb8c50
      Paolo Abeni authored
      If recvmsg() and the workqueue race to dequeue the data
      pending on some subflow, the current mapping for such
      subflow covers several skbs and some of them have not
      reached yet the received, either the worker or recvmsg()
      can find a subflow with the data_avail flag set - since
      the current mapping is valid and in sequence - but no
      skbs in the receive queue - since the other entity just
      processed them.
      
      The above will lead to an unbounded loop in __mptcp_move_skbs()
      and a subsequent hang of any task trying to acquiring the msk
      socket lock.
      
      This change addresses the issue stopping the __mptcp_move_skbs()
      loop as soon as we detect the above race (empty receive queue
      with data_avail set).
      
      Reported-and-tested-by: syzbot+fcf8ca5817d6e92c6567@syzkaller.appspotmail.com
      Fixes: ab174ad8 ("mptcp: move ooo skbs into msk out of order queue.")
      Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Reviewed-by: default avatarMat Martineau <mathew.j.martineau@linux.intel.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d9fb8c50
  2. 08 Oct, 2020 19 commits
    • Allen Pais's avatar
      cxgb4: convert tasklets to use new tasklet_setup() API · 0eb484ee
      Allen Pais authored
      In preparation for unconditionally passing the
      struct tasklet_struct pointer to all tasklet
      callbacks, switch to using the new tasklet_setup()
      and from_tasklet() to pass the tasklet pointer explicitly.
      Signed-off-by: default avatarRomain Perier <romain.perier@gmail.com>
      Signed-off-by: default avatarAllen Pais <apais@linux.microsoft.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      0eb484ee
    • Johannes Berg's avatar
      ethtool: correct policy for ETHTOOL_MSG_CHANNELS_SET · fd15dd05
      Johannes Berg authored
      This accidentally got wired up to the *get* policy instead
      of the *set* policy, causing operations to be rejected. Fix
      it by wiring up the correct policy instead.
      
      Fixes: 5028588b ("ethtool: wire up set policies to ops")
      Reported-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Tested-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      fd15dd05
    • Johannes Berg's avatar
      ethtool: strset: allow ETHTOOL_A_STRSET_COUNTS_ONLY attr · db972e53
      Johannes Berg authored
      The ETHTOOL_A_STRSET_COUNTS_ONLY flag attribute was previously
      not allowed to be used, but now due to the policy size reduction
      we would access the tb[] array out of bounds since we tried to
      check for the attribute despite it not being accepted.
      
      Fix both issues by adding it correctly to the appropriate policy.
      
      Fixes: ff419afa ("ethtool: trim policy tables")
      Fixes: 71921690 ("ethtool: provide string sets with STRSET_GET request")
      Reported-by: default avatarLeon Romanovsky <leon@kernel.org>
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Tested-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      db972e53
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 9d49aea1
      Jakub Kicinski authored
      Small conflict around locking in rxrpc_process_event() -
      channel_lock moved to bundle in next, while state lock
      needs _bh() from net.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      9d49aea1
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 3fdd47c3
      Linus Torvalds authored
      Pull vhost fixes from Michael Tsirkin:
       "Some last minute vhost,vdpa fixes.
      
        The last two of them haven't been in next but they do seem kind of
        obvious, very small and safe, fix bugs reported in the field, and they
        are both in a new mlx5 vdpa driver, so it's not like we can introduce
        regressions"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        vdpa/mlx5: Fix dependency on MLX5_CORE
        vdpa/mlx5: should keep avail_index despite device status
        vhost-vdpa: fix page pinning leakage in error path
        vhost-vdpa: fix vhost_vdpa_map() on error condition
        vhost: Don't call log_access_ok() when using IOTLB
        vhost: Use vhost_get_used_size() in vhost_vring_set_addr()
        vhost: Don't call access_ok() when using IOTLB
        vhost vdpa: fix vhost_vdpa_open error handling
      3fdd47c3
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 6288c1d8
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "One more set of fixes from the networking tree:
      
         - add missing input validation in nl80211_del_key(), preventing
           out-of-bounds access
      
         - last minute fix / improvement of a MRP netlink (uAPI) interface
           introduced in 5.9 (current) release
      
         - fix "unresolved symbol" build error under CONFIG_NET w/o
           CONFIG_INET due to missing tcp_timewait_sock and inet_timewait_sock
           BTF.
      
         - fix 32 bit sub-register bounds tracking in the bpf verifier for OR
           case
      
         - tcp: fix receive window update in tcp_add_backlog()
      
         - openvswitch: handle DNAT tuple collision in conntrack-related code
      
         - r8169: wait for potential PHY reset to finish after applying a FW
           file, avoiding unexpected PHY behaviour and failures later on
      
         - mscc: fix tail dropping watermarks for Ocelot switches
      
         - avoid use-after-free in macsec code after a call to the GRO layer
      
         - avoid use-after-free in sctp error paths
      
         - add a device id for Cellient MPL200 WWAN card
      
         - rxrpc fixes:
            - fix the xdr encoding of the contents read from an rxrpc key
            - fix a BUG() for a unsupported encoding type.
            - fix missing _bh lock annotations.
            - fix acceptance handling for an incoming call where the incoming
              call is encrypted.
            - the server token keyring isn't network namespaced - it belongs
              to the server, so there's no need. Namespacing it means that
              request_key() fails to find it.
            - fix a leak of the server keyring"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (21 commits)
        net: usb: qmi_wwan: add Cellient MPL200 card
        macsec: avoid use-after-free in macsec_handle_frame()
        r8169: consider that PHY reset may still be in progress after applying firmware
        openvswitch: handle DNAT tuple collision
        sctp: fix sctp_auth_init_hmacs() error path
        bridge: Netlink interface fix.
        net: wireless: nl80211: fix out-of-bounds access in nl80211_del_key()
        bpf: Fix scalar32_min_max_or bounds tracking
        tcp: fix receive window update in tcp_add_backlog()
        net: usb: rtl8150: set random MAC address when set_ethernet_addr() fails
        mptcp: more DATA FIN fixes
        net: mscc: ocelot: warn when encoding an out-of-bounds watermark value
        net: mscc: ocelot: divide watermark value by 60 when writing to SYS_ATOP
        net: qrtr: ns: Fix the incorrect usage of rcu_read_lock()
        rxrpc: Fix server keyring leak
        rxrpc: The server keyring isn't network-namespaced
        rxrpc: Fix accept on a connection that need securing
        rxrpc: Fix some missing _bh annotations on locking conn->state_lock
        rxrpc: Downgrade the BUG() for unsupported token type in rxrpc_read()
        rxrpc: Fix rxkad token xdr encoding
        ...
      6288c1d8
    • Eli Cohen's avatar
      vdpa/mlx5: Fix dependency on MLX5_CORE · aff90770
      Eli Cohen authored
      Remove propmt for selecting MLX5_VDPA by the user and modify
      MLX5_VDPA_NET to select MLX5_VDPA. Also modify MLX5_VDPA_NET to depend
      on mlx5_core.
      
      This fixes an issue where configuration sets 'y' for MLX5_VDPA_NET while
      MLX5_CORE is compiled as a module causing link errors.
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Fixes: 1a86b377 ("vdpa/mlx5: Add VDPA driver for supported mlx5 device")s
      Signed-off-by: default avatarEli Cohen <elic@nvidia.com>
      Link: https://lore.kernel.org/r/20201007064011.GA50074@mtl-vdi-166.wap.labs.mlnxSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      aff90770
    • Si-Wei Liu's avatar
      vdpa/mlx5: should keep avail_index despite device status · 3176e974
      Si-Wei Liu authored
      A VM with mlx5 vDPA has below warnings while being reset:
      
      vhost VQ 0 ring restore failed: -1: Resource temporarily unavailable (11)
      vhost VQ 1 ring restore failed: -1: Resource temporarily unavailable (11)
      
      We should allow userspace emulating the virtio device be
      able to get to vq's avail_index, regardless of vDPA device
      status. Save the index that was last seen when virtq was
      stopped, so that userspace doesn't complain.
      Signed-off-by: default avatarSi-Wei Liu <si-wei.liu@oracle.com>
      Link: https://lore.kernel.org/r/1601583511-15138-1-git-send-email-si-wei.liu@oracle.comSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarEli Cohen <elic@nvidia.com>
      3176e974
    • Wilken Gottwalt's avatar
      net: usb: qmi_wwan: add Cellient MPL200 card · 28802e7c
      Wilken Gottwalt authored
      Add usb ids of the Cellient MPL200 card.
      Signed-off-by: default avatarWilken Gottwalt <wilken.gottwalt@mailbox.org>
      Acked-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      28802e7c
    • Eric Dumazet's avatar
      macsec: avoid use-after-free in macsec_handle_frame() · c7cc9200
      Eric Dumazet authored
      De-referencing skb after call to gro_cells_receive() is not allowed.
      We need to fetch skb->len earlier.
      
      Fixes: 5491e7c6 ("macsec: enable GRO and RPS on macsec devices")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Acked-by: default avatarPaolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      c7cc9200
    • Heiner Kallweit's avatar
      r8169: consider that PHY reset may still be in progress after applying firmware · 47dda786
      Heiner Kallweit authored
      Some firmware files trigger a PHY soft reset and don't wait for it to
      be finished. PHY register writes directly after applying the firmware
      may fail or provide unexpected results therefore. Fix this by waiting
      for bit BMCR_RESET to be cleared after applying firmware.
      
      There's nothing wrong with the referenced change, it's just that the
      fix will apply cleanly only after this change.
      
      Fixes: 89fbd26c ("r8169: fix firmware not resetting tp->ocp_base")
      Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      47dda786
    • Dumitru Ceara's avatar
      openvswitch: handle DNAT tuple collision · 8aa7b526
      Dumitru Ceara authored
      With multiple DNAT rules it's possible that after destination
      translation the resulting tuples collide.
      
      For example, two openvswitch flows:
      nw_dst=10.0.0.10,tp_dst=10, actions=ct(commit,table=2,nat(dst=20.0.0.1:20))
      nw_dst=10.0.0.20,tp_dst=10, actions=ct(commit,table=2,nat(dst=20.0.0.1:20))
      
      Assuming two TCP clients initiating the following connections:
      10.0.0.10:5000->10.0.0.10:10
      10.0.0.10:5000->10.0.0.20:10
      
      Both tuples would translate to 10.0.0.10:5000->20.0.0.1:20 causing
      nf_conntrack_confirm() to fail because of tuple collision.
      
      Netfilter handles this case by allocating a null binding for SNAT at
      egress by default.  Perform the same operation in openvswitch for DNAT
      if no explicit SNAT is requested by the user and allocate a null binding
      for SNAT for packets in the "original" direction.
      
      Reported-at: https://bugzilla.redhat.com/1877128Suggested-by: default avatarFlorian Westphal <fw@strlen.de>
      Fixes: 05752523 ("openvswitch: Interface with NAT.")
      Signed-off-by: default avatarDumitru Ceara <dceara@redhat.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      8aa7b526
    • Eric Dumazet's avatar
      sctp: fix sctp_auth_init_hmacs() error path · d42ee76e
      Eric Dumazet authored
      After freeing ep->auth_hmacs we have to clear the pointer
      or risk use-after-free as reported by syzbot:
      
      BUG: KASAN: use-after-free in sctp_auth_destroy_hmacs net/sctp/auth.c:509 [inline]
      BUG: KASAN: use-after-free in sctp_auth_destroy_hmacs net/sctp/auth.c:501 [inline]
      BUG: KASAN: use-after-free in sctp_auth_free+0x17e/0x1d0 net/sctp/auth.c:1070
      Read of size 8 at addr ffff8880a8ff52c0 by task syz-executor941/6874
      
      CPU: 0 PID: 6874 Comm: syz-executor941 Not tainted 5.9.0-rc8-syzkaller #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
      Call Trace:
       __dump_stack lib/dump_stack.c:77 [inline]
       dump_stack+0x198/0x1fd lib/dump_stack.c:118
       print_address_description.constprop.0.cold+0xae/0x497 mm/kasan/report.c:383
       __kasan_report mm/kasan/report.c:513 [inline]
       kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
       sctp_auth_destroy_hmacs net/sctp/auth.c:509 [inline]
       sctp_auth_destroy_hmacs net/sctp/auth.c:501 [inline]
       sctp_auth_free+0x17e/0x1d0 net/sctp/auth.c:1070
       sctp_endpoint_destroy+0x95/0x240 net/sctp/endpointola.c:203
       sctp_endpoint_put net/sctp/endpointola.c:236 [inline]
       sctp_endpoint_free+0xd6/0x110 net/sctp/endpointola.c:183
       sctp_destroy_sock+0x9c/0x3c0 net/sctp/socket.c:4981
       sctp_v6_destroy_sock+0x11/0x20 net/sctp/socket.c:9415
       sk_common_release+0x64/0x390 net/core/sock.c:3254
       sctp_close+0x4ce/0x8b0 net/sctp/socket.c:1533
       inet_release+0x12e/0x280 net/ipv4/af_inet.c:431
       inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:475
       __sock_release+0xcd/0x280 net/socket.c:596
       sock_close+0x18/0x20 net/socket.c:1277
       __fput+0x285/0x920 fs/file_table.c:281
       task_work_run+0xdd/0x190 kernel/task_work.c:141
       exit_task_work include/linux/task_work.h:25 [inline]
       do_exit+0xb7d/0x29f0 kernel/exit.c:806
       do_group_exit+0x125/0x310 kernel/exit.c:903
       __do_sys_exit_group kernel/exit.c:914 [inline]
       __se_sys_exit_group kernel/exit.c:912 [inline]
       __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:912
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      RIP: 0033:0x43f278
      Code: Bad RIP value.
      RSP: 002b:00007fffe0995c38 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
      RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 000000000043f278
      RDX: 0000000000000000 RSI: 000000000000003c RDI: 0000000000000000
      RBP: 00000000004bf068 R08: 00000000000000e7 R09: ffffffffffffffd0
      R10: 0000000020000000 R11: 0000000000000246 R12: 0000000000000001
      R13: 00000000006d1180 R14: 0000000000000000 R15: 0000000000000000
      
      Allocated by task 6874:
       kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
       kasan_set_track mm/kasan/common.c:56 [inline]
       __kasan_kmalloc.constprop.0+0xbf/0xd0 mm/kasan/common.c:461
       kmem_cache_alloc_trace+0x174/0x300 mm/slab.c:3554
       kmalloc include/linux/slab.h:554 [inline]
       kmalloc_array include/linux/slab.h:593 [inline]
       kcalloc include/linux/slab.h:605 [inline]
       sctp_auth_init_hmacs+0xdb/0x3b0 net/sctp/auth.c:464
       sctp_auth_init+0x8a/0x4a0 net/sctp/auth.c:1049
       sctp_setsockopt_auth_supported net/sctp/socket.c:4354 [inline]
       sctp_setsockopt+0x477e/0x97f0 net/sctp/socket.c:4631
       __sys_setsockopt+0x2db/0x610 net/socket.c:2132
       __do_sys_setsockopt net/socket.c:2143 [inline]
       __se_sys_setsockopt net/socket.c:2140 [inline]
       __x64_sys_setsockopt+0xba/0x150 net/socket.c:2140
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Freed by task 6874:
       kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
       kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
       kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
       __kasan_slab_free+0xd8/0x120 mm/kasan/common.c:422
       __cache_free mm/slab.c:3422 [inline]
       kfree+0x10e/0x2b0 mm/slab.c:3760
       sctp_auth_destroy_hmacs net/sctp/auth.c:511 [inline]
       sctp_auth_destroy_hmacs net/sctp/auth.c:501 [inline]
       sctp_auth_init_hmacs net/sctp/auth.c:496 [inline]
       sctp_auth_init_hmacs+0x2b7/0x3b0 net/sctp/auth.c:454
       sctp_auth_init+0x8a/0x4a0 net/sctp/auth.c:1049
       sctp_setsockopt_auth_supported net/sctp/socket.c:4354 [inline]
       sctp_setsockopt+0x477e/0x97f0 net/sctp/socket.c:4631
       __sys_setsockopt+0x2db/0x610 net/socket.c:2132
       __do_sys_setsockopt net/socket.c:2143 [inline]
       __se_sys_setsockopt net/socket.c:2140 [inline]
       __x64_sys_setsockopt+0xba/0x150 net/socket.c:2140
       do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
       entry_SYSCALL_64_after_hwframe+0x44/0xa9
      
      Fixes: 1f485649 ("[SCTP]: Implement SCTP-AUTH internals")
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Vlad Yasevich <vyasevich@gmail.com>
      Cc: Neil Horman <nhorman@tuxdriver.com>
      Cc: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      d42ee76e
    • Jakub Kicinski's avatar
      Merge tag 'mac80211-for-net-2020-10-08' of... · a9e54cb3
      Jakub Kicinski authored
      Merge tag 'mac80211-for-net-2020-10-08' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
      
      Johannes Berg says:
      
      ====================
      pull-request: mac80211 2020-10-08
      
      A single fix for missing input validation in nl80211.
      ====================
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      a9e54cb3
    • Jakub Kicinski's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · cfe90f49
      Jakub Kicinski authored
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf 2020-10-08
      
      The main changes are:
      
      1) Fix "unresolved symbol" build error under CONFIG_NET w/o CONFIG_INET due
         to missing tcp_timewait_sock and inet_timewait_sock BTF, from Yonghong Song.
      
      2) Fix 32 bit sub-register bounds tracking for OR case, from Daniel Borkmann.
      ====================
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      cfe90f49
    • Henrik Bjoernlund's avatar
      bridge: Netlink interface fix. · b6c02ef5
      Henrik Bjoernlund authored
      This commit is correcting NETLINK br_fill_ifinfo() to be able to
      handle 'filter_mask' with multiple flags asserted.
      
      Fixes: 36a8e8e2 ("bridge: Extend br_fill_ifinfo to return MPR status")
      Signed-off-by: default avatarHenrik Bjoernlund <henrik.bjoernlund@microchip.com>
      Reviewed-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Suggested-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Tested-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
      Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      b6c02ef5
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2020-10-08' of git://anongit.freedesktop.org/drm/drm · 3d006ee4
      Linus Torvalds authored
      Pull drm nouveau fixes from Dave Airlie:
       "Karol found two last minute nouveau fixes, they both fix crashes, the
        TTM one follows what other drivers do already, and the other is for
        bailing on load on unrecognised chipsets.
      
         - fix crash in TTM alloc fail path
      
         - return error earlier for unknown chipsets"
      
      * tag 'drm-fixes-2020-10-08' of git://anongit.freedesktop.org/drm/drm:
        drm/nouveau/mem: guard against NULL pointer access in mem_del
        drm/nouveau/device: return error for unknown chipsets
      3d006ee4
    • Linus Torvalds's avatar
      Merge tag 'exfat-for-5.9-rc9' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat · b9e3aa2a
      Linus Torvalds authored
      Pull exfat fixes from Namjae Jeon:
      
       - Fix use of uninitialized spinlock on error path
      
       - Fix missing err assignment in exfat_build_inode()
      
      * tag 'exfat-for-5.9-rc9' of git://git.kernel.org/pub/scm/linux/kernel/git/linkinjeon/exfat:
        exfat: fix use of uninitialized spinlock on error path
        exfat: fix pointer error checking
      b9e3aa2a
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.9b-rc9-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · 86f0a5fb
      Linus Torvalds authored
      Pull xen fix from Juergen Gross:
       "One fix for a regression when booting as a Xen guest on ARM64
        introduced probably during the 5.9 cycle. It is very low risk as it is
        modifying Xen specific code only.
      
        The exact commit introducing the bug hasn't been identified yet, but
        everything was fine in 5.8 and only in 5.9 some configurations started
        to fail"
      
      * tag 'for-linus-5.9b-rc9-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        arm/arm64: xen: Fix to convert percpu address to gfn correctly
      86f0a5fb