1. 07 Mar, 2016 16 commits
    • David Howells's avatar
      rxrpc: Implement peer endpoint cache · 8acac5bb
      David Howells authored
      Implement the peer RxRPC endpoint cache.  Only the primary cache is used.
      This is indexed on the following details:
      
        - Network transport family - currently only AF_INET.
        - Network transport type - currently only UDP.
        - Peer network transport address.
      
      We use the RCU read lock to handle non-creating lookups so that we can do
      the look up from bottom half context in the sk_error_report handler.
      Creating lookups are done under spinlock rather than mutex as they might be
      set up due to an external stimulus if the local endpoint is a server.
      
      Captured network error messages (ICMP) are handled with respect to this
      struct and MTU size and RTT are cached here.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      8acac5bb
    • David Howells's avatar
      rxrpc: Rename ar-peer.c to peer-object.c · a97efe2f
      David Howells authored
      Rename ar-peer.c to peer-object.c for consistency (to be) with the other
      new object cache management files.  It will be modified in a later commit.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      a97efe2f
    • David Howells's avatar
      rxrpc: Rename ar-local.c to local-event.c · 0fccde8b
      David Howells authored
      Rename ar-local.c to local-event.c.  What's left in the file is the local
      endpoint event/packet handling code after the object management has been
      separated out.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      0fccde8b
    • David Howells's avatar
      rxrpc: procfs file to list local endpoints · d5e30025
      David Howells authored
      Add a proc file to list local rxrpc endpoints using the object cache
      facility to do much of the work.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      d5e30025
    • David Howells's avatar
      rxrpc: Implement local endpoint cache · b2347cb5
      David Howells authored
      Implement the local RxRPC endpoint cache.  Only the primary cache is used.
      This is indexed on the following details:
      
        - Local network transport family - currently only AF_INET.
        - Local network transport type - currently only UDP.
        - Local network transport address.
      
      The hash isn't very big since we don't expect to have many local endpoints
      hanging around - RxRPC sockets opened with a 0 service ID (ie. client-only
      sockets) share local endpoints if they have matching local network
      addresses (typically all zeros).
      
      We use a mutex to handle lookups and don't provide RCU-only lookups since
      we only expect write access to this cache to be done from process context
      when opening a socket.  The local endpoint object is pointed to by the
      transport socket's sk_user_data for the life of the transport socket so
      that it's fast to access by the transport socket sk_data_ready and
      sk_error_report callbacks.
      
      Further, the transport socket is shut down before we clear the sk_user_data
      pointer, so that we can be sure that the transport socket's callbacks won't
      be invoked once the RCU destruction is scheduled.
      
      The local endpoint retains the transport socket that we use to send and
      capture packets and capture network error messages (ICMP).  The socket is
      opened when an endpoint is looked up - if it doesn't already exist.
      
      Note that to make this work, we have to get rid of rxrpc_local_lock as that
      causes a potential deadlock between a softirq looking in an object cache
      whilst holding that lock vs objcache_clear() taking the cache lock and then
      an interrupt.
      
      However, since the socket is locked by the caller of the rxrpc_data_ready()
      function and given that we don't clear sk_user_data until after we've shut
      down the socket, we are guaranteed that the local endpoint struct is pinned
      until rxrpc_data_ready() returns - so we don't need to lock the local
      endpoint struct there.
      
      The other places we've taken the lock where we read the usage count and
      then increment it if not zero can be replaced by atomic_inc_not_zero()
      (hidden inside rxrpc_get_local_maybe()).
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      b2347cb5
    • David Howells's avatar
      rxrpc: Separate local endpoint object handling out into its own file · f9aa3a15
      David Howells authored
      Separate local endpoint object handling out into its own file preparatory
      to overhauling it to use the new object cache.  The original file is then
      be used exclusively for the local endpoint packet and event handling.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      f9aa3a15
    • David Howells's avatar
      rxrpc: Do procfs lists through objcache · e3e1aa90
      David Howells authored
      Use the object cache primary hash to provide lists of RxRPC objects through
      /proc/net/ for all caches where desired.  Each user of the cache just needs
      to provide a show function in its objcache struct and register the proc
      file with objcache_seq_fops as its file operations.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      e3e1aa90
    • David Howells's avatar
      rxrpc: Add a common object cache · 7c02dc94
      David Howells authored
      Add a common object cache implementation for RxRPC.  This will be used to
      cache objects of various types (calls, connections, local and remote
      endpoint records).  Each object that would be cached must contain an
      obj_node struct for the cache to use.  The object's usage count and link
      pointers are here, plus other internal metadata.
      
      Each object cache consists of a primary hash to which all objects of that
      type must be added and a secondary hash to which objects may also be added
      and removed a single time.  Objects are automatically removed from both
      hashes when they expire.
      
      Objects start off life with a usage count of 2 - one for the cache and one
      for the caller.  When an object's usage count is reduced to 1, it sits in
      the cache until its expiry time is reached, at which point the cache
      attempts to reduce the count to 0 and, if successful, clean it up.  An
      object with a usage count of 1 in the cache can be looked up and have its
      usage count increased, thereby stopping the expiry process.
      
      Objects are looked up, unlinked and destroyed under RCU-safe conditions.
      
      A garbage collector cycles through all the hash buckets in the primary hash
      and compares the expiry times of the usage-count-1 objects to the current
      time, removing any that have expired.  This is kicked by a single timer for
      the whole cache rather than having a timer per object.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      7c02dc94
    • Jon Paul Maloy's avatar
      tipc: remove pre-allocated message header in link struct · e74a386d
      Jon Paul Maloy authored
      Until now, we have kept a pre-allocated protocol message header
      aggregated into struct tipc_link. Apart from adding unnecessary
      footprint to the link instances, this requires extra code both to
      initialize and re-initialize it.
      
      We now remove this sub-optimization. This change also makes it
      possible to clean up the function tipc_build_proto_msg() and remove
      a couple of small functions that were accessing the mentioned header.
      In particular, we can replace all occurrences of the local function
      call link_own_addr(link) with the generic tipc_own_addr(net).
      Acked-by: default avatarYing Xue <ying.xue@windriver.com>
      Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e74a386d
    • Richard Alpe's avatar
      tipc: make sure required IPv6 addresses are scoped · 34f65dbb
      Richard Alpe authored
      Make sure the user has provided a scope for multicast and link local
      addresses used locally by a UDP bearer.
      Signed-off-by: default avatarRichard Alpe <richard.alpe@ericsson.com>
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      34f65dbb
    • Richard Alpe's avatar
      tipc: safely copy UDP netlink data from user · ddb37125
      Richard Alpe authored
      The netlink policy for TIPC_NLA_UDP_LOCAL and TIPC_NLA_UDP_REMOTE
      is of type binary with a defined length. This causes the policy
      framework to threat the defined length as maximum length.
      
      There is however no protection against a user sending a smaller
      amount of data. Prior to this patch this wasn't handled which could
      result in a partially incomplete sockaddr_storage struct containing
      uninitialized data.
      
      In this patch we use nla_memcpy() when copying the user data. This
      ensures a potential gap at the end is cleared out properly.
      
      This was found by Julia with Coccinelle tool.
      Reported-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Reported-by: default avatarJulia Lawall <julia.lawall@lip6.fr>
      Signed-off-by: default avatarRichard Alpe <richard.alpe@ericsson.com>
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ddb37125
    • Richard Alpe's avatar
      tipc: don't check link reset on non existing link · 2837f39c
      Richard Alpe authored
      Make sure we have a link before checking if it has been reset or not.
      
      Prior to this patch tipc_link_is_reset() could be called with a non
      existing link, resulting in a null pointer dereference.
      Signed-off-by: default avatarRichard Alpe <richard.alpe@ericsson.com>
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2837f39c
    • Richard Alpe's avatar
      tipc: add net device to skb before UDP xmit · 9b300960
      Richard Alpe authored
      Prior to this patch enabling a IPv4 UDP bearer caused a null pointer
      dereference in iptunnel_xmit_stats(), when it tried to dereference the
      net device from the skb. To resolve this we now point the skb device
      to the net device resolved from the routing table.
      
      Fixes: 039f5062 (ip_tunnel: Move stats update to iptunnel_xmit())
      Signed-off-by: default avatarRichard Alpe <richard.alpe@ericsson.com>
      Acked-by: default avatarJon Maloy <jon.maloy@ericsson.com>
      Reviewed-by: default avatarErik Hugne <erik.hugne@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9b300960
    • Bernhard Walle's avatar
      net: fec: Rename "phy-reset-active-low" property · 962d8cdc
      Bernhard Walle authored
      is actually "active high". Thanks for Troy Kisky for pointing
      that out.
      
      Since the patch is in linux-next, this patch is incremental and doesn't
      replace the original patch.
      Signed-off-by: default avatarBernhard Walle <bernhard@bwalle.de>
      Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      962d8cdc
    • Wu Fengguang's avatar
      stmmac: fix noderef.cocci warnings · 4c3e962d
      Wu Fengguang authored
      drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c:115:15-21: ERROR: application of sizeof to pointer
      
       sizeof when applied to a pointer typed expression gives the size of
       the pointer
      
      Generated by: scripts/coccinelle/misc/noderef.cocci
      
      CC: Giuseppe Cavallaro <peppe.cavallaro@st.com>
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4c3e962d
    • WANG Cong's avatar
      act_ife: fix a typo in kmemdup() parameters · d1491fa5
      WANG Cong authored
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
      Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d1491fa5
  2. 05 Mar, 2016 5 commits
  3. 04 Mar, 2016 19 commits