rpms/kernel/devel linux-2.6-inotify-accounting.patch, NONE, 1.1 kernel.spec, 1.1751, 1.1752

Eric Paris eparis at fedoraproject.org
Fri Aug 28 17:26:08 UTC 2009


Author: eparis

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv14303

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-inotify-accounting.patch 
Log Message:
* Fri Aug 28 2009 Eric Paris <eparis at redhat.com>
- fix inotify length accounting and send inotify events


linux-2.6-inotify-accounting.patch:
 inotify_user.c |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

--- NEW FILE linux-2.6-inotify-accounting.patch ---
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 0e781bc..dcd2040 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -154,7 +154,8 @@ static struct fsnotify_event *get_one_event(struct fsnotify_group *group,
 
 	event = fsnotify_peek_notify_event(group);
 
-	event_size += roundup(event->name_len, event_size);
+	if (event->name_len)
+		event_size += roundup(event->name_len + 1, event_size);
 
 	if (event_size > count)
 		return ERR_PTR(-EINVAL);
@@ -180,7 +181,7 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
 	struct fsnotify_event_private_data *fsn_priv;
 	struct inotify_event_private_data *priv;
 	size_t event_size = sizeof(struct inotify_event);
-	size_t name_len;
+	size_t name_len = 0;
 
 	/* we get the inotify watch descriptor from the event private data */
 	spin_lock(&event->lock);
@@ -196,10 +197,12 @@ static ssize_t copy_event_to_user(struct fsnotify_group *group,
 		inotify_free_event_priv(fsn_priv);
 	}
 
-	/* round up event->name_len so it is a multiple of event_size
+	/*
+	 * 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)
+		name_len = roundup(event->name_len + 1, event_size);
 	inotify_event.len = name_len;
 
 	inotify_event.mask = inotify_mask_to_arg(event->mask);
@@ -325,8 +328,9 @@ static long inotify_ioctl(struct file *file, unsigned int cmd,
 		list_for_each_entry(holder, &group->notification_list, event_list) {
 			event = holder->event;
 			send_len += sizeof(struct inotify_event);
-			send_len += roundup(event->name_len,
-					     sizeof(struct inotify_event));
+			if (event->name_len)
+				send_len += roundup(event->name_len + 1,
+						sizeof(struct inotify_event));
 		}
 		mutex_unlock(&group->notification_mutex);
 		ret = put_user(send_len, (int __user *) p);
@@ -587,6 +591,10 @@ retry:
 	/* match the ref from fsnotify_init_markentry() */
 	fsnotify_put_mark(&tmp_ientry->fsn_entry);
 
+	/* if this mark added a new event update the group mask */
+	if (mask & ~group->mask)
+		fsnotify_recalc_group_mask(group);
+
 out_err:
 	if (ret < 0)
 		kmem_cache_free(inotify_inode_mark_cachep, tmp_ientry);


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1751
retrieving revision 1.1752
diff -u -p -r1.1751 -r1.1752
--- kernel.spec	28 Aug 2009 16:46:16 -0000	1.1751
+++ kernel.spec	28 Aug 2009 17:26:08 -0000	1.1752
@@ -724,6 +724,7 @@ Patch11010: via-hwmon-temp-sensor.patch
 # patches headed upstream
 Patch12010: linux-2.6-dell-laptop-rfkill-fix.patch
 Patch12011: linux-2.6-block-silently-error-unsupported-empty-barriers-too.patch
+Patch12012: linux-2.6-inotify-accounting.patch
 
 %endif
 
@@ -1338,6 +1339,7 @@ ApplyPatch linux-2.6-silence-acpi-blackl
 #ApplyPatch linux-2.6-revert-dvb-net-kabi-change.patch
 
 # Patches headed upstream
+ApplyPatch linux-2.6-inotify-accounting.patch
 
 # END OF PATCH APPLICATIONS
 
@@ -2005,6 +2007,9 @@ fi
 # and build.
 
 %changelog
+* Fri Aug 28 2009 Eric Paris <eparis at redhat.com>
+- fix inotify length accounting and send inotify events
+
 * Fri Aug 28 2009 David Woodhouse <David.Woodhouse at intel.com>
 - Enable Solos DSL driver
 




More information about the fedora-extras-commits mailing list