Skip to content
  1. Dec 19, 2019
    • Maxim Mikityanskiy's avatar
      net/i40e: Fix concurrency issues between config flow and XSK · b3873a5b
      Maxim Mikityanskiy authored
      
      
      Use synchronize_rcu to wait until the XSK wakeup function finishes
      before destroying the resources it uses:
      
      1. i40e_down already calls synchronize_rcu. On i40e_down either
      __I40E_VSI_DOWN or __I40E_CONFIG_BUSY is set. Check the latter in
      i40e_xsk_wakeup (the former is already checked there).
      
      2. After switching the XDP program, call synchronize_rcu to let
      i40e_xsk_wakeup exit before the XDP program is freed.
      
      3. Changing the number of channels brings the interface down (see
      i40e_prep_for_reset and i40e_pf_quiesce_all_vsi).
      
      4. Disabling UMEM sets __I40E_CONFIG_BUSY, too.
      
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Signed-off-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20191217162023.16011-4-maximmi@mellanox.com
      b3873a5b
    • Maxim Mikityanskiy's avatar
      net/mlx5e: Fix concurrency issues between config flow and XSK · 9cf88808
      Maxim Mikityanskiy authored
      
      
      After disabling resources necessary for XSK (the XDP program, channels,
      XSK queues), use synchronize_rcu to wait until the XSK wakeup function
      finishes, before freeing the resources.
      
      Suspend XSK wakeups during switching channels. If the XDP program is
      being removed, synchronize_rcu before closing the old channels to allow
      XSK wakeup to complete.
      
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20191217162023.16011-3-maximmi@mellanox.com
      9cf88808
    • Maxim Mikityanskiy's avatar
      xsk: Add rcu_read_lock around the XSK wakeup · 06870682
      Maxim Mikityanskiy authored
      The XSK wakeup callback in drivers makes some sanity checks before
      triggering NAPI. However, some configuration changes may occur during
      this function that affect the result of those checks. For example, the
      interface can go down, and all the resources will be destroyed after the
      checks in the wakeup function, but before it attempts to use these
      resources. Wrap this callback in rcu_read_lock to allow driver to
      synchronize_rcu before actually destroying the resources.
      
      xsk_wakeup is a new function that encapsulates calling ndo_xsk_wakeup
      wrapped into the RCU lock. After this commit, xsk_poll starts using
      xsk_wakeup and checks xs->zc instead of ndo_xsk_wakeup != NULL to decide
      ndo_xsk_wakeup should be called. It also fixes a bug introduced with the
      need_wakeup feature: a non-zero-copy socket may be used with a driver
      supporting zero-copy, and in this case ndo_xsk_wakeup should not be
      called, so the xs->zc check is the correct one.
      
      Fixes: 77cd0d7b
      
       ("xsk: add support for need_wakeup flag in AF_XDP rings")
      Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@mellanox.com>
      Signed-off-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20191217162023.16011-2-maximmi@mellanox.com
      06870682
  2. Dec 18, 2019
    • Daniel Borkmann's avatar
      bpf: Fix cgroup local storage prog tracking · e4730423
      Daniel Borkmann authored
      Recently noticed that we're tracking programs related to local storage maps
      through their prog pointer. This is a wrong assumption since the prog pointer
      can still change throughout the verification process, for example, whenever
      bpf_patch_insn_single() is called.
      
      Therefore, the prog pointer that was assigned via bpf_cgroup_storage_assign()
      is not guaranteed to be the same as we pass in bpf_cgroup_storage_release()
      and the map would therefore remain in busy state forever. Fix this by using
      the prog's aux pointer which is stable throughout verification and beyond.
      
      Fixes: de9cbbaa
      
       ("bpf: introduce cgroup storage maps")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Cc: Roman Gushchin <guro@fb.com>
      Cc: Martin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/1471c69eca3022218666f909bc927a92388fd09e.1576580332.git.daniel@iogearbox.net
      e4730423
  3. Dec 17, 2019
    • Daniel Borkmann's avatar
      bpf: Fix missing prog untrack in release_maps · a2ea0746
      Daniel Borkmann authored
      Commit da765a2f ("bpf: Add poke dependency tracking for prog array
      maps") wrongly assumed that in case of prog load errors, we're cleaning
      up all program tracking via bpf_free_used_maps().
      
      However, it can happen that we're still at the point where we didn't copy
      map pointers into the prog's aux section such that env->prog->aux->used_maps
      is still zero, running into a UAF. In such case, the verifier has similar
      release_maps() helper that drops references to used maps from its env.
      
      Consolidate the release code into __bpf_free_used_maps() and call it from
      all sides to fix it.
      
      Fixes: da765a2f
      
       ("bpf: Add poke dependency tracking for prog array maps")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Acked-by: default avatarYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/bpf/1c2909484ca524ae9f55109b06f22b6213e76376.1576514756.git.daniel@iogearbox.net
      a2ea0746
  4. Dec 14, 2019
  5. Dec 13, 2019
  6. Dec 12, 2019
  7. Dec 11, 2019
    • Toke Høiland-Jørgensen's avatar
      bpftool: Don't crash on missing jited insns or ksyms · 5b79bcdf
      Toke Høiland-Jørgensen authored
      When the kptr_restrict sysctl is set, the kernel can fail to return
      jited_ksyms or jited_prog_insns, but still have positive values in
      nr_jited_ksyms and jited_prog_len. This causes bpftool to crash when
      trying to dump the program because it only checks the len fields not
      the actual pointers to the instructions and ksyms.
      
      Fix this by adding the missing checks.
      
      Fixes: 71bb428f ("tools: bpf: add bpftool")
      Fixes: f84192ee
      
       ("tools: bpftool: resolve calls without using imm field")
      Signed-off-by: default avatarToke Høiland-Jørgensen <toke@redhat.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/20191210181412.151226-1-toke@redhat.com
      5b79bcdf
    • Arnd Bergmann's avatar
      bpf: Fix build in minimal configurations, again · 4c80c7bc
      Arnd Bergmann authored
      Building with -Werror showed another failure:
      
      kernel/bpf/btf.c: In function 'btf_get_prog_ctx_type.isra.31':
      kernel/bpf/btf.c:3508:63: error: array subscript 0 is above array bounds of 'u8[0]' {aka 'unsigned char[0]'} [-Werror=array-bounds]
        ctx_type = btf_type_member(conv_struct) + bpf_ctx_convert_map[prog_type] * 2;
      
      I don't actually understand why the array is empty, but a similar
      fix has addressed a related problem, so I suppose we can do the
      same thing here.
      
      Fixes: ce27709b
      
       ("bpf: Fix build in minimal configurations")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/20191210203553.2941035-1-arnd@arndb.de
      4c80c7bc
    • Paul Chaignon's avatar
      bpf, mips: Limit to 33 tail calls · e49e6f6d
      Paul Chaignon authored
      All BPF JIT compilers except RISC-V's and MIPS' enforce a 33-tail calls
      limit at runtime.  In addition, a test was recently added, in tailcalls2,
      to check this limit.
      
      This patch updates the tail call limit in MIPS' JIT compiler to allow
      33 tail calls.
      
      Fixes: b6bd53f9
      
       ("MIPS: Add missing file for eBPF JIT.")
      Reported-by: default avatarMahshid Khezri <khezri.mahshid@gmail.com>
      Signed-off-by: default avatarPaul Chaignon <paul.chaignon@orange.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/b8eb2caac1c25453c539248e56ca22f74b5316af.1575916815.git.paul.chaignon@gmail.com
      e49e6f6d
    • Paul Chaignon's avatar
      bpf, riscv: Limit to 33 tail calls · 96bc4432
      Paul Chaignon authored
      All BPF JIT compilers except RISC-V's and MIPS' enforce a 33-tail calls
      limit at runtime.  In addition, a test was recently added, in tailcalls2,
      to check this limit.
      
      This patch updates the tail call limit in RISC-V's JIT compiler to allow
      33 tail calls.  I tested it using the above selftest on an emulated
      RISCV64.
      
      Fixes: 2353ecc6
      
       ("bpf, riscv: add BPF JIT for RV64G")
      Reported-by: default avatarMahshid Khezri <khezri.mahshid@gmail.com>
      Signed-off-by: default avatarPaul Chaignon <paul.chaignon@orange.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarBjörn Töpel <bjorn.topel@gmail.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/966fe384383bf23a0ee1efe8d7291c78a3fb832b.1575916815.git.paul.chaignon@gmail.com
      96bc4432
    • Netanel Belgazal's avatar
      net: ena: fix napi handler misbehavior when the napi budget is zero · 24dee0c7
      Netanel Belgazal authored
      In netpoll the napi handler could be called with budget equal to zero.
      Current ENA napi handler doesn't take that into consideration.
      
      The napi handler handles Rx packets in a do-while loop.
      Currently, the budget check happens only after decrementing the
      budget, therefore the napi handler, in rare cases, could run over
      MAX_INT packets.
      
      In addition to that, this moves all budget related variables to int
      calculation and stop mixing u32 to avoid ambiguity
      
      Fixes: 1738cd3e
      
       ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
      Signed-off-by: default avatarNetanel Belgazal <netanel@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24dee0c7
    • David S. Miller's avatar
      Merge branch 'tipc-fix-some-issues' · f1ce0a15
      David S. Miller authored
      
      
      Tuong Lien says:
      
      ====================
      tipc: fix some issues
      
      This series consists of some bug-fixes for TIPC.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f1ce0a15
    • Tuong Lien's avatar
      tipc: fix use-after-free in tipc_disc_rcv() · 31e4ccc9
      Tuong Lien authored
      In the function 'tipc_disc_rcv()', the 'msg_peer_net_hash()' is called
      to read the header data field but after the message skb has been freed,
      that might result in a garbage value...
      
      This commit fixes it by defining a new local variable to store the data
      first, just like the other header fields' handling.
      
      Fixes: f73b1281
      
       ("tipc: improve throughput between nodes in netns")
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31e4ccc9
    • Tuong Lien's avatar
      tipc: fix retrans failure due to wrong destination · abc9b4e0
      Tuong Lien authored
      When a user message is sent, TIPC will check if the socket has faced a
      congestion at link layer. If that happens, it will make a sleep to wait
      for the congestion to disappear. This leaves a gap for other users to
      take over the socket (e.g. multi threads) since the socket is released
      as well. Also, in case of connectionless (e.g. SOCK_RDM), user is free
      to send messages to various destinations (e.g. via 'sendto()'), then
      the socket's preformatted header has to be updated correspondingly
      prior to the actual payload message building.
      
      Unfortunately, the latter action is done before the first action which
      causes a condition issue that the destination of a certain message can
      be modified incorrectly in the middle, leading to wrong destination
      when that message is built. Consequently, when the message is sent to
      the link layer, it gets stuck there forever because the peer node will
      simply reject it. After a number of retransmission attempts, the link
      is eventually taken down and the retransmission failure is reported.
      
      This commit fixes the problem by rearranging the order of actions to
      prevent the race condition from occurring, so the message building is
      'atomic' and its header will not be modified by anyone.
      
      Fixes: 365ad353
      
       ("tipc: reduce risk of user starvation during link congestion")
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      abc9b4e0
    • Tuong Lien's avatar
      tipc: fix potential hanging after b/rcast changing · dca4a17d
      Tuong Lien authored
      In commit c55c8eda ("tipc: smooth change between replicast and
      broadcast"), we allow instant switching between replicast and broadcast
      by sending a dummy 'SYN' packet on the last used link to synchronize
      packets on the links. The 'SYN' message is an object of link congestion
      also, so if that happens, a 'SOCK_WAKEUP' will be scheduled to be sent
      back to the socket...
      However, in that commit, we simply use the same socket 'cong_link_cnt'
      counter for both the 'SYN' & normal payload message sending. Therefore,
      if both the replicast & broadcast links are congested, the counter will
      be not updated correctly but overwritten by the latter congestion.
      Later on, when the 'SOCK_WAKEUP' messages are processed, the counter is
      reduced one by one and eventually overflowed. Consequently, further
      activities on the socket will only wait for the false congestion signal
      to disappear but never been met.
      
      Because sending the 'SYN' message is vital for the mechanism, it should
      be done anyway. This commit fixes the issue by marking the message with
      an error code e.g. 'TIPC_ERR_NO_PORT', so its sending should not face a
      link congestion, there is no need to touch the socket 'cong_link_cnt'
      either. In addition, in the event of any error (e.g. -ENOBUFS), we will
      purge the entire payload message queue and make a return immediately.
      
      Fixes: c55c8eda
      
       ("tipc: smooth change between replicast and broadcast")
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dca4a17d
    • Tuong Lien's avatar
      tipc: fix name table rbtree issues · d5162f34
      Tuong Lien authored
      
      
      The current rbtree for service ranges in the name table is built based
      on the 'lower' & 'upper' range values resulting in a flaw in the rbtree
      searching. Some issues have been observed in case of range overlapping:
      
      Case #1: unable to withdraw a name entry:
      After some name services are bound, all of them are withdrawn by user
      but one remains in the name table forever. This corrupts the table and
      that service becomes dummy i.e. no real port.
      E.g.
      
                      /
                 {22, 22}
                    /
                   /
         --->  {10, 50}
                 /  \
                /    \
          {10, 30}  {20, 60}
      
      The node {10, 30} cannot be removed since the rbtree searching stops at
      the node's ancestor i.e. {10, 50}, so starting from it will never reach
      the finding node.
      
      Case #2: failed to send data in some cases:
      E.g. Two service ranges: {20, 60}, {10, 50} are bound. The rbtree for
      this service will be one of the two cases below depending on the order
      of the bindings:
      
              {20, 60}             {10, 50} <--
                /  \                 /  \
               /    \               /    \
          {10, 50}  NIL <--       NIL  {20, 60}
      
                (a)                    (b)
      
      Now, try to send some data to service {30}, there will be two results:
      (a): Failed, no route to host.
      (b): Ok.
      
      The reason is that the rbtree searching will stop at the pointing node
      as shown above.
      
      Case #3: Same as case #2b above but if the data sending's scope is
      local and the {10, 50} is published by a peer node, then it will result
      in 'no route to host' even though the other {20, 60} is for example on
      the local node which should be able to get the data.
      
      The issues are actually due to the way we built the rbtree. This commit
      fixes it by introducing an additional field to each node - named 'max',
      which is the largest 'upper' of that node subtree. The 'max' value for
      each subtrees will be propagated correctly whenever a node is inserted/
      removed or the tree is rebalanced by the augmented rbtree callbacks.
      
      By this way, we can change the rbtree searching appoarch to solve the
      issues above. Another benefit from this is that we can now improve the
      searching for a next range matching e.g. in case of multicast, so get
      rid of the unneeded looping over all nodes in the tree.
      
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarTuong Lien <tuong.t.lien@dektech.com.au>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d5162f34
    • David S. Miller's avatar
      Merge branch 'bnxt_en-Error-recovery-fixes' · ac397934
      David S. Miller authored
      
      
      Michael Chan says:
      
      ====================
      bnxt_en: Error recovery fixes.
      
      This patch series contains fixes mostly for the error recovery feature
      and related areas.  Please queue the series for -stable also.  Thanks.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ac397934
    • Vasundhara Volam's avatar
      bnxt_en: Add missing devlink health reporters for VFs. · 7e334fc8
      Vasundhara Volam authored
      The VF driver also needs to create the health reporters since
      VFs are also involved in firmware reset and recovery.  Modify
      bnxt_dl_register() and bnxt_dl_unregister() so that they can
      be called by the VFs to register/unregister devlink.  Only the PF
      will register the devlink parameters.  With devlink registered,
      we can now create the health reporters on the VFs.
      
      Fixes: 6763c779
      
       ("bnxt_en: Add new FW devlink_health_reporter")
      Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7e334fc8
    • Vasundhara Volam's avatar
      bnxt_en: Fix the logic that creates the health reporters. · 937f188c
      Vasundhara Volam authored
      Fix the logic to properly check the fw capabilities and create the
      devlink health reporters only when needed.  The current code creates
      the reporters unconditionally as long as bp->fw_health is valid, and
      that's not correct.
      
      Call bnxt_dl_fw_reporters_create() directly from the init and reset
      code path instead of from bnxt_dl_register().  This allows the
      reporters to be adjusted when capabilities change.  The same
      applies to bnxt_dl_fw_reporters_destroy().
      
      Fixes: 6763c779
      
       ("bnxt_en: Add new FW devlink_health_reporter")
      Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      937f188c
    • Vasundhara Volam's avatar
      bnxt_en: Remove unnecessary NULL checks for fw_health · 0797c10d
      Vasundhara Volam authored
      
      
      After fixing the allocation of bp->fw_health in the previous patch,
      the driver will not go through the fw reset and recovery code paths
      if bp->fw_health allocation fails.  So we can now remove the
      unnecessary NULL checks.
      
      Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0797c10d
    • Vasundhara Volam's avatar
      bnxt_en: Fix bp->fw_health allocation and free logic. · 8280b38e
      Vasundhara Volam authored
      bp->fw_health needs to be allocated for either the firmware initiated
      reset feature or the driver initiated error recovery feature.  The
      current code is not allocating bp->fw_health for all the necessary cases.
      This patch corrects the logic to allocate bp->fw_health correctly when
      needed.  If allocation fails, we clear the feature flags.
      
      We also add the the missing kfree(bp->fw_health) when the driver is
      unloaded.  If we get an async reset message from the firmware, we also
      need to make sure that we have a valid bp->fw_health before proceeding.
      
      Fixes: 07f83d72
      
       ("bnxt_en: Discover firmware error recovery capabilities.")
      Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8280b38e
    • Vasundhara Volam's avatar
      bnxt_en: Return error if FW returns more data than dump length · c74751f4
      Vasundhara Volam authored
      If any change happened in the configuration of VF in VM while
      collecting live dump, there could be a race and firmware can return
      more data than allocated dump length. Fix it by keeping track of
      the accumulated core dump length copied so far and abort the copy
      with error code if the next chunk of core dump will exceed the
      original dump length.
      
      Fixes: 6c5657d0
      
       ("bnxt_en: Add support for ethtool get dump.")
      Signed-off-by: default avatarVasundhara Volam <vasundhara-v.volam@broadcom.com>
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c74751f4
    • Michael Chan's avatar
      bnxt_en: Free context memory in the open path if firmware has been reset. · 325f85f3
      Michael Chan authored
      This will trigger new context memory to be rediscovered and allocated
      during the re-probe process after a firmware reset.  Without this, the
      newly reset firmware does not have valid context memory and the driver
      will eventually fail to allocate some resources.
      
      Fixes: ec5d31e3
      
       ("bnxt_en: Handle firmware reset status during IF_UP.")
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      325f85f3
    • Michael Chan's avatar
      bnxt_en: Fix MSIX request logic for RDMA driver. · 0c722ec0
      Michael Chan authored
      The logic needs to check both bp->total_irqs and the reserved IRQs in
      hw_resc->resv_irqs if applicable and see if both are enough to cover
      the L2 and RDMA requested vectors.  The current code is only checking
      bp->total_irqs and can fail in some code paths, such as the TX timeout
      code path with the RDMA driver requesting vectors after recovery.  In
      this code path, we have not reserved enough MSIX resources for the
      RDMA driver yet.
      
      Fixes: 75720e63
      
       ("bnxt_en: Keep track of reserved IRQs.")
      Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0c722ec0
  8. Dec 10, 2019
    • Stephan Gerhold's avatar
      NFC: nxp-nci: Fix probing without ACPI · 868afbac
      Stephan Gerhold authored
      devm_acpi_dev_add_driver_gpios() returns -ENXIO if CONFIG_ACPI
      is disabled (e.g. on device tree platforms).
      In this case, nxp-nci will silently fail to probe.
      
      The other NFC drivers only log a debug message if
      devm_acpi_dev_add_driver_gpios() fails.
      Do the same in nxp-nci to fix this problem.
      
      Fixes: ad0acfd6
      
       ("NFC: nxp-nci: Get rid of code duplication in ->probe()")
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
      Acked-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      868afbac
    • Davide Caratti's avatar
      tc-testing: unbreak full listing of tdc testcases · 991a3459
      Davide Caratti authored
      the following command currently fails:
      
       [root@fedora tc-testing]# ./tdc.py -l
       The following test case IDs are not unique:
       {'6f5e'}
       Please correct them before continuing.
      
      this happens because there are two tests having the same id:
      
       [root@fedora tc-testing]# grep -r 6f5e tc-tests/*
       tc-tests/actions/pedit.json:        "id": "6f5e",
       tc-tests/filters/basic.json:        "id": "6f5e",
      
      fix it replacing the latest duplicate id with a brand new one:
      
       [root@fedora tc-testing]# sed -i 's/6f5e//1' tc-tests/filters/basic.json
       [root@fedora tc-testing]# ./tdc.py -i
      
      Fixes: 4717b053
      
       ("tc-testing: Introduced tdc tests for basic filter")
      Signed-off-by: default avatarDavide Caratti <dcaratti@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      991a3459
    • Chuhong Yuan's avatar
      fjes: fix missed check in fjes_acpi_add · a288f105
      Chuhong Yuan authored
      fjes_acpi_add() misses a check for platform_device_register_simple().
      Add a check to fix it.
      
      Fixes: 658d439b
      
       ("fjes: Introduce FUJITSU Extended Socket Network Device driver")
      Signed-off-by: default avatarChuhong Yuan <hslester96@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a288f105
    • Mao Wenan's avatar
      af_packet: set defaule value for tmo · b43d1f9f
      Mao Wenan authored
      There is softlockup when using TPACKET_V3:
      ...
      NMI watchdog: BUG: soft lockup - CPU#2 stuck for 60010ms!
      (__irq_svc) from [<c0558a0c>] (_raw_spin_unlock_irqrestore+0x44/0x54)
      (_raw_spin_unlock_irqrestore) from [<c027b7e8>] (mod_timer+0x210/0x25c)
      (mod_timer) from [<c0549c30>]
      (prb_retire_rx_blk_timer_expired+0x68/0x11c)
      (prb_retire_rx_blk_timer_expired) from [<c027a7ac>]
      (call_timer_fn+0x90/0x17c)
      (call_timer_fn) from [<c027ab6c>] (run_timer_softirq+0x2d4/0x2fc)
      (run_timer_softirq) from [<c021eaf4>] (__do_softirq+0x218/0x318)
      (__do_softirq) from [<c021eea0>] (irq_exit+0x88/0xac)
      (irq_exit) from [<c0240130>] (msa_irq_exit+0x11c/0x1d4)
      (msa_irq_exit) from [<c0209cf0>] (handle_IPI+0x650/0x7f4)
      (handle_IPI) from [<c02015bc>] (gic_handle_irq+0x108/0x118)
      (gic_handle_irq) from [<c0558ee4>] (__irq_usr+0x44/0x5c)
      ...
      
      If __ethtool_get_link_ksettings() is failed in
      prb_calc_retire_blk_tmo(), msec and tmo will be zero, so tov_in_jiffies
      is zero and the timer expire for retire_blk_timer is turn to
      mod_timer(&pkc->retire_blk_timer, jiffies + 0),
      which will trigger cpu usage of softirq is 100%.
      
      Fixes: f6fb8f10
      
       ("af-packet: TPACKET_V3 flexible buffer implementation.")
      Tested-by: default avatarXiao Jiangfeng <xiaojiangfeng@huawei.com>
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b43d1f9f
    • Grygorii Strashko's avatar
      net: ethernet: ti: davinci_cpdma: fix warning "device driver frees DMA memory with different size" · 8a2b2220
      Grygorii Strashko authored
      The TI CPSW(s) driver produces warning with DMA API debug options enabled:
      
      WARNING: CPU: 0 PID: 1033 at kernel/dma/debug.c:1025 check_unmap+0x4a8/0x968
      DMA-API: cpsw 48484000.ethernet: device driver frees DMA memory with different size
       [device address=0x00000000abc6aa02] [map size=64 bytes] [unmap size=42 bytes]
      CPU: 0 PID: 1033 Comm: ping Not tainted 5.3.0-dirty #41
      Hardware name: Generic DRA72X (Flattened Device Tree)
      [<c0112c60>] (unwind_backtrace) from [<c010d270>] (show_stack+0x10/0x14)
      [<c010d270>] (show_stack) from [<c09bc564>] (dump_stack+0xd8/0x110)
      [<c09bc564>] (dump_stack) from [<c013b93c>] (__warn+0xe0/0x10c)
      [<c013b93c>] (__warn) from [<c013b9ac>] (warn_slowpath_fmt+0x44/0x6c)
      [<c013b9ac>] (warn_slowpath_fmt) from [<c01e0368>] (check_unmap+0x4a8/0x968)
      [<c01e0368>] (check_unmap) from [<c01e08a8>] (debug_dma_unmap_page+0x80/0x90)
      [<c01e08a8>] (debug_dma_unmap_page) from [<c0752414>] (__cpdma_chan_free+0x114/0x16c)
      [<c0752414>] (__cpdma_chan_free) from [<c07525c4>] (__cpdma_chan_process+0x158/0x17c)
      [<c07525c4>] (__cpdma_chan_process) from [<c0753690>] (cpdma_chan_process+0x3c/0x5c)
      [<c0753690>] (cpdma_chan_process) from [<c0758660>] (cpsw_tx_mq_poll+0x48/0x94)
      [<c0758660>] (cpsw_tx_mq_poll) from [<c0803018>] (net_rx_action+0x108/0x4e4)
      [<c0803018>] (net_rx_action) from [<c010230c>] (__do_softirq+0xec/0x598)
      [<c010230c>] (__do_softirq) from [<c0143914>] (do_softirq.part.4+0x68/0x74)
      [<c0143914>] (do_softirq.part.4) from [<c0143a44>] (__local_bh_enable_ip+0x124/0x17c)
      [<c0143a44>] (__local_bh_enable_ip) from [<c0871590>] (ip_finish_output2+0x294/0xb7c)
      [<c0871590>] (ip_finish_output2) from [<c0875440>] (ip_output+0x210/0x364)
      [<c0875440>] (ip_output) from [<c0875e2c>] (ip_send_skb+0x1c/0xf8)
      [<c0875e2c>] (ip_send_skb) from [<c08a7fd4>] (raw_sendmsg+0x9a8/0xc74)
      [<c08a7fd4>] (raw_sendmsg) from [<c07d6b90>] (sock_sendmsg+0x14/0x24)
      [<c07d6b90>] (sock_sendmsg) from [<c07d8260>] (__sys_sendto+0xbc/0x100)
      [<c07d8260>] (__sys_sendto) from [<c01011ac>] (__sys_trace_return+0x0/0x14)
      Exception stack(0xea9a7fa8 to 0xea9a7ff0)
      ...
      
      The reason is that cpdma_chan_submit_si() now stores original buffer length
      (sw_len) in CPDMA descriptor instead of adjusted buffer length (hw_len)
      used to map the buffer.
      
      Hence, fix an issue by passing correct buffer length in CPDMA descriptor.
      
      Cc: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Fixes: 6670acac
      
       ("net: ethernet: ti: davinci_cpdma: add dma mapped submit")
      Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
      Reviewed-by: default avatarIvan Khoronzhuk <ivan.khoronzhuk@linaro.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8a2b2220
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/pablo/nf · 7da538c1
      David S. Miller authored
      
      
      Pablo Neira Ayuso says:
      
      ====================
      Netfilter fixes for net
      
      The following patchset contains Netfilter fixes for net:
      
      1) Wait for rcu grace period after releasing netns in ctnetlink,
         from Florian Westphal.
      
      2) Incorrect command type in flowtable offload ndo invocation,
         from wenxu.
      
      3) Incorrect callback type in flowtable offload flow tuple
         updates, also from wenxu.
      
      4) Fix compile warning on flowtable offload infrastructure due to
         possible reference to uninitialized variable, from Nathan Chancellor.
      
      5) Do not inline nf_ct_resolve_clash(), this is called from slow
         path / stress situations. From Florian Westphal.
      
      6) Missing IPv6 flow selector description in flowtable offload.
      
      7) Missing check for NETDEV_UNREGISTER in nf_tables offload
         infrastructure, from wenxu.
      
      8) Update NAT selftest to use randomized netns names, from
         Florian Westphal.
      
      9) Restore nfqueue bridge support, from Marco Oliverio.
      
      10) Compilation warning in SCTP_CHUNKMAP_*() on xt_sctp header.
          From Phil Sutter.
      
      11) Fix bogus lookup/get match for non-anonymous rbtree sets.
      
      12) Missing netlink validation for NFT_SET_ELEM_INTERVAL_END
          elements.
      
      13) Missing netlink validation for NFT_DATA_VALUE after
          nft_data_init().
      
      14) If rule specifies no actions, offload infrastructure returns
          EOPNOTSUPP.
      
      15) Module refcount leak in object updates.
      
      16) Missing sanitization for ARP traffic from br_netfilter, from
          Eric Dumazet.
      
      17) Compilation breakage on big-endian due to incorrect memcpy()
          size in the flowtable offload infrastructure.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7da538c1
    • Pablo Neira Ayuso's avatar
      netfilter: nf_flow_table_offload: Correct memcpy size for flow_overload_mangle() · 7acd9378
      Pablo Neira Ayuso authored
      In function 'memcpy',
           inlined from 'flow_offload_mangle' at net/netfilter/nf_flow_table_offload.c:112:2,
           inlined from 'flow_offload_port_dnat' at net/netfilter/nf_flow_table_offload.c:373:2,
           inlined from 'nf_flow_rule_route_ipv4' at net/netfilter/nf_flow_table_offload.c:424:3:
      ./include/linux/string.h:376:4: error: call to '__read_overflow2' declared with attribute error: detected read beyond size of object passed as 2nd parameter
         376 |    __read_overflow2();
             |    ^~~~~~~~~~~~~~~~~~
      
      The original u8* was done in the hope to make this more adaptable but
      consensus is to keep this like it is in tc pedit.
      
      Fixes: c29f74e0
      
       ("netfilter: nf_flow_table: hardware offload support")
      Reported-by: default avatarLaura Abbott <labbott@redhat.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      7acd9378
    • Martin Schiller's avatar
      net/x25: add new state X25_STATE_5 · f8fc57e8
      Martin Schiller authored
      
      
      This is needed, because if the flag X25_ACCPT_APPRV_FLAG is not set on a
      socket (manual call confirmation) and the channel is cleared by remote
      before the manual call confirmation was sent, this situation needs to
      be handled.
      
      Signed-off-by: default avatarMartin Schiller <ms@dev.tdt.de>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f8fc57e8
    • Ido Schimmel's avatar
      selftests: forwarding: Delete IPv6 address at the end · 65cb1398
      Ido Schimmel authored
      When creating the second host in h2_create(), two addresses are assigned
      to the interface, but only one is deleted. When running the test twice
      in a row the following error is observed:
      
      $ ./router_bridge_vlan.sh
      TEST: ping                                                          [ OK ]
      TEST: ping6                                                         [ OK ]
      TEST: vlan                                                          [ OK ]
      $ ./router_bridge_vlan.sh
      RTNETLINK answers: File exists
      TEST: ping                                                          [ OK ]
      TEST: ping6                                                         [ OK ]
      TEST: vlan                                                          [ OK ]
      
      Fix this by deleting the address during cleanup.
      
      Fixes: 5b1e7f9e
      
       ("selftests: forwarding: Test routed bridge interface")
      Signed-off-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      65cb1398