]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
svcrdma: bound check rq_pages index in inline path
authorJoshua Rogers <linux@joshua.hu>
Fri, 7 Nov 2025 15:09:49 +0000 (10:09 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 8 Dec 2025 15:51:26 +0000 (10:51 -0500)
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: d7cc73972661 ("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>
net/sunrpc/xprtrdma/svc_rdma_rw.c

index e813e54633521ac7f7d1603c1a9db930e5a95a79..310de7a80be52a520f8c46be935d4004943a279f 100644 (file)
@@ -841,6 +841,9 @@ static int svc_rdma_copy_inline_range(struct svc_rqst *rqstp,
        for (page_no = 0; page_no < numpages; page_no++) {
                unsigned int page_len;
 
+               if (head->rc_curpage >= rqstp->rq_maxpages)
+                       return -EINVAL;
+
                page_len = min_t(unsigned int, remaining,
                                 PAGE_SIZE - head->rc_pageoff);