From patchwork Thu Jul 29 08:27:16 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miao Xie X-Patchwork-Id: 115006 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6T94nvq028569 for ; Thu, 29 Jul 2010 09:04:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755152Ab0G2JEr (ORCPT ); Thu, 29 Jul 2010 05:04:47 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:54415 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754638Ab0G2JEq (ORCPT ); Thu, 29 Jul 2010 05:04:46 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 7CF4717013F; Thu, 29 Jul 2010 17:04:44 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o6T91j2L016066; Thu, 29 Jul 2010 17:01:46 +0800 Received: from [10.167.141.211] (unknown [10.167.141.211]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 10E8714C00A; Thu, 29 Jul 2010 17:05:23 +0800 (CST) Message-ID: <4C513B64.6020805@cn.fujitsu.com> Date: Thu, 29 Jul 2010 16:27:16 +0800 From: Miao Xie Reply-To: miaox@cn.fujitsu.com User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100413 Fedora/3.0.4-2.fc13 Thunderbird/3.0.4 MIME-Version: 1.0 To: Chris Mason , Yan Zheng CC: Linux Btrfs , Linux Kernel Subject: [PATCH 2/7] btrfs/acl: fix btrfs_xattr_acl_set() Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 29 Jul 2010 09:04:50 +0000 (UTC) diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 2f4f65a..bb35580 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -169,16 +169,17 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name, if (value) { acl = posix_acl_from_xattr(value, size); - if (acl == NULL) { - value = NULL; - size = 0; - } else if (IS_ERR(acl)) { + if (acl) { + ret = posix_acl_valid(acl); + if (ret) + goto out; + } else if (IS_ERR(acl)) return PTR_ERR(acl); - } } ret = btrfs_set_acl(NULL, dentry->d_inode, acl, type); +out: posix_acl_release(acl); return ret;