Skip to content

Commit 97bbf9e

Browse files
Denis Arefevrichardweinberger
authored andcommitted
ubi: Add a check for ubi_num
Added a check for ubi_num for negative numbers If the variable ubi_num takes negative values then we get: qemu-system-arm ... -append "ubi.mtd=0,0,0,-22222345" ... [ 0.745065] ubi_attach_mtd_dev from ubi_init+0x178/0x218 [ 0.745230] ubi_init from do_one_initcall+0x70/0x1ac [ 0.745344] do_one_initcall from kernel_init_freeable+0x198/0x224 [ 0.745474] kernel_init_freeable from kernel_init+0x18/0x134 [ 0.745600] kernel_init from ret_from_fork+0x14/0x28 [ 0.745727] Exception stack(0x90015fb0 to 0x90015ff8) Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 83ff59a ("UBI: support ubi_num on mtd.ubi command line") Cc: [email protected] Signed-off-by: Denis Arefev <[email protected]> Reviewed-by: Zhihao Cheng <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 9d89551 commit 97bbf9e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mtd/ubi/build.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1537,7 +1537,7 @@ static int ubi_mtd_param_parse(const char *val, const struct kernel_param *kp)
15371537
if (token) {
15381538
int err = kstrtoint(token, 10, &p->ubi_num);
15391539

1540-
if (err) {
1540+
if (err || p->ubi_num < UBI_DEV_NUM_AUTO) {
15411541
pr_err("UBI error: bad value for ubi_num parameter: %s\n",
15421542
token);
15431543
return -EINVAL;

0 commit comments

Comments
 (0)