From: Matthew Bobrowski <repnop@google.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
Matthew Bobrowski <mbobrowski@mbobrowski.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fanotify: do not allow setting FAN_RENAME on non-dir
Date: Fri, 6 May 2022 13:49:33 +1000 [thread overview]
Message-ID: <YnSazY4pE3NXJq5H@google.com> (raw)
In-Reply-To: <20220506014626.191619-1-amir73il@gmail.com>
On Fri, May 06, 2022 at 04:46:26AM +0300, Amir Goldstein wrote:
> The desired sematics of this action are not clear, so for now deny
> this action. We may relax it when we decide on the semantics and
> implement them.
>
> Fixes: 8cc3b1ccd930 ("fanotify: wire up FAN_RENAME event")
> Link: https://lore.kernel.org/linux-fsdevel/20220505133057.zm5t6vumc4xdcnsg@quack3.lan/
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Thanks for sending this patch through Amir, LGTM.
Feel free to add:
Reviewed-by: Matthew Bobrowski <repnop@google.com>
> ---
> fs/notify/fanotify/fanotify_user.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index edad67d674dc..ae0c27fac651 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -1695,6 +1695,11 @@ static int do_fanotify_mark(int fanotify_fd, unsigned int flags, __u64 mask,
> else
> mnt = path.mnt;
>
> + /* FAN_RENAME is not allowed on non-dir (for now) */
> + ret = -EINVAL;
> + if (inode && (mask & FAN_RENAME) && !S_ISDIR(inode->i_mode))
> + goto path_put_and_out;
> +
> /* Mask out FAN_EVENT_ON_CHILD flag for sb/mount/non-dir marks */
> if (mnt || !S_ISDIR(inode->i_mode)) {
> mask &= ~FAN_EVENT_ON_CHILD;
> --
> 2.25.1
/M
next prev parent reply other threads:[~2022-05-06 3:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 1:46 [PATCH] fanotify: do not allow setting FAN_RENAME on non-dir Amir Goldstein
2022-05-06 3:49 ` Matthew Bobrowski [this message]
2022-05-06 9:12 ` Jan Kara
2022-05-07 5:57 ` Amir Goldstein
2022-05-07 7:55 ` Amir Goldstein
2022-05-09 9:44 ` Jan Kara
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=YnSazY4pE3NXJq5H@google.com \
--to=repnop@google.com \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=mbobrowski@mbobrowski.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 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.