mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] Disallow appends to sysfs files
@ 2005-01-25 22:38 Mitch Williams
  2005-01-25 22:46 ` Josh Boyer
  0 siblings, 1 reply; 3+ messages in thread
From: Mitch Williams @ 2005-01-25 22:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: greg

This patch causes an error to be returned if the caller attempts to open a
sysfs file in append mode.

This patch applies cleanly to 2.6.11-rc1.

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-24 16:26:21.000000000 -0800
@@ -275,6 +275,11 @@ static int check_perm(struct inode * ino
 	if (!ops)
 		goto Eaccess;

+	/* Is the file is open for append?  Sorry, we don't do that. */
+	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] 3+ messages in thread

* Re: [PATCH 1/2] Disallow appends to sysfs files
  2005-01-25 22:38 [PATCH 1/2] Disallow appends to sysfs files Mitch Williams
@ 2005-01-25 22:46 ` Josh Boyer
  2005-01-25 22:50   ` Mitch Williams
  0 siblings, 1 reply; 3+ messages in thread
From: Josh Boyer @ 2005-01-25 22:46 UTC (permalink / raw)
  To: Mitch Williams; +Cc: linux-kernel, greg

On Tue, 2005-01-25 at 16:38, Mitch Williams wrote:
> This patch causes an error to be returned if the caller attempts to open a
> sysfs file in append mode.
> 
> This patch applies cleanly to 2.6.11-rc1.
> 
> 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-24 16:26:21.000000000 -0800
> @@ -275,6 +275,11 @@ static int check_perm(struct inode * ino
>  	if (!ops)
>  		goto Eaccess;
> 
> +	/* Is the file is open for append?  Sorry, we don't do that. */
> +	if (file->f_flags & O_APPEND) {
> +		goto Einval;
> +	}
> +

Could you drop the braces?  Coding style thing.

thx,
josh


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] Disallow appends to sysfs files
  2005-01-25 22:46 ` Josh Boyer
@ 2005-01-25 22:50   ` Mitch Williams
  0 siblings, 0 replies; 3+ messages in thread
From: Mitch Williams @ 2005-01-25 22:50 UTC (permalink / raw)
  To: Josh Boyer; +Cc: Williams, Mitch A, linux-kernel, greg



On Tue, 25 Jan 2005, Josh Boyer wrote:
>
> Could you drop the braces?  Coding style thing.
>
Yeah, I'll drop and resubmit.  I've got so many different things going on
with these patches, I'm getting confused.  I know Greg asked for this same
change a while back but it got lost.

Resubmittal will commence in a few minutes.

-Mitch

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-01-25 22:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-25 22:38 [PATCH 1/2] Disallow appends to sysfs files Mitch Williams
2005-01-25 22:46 ` Josh Boyer
2005-01-25 22:50   ` Mitch Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®