summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2012-01-13 18:07:40 +0400
committerArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>2012-01-15 17:06:08 +0400
commit4a59c797a18917a5cf3ff7ade296b46134d91e6a (patch)
tree5f6f45af1f25eb25f99ac110f27084bd29cfb260 /drivers/mtd
parente234b5f2079414b3d772286e3ee00e7bbf6da833 (diff)
downloadlinux-4a59c797a18917a5cf3ff7ade296b46134d91e6a.tar.xz
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,
if (req->alignment != 1 && n)
goto bad;
+ if (!req->name[0] || !req->name_len)
+ goto bad;
+
if (req->name_len > UBI_VOL_NAME_MAX) {
err = -ENAMETOOLONG;
goto bad;