1. 21 Aug, 2020 5 commits
    • Florian Westphal's avatar
      netfilter: nf_tables: fix destination register zeroing · 1e105e6a
      Florian Westphal authored
      Following bug was reported via irc:
      nft list ruleset
         set knock_candidates_ipv4 {
            type ipv4_addr . inet_service
            size 65535
            elements = { 127.0.0.1 . 123,
                         127.0.0.1 . 123 }
            }
       ..
         udp dport 123 add @knock_candidates_ipv4 { ip saddr . 123 }
         udp dport 123 add @knock_candidates_ipv4 { ip saddr . udp dport }
      
      It should not have been possible to add a duplicate set entry.
      
      After some debugging it turned out that the problem is the immediate
      value (123) in the second-to-last rule.
      
      Concatenations use 32bit registers, i.e. the elements are 8 bytes each,
      not 6 and it turns out the kernel inserted
      
      inet firewall @knock_candidates_ipv4
              element 0100007f ffff7b00  : 0 [end]
              element 0100007f 00007b00  : 0 [end]
      
      Note the non-zero upper bits of the first element.  It turns out that
      nft_immediate doesn't zero the destination register, but this is needed
      when the length isn't a multiple of 4.
      
      Furthermore, the zeroing in nft_payload is broken.  We can't use
      [len / 4] = 0 -- if len is a multiple of 4, index is off by one.
      
      Skip zeroing in this case and use a conditional instead of (len -1) / 4.
      
      Fixes: 49499c3e ("netfilter: nf_tables: switch registers to 32 bit addressing")
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      1e105e6a
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: incorrect enum nft_list_attributes definition · da9125df
      Pablo Neira Ayuso authored
      This should be NFTA_LIST_UNSPEC instead of NFTA_LIST_UNPEC, all other
      similar attribute definitions are postfixed with _UNSPEC.
      
      Fixes: 96518518 ("netfilter: add nftables")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      da9125df
    • Pablo Neira Ayuso's avatar
      netfilter: nf_tables: add NFTA_SET_USERDATA if not null · 6f03bf43
      Pablo Neira Ayuso authored
      Kernel sends an empty NFTA_SET_USERDATA attribute with no value if
      userspace adds a set with no NFTA_SET_USERDATA attribute.
      
      Fixes: e6d8ecac ("netfilter: nf_tables: Add new attributes into nft_set to store user data.")
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      6f03bf43
    • Stefano Brivio's avatar
      netfilter: nft_set_rbtree: Detect partial overlap with start endpoint match · 07267630
      Stefano Brivio authored
      Getting creative with nft and omitting the interval_overlap()
      check from the set_overlap() function, without omitting
      set_overlap() altogether, led to the observation of a partial
      overlap that wasn't detected, and would actually result in
      replacement of the end element of an existing interval.
      
      This is due to the fact that we'll return -EEXIST on a matching,
      pre-existing start element, instead of -ENOTEMPTY, and the error
      is cleared by API if NLM_F_EXCL is not given. At this point, we
      can insert a matching start, and duplicate the end element as long
      as we don't end up into other intervals.
      
      For instance, inserting interval 0 - 2 with an existing 0 - 3
      interval would result in a single 0 - 2 interval, and a dangling
      '3' end element. This is because nft will proceed after inserting
      the '0' start element as no error is reported, and no further
      conflicting intervals are detected on insertion of the end element.
      
      This needs a different approach as it's a local condition that can
      be detected by looking for duplicate ends coming from left and
      right, separately. Track those and directly report -ENOTEMPTY on
      duplicated end elements for a matching start.
      Signed-off-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      07267630
    • Stefano Brivio's avatar
      netfilter: nft_set_rbtree: Handle outcomes of tree rotations in overlap detection · 226a88de
      Stefano Brivio authored
      Checks for partial overlaps on insertion assume that end elements
      are always descendant nodes of their corresponding start, because
      they are inserted later. However, this is not the case if a
      previous delete operation caused a tree rotation as part of
      rebalancing.
      
      Taking the issue reported by Andreas Fischer as an example, if we
      omit delete operations, the existing procedure works because,
      equivalently, we are inserting a start item with value 40 in the
      this region of the red-black tree with single-sized intervals:
      
                                        overlap flag
                         10 (start)
                        /  \            false
                            20 (start)
                           /  \         false
                               30 (start)
                              /  \      false
                                  60 (start)
                                 /  \   false
                               50 (end)
                              /  \      false
                            20 (end)
                           /  \         false
                               40 (start)
      
      if we now delete interval 30 - 30, the tree can be rearranged in
      a way similar to this (note the rotation involving 50 - 50):
      
                                        overlap flag
                         10 (start)
                        /  \            false
                            20 (start)
                           /  \         false
                               25 (start)
                              /  \      false
                                  70 (start)
                                 /  \   false
                               50 (end)
                              /  \      true (from rule a1.)
                            50 (start)
                           /  \         true
                         40 (start)
      
      and we traverse interval 50 - 50 from the opposite direction
      compared to what was expected.
      
      To deal with those cases, add a start-before-start rule, b4.,
      that covers traversal of existing intervals from the right.
      
      We now need to restrict start-after-end rule b3. to cases
      where there are no occurring nodes between existing start and
      end elements, because addition of rule b4. isn't sufficient to
      ensure that the pre-existing end element we encounter while
      descending the tree corresponds to a start element of an
      interval that we already traversed entirely.
      
      Different types of overlap detection on trees with rotations
      resulting from re-balancing will be covered by nft test case
      sets/0044interval_overlap_1.
      Reported-by: default avatarAndreas Fischer <netfilter@d9c.eu>
      Bugzilla: https://bugzilla.netfilter.org/show_bug.cgi?id=1449
      Cc: <stable@vger.kernel.org> # 5.6.x
      Fixes: 7c84d414 ("netfilter: nft_set_rbtree: Detect partial overlaps on insertion")
      Signed-off-by: default avatarStefano Brivio <sbrivio@redhat.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      226a88de
  2. 20 Aug, 2020 1 commit
    • Florian Westphal's avatar
      netfilter: conntrack: allow sctp hearbeat after connection re-use · cc5453a5
      Florian Westphal authored
      If an sctp connection gets re-used, heartbeats are flagged as invalid
      because their vtag doesn't match.
      
      Handle this in a similar way as TCP conntrack when it suspects that the
      endpoints and conntrack are out-of-sync.
      
      When a HEARTBEAT request fails its vtag validation, flag this in the
      conntrack state and accept the packet.
      
      When a HEARTBEAT_ACK is received with an invalid vtag in the reverse
      direction after we allowed such a HEARTBEAT through, assume we are
      out-of-sync and re-set the vtag info.
      
      v2: remove left-over snippet from an older incarnation that moved
          new_state/old_state assignments, thats not needed so keep that
          as-is.
      Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      cc5453a5
  3. 19 Aug, 2020 8 commits
    • Wang Hai's avatar
      net: gemini: Fix missing free_netdev() in error path of gemini_ethernet_port_probe() · cf96d977
      Wang Hai authored
      Replace alloc_etherdev_mq with devm_alloc_etherdev_mqs. In this way,
      when probe fails, netdev can be freed automatically.
      
      Fixes: 4d5ae32f ("net: ethernet: Add a driver for Gemini gigabit ethernet")
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarWang Hai <wanghai38@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      cf96d977
    • Sebastian Andrzej Siewior's avatar
      net: atlantic: Use readx_poll_timeout() for large timeout · 9553b62c
      Sebastian Andrzej Siewior authored
      Commit
         8dcf2ad3 ("net: atlantic: add hwmon getter for MAC temperature")
      
      implemented a read callback with an udelay(10000U). This fails to
      compile on ARM because the delay is >1ms. I doubt that it is needed to
      spin for 10ms even if possible on x86.
      
      >From looking at the code, the context appears to be preemptible so using
      usleep() should work and avoid busy spinning.
      
      Use readx_poll_timeout() in the poll loop.
      
      Fixes: 8dcf2ad3 ("net: atlantic: add hwmon getter for MAC temperature")
      Cc: Mark Starovoytov <mstarovoitov@marvell.com>
      Cc: Igor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarSebastian Andrzej Siewior <sebastian@breakpoint.cc>
      Acked-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9553b62c
    • Min Li's avatar
      ptp: ptp_clockmatrix: use i2c_master_send for i2c write · 957ff427
      Min Li authored
      The old code for i2c write would break on some controllers, which fails
      at handling Repeated Start Condition. So we will just use i2c_master_send
      to handle write in one transanction.
      
      Changes since v1:
      - Remove indentation change
      Signed-off-by: default avatarMin Li <min.li.xe@renesas.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      957ff427
    • Johannes Berg's avatar
      netlink: fix state reallocation in policy export · d1fb5559
      Johannes Berg authored
      Evidently, when I did this previously, we didn't have more than
      10 policies and didn't run into the reallocation path, because
      it's missing a memset() for the unused policies. Fix that.
      
      Fixes: d07dcf9a ("netlink: add infrastructure to expose policies to userspace")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d1fb5559
    • David S. Miller's avatar
      Merge branch 'Bug-fixes-for-ENA-ethernet-driver' · b4c8998b
      David S. Miller authored
      Shay Agroskin says:
      
      ====================
      Bug fixes for ENA ethernet driver
      
      This series adds the following:
      - Fix undesired call to ena_restore after returning from suspend
      - Fix condition inside a WARN_ON
      - Fix overriding previous value when updating missed_tx statistic
      
      v1->v2:
      - fix bug when calling reset routine after device resources are freed (Jakub)
      
      v2->v3:
      - fix wrong hash in 'Fixes' tag
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b4c8998b
    • Shay Agroskin's avatar
      net: ena: Make missed_tx stat incremental · ccd143e5
      Shay Agroskin authored
      Most statistics in ena driver are incremented, meaning that a stat's
      value is a sum of all increases done to it since driver/queue
      initialization.
      
      This patch makes all statistics this way, effectively making missed_tx
      statistic incremental.
      Also added a comment regarding rx_drops and tx_drops to make it
      clearer how these counters are calculated.
      
      Fixes: 11095fdb ("net: ena: add statistics for missed tx packets")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ccd143e5
    • Shay Agroskin's avatar
      net: ena: Change WARN_ON expression in ena_del_napi_in_range() · 8b147f6f
      Shay Agroskin authored
      The ena_del_napi_in_range() function unregisters the napi handler for
      rings in a given range.
      This function had the following WARN_ON macro:
      
          WARN_ON(ENA_IS_XDP_INDEX(adapter, i) &&
      	    adapter->ena_napi[i].xdp_ring);
      
      This macro prints the call stack if the expression inside of it is
      true [1], but the expression inside of it is the wanted situation.
      The expression checks whether the ring has an XDP queue and its index
      corresponds to a XDP one.
      
      This patch changes the expression to
          !ENA_IS_XDP_INDEX(adapter, i) && adapter->ena_napi[i].xdp_ring
      which indicates an unwanted situation.
      
      Also, change the structure of the function. The napi handler is
      unregistered for all rings, and so there's no need to check whether the
      index is an XDP index or not. By removing this check the code becomes
      much more readable.
      
      Fixes: 548c4940 ("net: ena: Implement XDP_TX action")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b147f6f
    • Shay Agroskin's avatar
      net: ena: Prevent reset after device destruction · 63d4a4c1
      Shay Agroskin authored
      The reset work is scheduled by the timer routine whenever it
      detects that a device reset is required (e.g. when a keep_alive signal
      is missing).
      When releasing device resources in ena_destroy_device() the driver
      cancels the scheduling of the timer routine without destroying the reset
      work explicitly.
      
      This creates the following bug:
          The driver is suspended and the ena_suspend() function is called
      	-> This function calls ena_destroy_device() to free the net device
      	   resources
      	    -> The driver waits for the timer routine to finish
      	    its execution and then cancels it, thus preventing from it
      	    to be called again.
      
          If, in its final execution, the timer routine schedules a reset,
          the reset routine might be called afterwards,and a redundant call to
          ena_restore_device() would be made.
      
      By changing the reset routine we allow it to read the device's state
      accurately.
      This is achieved by checking whether ENA_FLAG_TRIGGER_RESET flag is set
      before resetting the device and making both the destruction function and
      the flag check are under rtnl lock.
      The ENA_FLAG_TRIGGER_RESET is cleared at the end of the destruction
      routine. Also surround the flag check with 'likely' because
      we expect that the reset routine would be called only when
      ENA_FLAG_TRIGGER_RESET flag is set.
      
      The destruction of the timer and reset services in __ena_shutoff() have to
      stay, even though the timer routine is destroyed in ena_destroy_device().
      This is to avoid a case in which the reset routine is scheduled after
      free_netdev() in __ena_shutoff(), which would create an access to freed
      memory in adapter->flags.
      
      Fixes: 8c5c7abd ("net: ena: add power management ops to the ENA driver")
      Signed-off-by: default avatarShay Agroskin <shayagr@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      63d4a4c1
  4. 18 Aug, 2020 21 commits
    • Colin Ian King's avatar
      net: ipv4: remove duplicate "the the" phrase in Kconfig text · ad664118
      Colin Ian King authored
      The Kconfig help text contains the phrase "the the" in the help
      text. Fix this and reformat the block of help text.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ad664118
    • Colin Ian King's avatar
      net: mscc: ocelot: remove duplicate "the the" phrase in Kconfig text · 17340552
      Colin Ian King authored
      The Kconfig help text contains the phrase "the the" in the help
      text. Fix this.
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      17340552
    • David S. Miller's avatar
      Merge branch 'ethtool-netlink-bug-fixes' · 0df55a03
      David S. Miller authored
      Maxim Mikityanskiy says:
      
      ====================
      ethtool-netlink bug fixes
      
      This series contains a few bug fixes for ethtool-netlink. These bugs are
      specific for the netlink interface, and the legacy ioctl interface is
      not affected. These patches aim to have the same behavior in
      ethtool-netlink as in the legacy ethtool.
      
      Please also see the sibling series for the userspace tool.
      
      v2 changes: Added Fixes tags.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0df55a03
    • Maxim Mikityanskiy's avatar
      ethtool: Don't omit the netlink reply if no features were changed · f01204ec
      Maxim Mikityanskiy authored
      The legacy ethtool userspace tool shows an error when no features could
      be changed. It's useful to have a netlink reply to be able to show this
      error when __netdev_update_features wasn't called, for example:
      
      1. ethtool -k eth0
         large-receive-offload: off
      2. ethtool -K eth0 rx-fcs on
      3. ethtool -K eth0 lro on
         Could not change any device features
         rx-lro: off [requested on]
      4. ethtool -K eth0 lro on
         # The output should be the same, but without this patch the kernel
         # doesn't send the reply, and ethtool is unable to detect the error.
      
      This commit makes ethtool-netlink always return a reply when requested,
      and it still avoids unnecessary calls to __netdev_update_features if the
      wanted features haven't changed.
      
      Fixes: 0980bfcd ("ethtool: set netdev features with FEATURES_SET request")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f01204ec
    • Maxim Mikityanskiy's avatar
      ethtool: Account for hw_features in netlink interface · 2847bfed
      Maxim Mikityanskiy authored
      ethtool-netlink ignores dev->hw_features and may confuse the drivers by
      asking them to enable features not in the hw_features bitmask. For
      example:
      
      1. ethtool -k eth0
         tls-hw-tx-offload: off [fixed]
      2. ethtool -K eth0 tls-hw-tx-offload on
         tls-hw-tx-offload: on
      3. ethtool -k eth0
         tls-hw-tx-offload: on [fixed]
      
      Fitler out dev->hw_features from req_wanted to fix it and to resemble
      the legacy ethtool behavior.
      
      Fixes: 0980bfcd ("ethtool: set netdev features with FEATURES_SET request")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2847bfed
    • Maxim Mikityanskiy's avatar
      ethtool: Fix preserving of wanted feature bits in netlink interface · 840110a4
      Maxim Mikityanskiy authored
      Currently, ethtool-netlink calculates new wanted bits as:
      (req_wanted & req_mask) | (old_active & ~req_mask)
      
      It completely discards the old wanted bits, so they are forgotten with
      the next ethtool command. Sample steps to reproduce:
      
      1. ethtool -k eth0
         tx-tcp-segmentation: on # TSO is on from the beginning
      2. ethtool -K eth0 tx off
         tx-tcp-segmentation: off [not requested]
      3. ethtool -k eth0
         tx-tcp-segmentation: off [requested on]
      4. ethtool -K eth0 rx off # Some change unrelated to TSO
      5. ethtool -k eth0
         tx-tcp-segmentation: off # "Wanted on" is forgotten
      
      This commit fixes it by changing the formula to:
      (req_wanted & req_mask) | (old_wanted & ~req_mask),
      where old_active was replaced by old_wanted to account for the wanted
      bits.
      
      The shortcut condition for the case where nothing was changed now
      compares wanted bitmasks, instead of wanted to active.
      
      Fixes: 0980bfcd ("ethtool: set netdev features with FEATURES_SET request")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Reviewed-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      840110a4
    • Xin Long's avatar
      ipv6: some fixes for ipv6_dev_find() · 4ef1a7cb
      Xin Long authored
      This patch is to do 3 things for ipv6_dev_find():
      
        As David A. noticed,
      
        - rt6_lookup() is not really needed. Different from __ip_dev_find(),
          ipv6_dev_find() doesn't have a compatibility problem, so remove it.
      
        As Hideaki suggested,
      
        - "valid" (non-tentative) check for the address is also needed.
          ipv6_chk_addr() calls ipv6_chk_addr_and_flags(), which will
          traverse the address hash list, but it's heavy to be called
          inside ipv6_dev_find(). This patch is to reuse the code of
          ipv6_chk_addr_and_flags() for ipv6_dev_find().
      
        - dev parameter is passed into ipv6_dev_find(), as link-local
          addresses from user space has sin6_scope_id set and the dev
          lookup needs it.
      
      Fixes: 81f6cb31 ("ipv6: add ipv6_dev_find()")
      Suggested-by: default avatarYOSHIFUJI Hideaki <hideaki.yoshifuji@miraclelinux.com>
      Reported-by: default avatarDavid Ahern <dsahern@gmail.com>
      Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4ef1a7cb
    • Jiri Wiesner's avatar
      bonding: fix active-backup failover for current ARP slave · 0410d071
      Jiri Wiesner authored
      When the ARP monitor is used for link detection, ARP replies are
      validated for all slaves (arp_validate=3) and fail_over_mac is set to
      active, two slaves of an active-backup bond may get stuck in a state
      where both of them are active and pass packets that they receive to
      the bond. This state makes IPv6 duplicate address detection fail. The
      state is reached thus:
      1. The current active slave goes down because the ARP target
         is not reachable.
      2. The current ARP slave is chosen and made active.
      3. A new slave is enslaved. This new slave becomes the current active
         slave and can reach the ARP target.
      As a result, the current ARP slave stays active after the enslave
      action has finished and the log is littered with "PROBE BAD" messages:
      > bond0: PROBE: c_arp ens10 && cas ens11 BAD
      The workaround is to remove the slave with "going back" status from
      the bond and re-enslave it. This issue was encountered when DPDK PMD
      interfaces were being enslaved to an active-backup bond.
      
      I would be possible to fix the issue in bond_enslave() or
      bond_change_active_slave() but the ARP monitor was fixed instead to
      keep most of the actions changing the current ARP slave in the ARP
      monitor code. The current ARP slave is set as inactive and backup
      during the commit phase. A new state, BOND_LINK_FAIL, has been
      introduced for slaves in the context of the ARP monitor. This allows
      administrators to see how slaves are rotated for sending ARP requests
      and attempts are made to find a new active slave.
      
      Fixes: b2220cad ("bonding: refactor ARP active-backup monitor")
      Signed-off-by: default avatarJiri Wiesner <jwiesner@suse.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0410d071
    • Miaohe Lin's avatar
      net: handle the return value of pskb_carve_frag_list() correctly · eabe8618
      Miaohe Lin authored
      pskb_carve_frag_list() may return -ENOMEM in pskb_carve_inside_nonlinear().
      we should handle this correctly or we would get wrong sk_buff.
      
      Fixes: 6fa01ccd ("skbuff: Add pskb_extract() helper function")
      Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      eabe8618
    • Sumera Priyadarsini's avatar
      net: gianfar: Add of_node_put() before goto statement · 989e4da0
      Sumera Priyadarsini authored
      Every iteration of for_each_available_child_of_node() decrements
      reference count of the previous node, however when control
      is transferred from the middle of the loop, as in the case of
      a return or break or goto, there is no decrement thus ultimately
      resulting in a memory leak.
      
      Fix a potential memory leak in gianfar.c by inserting of_node_put()
      before the goto statement.
      
      Issue found with Coccinelle.
      Signed-off-by: default avatarSumera Priyadarsini <sylphrenadin@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      989e4da0
    • David S. Miller's avatar
      Merge branch 'cxgb4-Fix-ethtool-selftest-flits-calculation' · 5680790b
      David S. Miller authored
      Ganji Aravind says:
      
      ====================
      cxgb4: Fix ethtool selftest flits calculation
      
      Patch 1 will fix work request size calculation for loopback selftest.
      
      Patch 2 will fix race between loopback selftest and normal Tx handler.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5680790b
    • Ganji Aravind's avatar
      cxgb4: Fix race between loopback and normal Tx path · c650e048
      Ganji Aravind authored
      Even after Tx queues are marked stopped, there exists a
      small window where the current packet in the normal Tx
      path is still being sent out and loopback selftest ends
      up corrupting the same Tx ring. So, ensure selftest takes
      the Tx lock to synchronize access the Tx ring.
      
      Fixes: 7235ffae ("cxgb4: add loopback ethtool self-test")
      Signed-off-by: default avatarGanji Aravind <ganji.aravind@chelsio.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c650e048
    • Ganji Aravind's avatar
      cxgb4: Fix work request size calculation for loopback test · 33595642
      Ganji Aravind authored
      Work request used for sending loopback packet needs to add
      the firmware work request only once. So, fix by using
      correct structure size.
      
      Fixes: 7235ffae ("cxgb4: add loopback ethtool self-test")
      Signed-off-by: default avatarGanji Aravind <ganji.aravind@chelsio.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      33595642
    • David S. Miller's avatar
      Merge branch 'sfc-more-EF100-fixes' · ab97a289
      David S. Miller authored
      Edward Cree says:
      
      ====================
      sfc: more EF100 fixes
      
      Fix up some bugs in the initial EF100 submission, and re-fix
       the hash_valid fix which was incomplete.
      
      The reset bugs are currently hard to trigger; they were found
       with an in-progress patch adding ethtool support, whereby
       ethtool --reset reliably reproduces them.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ab97a289
    • Edward Cree's avatar
      sfc: don't free_irq()s if they were never requested · e6a43910
      Edward Cree authored
      If efx_nic_init_interrupt fails, or was never run (e.g. due to an earlier
       failure in ef100_net_open), freeing irqs in efx_nic_fini_interrupt is not
       needed and will cause error messages and stack traces.
      So instead, only do this if efx_nic_init_interrupt successfully completed,
       as indicated by the new efx->irqs_hooked flag.
      
      Fixes: 965b549f ("sfc_ef100: implement ndo_open/close and EVQ probing")
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e6a43910
    • Edward Cree's avatar
      sfc: null out channel->rps_flow_id after freeing it · 788f920a
      Edward Cree authored
      If an ef100_net_open() fails, ef100_net_stop() may be called without
       channel->rps_flow_id having been written; thus it may hold the address
       freed by a previous ef100_net_stop()'s call to efx_remove_filters().
       This then causes a double-free when efx_remove_filters() is called
       again, leading to a panic.
      To prevent this, after freeing it, overwrite it with NULL.
      
      Fixes: a9dc3d56 ("sfc_ef100: RX filter table management and related gubbins")
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      788f920a
    • Edward Cree's avatar
      sfc: take correct lock in ef100_reset() · 9cbbc451
      Edward Cree authored
      When downing and upping the ef100 filter table, we need to take a write
       lock on efx->filter_sem, not just a read lock, because we may kfree()
       the table pointers.
      Without this, resets cause a WARN_ON from efx_rwsem_assert_write_locked().
      
      Fixes: a9dc3d56 ("sfc_ef100: RX filter table management and related gubbins")
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9cbbc451
    • Edward Cree's avatar
      sfc: really check hash is valid before using it · db06ea34
      Edward Cree authored
      Actually hook up the .rx_buf_hash_valid method in EF100's nic_type.
      
      Fixes: 06888543 ("sfc: check hash is valid before using it")
      Reported-by: default avatarMartin Habets <mhabets@solarflare.com>
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      db06ea34
    • Alvin Šipraga's avatar
      macvlan: validate setting of multiple remote source MAC addresses · 8b61fba5
      Alvin Šipraga authored
      Remote source MAC addresses can be set on a 'source mode' macvlan
      interface via the IFLA_MACVLAN_MACADDR_DATA attribute. This commit
      tightens the validation of these MAC addresses to match the validation
      already performed when setting or adding a single MAC address via the
      IFLA_MACVLAN_MACADDR attribute.
      
      iproute2 uses IFLA_MACVLAN_MACADDR_DATA for its 'macvlan macaddr set'
      command, and IFLA_MACVLAN_MACADDR for its 'macvlan macaddr add' command,
      which demonstrates the inconsistent behaviour that this commit
      addresses:
      
       # ip link add link eth0 name macvlan0 type macvlan mode source
       # ip link set link dev macvlan0 type macvlan macaddr add 01:00:00:00:00:00
       RTNETLINK answers: Cannot assign requested address
       # ip link set link dev macvlan0 type macvlan macaddr set 01:00:00:00:00:00
       # ip -d link show macvlan0
       5: macvlan0@eth0: <BROADCAST,MULTICAST,DYNAMIC,UP,LOWER_UP> mtu 1500 ...
           link/ether 2e:ac:fd:2d:69:f8 brd ff:ff:ff:ff:ff:ff promiscuity 0
           macvlan mode source remotes (1) 01:00:00:00:00:00 numtxqueues 1 ...
      
      With this change, the 'set' command will (rightly) fail in the same way
      as the 'add' command.
      Signed-off-by: default avatarAlvin Šipraga <alsi@bang-olufsen.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8b61fba5
    • Linus Torvalds's avatar
      Merge tag 'pstore-v5.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 06a4ec1d
      Linus Torvalds authored
      Pull mailmap update from Kees Cook:
       "This was originally part of my pstore tree, but when I realized that
        mailmap needed re-alphabetizing, I decided to wait until -rc1 to send
        this, as I saw a lot of mailmap additions pending in -next for the
        merge window.
      
        It's a programmatic reordering and the addition of a pstore
        contributor's preferred email address"
      
      * tag 'pstore-v5.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        mailmap: Add WeiXiong Liao
        mailmap: Restore dictionary sorting
      06a4ec1d
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 4cf75621
      Linus Torvalds authored
      Pull networking fixes from David Miller:
       "Another batch of fixes:
      
        1) Remove nft_compat counter flush optimization, it generates warnings
           from the refcount infrastructure. From Florian Westphal.
      
        2) Fix BPF to search for build id more robustly, from Jiri Olsa.
      
        3) Handle bogus getopt lengths in ebtables, from Florian Westphal.
      
        4) Infoleak and other fixes to j1939 CAN driver, from Eric Dumazet and
           Oleksij Rempel.
      
        5) Reset iter properly on mptcp sendmsg() error, from Florian
           Westphal.
      
        6) Show a saner speed in bonding broadcast mode, from Jarod Wilson.
      
        7) Various kerneldoc fixes in bonding and elsewhere, from Lee Jones.
      
        8) Fix double unregister in bonding during namespace tear down, from
           Cong Wang.
      
        9) Disable RP filter during icmp_redirect selftest, from David Ahern"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (75 commits)
        otx2_common: Use devm_kcalloc() in otx2_config_npa()
        net: qrtr: fix usage of idr in port assignment to socket
        selftests: disable rp_filter for icmp_redirect.sh
        Revert "net: xdp: pull ethernet header off packet after computing skb->protocol"
        phylink: <linux/phylink.h>: fix function prototype kernel-doc warning
        mptcp: sendmsg: reset iter on error redux
        net: devlink: Remove overzealous WARN_ON with snapshots
        tipc: not enable tipc when ipv6 works as a module
        tipc: fix uninit skb->data in tipc_nl_compat_dumpit()
        net: Fix potential wrong skb->protocol in skb_vlan_untag()
        net: xdp: pull ethernet header off packet after computing skb->protocol
        ipvlan: fix device features
        bonding: fix a potential double-unregister
        can: j1939: add rxtimer for multipacket broadcast session
        can: j1939: abort multipacket broadcast session when timeout occurs
        can: j1939: cancel rxtimer on multipacket broadcast session complete
        can: j1939: fix support for multipacket broadcast message
        net: fddi: skfp: cfm: Remove seemingly unused variable 'ID_sccs'
        net: fddi: skfp: cfm: Remove set but unused variable 'oldstate'
        net: fddi: skfp: smt: Remove seemingly unused variable 'ID_sccs'
        ...
      4cf75621
  5. 17 Aug, 2020 5 commits