From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753412AbdA2Abi (ORCPT ); Sat, 28 Jan 2017 19:31:38 -0500 Received: from [160.91.203.10] ([160.91.203.10]:49074 "EHLO smtp1.ccs.ornl.gov" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752551AbdA2Ab3 (ORCPT ); Sat, 28 Jan 2017 19:31:29 -0500 From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Oleg Drokin Cc: Linux Kernel Mailing List , Lustre Development List , James Simmons Subject: [PATCH 60/60] staging: lustre: libcfs: fix minimum size check for libcfs ioctl Date: Sat, 28 Jan 2017 19:05:28 -0500 Message-Id: <1485648328-2141-61-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> References: <1485648328-2141-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The check for the smallest ioctl data in libcfs_ioctl_getdata() is incorrect. Instead of checking against struct libcfs_ioctl_data compare the size to struct libcfs_ioctl_hdr. Reported-by: Doug Oucharek Signed-off-by: James Simmons --- drivers/staging/lustre/lnet/libcfs/linux/linux-module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c index 3f5d58b..bda6c16 100644 --- a/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c +++ b/drivers/staging/lustre/lnet/libcfs/linux/linux-module.c @@ -134,7 +134,7 @@ int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp, return -EINVAL; } - if (hdr.ioc_len < sizeof(struct libcfs_ioctl_data)) { + if (hdr.ioc_len < sizeof(hdr)) { CERROR("libcfs ioctl: user buffer too small for ioctl\n"); return -EINVAL; } -- 1.8.3.1