1. 20 Jun, 2017 21 commits
  2. 19 Jun, 2017 9 commits
  3. 18 Jun, 2017 10 commits
    • Florian Fainelli's avatar
      net: dsa: Fix legacy probing · 06d4d450
      Florian Fainelli authored
      After commit 6d3c8c0d ("net: dsa: Remove master_netdev and
      use dst->cpu_dp->netdev") and a29342e7 ("net: dsa: Associate
      slave network device with CPU port") we would be seeing NULL pointer
      dereferences when accessing dst->cpu_dp->netdev too early. In the legacy
      code, we actually know early in advance the master network device, so
      pass it down to the relevant functions.
      
      Fixes: 6d3c8c0d ("net: dsa: Remove master_netdev and use dst->cpu_dp->netdev")
      Fixes: a29342e7 ("net: dsa: Associate slave network device with CPU port")
      Reported-by: default avatarJason Cobham <jcobham@questertangent.com>
      Tested-by: default avatarJason Cobham <jcobham@questertangent.com>
      Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Reviewed-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      06d4d450
    • Dave Watson's avatar
      tls: update Kconfig · d807ec65
      Dave Watson authored
      Missing crypto deps for some platforms.
      Default to n for new module.
      
      config: m68k-amcore_defconfig (attached as .config)
      compiler: m68k-linux-gcc (GCC) 4.9.0
      
      make.cross ARCH=m68k
      All errors (new ones prefixed by >>):
      
         net/built-in.o: In function `tls_set_sw_offload':
      >> (.text+0x732f8): undefined reference to `crypto_alloc_aead'
         net/built-in.o: In function `tls_set_sw_offload':
      >> (.text+0x7333c): undefined reference to `crypto_aead_setkey'
         net/built-in.o: In function `tls_set_sw_offload':
      >> (.text+0x73354): undefined reference to `crypto_aead_setauthsize'
      Reported-by: default avatarkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: default avatarDave Watson <davejwatson@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d807ec65
    • David S. Miller's avatar
      Merge branch 'net-remove-dst-garbage-collector-logic' · ffe95ecf
      David S. Miller authored
      Wei Wang says:
      
      ====================
      remove dst garbage collector logic
      
      The current mechanism of dst release is a bit complicated. It is because
      the users of dst get divided into 2 situations:
        1. Most users take the reference count when using a dst and release the
           reference count when done.
        2. Exceptional users like IPv4/IPv6/decnet/xfrm routing code do not take
           reference count when referencing to a dst due to some histotic reasons.
      
      Due to those exceptional use cases in 2, reference count being 0 is not an
      adequate evidence to indicate that no user is using this dst. So users in 1
      can't free the dst simply based on reference count being 0 because users in
      2 might still hold reference to it.
      Instead, a dst garbage list is needed to hold the dst entries that already
      get removed by the users in 2 but are still held by users in 1. And a periodic
      garbage collector task is run to check all the dst entries in the list to see
      if the users in 1 have released the reference to those dst entries.
      If so, the dst is now ready to be freed.
      
      This logic introduces unnecessary complications in the dst code which makes it
      hard to understand and to debug.
      
      In order to get rid of the whole dst garbage collector (gc) and make the dst
      code more unified and simplified, we can make the users in 2 also take reference
      count on the dst and release it properly when done.
      This way, dst can be safely freed once the refcount drops to 0 and no gc
      thread is needed anymore.
      
      This patch series' target is to completely get rid of dst gc logic and free
      dst based on reference count only.
      Patch 1-3 are preparation patches to do some cleanup/improvement on the existing
      code to make later work easier.
      Patch 4-21 are real implementations.
      In these patches, a temporary flag DST_NOGC is used to help transition
      those exceptional users one by one. Once every component is transitioned,
      this temporary flag is removed.
      By the end of this patch series, all dst are refcounted when being used
      and released when done. And dst will be freed when its refcount drops to 0.
      No dst gc task is running anymore.
      
      Note: This patch series depends on the decnet fix that was sent right before:
            "decnet: always not take dst->__refcnt when inserting dst into hash table"
      
      v2:
        add curly braces in udp_v4/6_early_demux() in patch 02
        add EXPORT_SYMBOL() for dst_dev_put() in patch 05
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ffe95ecf
    • Wei Wang's avatar
      net: add debug atomic_inc_not_zero() in dst_hold() · 44ebe791
      Wei Wang authored
      This patch is meant to add a debug warning on the situation where dst is
      being held during its destroy phase. This could potentially cause double
      free issue on the dst.
      Signed-off-by: default avatarWei Wang <weiwan@google.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      44ebe791
    • Wei Wang's avatar
      net: reorder all the dst flags · 1eb04e7c
      Wei Wang authored
      As some dst flags are removed, reorder the dst flags to fill in the
      blanks.
      Note: these flags are not exposed into user space. So it is safe to
      reorder.
      Signed-off-by: default avatarWei Wang <weiwan@google.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1eb04e7c
    • Wei Wang's avatar
      net: remove DST_NOCACHE flag · a4c2fd7f
      Wei Wang authored
      DST_NOCACHE flag check has been removed from dst_release() and
      dst_hold_safe() in a previous patch because all the dst are now ref
      counted properly and can be released based on refcnt only.
      Looking at the rest of the DST_NOCACHE use, all of them can now be
      removed or replaced with other checks.
      So this patch gets rid of all the DST_NOCACHE usage and remove this flag
      completely.
      Signed-off-by: default avatarWei Wang <weiwan@google.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a4c2fd7f
    • Wei Wang's avatar
      net: remove DST_NOGC flag · b2a9c0ed
      Wei Wang authored
      Now that all the components have been changed to release dst based on
      refcnt only and not depend on dst gc anymore, we can remove the
      temporary flag DST_NOGC.
      
      Note that we also need to remove the DST_NOCACHE check in dst_release()
      and dst_hold_safe() because now all the dst are released based on refcnt
      and behaves as DST_NOCACHE.
      Signed-off-by: default avatarWei Wang <weiwan@google.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b2a9c0ed
    • Wei Wang's avatar
      net: remove dst gc related code · 5b7c9a8f
      Wei Wang authored
      This patch removes all dst gc related code and all the dst free
      functions
      Signed-off-by: default avatarWei Wang <weiwan@google.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5b7c9a8f
    • Wei Wang's avatar
      decnet: take dst->__refcnt when struct dn_route is created · 560fd93b
      Wei Wang authored
      struct dn_route is inserted into dn_rt_hash_table but no dst->__refcnt
      is taken.
      This patch makes sure the dn_rt_hash_table's reference to the dst is ref
      counted.
      
      As the dst is always ref counted properly, we can safely mark
      DST_NOGC flag so dst_release() will release dst based on refcnt only.
      And dst gc is no longer needed and all dst_free() or its related
      function calls should be replaced with dst_release() or
      dst_release_immediate(). And dst_dev_put() is called when removing dst
      from the hash table to release the reference on dst->dev before we lose
      pointer to it.
      
      Also, correct the logic in dn_dst_check_expire() and dn_dst_gc() to
      check dst->__refcnt to be > 1 to indicate it is referenced by other
      users.
      Signed-off-by: default avatarWei Wang <weiwan@google.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      560fd93b
    • Wei Wang's avatar
      xfrm: take refcnt of dst when creating struct xfrm_dst bundle · 52df157f
      Wei Wang authored
      During the creation of xfrm_dst bundle, always take ref count when
      allocating the dst. This way, xfrm_bundle_create() will form a linked
      list of dst with dst->child pointing to a ref counted dst child. And
      the returned dst pointer is also ref counted. This makes the link from
      the flow cache to this dst now ref counted properly.
      As the dst is always ref counted properly, we can safely mark
      DST_NOGC flag so dst_release() will release dst based on refcnt only.
      And dst gc is no longer needed and all dst_free() and its related
      function calls should be replaced with dst_release() or
      dst_release_immediate().
      
      The special handling logic for dst->child in dst_destroy() can be
      replaced with a simple dst_release_immediate() call on the child to
      release the whole list linked by dst->child pointer.
      Previously used DST_NOHASH flag is not needed anymore as well. The
      reason that DST_NOHASH is used in the existing code is mainly to prevent
      the dst inserted in the fib tree to be wrongly destroyed during the
      deletion of the xfrm_dst bundle. So in the existing code, DST_NOHASH
      flag is marked in all the dst children except the one which is in the
      fib tree.
      However, with this patch series to remove dst gc logic and release dst
      only based on ref count, it is safe to release all the children from a
      xfrm_dst bundle as long as the dst children are all ref counted
      properly which is already the case in the existing code.
      So, this patch removes the use of DST_NOHASH flag.
      Signed-off-by: default avatarWei Wang <weiwan@google.com>
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      52df157f