RDS: make message size limit compliant with spec
RDS support max message size as 1M but the code doesn't check this in all cases. Patch fixes it for RDMA & non-RDMA and RDS MR size and its enforced irrespective of underlying transport. Signed-off-by: Avinash Repaka <avinash.repaka@oracle.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
This commit is contained in:

committed by
Santosh Shilimkar

parent
192a798f52
commit
f9fb69adb6
@@ -40,7 +40,6 @@
|
||||
/*
|
||||
* XXX
|
||||
* - build with sparse
|
||||
* - should we limit the size of a mr region? let transport return failure?
|
||||
* - should we detect duplicate keys on a socket? hmm.
|
||||
* - an rdma is an mlock, apply rlimit?
|
||||
*/
|
||||
@@ -200,6 +199,14 @@ static int __rds_rdma_map(struct rds_sock *rs, struct rds_get_mr_args *args,
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Restrict the size of mr irrespective of underlying transport
|
||||
* To account for unaligned mr regions, subtract one from nr_pages
|
||||
*/
|
||||
if ((nr_pages - 1) > (RDS_MAX_MSG_SIZE >> PAGE_SHIFT)) {
|
||||
ret = -EMSGSIZE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rdsdebug("RDS: get_mr addr %llx len %llu nr_pages %u\n",
|
||||
args->vec.addr, args->vec.bytes, nr_pages);
|
||||
|
||||
|
Reference in New Issue
Block a user