aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r--drivers/mtd/mtdchar.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 98240575a18d..145b3d0dc0db 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -522,10 +522,6 @@ static int mtd_blkpg_ioctl(struct mtd_info *mtd,
522 if (!capable(CAP_SYS_ADMIN)) 522 if (!capable(CAP_SYS_ADMIN))
523 return -EPERM; 523 return -EPERM;
524 524
525 /* Only master mtd device must be used to control partitions */
526 if (!mtd_is_master(mtd))
527 return -EINVAL;
528
529 if (copy_from_user(&a, arg, sizeof(struct blkpg_ioctl_arg))) 525 if (copy_from_user(&a, arg, sizeof(struct blkpg_ioctl_arg)))
530 return -EFAULT; 526 return -EFAULT;
531 527
@@ -535,6 +531,10 @@ static int mtd_blkpg_ioctl(struct mtd_info *mtd,
535 switch (a.op) { 531 switch (a.op) {
536 case BLKPG_ADD_PARTITION: 532 case BLKPG_ADD_PARTITION:
537 533
534 /* Only master mtd device must be used to add partitions */
535 if (mtd_is_partition(mtd))
536 return -EINVAL;
537
538 return mtd_add_partition(mtd, p.devname, p.start, p.length); 538 return mtd_add_partition(mtd, p.devname, p.start, p.length);
539 539
540 case BLKPG_DEL_PARTITION: 540 case BLKPG_DEL_PARTITION:
@@ -601,6 +601,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
601 } 601 }
602 602
603 case MEMGETINFO: 603 case MEMGETINFO:
604 memset(&info, 0, sizeof(info));
604 info.type = mtd->type; 605 info.type = mtd->type;
605 info.flags = mtd->flags; 606 info.flags = mtd->flags;
606 info.size = mtd->size; 607 info.size = mtd->size;
@@ -609,7 +610,6 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
609 info.oobsize = mtd->oobsize; 610 info.oobsize = mtd->oobsize;
610 /* The below fields are obsolete */ 611 /* The below fields are obsolete */
611 info.ecctype = -1; 612 info.ecctype = -1;
612 info.eccsize = 0;
613 if (copy_to_user(argp, &info, sizeof(struct mtd_info_user))) 613 if (copy_to_user(argp, &info, sizeof(struct mtd_info_user)))
614 return -EFAULT; 614 return -EFAULT;
615 break; 615 break;