aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/kernel/lparcfg.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 41c05dcd68f4..0de5a08cf9b0 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,
439 439
440 ssize_t retval = -ENOMEM; 440 ssize_t retval = -ENOMEM;
441 441
442 if (!firmware_has_feature(FW_FEATURE_SPLPAR) ||
443 firmware_has_feature(FW_FEATURE_ISERIES))
444 return -EINVAL;
445
442 kbuf = kmalloc(count, GFP_KERNEL); 446 kbuf = kmalloc(count, GFP_KERNEL);
443 if (!kbuf) 447 if (!kbuf)
444 goto out; 448 goto out;
@@ -517,7 +521,7 @@ static int pseries_lparcfg_data(struct seq_file *m, void *v)
517static ssize_t lparcfg_write(struct file *file, const char __user * buf, 521static ssize_t lparcfg_write(struct file *file, const char __user * buf,
518 size_t count, loff_t * off) 522 size_t count, loff_t * off)
519{ 523{
520 return count; 524 return -EINVAL;
521} 525}
522 526
523#endif /* CONFIG_PPC_PSERIES */ 527#endif /* CONFIG_PPC_PSERIES */
@@ -570,6 +574,7 @@ static int lparcfg_open(struct inode *inode, struct file *file)
570struct file_operations lparcfg_fops = { 574struct file_operations lparcfg_fops = {
571 .owner = THIS_MODULE, 575 .owner = THIS_MODULE,
572 .read = seq_read, 576 .read = seq_read,
577 .write = lparcfg_write,
573 .open = lparcfg_open, 578 .open = lparcfg_open,
574 .release = single_release, 579 .release = single_release,
575}; 580};
@@ -581,10 +586,8 @@ int __init lparcfg_init(void)
581 586
582 /* Allow writing if we have FW_FEATURE_SPLPAR */ 587 /* Allow writing if we have FW_FEATURE_SPLPAR */
583 if (firmware_has_feature(FW_FEATURE_SPLPAR) && 588 if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
584 !firmware_has_feature(FW_FEATURE_ISERIES)) { 589 !firmware_has_feature(FW_FEATURE_ISERIES))
585 lparcfg_fops.write = lparcfg_write;
586 mode |= S_IWUSR; 590 mode |= S_IWUSR;
587 }
588 591
589 ent = create_proc_entry("ppc64/lparcfg", mode, NULL); 592 ent = create_proc_entry("ppc64/lparcfg", mode, NULL);
590 if (ent) { 593 if (ent) {