patches in powerpc.git

Stephen Rothwell sfr at canb.auug.org.au
Thu Feb 8 10:42:34 EST 2007


On Wed, 07 Feb 2007 10:38:30 -0600 Will Schmidt <will_schmidt at vnet.ibm.com> wrote:
>
> On Wed, 2007-07-02 at 15:55 +1100, Stephen Rothwell wrote:
> > On Wed, 7 Feb 2007 15:03:13 +1100 Paul Mackerras <paulus at samba.org> wrote:
> > >
> > > If anyone has patches not listed here that they want in 2.6.21, please
> > > let me or the relevant sub-arch maintainer know.
> > 
> > How about "Fix ppc64's writing to struct file_operations" sent to you
> > yesterday by Andrew Morton.
> > 
> 
> Is this the lparcfg fops .write changes that came across LKML
> mid-January?    I didnt notice any references to it here.. 

Yep.  Copy below.

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

Subject: [patch 03/10] Fix ppc64's writing to struct file_operations
To: paulus at samba.org
Cc: benh at kernel.crashing.org, akpm at linux-foundation.org, sfr at canb.auug.org.au,
   arjan at infradead.org
From: akpm at linux-foundation.org
Date: Mon, 05 Feb 2007 16:14:05 -0800

From: Stephen Rothwell <sfr at canb.auug.org.au>

In preparation for marking file_operations as const.

Cc: Paul Mackerras <paulus at samba.org>
Cc: Benjamin Herrenschmidt <benh at kernel.crashing.org>
Acked-by: Arjan van de Ven <arjan at infradead.org>
Signed-off-by: Stephen Rothwell <sfr at canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
---

 arch/powerpc/kernel/lparcfg.c |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff -puN arch/powerpc/kernel/lparcfg.c~fix-ppc64s-writing-to-struct-file_operations arch/powerpc/kernel/lparcfg.c
--- a/arch/powerpc/kernel/lparcfg.c~fix-ppc64s-writing-to-struct-file_operations
+++ a/arch/powerpc/kernel/lparcfg.c
@@ -439,6 +439,10 @@ static ssize_t lparcfg_write(struct file
 
 	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 s
 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 *in
 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) {
_




More information about the Linuxppc-dev mailing list