[PATCH] inotify: Fix events with no pathname

From: Brian Rogers
Date: Fri Aug 28 2009 - 07:46:51 EST


When an event has no pathname, there's no need to pad it with a null byte and
therefore generate an inotify_event sized block of zeros. This fixes a
regression introduced by commit 0db501bd0610ee0c0aca84d927f90bcccd09e2bd where
my system wouldn't finish booting because some process was being confused by
this.

Signed-off-by: Brian Rogers <brian@xxxxxxxx>
---
fs/notify/inotify/inotify_user.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 0e781bc..d94ce8b 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -199,7 +199,10 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
/* round up event->name_len so it is a multiple of event_size
* plus an extra byte for the terminating '\0'.
*/
- name_len = roundup(event->name_len + 1, event_size);
+ if (event->name_len > 0)
+ name_len = roundup(event->name_len + 1, event_size);
+ else
+ name_len = 0;
inotify_event.len = name_len;

inotify_event.mask = inotify_mask_to_arg(event->mask);
--
1.6.3.3


--------------020605050003020006000308--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/