All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ubi: check the presence of volume before call ubi_fastmap_destroy_checkmap()
@ 2019-11-30  9:48 Hou Tao
  2020-01-16 23:19 ` Richard Weinberger
  0 siblings, 1 reply; 2+ messages in thread
From: Hou Tao @ 2019-11-30  9:48 UTC (permalink / raw)
  To: linux-mtd
  Cc: vigneshr, dedekind1, richard, marek.vasut, miquel.raynal,
	computersforpeace, dwmw2

Else there may be oops when fastmap is enabled and init_volumes() fails.

Signed-off-by: Hou Tao <houtao1@huawei.com>
---
 drivers/mtd/ubi/vtbl.c | 2 ++
 1 file changed, 2 insertions(+)

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;
-- 
2.22.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/2] ubi: check the presence of volume before call ubi_fastmap_destroy_checkmap()
  2019-11-30  9:48 [PATCH 1/2] ubi: check the presence of volume before call ubi_fastmap_destroy_checkmap() Hou Tao
@ 2020-01-16 23:19 ` Richard Weinberger
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2020-01-16 23:19 UTC (permalink / raw)
  To: Hou Tao
  Cc: Vignesh Raghavendra, Artem Bityutskiy, Richard Weinberger,
	Marek Vasut, linux-mtd, Miquel Raynal, Brian Norris,
	David Woodhouse

On Sat, Nov 30, 2019 at 10:41 AM Hou Tao <houtao1@huawei.com> wrote:
>
> Else there may be oops when fastmap is enabled and init_volumes() fails.
>
> Signed-off-by: Hou Tao <houtao1@huawei.com>
> ---
>  drivers/mtd/ubi/vtbl.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied. :-)

-- 
Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-16 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-30  9:48 [PATCH 1/2] ubi: check the presence of volume before call ubi_fastmap_destroy_checkmap() Hou Tao
2020-01-16 23:19 ` Richard Weinberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.