r2707 - in trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian: . patches patches/series

Andres Salomon dilinger-guest@costa.debian.org
Mon, 14 Mar 2005 11:17:57 +0100


Author: dilinger-guest
Date: 2005-03-14 11:17:56 +0100 (Mon, 14 Mar 2005)
New Revision: 2707

Added:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/143-sysfs_write_file_signedness_problem.dpatch
Modified:
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
   trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-14
Log:
  * 143-sysfs_write_file_signedness_problem.dpatch
    sysfs_write_file assigns the result of fill_write_buffer (which is
    signed and returns negative upon error) to an unsigned int.  Clearly,
    bad and wrong.. (Andres Salomon)



Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2005-03-14 10:13:31 UTC (rev 2706)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/changelog	2005-03-14 10:17:56 UTC (rev 2707)
@@ -102,6 +102,11 @@
     http://www.guninski.com/where_do_you_want_billg_to_go_today_3.html
     (Andres Salomon).
 
+  * 143-sysfs_write_file_signedness_problem.dpatch
+    sysfs_write_file assigns the result of fill_write_buffer (which is
+    signed and returns negative upon error) to an unsigned int.  Clearly,
+    bad and wrong.. (Andres Salomon)
+
  -- Joshua Kwan <joshk@triplehelix.org>  Mon, 14 Mar 2005 00:03:12 -0800
 
 kernel-source-2.6.8 (2.6.8-13) unstable; urgency=high

Added: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/143-sysfs_write_file_signedness_problem.dpatch
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/143-sysfs_write_file_signedness_problem.dpatch	2005-03-14 10:13:31 UTC (rev 2706)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/143-sysfs_write_file_signedness_problem.dpatch	2005-03-14 10:17:56 UTC (rev 2707)
@@ -0,0 +1,45 @@
+diff -Naru a/fs/sysfs/file.c b/fs/sysfs/file.c
+--- a/fs/sysfs/file.c	2005-03-09 20:20:22 -08:00
++++ b/fs/sysfs/file.c	2005-03-09 20:20:22 -08:00
+@@ -231,15 +231,16 @@
+ sysfs_write_file(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
+ {
+ 	struct sysfs_buffer * buffer = file->private_data;
++	ssize_t len;
+ 
+ 	down(&buffer->sem);
+-	count = fill_write_buffer(buffer,buf,count);
+-	if (count > 0)
+-		count = flush_write_buffer(file->f_dentry,buffer,count);
+-	if (count > 0)
+-		*ppos += count;
++	len = fill_write_buffer(buffer, buf, count);
++	if (len > 0)
++		len = flush_write_buffer(file->f_dentry, buffer, len);
++	if (len > 0)
++		*ppos += len;
+ 	up(&buffer->sem);
+-	return count;
++	return len;
+ }
+ 
+ static int check_perm(struct inode * inode, struct file * file)
+# This is a BitKeeper generated diff -Nru style patch.
+#
+# ChangeSet
+#   2005/03/01 16:18:03-08:00 greg@kroah.com 
+#   [PATCH] sysfs: fix signedness problem
+#   
+#   count is size_t, fill_write_buffer() may return a negative number
+#   which would evade the 'count > 0' checks and do bad things.
+#   
+#   found by the Coverity tool
+#   
+#   Signed-off-by: Alexander Nyberg <alexn@dsv.su.se>
+#   Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+#   Signed-off-by: Linus Torvalds <torvalds@osdl.org>
+# 
+# fs/sysfs/file.c
+#   2005/02/26 06:48:19-08:00 greg@kroah.com +7 -6
+#   sysfs: fix signedness problem
+# 

Modified: trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-14
===================================================================
--- trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-14	2005-03-14 10:13:31 UTC (rev 2706)
+++ trunk/kernel/source/kernel-source-2.6.8-2.6.8/debian/patches/series/2.6.8-14	2005-03-14 10:17:56 UTC (rev 2707)
@@ -27,3 +27,4 @@
 + 116-n_tty_copy_from_read_buf_signedness_fixes.dpatch
 + 117-reiserfs_file_64bit_size_t_fixes.dpatch
 + 123-atm_get_addr_signedness_fix.dpatch
++ 143-sysfs_write_file_signedness_problem.dpatch