mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephen Rothwell <sfr@canb.auug.org.au>
To: Arjan van de Ven <arjan@infradead.org>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org,
	Alan <alan@lxorguk.ukuu.org.uk>
Subject: Re: [patch 00/12] Fix ppc64's writing to struct file_operations
Date: Mon, 15 Jan 2007 10:55:01 +1100	[thread overview]
Message-ID: <20070115105501.0ec8ead0.sfr@canb.auug.org.au> (raw)
In-Reply-To: <20070114145411.1fd8c985@localhost.localdomain>

On Sun, 14 Jan 2007 14:54:11 +0000 Alan <alan@lxorguk.ukuu.org.uk> 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                    sfr@canb.auug.org.au
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) {

  reply	other threads:[~2007-01-14 23:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-14  0:51 Patch series to mark struct file_operations and struct inode_operations const Arjan van de Ven
2007-01-14  0:51 ` [patch 00/12] Fix ppc64's writing to struct file_operations Arjan van de Ven
2007-01-14 14:54   ` Alan
2007-01-14 23:55     ` Stephen Rothwell [this message]
2007-01-15  0:15       ` Arjan van de Ven
2007-01-14  0:52 ` [patch 01/12] mark struct file_operations const 1 Arjan van de Ven
2007-01-14  0:53 ` [patch 02/12] mark struct file_operations const 2 Arjan van de Ven
2007-01-14  0:53 ` [patch 03/12] mark struct file_operations const 3 Arjan van de Ven
2007-01-14  0:54 ` [patch 04/12] mark struct file_operations const 4 Arjan van de Ven
2007-01-14  0:54 ` [patch 05/12] mark struct file_operations const 5 Arjan van de Ven
2007-01-14  0:55 ` [patch 06/12] mark struct file_operations const 6 Arjan van de Ven
2007-01-14  0:56 ` [patch 07/12] mark struct file_operations const 7 Arjan van de Ven
2007-01-14  0:56 ` [patch 08/12] mark struct file_operations const 8 Arjan van de Ven
2007-01-14  0:57 ` [patch 09/12] mark struct file_operations const 9 Arjan van de Ven
2007-01-14  0:57 ` [patch 10/12] mark struct inode_operations const 1 Arjan van de Ven
2007-01-14  0:58 ` [patch 11/12] mark struct inode_operations const 2 Arjan van de Ven
2007-01-14  0:58 ` [patch 12/12] mark struct inode_operations const 3 Arjan van de Ven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070115105501.0ec8ead0.sfr@canb.auug.org.au \
    --to=sfr@canb.auug.org.au \
    --cc=akpm@osdl.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®