Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755838AbcCBWCn (ORCPT ); Wed, 2 Mar 2016 17:02:43 -0500 Received: from smtp1.ccs.ornl.gov ([160.91.199.38]:59318 "EHLO smtp1.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755531AbcCBWCk (ORCPT ); Wed, 2 Mar 2016 17:02:40 -0500 From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Cc: Linux Kernel Mailing List , Lustre Development List , Dmitry Eremin Subject: [PATCH 14/27] staging: lustre: fix conctl.c issues found by Klocwork Insight tool Date: Wed, 2 Mar 2016 17:01:57 -0500 Message-Id: <1456956130-6110-15-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1456956130-6110-1-git-send-email-jsimmons@infradead.org> References: <1456956130-6110-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1700 Lines: 46 From: Dmitry Eremin 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: Dmitry Eremin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4629 Reviewed-on: http://review.whamcloud.com/9386 Reviewed-by: John L. Hammond Reviewed-by: Isaac Huang Reviewed-by: Oleg Drokin --- drivers/staging/lustre/lnet/selftest/conctl.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c b/drivers/staging/lustre/lnet/selftest/conctl.c index 90b7771..714d14b 100644 --- a/drivers/staging/lustre/lnet/selftest/conctl.c +++ b/drivers/staging/lustre/lnet/selftest/conctl.c @@ -761,6 +761,11 @@ static int lst_test_add_ioctl(lstio_test_args_t *args) LIBCFS_ALLOC(param, args->lstio_tes_param_len); if (!param) goto out; + if (copy_from_user(param, args->lstio_tes_param, + args->lstio_tes_param_len)) { + rc = -EFAULT; + goto out; + } } rc = -EFAULT; @@ -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, args->lstio_tes_sgrp_nmlen) || copy_from_user(dst_name, args->lstio_tes_dgrp_name, - args->lstio_tes_dgrp_nmlen) || - copy_from_user(param, args->lstio_tes_param, - args->lstio_tes_param_len)) + args->lstio_tes_dgrp_nmlen)) goto out; rc = lstcon_test_add(batch_name, args->lstio_tes_type, -- 1.7.1