From: Jerome Marchand <jmarchan@redhat.com>
To: Eric Paris <eparis@parisplace.org>, Robert Love <rlove@rlove.org>,
John McCutchan <john@johnmccutchan.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: RFC][PATCH] inotify: Fix mask checks
Date: Wed, 19 May 2010 13:52:45 +0200 [thread overview]
Message-ID: <4BF3D10D.2040902@redhat.com> (raw)
The mask checks in inotify_update_existing_watch() and
inotify_new_watch() are useless because inotify_arg_to_mask() sets
FS_IN_IGNORED and FS_EVENT_ON_CHILD bits anyway. We should either
test that at least one of the user events is set (see the untested
patch below) or remove the test completely if we consider OK to only
watch for the implicit events (IN_UNMOUNT, IN_Q_OVERFLOW and
IN_IGNORED).
Btw, is it necessary to set IN_IGNORED in inotify_arg_to_mask()?
Wouldn't the IN_IGNORED event be send anyway, whatever that bit is set
or not in the mask?
Thanks,
Jerome
---
From: Jerome Marchand <jmarchan@redhat.com>
Currently, the mask checks in inotify_update_existing_watch() and
inotify_new_watch() are useless because inotify_arg_to_mask() sets
FS_IN_IGNORED and FS_EVENT_ON_CHILD bits anyway.
Check that at least one user event is set.
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
---
inotify_user.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index e46ca68..a95ca25 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -467,7 +467,7 @@ static int inotify_update_existing_watch(struct fsnotify_group *group,
/* don't allow invalid bits: we don't want flags set */
mask = inotify_arg_to_mask(arg);
- if (unlikely(!mask))
+ if (unlikely(!(mask & IN_ALL_EVENTS)))
return -EINVAL;
spin_lock(&inode->i_lock);
@@ -527,7 +527,7 @@ static int inotify_new_watch(struct fsnotify_group *group,
/* don't allow invalid bits: we don't want flags set */
mask = inotify_arg_to_mask(arg);
- if (unlikely(!mask))
+ if (unlikely(!(mask & IN_ALL_EVENTS)))
return -EINVAL;
tmp_ientry = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL);
reply other threads:[~2010-05-19 11:52 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4BF3D10D.2040902@redhat.com \
--to=jmarchan@redhat.com \
--cc=eparis@parisplace.org \
--cc=john@johnmccutchan.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rlove@rlove.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