1. 31 3月, 2015 13 次提交
  2. 24 2月, 2015 1 次提交
    • C
      xprtrdma: Store RDMA credits in unsigned variables · 9b1dcbc8
      Chuck Lever 提交于
      Dan Carpenter's static checker pointed out:
      
         net/sunrpc/xprtrdma/rpc_rdma.c:879 rpcrdma_reply_handler()
         warn: can 'credits' be negative?
      
      "credits" is defined as an int. The credits value comes from the
      server as a 32-bit unsigned integer.
      
      A malicious or broken server can plant a large unsigned integer in
      that field which would result in an underflow in the following
      logic, potentially triggering a deadlock of the mount point by
      blocking the client from issuing more RPC requests.
      
      net/sunrpc/xprtrdma/rpc_rdma.c:
      
        876          credits = be32_to_cpu(headerp->rm_credit);
        877          if (credits == 0)
        878                  credits = 1;    /* don't deadlock */
        879          else if (credits > r_xprt->rx_buf.rb_max_requests)
        880                  credits = r_xprt->rx_buf.rb_max_requests;
        881
        882          cwnd = xprt->cwnd;
        883          xprt->cwnd = credits << RPC_CWNDSHIFT;
        884          if (xprt->cwnd > cwnd)
        885                  xprt_release_rqst_cong(rqst->rq_task);
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Fixes: eba8ff66 ("xprtrdma: Move credit update to RPC . . .")
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
      9b1dcbc8
  3. 06 2月, 2015 1 次提交
  4. 31 1月, 2015 1 次提交
  5. 30 1月, 2015 20 次提交
  6. 16 1月, 2015 4 次提交
    • C
      svcrdma: Handle additional inline content · a97c331f
      Chuck Lever 提交于
      Most NFS RPCs place their large payload argument at the end of the
      RPC header (eg, NFSv3 WRITE). For NFSv3 WRITE and SYMLINK, RPC/RDMA
      sends the complete RPC header inline, and the payload argument in
      the read list. Data in the read list is the last part of the XDR
      stream.
      
      One important case is not like this, however. NFSv4 COMPOUND is a
      counted array of operations. A WRITE operation, with its large data
      payload, can appear in the middle of the compound's operations
      array. Thus NFSv4 WRITE compounds can have header content after the
      WRITE payload.
      
      The Linux client, for example, performs an NFSv4 WRITE like this:
      
        { PUTFH, WRITE, GETATTR }
      
      Though RFC 5667 is not precise about this, the proper way to convey
      this compound is to place the GETATTR inline, _after_ the front of
      the RPC header. The receiver inserts the read list payload into the
      XDR stream after the initial WRITE arguments, and before the GETATTR
      operation, thanks to the value of the read list "position" field.
      
      The Linux client currently sends the GETATTR at the end of the
      RPC/RDMA read list, which is incorrect. It will be corrected in the
      future.
      
      The Linux server currently rejects NFSv4 compounds with inline
      content after the read list. For the above NFSv4 WRITE compound, the
      NFS compound header indicates there are three operations, but the
      server finds nonsense when it looks in the XDR stream for the third
      operation, and the compound fails with OP_ILLEGAL.
      
      Move trailing inline content to the end of the XDR buffer's page
      list. This presents incoming NFSv4 WRITE compounds to NFSD in the
      same way the socket transport does.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Reviewed-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      a97c331f
    • C
      svcrdma: Move read list XDR round-up logic · fcbeced5
      Chuck Lever 提交于
      This is a pre-requisite for a subsequent patch.
      
      Read list XDR round-up needs to be done _before_ additional inline
      content is copied to the end of the XDR buffer's page list. Move
      the logic added by commit e560e3b5 ("svcrdma: Add zero padding
      if the client doesn't send it").
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Reviewed-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      fcbeced5
    • C
      svcrdma: Support RDMA_NOMSG requests · 0b056c22
      Chuck Lever 提交于
      Currently the Linux server can not decode RDMA_NOMSG type requests.
      Operations whose length exceeds the fixed size of RDMA SEND buffers,
      like large NFSv4 CREATE(NF4LNK) operations, must be conveyed via
      RDMA_NOMSG.
      
      For an RDMA_MSG type request, the client sends the RPC/RDMA, RPC
      headers, and some or all of the NFS arguments via RDMA SEND.
      
      For an RDMA_NOMSG type request, the client sends just the RPC/RDMA
      header via RDMA SEND. The request's read list contains elements for
      the entire RPC message, including the RPC header.
      
      NFSD expects the RPC/RMDA header and RPC header to be contiguous in
      page zero of the XDR buffer. Add logic in the RDMA READ path to make
      the read list contents land where the server prefers, when the
      incoming message is a type RDMA_NOMSG message.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Reviewed-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      0b056c22
    • C
      svcrdma: rc_position sanity checking · 61edbcb7
      Chuck Lever 提交于
      An RPC/RDMA client may send large RPC arguments via a read
      list. This is a list of scatter/gather elements which convey
      RPC call arguments too large to fit in a small RDMA SEND.
      
      Each entry in the read list has a "position" field, whose value is
      the byte offset in the XDR stream where the data in that entry is to
      be inserted. Entries which share the same "position" value make up
      the same RPC argument. The receiver inserts entries with the same
      position field value in list order into the XDR stream.
      
      Currently the Linux NFS/RDMA server cannot handle receiving read
      chunks in more than one position, mostly because no current client
      sends read lists with elements in more than one position. As a
      sanity check, ensure that all received chunks have the same
      "rc_position."
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Reviewed-by: NSteve Wise <swise@opengridcomputing.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      61edbcb7