Re: [patch 00/12] Fix ppc64's writing to struct file_operations

2007-01-14 Thread Arjan van de Ven
On Mon, 2007-01-15 at 10:55 +1100, Stephen Rothwell wrote:
> On Sun, 14 Jan 2007 14:54:11 + Alan <[EMAIL PROTECTED]> wrote:
> >
> > This doesn't appea to do the same thing at all. You need to select
> > between two sets of const inode ops instead, otherwise you turn write on
> > arbitarily.
> 
> Or something like below ... (compile tested on pseries, iseries and combined).

ok I was about to do this instead... but you beat me to it.. thanks!

Acked-by: Arjan van de Ven <[EMAIL PROTECTED]>



-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via 
http://www.linuxfirmwarekit.org

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 00/12] Fix ppc64's writing to struct file_operations

2007-01-14 Thread Stephen Rothwell
On Sun, 14 Jan 2007 14:54:11 + Alan <[EMAIL PROTECTED]> wrote:
>
> This doesn't appea to do the same thing at all. You need to select
> between two sets of const inode ops instead, otherwise you turn write on
> arbitarily.

Or something like below ... (compile tested on pseries, iseries and combined).

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/

diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 41c05dc..0de5a08 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -439,6 +439,10 @@ static ssize_t lparcfg_write(struct file *file, const char 
__user * buf,
 
ssize_t retval = -ENOMEM;
 
+   if (!firmware_has_feature(FW_FEATURE_SPLPAR) ||
+   firmware_has_feature(FW_FEATURE_ISERIES))
+   return -EINVAL;
+
kbuf = kmalloc(count, GFP_KERNEL);
if (!kbuf)
goto out;
@@ -517,7 +521,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
 static ssize_t lparcfg_write(struct file *file, const char __user * buf,
 size_t count, loff_t * off)
 {
-   return count;
+   return -EINVAL;
 }
 
 #endif /* CONFIG_PPC_PSERIES */
@@ -570,6 +574,7 @@ static int lparcfg_open(struct inode *inode, struct file 
*file)
 struct file_operations lparcfg_fops = {
.owner  = THIS_MODULE,
.read   = seq_read,
+   .write  = lparcfg_write,
.open   = lparcfg_open,
.release= single_release,
 };
@@ -581,10 +586,8 @@ int __init lparcfg_init(void)
 
/* Allow writing if we have FW_FEATURE_SPLPAR */
if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
-   !firmware_has_feature(FW_FEATURE_ISERIES)) {
-   lparcfg_fops.write = lparcfg_write;
+   !firmware_has_feature(FW_FEATURE_ISERIES))
mode |= S_IWUSR;
-   }
 
ent = create_proc_entry("ppc64/lparcfg", mode, NULL);
if (ent) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 00/12] Fix ppc64's writing to struct file_operations

2007-01-14 Thread Alan
>   .read   = seq_read,
> + .write  = lparcfg_write,
>   .open   = lparcfg_open,
>   .release= single_release,
>  };
> @@ -581,10 +582,8 @@ int __init lparcfg_init(void)
>  
>   /* Allow writing if we have FW_FEATURE_SPLPAR */
>   if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
> - !firmware_has_feature(FW_FEATURE_ISERIES)) {
> - lparcfg_fops.write = lparcfg_write;
> + !firmware_has_feature(FW_FEATURE_ISERIES))
>   mode |= S_IWUSR;
> - }


This doesn't appea to do the same thing at all. You need to select
between two sets of const inode ops instead, otherwise you turn write on
arbitarily.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 00/12] Fix ppc64's writing to struct file_operations

2007-01-14 Thread Alan
   .read   = seq_read,
 + .write  = lparcfg_write,
   .open   = lparcfg_open,
   .release= single_release,
  };
 @@ -581,10 +582,8 @@ int __init lparcfg_init(void)
  
   /* Allow writing if we have FW_FEATURE_SPLPAR */
   if (firmware_has_feature(FW_FEATURE_SPLPAR) 
 - !firmware_has_feature(FW_FEATURE_ISERIES)) {
 - lparcfg_fops.write = lparcfg_write;
 + !firmware_has_feature(FW_FEATURE_ISERIES))
   mode |= S_IWUSR;
 - }


This doesn't appea to do the same thing at all. You need to select
between two sets of const inode ops instead, otherwise you turn write on
arbitarily.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 00/12] Fix ppc64's writing to struct file_operations

2007-01-14 Thread Stephen Rothwell
On Sun, 14 Jan 2007 14:54:11 + Alan [EMAIL PROTECTED] wrote:

 This doesn't appea to do the same thing at all. You need to select
 between two sets of const inode ops instead, otherwise you turn write on
 arbitarily.

Or something like below ... (compile tested on pseries, iseries and combined).

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/

diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 41c05dc..0de5a08 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -439,6 +439,10 @@ static ssize_t lparcfg_write(struct file *file, const char 
__user * buf,
 
ssize_t retval = -ENOMEM;
 
+   if (!firmware_has_feature(FW_FEATURE_SPLPAR) ||
+   firmware_has_feature(FW_FEATURE_ISERIES))
+   return -EINVAL;
+
kbuf = kmalloc(count, GFP_KERNEL);
if (!kbuf)
goto out;
@@ -517,7 +521,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
 static ssize_t lparcfg_write(struct file *file, const char __user * buf,
 size_t count, loff_t * off)
 {
-   return count;
+   return -EINVAL;
 }
 
 #endif /* CONFIG_PPC_PSERIES */
@@ -570,6 +574,7 @@ static int lparcfg_open(struct inode *inode, struct file 
*file)
 struct file_operations lparcfg_fops = {
.owner  = THIS_MODULE,
.read   = seq_read,
+   .write  = lparcfg_write,
.open   = lparcfg_open,
.release= single_release,
 };
@@ -581,10 +586,8 @@ int __init lparcfg_init(void)
 
/* Allow writing if we have FW_FEATURE_SPLPAR */
if (firmware_has_feature(FW_FEATURE_SPLPAR) 
-   !firmware_has_feature(FW_FEATURE_ISERIES)) {
-   lparcfg_fops.write = lparcfg_write;
+   !firmware_has_feature(FW_FEATURE_ISERIES))
mode |= S_IWUSR;
-   }
 
ent = create_proc_entry(ppc64/lparcfg, mode, NULL);
if (ent) {
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch 00/12] Fix ppc64's writing to struct file_operations

2007-01-14 Thread Arjan van de Ven
On Mon, 2007-01-15 at 10:55 +1100, Stephen Rothwell wrote:
 On Sun, 14 Jan 2007 14:54:11 + Alan [EMAIL PROTECTED] wrote:
 
  This doesn't appea to do the same thing at all. You need to select
  between two sets of const inode ops instead, otherwise you turn write on
  arbitarily.
 
 Or something like below ... (compile tested on pseries, iseries and combined).

ok I was about to do this instead... but you beat me to it.. thanks!

Acked-by: Arjan van de Ven [EMAIL PROTECTED]



-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via 
http://www.linuxfirmwarekit.org

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 00/12] Fix ppc64's writing to struct file_operations

2007-01-13 Thread Arjan van de Ven
From: Arjan van de Ven <[EMAIL PROTECTED]>
Subject: [patch 00/12] Fix ppc64's writing to struct file_operations

the ppc64 code needlessly wrote to a struct file_operations variable;
this patch turns this into a compile time initialization instead.


Signed-off-by: Arjan van de Ven <[EMAIL PROTECTED]>

Index: linux-2.6/arch/powerpc/kernel/lparcfg.c
===
--- linux-2.6.orig/arch/powerpc/kernel/lparcfg.c
+++ linux-2.6/arch/powerpc/kernel/lparcfg.c
@@ -570,6 +570,7 @@ static int lparcfg_open(struct inode *in
 struct file_operations lparcfg_fops = {
.owner  = THIS_MODULE,
.read   = seq_read,
+   .write  = lparcfg_write,
.open   = lparcfg_open,
.release= single_release,
 };
@@ -581,10 +582,8 @@ int __init lparcfg_init(void)
 
/* Allow writing if we have FW_FEATURE_SPLPAR */
if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
-   !firmware_has_feature(FW_FEATURE_ISERIES)) {
-   lparcfg_fops.write = lparcfg_write;
+   !firmware_has_feature(FW_FEATURE_ISERIES))
mode |= S_IWUSR;
-   }
 
ent = create_proc_entry("ppc64/lparcfg", mode, NULL);
if (ent) {


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch 00/12] Fix ppc64's writing to struct file_operations

2007-01-13 Thread Arjan van de Ven
From: Arjan van de Ven [EMAIL PROTECTED]
Subject: [patch 00/12] Fix ppc64's writing to struct file_operations

the ppc64 code needlessly wrote to a struct file_operations variable;
this patch turns this into a compile time initialization instead.


Signed-off-by: Arjan van de Ven [EMAIL PROTECTED]

Index: linux-2.6/arch/powerpc/kernel/lparcfg.c
===
--- linux-2.6.orig/arch/powerpc/kernel/lparcfg.c
+++ linux-2.6/arch/powerpc/kernel/lparcfg.c
@@ -570,6 +570,7 @@ static int lparcfg_open(struct inode *in
 struct file_operations lparcfg_fops = {
.owner  = THIS_MODULE,
.read   = seq_read,
+   .write  = lparcfg_write,
.open   = lparcfg_open,
.release= single_release,
 };
@@ -581,10 +582,8 @@ int __init lparcfg_init(void)
 
/* Allow writing if we have FW_FEATURE_SPLPAR */
if (firmware_has_feature(FW_FEATURE_SPLPAR) 
-   !firmware_has_feature(FW_FEATURE_ISERIES)) {
-   lparcfg_fops.write = lparcfg_write;
+   !firmware_has_feature(FW_FEATURE_ISERIES))
mode |= S_IWUSR;
-   }
 
ent = create_proc_entry(ppc64/lparcfg, mode, NULL);
if (ent) {


-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/