From: Alexey Lyashkov Date: Tue, 19 Nov 2019 14:00:42 +0000 (+0300) Subject: LU-12981 lnet: Check MTU accurately X-Git-Tag: 2.13.53~171 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=3f80976445f7e9662b81d11db6136efe5d501bb4;p=fs%2Flustre-release.git LU-12981 lnet: Check MTU accurately The existing check for MTU lacks checking for the KIOV/IOV cases, and false positive triggered for very large incomming buffer. Cray-bug-id: LUS-7948 Signed-off-by: Alexey Lyashkov Change-Id: Id3497e5f63470c24b2e51703fc564b02c9516aa6 Reviewed-on: https://review.whamcloud.com/36796 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Serguei Smirnov Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/lib-md.c b/lnet/lnet/lib-md.c index 99b1305..53a8557 100644 --- a/lnet/lnet/lib-md.c +++ b/lnet/lnet/lib-md.c @@ -330,10 +330,6 @@ lnet_md_validate(struct lnet_md *umd) CERROR("Invalid option: too many fragments %u, %d max\n", umd->length, LNET_MAX_IOV); return -EINVAL; - } else if (umd->length > LNET_MTU) { - CERROR("Invalid length: too big fragment size %u, %d max\n", - umd->length, LNET_MTU); - return -EINVAL; } return 0; @@ -467,6 +463,13 @@ LNetMDBind(struct lnet_md umd, enum lnet_unlink unlink, if (rc != 0) goto out_free; + if (md->md_length > LNET_MTU) { + CERROR("Invalid length: too big transfer size %u, %d max\n", + md->md_length, LNET_MTU); + rc = -EINVAL; + goto out_free; + } + cpt = lnet_res_lock_current(); rc = lnet_md_link(md, umd.eq_handle, cpt);