Skip to content

Commit d1bea0c

Browse files
Joshua Rogerschucklever
authored andcommitted
svcrdma: bound check rq_pages index in inline path
svc_rdma_copy_inline_range indexed rqstp->rq_pages[rc_curpage] without verifying rc_curpage stays within the allocated page array. Add guards before the first use and after advancing to a new page. Fixes: d7cc739 ("svcrdma: support multiple Read chunks per RPC") Cc: stable@vger.kernel.org Signed-off-by: Joshua Rogers <linux@joshua.hu> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 9497202 commit d1bea0c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/sunrpc/xprtrdma/svc_rdma_rw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,9 @@ static int svc_rdma_copy_inline_range(struct svc_rqst *rqstp,
841841
for (page_no = 0; page_no < numpages; page_no++) {
842842
unsigned int page_len;
843843

844+
if (head->rc_curpage >= rqstp->rq_maxpages)
845+
return -EINVAL;
846+
844847
page_len = min_t(unsigned int, remaining,
845848
PAGE_SIZE - head->rc_pageoff);
846849

0 commit comments

Comments
 (0)