linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] reject sysfs writes with nonzero position
@ 2005-02-01 22:39 Mitch Williams
  0 siblings, 0 replies; only message in thread
From: Mitch Williams @ 2005-02-01 22:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: greg

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@intel.com>

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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-02-01 22:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-01 22:39 [PATCH] reject sysfs writes with nonzero position Mitch Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).