From: Viacheslav Dubeyko <slava@dubeyko.com>
To: Davy Felipe <davyfelipe34@gmail.com>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Yangtao Li <frank.li@vivo.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hfs: return -EPERM for unsupported setattr changes
Date: Thu, 17 Sep 2026 11:16:38 -0700 [thread overview]
Message-ID: <a99ac0a432911dd0a356d4fe95bae45973f23cb3.camel@dubeyko.com> (raw)
In-Reply-To: <20260916224016.266800-1-davyfelipe34@gmail.com>
On Wed, 2026-09-16 at 19:40 -0300, Davy Felipe wrote:
> hfs_inode_setattr() rejects unsupported UID, GID and mode changes,
> but returns the value stored in error when the filesystem is not
> mounted with the quiet option.
>
> At this point error is zero, as execution has already passed a
> successful setattr_prepare() call. As a result, unsupported attribute
> changes are incorrectly reported to userspace as successful even
> though the inode remains unchanged.
>
> Return -EPERM for these operations while preserving the existing
> behavior for quiet mounts.
>
> A chown test on an HFS image reproduces the problem. Without the fix,
> chown 1234:1234 returns success while ownership remains 0:0. With the
> fix, the same operation fails with EPERM and ownership remains
> unchanged.
>
> Signed-off-by: Davy Felipe <davyfelipe34@gmail.com>
> ---
> fs/hfs/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c
> index 2aef3c36a150..cce3a7bb95e9 100644
> --- a/fs/hfs/inode.c
> +++ b/fs/hfs/inode.c
> @@ -663,7 +663,7 @@ int hfs_inode_setattr(struct mnt_idmap *idmap,
> struct dentry *dentry,
> ((S_ISDIR(inode->i_mode) &&
> (attr->ia_mode != inode->i_mode)) ||
> (attr->ia_mode & ~HFS_VALID_MODE_BITS)))) {
> - return hsb->s_quiet ? 0 : error;
> + return hsb->s_quiet ? 0 : -EPERM;
> }
>
> /* map file permissions to the closest allowable permissions
> in HFS */
Looks good.
Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
Thanks,
Slava.
prev parent reply other threads:[~2026-09-17 18:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 22:40 Davy Felipe
2026-09-17 18:16 ` Viacheslav Dubeyko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a99ac0a432911dd0a356d4fe95bae45973f23cb3.camel@dubeyko.com \
--to=slava@dubeyko.com \
--cc=davyfelipe34@gmail.com \
--cc=frank.li@vivo.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®