From patchwork Thu Oct 8 15:33:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 7353841 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6514BBEEA4 for ; Thu, 8 Oct 2015 15:33:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A0DAD20808 for ; Thu, 8 Oct 2015 15:33:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6AA620803 for ; Thu, 8 Oct 2015 15:33:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934356AbbJHPdb (ORCPT ); Thu, 8 Oct 2015 11:33:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47594 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934296AbbJHPda (ORCPT ); Thu, 8 Oct 2015 11:33:30 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 396098EA43; Thu, 8 Oct 2015 15:33:30 +0000 (UTC) Received: from nux.home.com (vpn1-6-243.ams2.redhat.com [10.36.6.243]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t98FXRga025177; Thu, 8 Oct 2015 11:33:28 -0400 From: Andreas Gruenbacher To: Alexander Viro , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH] vfs: Check attribute names in posix acl xattr handers Date: Thu, 8 Oct 2015 17:33:23 +0200 Message-Id: <1444318403-21985-1-git-send-email-agruenba@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The get and set operations of the posix acl xattr handlers failed to check the attribute names, so all names with "system.posix_acl_access" or "system.posix_acl_default" as a prefix were accepted. Reject invalid names from now on. Signed-off-by: Andreas Gruenbacher --- fs/posix_acl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 4fb17de..b1a66e8 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -768,6 +768,8 @@ posix_acl_xattr_get(struct dentry *dentry, const char *name, struct posix_acl *acl; int error; + if (strcmp(name, "") != 0) + return -EINVAL; if (!IS_POSIXACL(d_backing_inode(dentry))) return -EOPNOTSUPP; if (d_is_symlink(dentry)) @@ -793,6 +795,8 @@ posix_acl_xattr_set(struct dentry *dentry, const char *name, struct posix_acl *acl = NULL; int ret; + if (strcmp(name, "") != 0) + return -EINVAL; if (!IS_POSIXACL(inode)) return -EOPNOTSUPP; if (!inode->i_op->set_acl)