From: Christopher J. Morrone Date: Fri, 6 Jun 2014 01:02:43 +0000 (-0700) Subject: LU-5150 mdc: Handle empty but non-zero acl xattr X-Git-Tag: 2.6.0-RC1~79 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F20%2F10620%2F2;p=fs%2Flustre-release.git LU-5150 mdc: Handle empty but non-zero acl xattr 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. Change-Id: Ib4f623642b86db2c88923a27cd9e77c870f301af Signed-off-by: Christopher J. Morrone Reviewed-on: http://review.whamcloud.com/10620 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Lai Siyao Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index f9e2b09..4bee7c2 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -463,6 +463,8 @@ 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->mbo_aclsize); + if (acl == NULL) + RETURN(0); if (IS_ERR(acl)) { rc = PTR_ERR(acl); CERROR("convert xattr to acl: %d\n", rc);