summaryrefslogtreecommitdiff
path: root/drivers/mtd/ubi/vtbl.c
diff options
context:
space:
mode:
authorHou Tao <houtao1@huawei.com>2019-11-30 17:48:00 +0800
committerRichard Weinberger <richard@nod.at>2020-01-16 23:35:48 +0100
commit9d6c4742f96cc0380a3f2854d62c667b87736d71 (patch)
tree962775ce734d04406487aaf35a3cfac356608de7 /drivers/mtd/ubi/vtbl.c
parent219b0e2cba4ec326f88a08a5c9ad51103089bdab (diff)
ubi: Check the presence of volume before call ubi_fastmap_destroy_checkmap()
Else there may be oops when fastmap is enabled and init_volumes() fails. Signed-off-by: Hou Tao <houtao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'drivers/mtd/ubi/vtbl.c')
-rw-r--r--drivers/mtd/ubi/vtbl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 53d8ab54e181..8a2a0f091598 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -852,6 +852,8 @@ int ubi_read_volume_table(struct ubi_device *ubi, struct ubi_attach_info *ai)
out_free:
vfree(ubi->vtbl);
for (i = 0; i < ubi->vtbl_slots + UBI_INT_VOL_COUNT; i++) {
+ if (!ubi->volumes[i])
+ continue;
ubi_fastmap_destroy_checkmap(ubi->volumes[i]);
kfree(ubi->volumes[i]);
ubi->volumes[i] = NULL;