From 80203fe305d733bf840af8f08d3490f7c474dbba Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 24 Jun 2013 21:05:55 -0700 Subject: [PATCH] 3.4-stable patches added patches: inotify-invalid-mask-should-return-a-error-number-but-not-set-it.patch --- ...return-a-error-number-but-not-set-it.patch | 68 +++++++++++++++++++ queue-3.4/series | 1 + 2 files changed, 69 insertions(+) create mode 100644 queue-3.4/inotify-invalid-mask-should-return-a-error-number-but-not-set-it.patch diff --git a/queue-3.4/inotify-invalid-mask-should-return-a-error-number-but-not-set-it.patch b/queue-3.4/inotify-invalid-mask-should-return-a-error-number-but-not-set-it.patch new file mode 100644 index 00000000000..d87bc5a551b --- /dev/null +++ b/queue-3.4/inotify-invalid-mask-should-return-a-error-number-but-not-set-it.patch @@ -0,0 +1,68 @@ +From 04df32fa10ab9a6f0643db2949d42efc966bc844 Mon Sep 17 00:00:00 2001 +From: Zhao Hongjiang +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 + +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. + +[akpm@linux-foundation.org: fix build] +Signed-off-by: Zhao Hongjiang +Acked-by: Jim Somerville +Cc: Paul Gortmaker +Cc: Jerome Marchand +Cc: Eric Paris +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + + +--- + 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 +@@ -577,7 +577,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); +@@ -628,7 +627,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); +@@ -757,6 +755,10 @@ SYSCALL_DEFINE3(inotify_add_watch, int, + int ret, fput_needed; + unsigned flags = 0; + ++ /* don't allow invalid bits: we don't want flags set */ ++ if (unlikely(!(mask & ALL_INOTIFY_BITS))) ++ return -EINVAL; ++ + filp = fget_light(fd, &fput_needed); + if (unlikely(!filp)) + return -EBADF; diff --git a/queue-3.4/series b/queue-3.4/series index 181a25da41c..ff990f461d0 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -24,3 +24,4 @@ bonding-rlb-mode-of-bond-should-not-alter-arp-originating-via-bridge.patch input-cyttsp-fix-memcpy-size-param.patch usb-serial-ti_usb_3410_5052-new-device-id-for-abbot-strip-port-cable.patch target-iscsi-don-t-corrupt-bh_count-in-iscsit_stop_time2retain_timer.patch +inotify-invalid-mask-should-return-a-error-number-but-not-set-it.patch -- 2.47.3