[PATCH] reject sysfs writes with nonzero position

From: Mitch Williams
Date: Tue Feb 01 2005 - 17:51:27 EST


This patch causes an error to be returned if the user attempts to write a
sysfs file at a nonzero offset. Because sysfs store methods do not
support a position parameter, the behavior in this case would be
unpredictable. Thus, we return an error, because at least now we're
consistent.

This patch generated from 2.6.11-rc1.

Now with tabs.

Signed-off-by: Mitch Williams <mitch.a.williams@xxxxxxxxx>

diff -urpN -X dontdiff linux-2.6.11-clean/fs/sysfs/file.c linux-2.6.11/fs/sysfs/file.c
--- linux-2.6.11-clean/fs/sysfs/file.c 2004-12-24 13:33:50.000000000 -0800
+++ linux-2.6.11/fs/sysfs/file.c 2005-01-25 10:47:15.000000000 -0800
@@ -232,6 +232,8 @@ sysfs_write_file(struct file *file, cons
{
struct sysfs_buffer * buffer = file->private_data;

+ if (*ppos > 0)
+ return -EIO;
down(&buffer->sem);
count = fill_write_buffer(buffer,buf,count);
if (count > 0)
-
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/