Hi, Greg

This should in 3.4-stable also, but this patch failed at a error, i'll send a
new one for 3.4-stable.

                                Hongjiang

On 2013/5/4 7:02, [email protected] wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     inotify: invalid mask should return a error number but not set it
> 
> to the 3.8-stable tree which can be found at:
>     
> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>      inotify-invalid-mask-should-return-a-error-number-but-not-set-it.patch
> and it can be found in the queue-3.8 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <[email protected]> know about it.
> 
> 
>>From 04df32fa10ab9a6f0643db2949d42efc966bc844 Mon Sep 17 00:00:00 2001
> From: Zhao Hongjiang <[email protected]>
> Date: Tue, 30 Apr 2013 15:26:46 -0700
> Subject: inotify: invalid mask should return a error number but not set it
> 
> From: Zhao Hongjiang <[email protected]>
> 
> commit 04df32fa10ab9a6f0643db2949d42efc966bc844 upstream.
> 
> When we run the crackerjack testsuite, the inotify_add_watch test is
> stalled.
> 
> This is caused by the invalid mask 0 - the task is waiting for the event
> but it never comes.  inotify_add_watch() should return -EINVAL as it did
> before commit 676a0675cf92 ("inotify: remove broken mask checks causing
> unmount to be EINVAL").  That commit removes the invalid mask check, but
> that check is needed.
> 
> Check the mask's ALL_INOTIFY_BITS before the inotify_arg_to_mask() call.
> If none are set, just return -EINVAL.
> 
> Because IN_UNMOUNT is in ALL_INOTIFY_BITS, this change will not trigger
> the problem that above commit fixed.
> 
> [[email protected]: fix build]
> Signed-off-by: Zhao Hongjiang <[email protected]>
> Acked-by: Jim Somerville <[email protected]>
> Cc: Paul Gortmaker <[email protected]>
> Cc: Jerome Marchand <[email protected]>
> Cc: Eric Paris <[email protected]>
> Signed-off-by: Andrew Morton <[email protected]>
> Signed-off-by: Linus Torvalds <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> 
> ---
>  fs/notify/inotify/inotify_user.c |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> --- a/fs/notify/inotify/inotify_user.c
> +++ b/fs/notify/inotify/inotify_user.c
> @@ -574,7 +574,6 @@ static int inotify_update_existing_watch
>       int add = (arg & IN_MASK_ADD);
>       int ret;
>  
> -     /* don't allow invalid bits: we don't want flags set */
>       mask = inotify_arg_to_mask(arg);
>  
>       fsn_mark = fsnotify_find_inode_mark(group, inode);
> @@ -625,7 +624,6 @@ static int inotify_new_watch(struct fsno
>       struct idr *idr = &group->inotify_data.idr;
>       spinlock_t *idr_lock = &group->inotify_data.idr_lock;
>  
> -     /* don't allow invalid bits: we don't want flags set */
>       mask = inotify_arg_to_mask(arg);
>  
>       tmp_i_mark = kmem_cache_alloc(inotify_inode_mark_cachep, GFP_KERNEL);
> @@ -753,6 +751,10 @@ SYSCALL_DEFINE3(inotify_add_watch, int,
>       int ret;
>       unsigned flags = 0;
>  
> +     /* don't allow invalid bits: we don't want flags set */
> +     if (unlikely(!(mask & ALL_INOTIFY_BITS)))
> +             return -EINVAL;
> +
>       f = fdget(fd);
>       if (unlikely(!f.file))
>               return -EBADF;
> 
> 
> Patches currently in stable-queue which might be from 
> [email protected] are
> 
> queue-3.8/inotify-invalid-mask-should-return-a-error-number-but-not-set-it.patch
> 
> .
> 


--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to