Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Richard Weinberger and committed by
Artem Bityutskiy
4a59c797 e234b5f2

+3
+3
drivers/mtd/ubi/cdev.c
··· 632 632 if (req->alignment != 1 && n) 633 633 goto bad; 634 634 635 + if (!req->name[0] || !req->name_len) 636 + goto bad; 637 + 635 638 if (req->name_len > UBI_VOL_NAME_MAX) { 636 639 err = -ENAMETOOLONG; 637 640 goto bad;