From patchwork Mon Sep 19 09:49:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 12979851 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1605BC54EE9 for ; Mon, 19 Sep 2022 09:49:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbiISJtg (ORCPT ); Mon, 19 Sep 2022 05:49:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbiISJtd (ORCPT ); Mon, 19 Sep 2022 05:49:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8215BD5 for ; Mon, 19 Sep 2022 02:49:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3785EB818A2 for ; Mon, 19 Sep 2022 09:49:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A649EC433C1; Mon, 19 Sep 2022 09:49:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663580965; bh=jqOw/lhGPxoVYYIIrji6Poc8TGW9Aq5/f8L0fS1L9xI=; h=From:To:Cc:Subject:Date:From; b=T8eCNdeEzrvaYOE6+0M+Cjb7wrZtejvZLrE3T4umwjvmsSPnVJC1VzuLw6P9imFEV Yrq7S4HgUzxn0gWgCUdSjNOIRnNP20NQoymJirTpe9doxqbbeAdqmgkZX9j4kdFLIt ArRIKybhdZMlQYcUnrCgqqSjA0udGVN/+ZlrtA4UvIDyKHhsbD7RYclUcz7pkyQfMu gRoqM2PnpPeUkwVwuzvNeXBIhBvY5cgLUMMLRkdn6/yEgjh7BqwWLruRyb59qTnfOF ZJLNOipqwnG1qtYz3KFX2cjV8+FBxs1Mz1Ap2eaHoAcSlqpAue1bnG1uvSJjMMhFoy XB5Px4Mgx/rqw== From: Christian Brauner To: linux-fsdevel@vger.kernel.org Cc: Christian Brauner , Seth Forshee , Christoph Hellwig Subject: [PATCH] xattr: always us is_posix_acl_xattr() helper Date: Mon, 19 Sep 2022 11:49:14 +0200 Message-Id: <20220919094914.1174728-1-brauner@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org The is_posix_acl_xattr() helper was added in 0c5fd887d2bb ("acl: move idmapped mount fixup into vfs_{g,s}etxattr()") to remove the open-coded checks for POSIX ACLs. We missed to update two locations. Switch them to use the helper. Cc: Seth Forshee (DigitalOcean) Cc: Christoph Hellwig Signed-off-by: Christian Brauner (Microsoft) Reviewed-by: Seth Forshee (DigitalOcean) Reviewed-by: Christoph Hellwig --- fs/xattr.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) base-commit: b90cb1053190353cc30f0fef0ef1f378ccc063c5 diff --git a/fs/xattr.c b/fs/xattr.c index a1f4998bc6be..01aa45cea83c 100644 --- a/fs/xattr.c +++ b/fs/xattr.c @@ -587,9 +587,7 @@ int setxattr_copy(const char __user *name, struct xattr_ctx *ctx) static void setxattr_convert(struct user_namespace *mnt_userns, struct dentry *d, struct xattr_ctx *ctx) { - if (ctx->size && - ((strcmp(ctx->kname->name, XATTR_NAME_POSIX_ACL_ACCESS) == 0) || - (strcmp(ctx->kname->name, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))) + if (ctx->size && is_posix_acl_xattr(ctx->kname->name)) posix_acl_fix_xattr_from_user(ctx->kvalue, ctx->size); } @@ -705,8 +703,7 @@ do_getxattr(struct user_namespace *mnt_userns, struct dentry *d, error = vfs_getxattr(mnt_userns, d, kname, ctx->kvalue, ctx->size); if (error > 0) { - if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) || - (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0)) + if (is_posix_acl_xattr(kname)) posix_acl_fix_xattr_to_user(ctx->kvalue, error); if (ctx->size && copy_to_user(ctx->value, ctx->kvalue, error)) error = -EFAULT;