diff options
author | Richard Weinberger <richard@nod.at> | 2012-01-13 15:07:40 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2012-01-25 13:53:21 -0800 |
commit | 0e60934064ce77caeff195b0de40b904f4098da3 (patch) | |
tree | e2ea7e13ab869042cc84eacdb0a39519bdc392b9 | |
parent | 917f70bc197f78299852c9cefbb5a2098f2560ab (diff) | |
download | lwn-0e60934064ce77caeff195b0de40b904f4098da3.tar.gz lwn-0e60934064ce77caeff195b0de40b904f4098da3.zip |
UBI: fix nameless volumes handling
commit 4a59c797a18917a5cf3ff7ade296b46134d91e6a 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: Richard Weinberger <richard@nod.at>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 111ea41c4ecd..1d11e86a1c90 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c @@ -628,6 +628,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; |