From 39e69f576e494bf8efef128cf5772bc8882fe5c6 Mon Sep 17 00:00:00 2001 From: isaac Date: Thu, 24 Jul 2008 17:27:06 +0000 Subject: [PATCH] i=liangzhen,i=maxim,b=16022: - added more stringent parameter checks. --- lnet/lnet/lib-md.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lnet/lnet/lib-md.c b/lnet/lnet/lib-md.c index 228f7d6..27c7e07 100644 --- a/lnet/lnet/lib-md.c +++ b/lnet/lnet/lib-md.c @@ -220,11 +220,14 @@ LNetMDAttach(lnet_handle_me_t meh, lnet_md_t umd, LASSERT (the_lnet.ln_init); LASSERT (the_lnet.ln_refcount > 0); - + if ((umd.options & (LNET_MD_KIOV | LNET_MD_IOVEC)) != 0 && umd.length > LNET_MAX_IOV) /* too many fragments */ return -EINVAL; + if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) == 0) + return -EINVAL; + md = lnet_md_alloc(&umd); if (md == NULL) return -ENOMEM; @@ -266,11 +269,14 @@ LNetMDBind(lnet_md_t umd, lnet_unlink_t unlink, lnet_handle_md_t *handle) LASSERT (the_lnet.ln_init); LASSERT (the_lnet.ln_refcount > 0); - + if ((umd.options & (LNET_MD_KIOV | LNET_MD_IOVEC)) != 0 && umd.length > LNET_MAX_IOV) /* too many fragments */ return -EINVAL; + if ((umd.options & (LNET_MD_OP_GET | LNET_MD_OP_PUT)) != 0) + return -EINVAL; + md = lnet_md_alloc(&umd); if (md == NULL) return -ENOMEM; -- 1.8.3.1