diff options
Diffstat (limited to 'drivers/mtd/ubi/cdev.c')
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 35d34b675c7..22c15a388f2 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -605,7 +605,9 @@ static int ubi_cdev_ioctl(struct inode *inode, struct file *file, | |||
605 | 605 | ||
606 | req.name[req.name_len] = '\0'; | 606 | req.name[req.name_len] = '\0'; |
607 | 607 | ||
608 | mutex_lock(&ubi->volumes_mutex); | ||
608 | err = ubi_create_volume(ubi, &req); | 609 | err = ubi_create_volume(ubi, &req); |
610 | mutex_unlock(&ubi->volumes_mutex); | ||
609 | if (err) | 611 | if (err) |
610 | break; | 612 | break; |
611 | 613 | ||
@@ -634,11 +636,14 @@ static int ubi_cdev_ioctl(struct inode *inode, struct file *file, | |||
634 | break; | 636 | break; |
635 | } | 637 | } |
636 | 638 | ||
639 | mutex_lock(&ubi->volumes_mutex); | ||
637 | err = ubi_remove_volume(desc); | 640 | err = ubi_remove_volume(desc); |
641 | mutex_unlock(&ubi->volumes_mutex); | ||
642 | |||
638 | /* | 643 | /* |
639 | * The volume is deleted, and the 'struct ubi_volume' object | 644 | * The volume is deleted (unless an error occurred), and the |
640 | * will be freed when 'ubi_close_volume()' will call | 645 | * 'struct ubi_volume' object will be freed when |
641 | * 'put_device()'. | 646 | * 'ubi_close_volume()' will call 'put_device()'. |
642 | */ | 647 | */ |
643 | ubi_close_volume(desc); | 648 | ubi_close_volume(desc); |
644 | break; | 649 | break; |
@@ -673,7 +678,9 @@ static int ubi_cdev_ioctl(struct inode *inode, struct file *file, | |||
673 | pebs = !!do_div(tmp, desc->vol->usable_leb_size); | 678 | pebs = !!do_div(tmp, desc->vol->usable_leb_size); |
674 | pebs += tmp; | 679 | pebs += tmp; |
675 | 680 | ||
681 | mutex_lock(&ubi->volumes_mutex); | ||
676 | err = ubi_resize_volume(desc, pebs); | 682 | err = ubi_resize_volume(desc, pebs); |
683 | mutex_unlock(&ubi->volumes_mutex); | ||
677 | ubi_close_volume(desc); | 684 | ubi_close_volume(desc); |
678 | break; | 685 | break; |
679 | } | 686 | } |