1. 25 8月, 2017 1 次提交
  2. 14 7月, 2017 7 次提交
  3. 13 7月, 2017 1 次提交
    • C
      sunrpc: Allocate up to RPCSVC_MAXPAGES per svc_rqst · 8c6ae498
      Chuck Lever 提交于
      svcrdma needs 259 pages allocated to receive 1MB NFSv4.0 WRITE requests:
      
       - 1 page for the transport header and head iovec
       - 256 pages for the data payload
       - 1 page for the trailing GETATTR request (since NFSD XDR decoding
         does not look for a tail iovec, the GETATTR is stuck at the end
         of the rqstp->rq_arg.pages list)
       - 1 page for building the reply xdr_buf
      
      But RPCSVC_MAXPAGES is already 259 (on x86_64). The problem is that
      svc_alloc_arg never allocates that many pages. To address this:
      
      1. The final element of rq_pages always points to NULL. To
         accommodate up to 259 pages in rq_pages, add an extra element
         to rq_pages for the array termination sentinel.
      
      2. Adjust the calculation of "pages" to match how RPCSVC_MAXPAGES
         is calculated, so it can go up to 259. Bruce noted that the
         calculation assumes sv_max_mesg is a multiple of PAGE_SIZE,
         which might not always be true. I didn't change this assumption.
      
      3. Change the loop boundaries to allow 259 pages to be allocated.
      
      Additional clean-up: WARN_ON_ONCE adds an extra conditional branch,
      which is basically never taken. And there's no need to dump the
      stack here because svc_alloc_arg has only one caller.
      
      Keeping that NULL "array termination sentinel"; there doesn't appear to
      be any code that depends on it, only code in nfsd_splice_actor() which
      needs the 259th element to be initialized to *something*.  So it's
      possible we could just keep the array at 259 elements and drop that
      final NULL, but we're being conservative for now.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      8c6ae498
  4. 17 5月, 2017 1 次提交
  5. 15 5月, 2017 7 次提交
  6. 28 4月, 2017 1 次提交
  7. 26 4月, 2017 1 次提交
    • J
      nfsd: check for oversized NFSv2/v3 arguments · 51f56777
      J. Bruce Fields 提交于
      A client can append random data to the end of an NFSv2 or NFSv3 RPC call
      without our complaining; we'll just stop parsing at the end of the
      expected data and ignore the rest.
      
      Encoded arguments and replies are stored together in an array of pages,
      and if a call is too large it could leave inadequate space for the
      reply.  This is normally OK because NFS RPC's typically have either
      short arguments and long replies (like READ) or long arguments and short
      replies (like WRITE).  But a client that sends an incorrectly long reply
      can violate those assumptions.  This was observed to cause crashes.
      
      So, insist that the argument not be any longer than we expect.
      
      Also, several operations increment rq_next_page in the decode routine
      before checking the argument size, which can leave rq_next_page pointing
      well past the end of the page array, causing trouble later in
      svc_free_pages.
      
      As followup we may also want to rewrite the encoding routines to check
      more carefully that they aren't running off the end of the page array.
      Reported-by: NTuomas Haanpää <thaan@synopsys.com>
      Reported-by: NAri Kauppi <ari@synopsys.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      51f56777
  8. 25 2月, 2017 2 次提交
  9. 14 7月, 2016 1 次提交
  10. 05 4月, 2016 1 次提交
  11. 11 8月, 2015 7 次提交
  12. 23 1月, 2015 1 次提交
  13. 10 12月, 2014 9 次提交