Whamcloud - gitweb
LU-12140 lnet: adds checking msg len
[fs/lustre-release.git] / lnet / lnet / lib-md.c
index a3d0487..7737744 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, 2013, Intel Corporation.
+ * Copyright (c) 2012, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -335,6 +335,10 @@ 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;