Commit 9a9cc2b9 authored by Richard Weinberger's avatar Richard Weinberger Committed by Greg Kroah-Hartman

UBI: fix nameless volumes handling

commit 4a59c797 upstream.

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.
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5b781fb9
...@@ -632,6 +632,9 @@ static int verify_mkvol_req(const struct ubi_device *ubi, ...@@ -632,6 +632,9 @@ static int verify_mkvol_req(const struct ubi_device *ubi,
if (req->alignment != 1 && n) if (req->alignment != 1 && n)
goto bad; goto bad;
if (!req->name[0] || !req->name_len)
goto bad;
if (req->name_len > UBI_VOL_NAME_MAX) { if (req->name_len > UBI_VOL_NAME_MAX) {
err = -ENAMETOOLONG; err = -ENAMETOOLONG;
goto bad; goto bad;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment