From: Richard Weinberger Date: Fri, 13 Jan 2012 14:07:40 +0000 (+0100) Subject: UBI: fix nameless volumes handling X-Git-Tag: v3.3-rc1~53^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a59c797a18917a5cf3ff7ade296b46134d91e6a;p=platform%2Fkernel%2Flinux-stable.git 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 Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 3320a50..ad76592 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;