Commit 95193044 authored by Dmitry Eremin's avatar Dmitry Eremin Committed by Greg Kroah-Hartman

staging: lustre: fix conctl.c issues found by Klocwork Insight tool

The function lst_test_add_ioctl is always copying lstio_tes_param
from userland even if the user doesn't send this data to LNet
selftest. Only consider lstio_tes_param data if lstio_tes_param_len
is not zero.
Signed-off-by: default avatarDmitry Eremin <dmitry.eremin@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629
Reviewed-on: http://review.whamcloud.com/9386Reviewed-by: default avatarJohn L. Hammond <john.hammond@intel.com>
Reviewed-by: default avatarIsaac Huang <he.huang@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 72159bb6
...@@ -761,6 +761,11 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) ...@@ -761,6 +761,11 @@ static int lst_test_add_ioctl(lstio_test_args_t *args)
LIBCFS_ALLOC(param, args->lstio_tes_param_len); LIBCFS_ALLOC(param, args->lstio_tes_param_len);
if (!param) if (!param)
goto out; goto out;
if (copy_from_user(param, args->lstio_tes_param,
args->lstio_tes_param_len)) {
rc = -EFAULT;
goto out;
}
} }
rc = -EFAULT; rc = -EFAULT;
...@@ -769,9 +774,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) ...@@ -769,9 +774,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args)
copy_from_user(src_name, args->lstio_tes_sgrp_name, copy_from_user(src_name, args->lstio_tes_sgrp_name,
args->lstio_tes_sgrp_nmlen) || args->lstio_tes_sgrp_nmlen) ||
copy_from_user(dst_name, args->lstio_tes_dgrp_name, copy_from_user(dst_name, args->lstio_tes_dgrp_name,
args->lstio_tes_dgrp_nmlen) || args->lstio_tes_dgrp_nmlen))
copy_from_user(param, args->lstio_tes_param,
args->lstio_tes_param_len))
goto out; goto out;
rc = lstcon_test_add(batch_name, args->lstio_tes_type, rc = lstcon_test_add(batch_name, args->lstio_tes_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment