linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Resubmittal [PATCH 1/2] Disallow appends to sysfs files
@ 2005-01-25 23:18 Mitch Williams
  0 siblings, 0 replies; only message in thread
From: Mitch Williams @ 2005-01-25 23:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: greg

This patch returns an error code if the caller attempts to open a sysfs
file for appending.

Generated from 2.6.11-rc2.

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 14:59:33.000000000 -0800
@@ -275,6 +275,15 @@ static int check_perm(struct inode * ino
 	if (!ops)
 		goto Eaccess;

+        /* Return error if the file is open for append.
+         * Sysfs can't support append because the kobject
+         * store methods don't take an offset into the buffer
+         * as an argument.  They end up thinking the appended
+         * data is the entire contents of the file.
+         */
+	if (file->f_flags & O_APPEND)
+		goto Einval;
+
 	/* File needs write support.
 	 * The inode's perms must say it's ok,
 	 * and we must have a store method.

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

only message in thread, other threads:[~2005-01-26  1:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-25 23:18 Resubmittal [PATCH 1/2] Disallow appends to sysfs files 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).