All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Hansen <dave@sr71.net>
To: unlisted-recipients:; (no To-header on input)
Cc: john@johnmccutchan.com, rlove@rlove.org, eparis@parisplace.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] inotify: actually check for invalid bits in sys_inotify_add_watch()
Date: Wed, 9 Sep 2015 14:59:55 -0700	[thread overview]
Message-ID: <55F0ABDB.7040509@sr71.net> (raw)
In-Reply-To: <20150630173603.D986EDB7@viggo.jf.intel.com>

On 06/30/2015 10:36 AM, Dave Hansen wrote:
> From: Dave Hansen <dave.hansen@linux.intel.com>
> 
> The comment here says that it is checking for invalid bits.  But,
> the mask is *actually* checking to ensure that _any_ valid bit
> is set, which is quite different.
> 
> Add the actual check which was intended.  Retain the existing
> check because it actually does something useful: ensure that some
> inotify bits are being added to the watch.  Plus, this is
> existing behavior which would be nice to preserve.
> 
> I did a quick sniff test that inotify functions and that my
> 'inotify-tools' package passes 'make check'.

Did anybody have any comments on this patch?  Who picks up inotify patches?

>  b/fs/notify/inotify/inotify_user.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff -puN fs/notify/inotify/inotify_user.c~inotify-EINVAL-on-invalid-bit fs/notify/inotify/inotify_user.c
> --- a/fs/notify/inotify/inotify_user.c~inotify-EINVAL-on-invalid-bit	2015-06-26 13:33:30.277219285 -0700
> +++ b/fs/notify/inotify/inotify_user.c	2015-06-26 13:35:19.026122033 -0700
> @@ -707,6 +707,9 @@ SYSCALL_DEFINE3(inotify_add_watch, int,
>  	unsigned flags = 0;
>  
>  	/* don't allow invalid bits: we don't want flags set */
> +	if (unlikely(mask & ~ALL_INOTIFY_BITS))
> +		return -EINVAL;
> +	/* require at least one valid bit set in the mask */
>  	if (unlikely(!(mask & ALL_INOTIFY_BITS)))
>  		return -EINVAL;
>  
> _
> 


  reply	other threads:[~2015-09-09 22:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 17:36 [PATCH] inotify: actually check for invalid bits in sys_inotify_add_watch() Dave Hansen
2015-09-09 21:59 ` Dave Hansen [this message]
2015-09-09 22:37   ` Josh Boyer
2015-09-09 23:16   ` Eric Paris
2015-09-09 23:32     ` Dave Hansen
2015-09-10 20:49       ` Andrew Morton
2015-09-21 11:29         ` Andrey Wagin

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=55F0ABDB.7040509@sr71.net \
    --to=dave@sr71.net \
    --cc=eparis@parisplace.org \
    --cc=john@johnmccutchan.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rlove@rlove.org \
    --cc=stable@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 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.