aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2012-01-13 09:07:40 -0500
committerArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>2012-01-15 08:06:08 -0500
commit4a59c797a18917a5cf3ff7ade296b46134d91e6a (patch)
tree5f6f45af1f25eb25f99ac110f27084bd29cfb260 /drivers/mtd
parente234b5f2079414b3d772286e3ee00e7bbf6da833 (diff)
UBI: fix nameless volumes handling
Currently it's possible to create a volume without a name. E.g: ubimkvol -n 32 -s 2MiB -t static /dev/ubi0 -N "" After that vtbl_check() will always fail because it does not permit empty strings. Cc: stable@kernel.org Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/cdev.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index 3320a50ba4f0..ad76592fb2f4 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -632,6 +632,9 @@ static int verify_mkvol_req(const struct ubi_device *ubi,
632 if (req->alignment != 1 && n) 632 if (req->alignment != 1 && n)
633 goto bad; 633 goto bad;
634 634
635 if (!req->name[0] || !req->name_len)
636 goto bad;
637
635 if (req->name_len > UBI_VOL_NAME_MAX) { 638 if (req->name_len > UBI_VOL_NAME_MAX) {
636 err = -ENAMETOOLONG; 639 err = -ENAMETOOLONG;
637 goto bad; 640 goto bad;