From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752202AbbCZByE (ORCPT ); Wed, 25 Mar 2015 21:54:04 -0400 Received: from linuxhacker.ru ([217.76.32.60]:39163 "EHLO fiona.linuxhacker.ru" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751797AbbCZBxw (ORCPT ); Wed, 25 Mar 2015 21:53:52 -0400 From: green@linuxhacker.ru To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger Cc: Linux Kernel Mailing List , "Christopher J. Morrone" , Oleg Drokin Subject: [PATCH 02/10] staging/lustre/mdc: Handle empty but non-zero acl xattr Date: Wed, 25 Mar 2015 21:53:18 -0400 Message-Id: <1427334806-31466-3-git-send-email-green@linuxhacker.ru> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1427334806-31466-1-git-send-email-green@linuxhacker.ru> References: <1427334806-31466-1-git-send-email-green@linuxhacker.ru> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Christopher J. Morrone" We have found that posix_acl_access can have a value of \002\000\000\000. In that case body->aclsize is non-zero, but the there are no actuall acls stored in the xattr. In mdc_unpack_acl(), it only checks IS_ERR() on the pointer returned by posix_acl_from_xattr(), it does not check for NULL. Because of the above situation, the xattr aclsize can be non-zero, but posic_acl_from_xattr() still returns NULL. Passing NULL to posix_acl_valid() crashes the kernel. We add a check to properly handle the NULL return value. Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/11989 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5150 Reviewed-by: Fan Yong Reviewed-by: Bob Glossman Signed-off-by: Oleg Drokin --- drivers/staging/lustre/lustre/mdc/mdc_request.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index c04eec5..f8ef5fe 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -481,6 +481,9 @@ static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md) return -EPROTO; acl = posix_acl_from_xattr(&init_user_ns, buf, body->aclsize); + if (acl == NULL) + return 0; + if (IS_ERR(acl)) { rc = PTR_ERR(acl); CERROR("convert xattr to acl: %d\n", rc); -- 2.1.0