From patchwork Tue May 18 00:50:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shi Weihua X-Patchwork-Id: 100282 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4I0p8MH027327 for ; Tue, 18 May 2010 00:51:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753591Ab0ERAui (ORCPT ); Mon, 17 May 2010 20:50:38 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:61553 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752559Ab0ERAui (ORCPT ); Mon, 17 May 2010 20:50:38 -0400 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 4DC1C170118; Tue, 18 May 2010 08:50:36 +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 o4I0mZrJ003938; Tue, 18 May 2010 08:48:35 +0800 Received: from [10.167.141.106] (unknown [10.167.141.106]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id EB02910C00A; Tue, 18 May 2010 08:54:08 +0800 (CST) Message-ID: <4BF1E458.7060500@cn.fujitsu.com> Date: Tue, 18 May 2010 08:50:32 +0800 From: Shi Weihua User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.10) Gecko/20100512 Thunderbird/3.0.5 MIME-Version: 1.0 To: chris.mason@oracle.com, "Yan, Zheng" CC: linux-btrfs@vger.kernel.org, LKML Subject: [PATCH] btrfs: should add a permission check for setfacl 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]); Tue, 18 May 2010 00:51:09 +0000 (UTC) diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index da3133c..12d7be8 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -159,6 +159,9 @@ static int btrfs_xattr_set_acl(struct inode *inode, int type, int ret; struct posix_acl *acl = NULL; + if (!is_owner_or_cap(inode)) + return -EPERM; + if (value) { acl = posix_acl_from_xattr(value, size); if (acl == NULL) {