Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754401AbaADHHv (ORCPT ); Sat, 4 Jan 2014 02:07:51 -0500 Received: from mail-pa0-f53.google.com ([209.85.220.53]:55214 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753625AbaADHHR (ORCPT ); Sat, 4 Jan 2014 02:07:17 -0500 From: Peng Tao To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, "John L. Hammond" , Peng Tao , Andreas Dilger Subject: [PATCH v2 3/8] staging/lustre/llite: pass correct pointer to obd_iocontrol() Date: Sat, 4 Jan 2014 15:06:15 +0800 Message-Id: <1388819180-31538-4-git-send-email-bergwolf@gmail.com> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1388819180-31538-3-git-send-email-bergwolf@gmail.com> References: <1388819180-31538-1-git-send-email-bergwolf@gmail.com> <1388819180-31538-2-git-send-email-bergwolf@gmail.com> <1388819180-31538-3-git-send-email-bergwolf@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1822 Lines: 63 From: "John L. Hammond" In copy_and_ioctl() use the kernel space copy as the karg to obd_iocontrol(). Lustre-change: http://review.whamcloud.com/6274 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3283 Signed-off-by: John L. Hammond Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin Signed-off-by: Peng Tao Signed-off-by: Andreas Dilger --- drivers/staging/lustre/lustre/llite/dir.c | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c index 22d0acc9..1b217c8 100644 --- a/drivers/staging/lustre/lustre/llite/dir.c +++ b/drivers/staging/lustre/lustre/llite/dir.c @@ -1048,20 +1048,25 @@ progress: } -static int copy_and_ioctl(int cmd, struct obd_export *exp, void *data, int len) +static int copy_and_ioctl(int cmd, struct obd_export *exp, + const void __user *data, size_t size) { - void *ptr; + void *copy; int rc; - OBD_ALLOC(ptr, len); - if (ptr == NULL) + OBD_ALLOC(copy, size); + if (copy == NULL) return -ENOMEM; - if (copy_from_user(ptr, data, len)) { - OBD_FREE(ptr, len); - return -EFAULT; + + if (copy_from_user(copy, data, size)) { + rc = -EFAULT; + goto out; } - rc = obd_iocontrol(cmd, exp, len, data, NULL); - OBD_FREE(ptr, len); + + rc = obd_iocontrol(cmd, exp, size, copy, NULL); +out: + OBD_FREE(copy, size); + return rc; } -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/