All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xattr: always us is_posix_acl_xattr() helper
@ 2022-09-19  9:49 Christian Brauner
  2022-09-19 13:41 ` Seth Forshee
  2022-09-20  8:40 ` Christoph Hellwig
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Brauner @ 2022-09-19  9:49 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: Christian Brauner, Seth Forshee, Christoph Hellwig

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) <sforshee@kernel.org>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
---
 fs/xattr.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

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;

base-commit: b90cb1053190353cc30f0fef0ef1f378ccc063c5
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xattr: always us is_posix_acl_xattr() helper
  2022-09-19  9:49 [PATCH] xattr: always us is_posix_acl_xattr() helper Christian Brauner
@ 2022-09-19 13:41 ` Seth Forshee
  2022-09-20  8:40 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Seth Forshee @ 2022-09-19 13:41 UTC (permalink / raw)
  To: Christian Brauner; +Cc: linux-fsdevel, Christoph Hellwig

On Mon, Sep 19, 2022 at 11:49:14AM +0200, Christian Brauner wrote:
> 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) <sforshee@kernel.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>

Reviewed-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xattr: always us is_posix_acl_xattr() helper
  2022-09-19  9:49 [PATCH] xattr: always us is_posix_acl_xattr() helper Christian Brauner
  2022-09-19 13:41 ` Seth Forshee
@ 2022-09-20  8:40 ` Christoph Hellwig
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2022-09-20  8:40 UTC (permalink / raw)
  To: Christian Brauner; +Cc: linux-fsdevel, Seth Forshee, Christoph Hellwig

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-20  8:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-19  9:49 [PATCH] xattr: always us is_posix_acl_xattr() helper Christian Brauner
2022-09-19 13:41 ` Seth Forshee
2022-09-20  8:40 ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.