Whamcloud - gitweb
LU-12981 lnet: Check MTU accurately 96/36796/4
authorAlexey Lyashkov <c17817@cray.com>
Tue, 19 Nov 2019 14:00:42 +0000 (17:00 +0300)
committerOleg Drokin <green@whamcloud.com>
Sun, 1 Mar 2020 05:35:39 +0000 (05:35 +0000)
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 <c17817@cray.com>
Change-Id: Id3497e5f63470c24b2e51703fc564b02c9516aa6
Reviewed-on: https://review.whamcloud.com/36796
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/lib-md.c

index 99b1305..53a8557 100644 (file)
@@ -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);