[PATCH v2] nand-bb: mtd_del_bb: fix missing pointer reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If an attached bb device was removed before the actual mtd device
the code would try due to a missing pointer reset to access
the no more present bb device handle which leads to a page fault.

This bug was made visible by commit "7649473 mtd: nand: remove
automatically created bb devices" which relys on a correct
mtd->cdev_bb handling.

Signed-off-by: Heinrich Toews <heinrich.toews@xxxxxxxx>
---
Change since v1: add Signed-off-by
---
 drivers/mtd/nand/nand-bb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index c197738..012163e 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -316,6 +316,8 @@ void mtd_del_bb(struct mtd_info *mtd)
 	list_del_init(&bb->list);
 	free(bb->name);
 	free(bb);
+
+	mtd->cdev_bb = NULL;
 }
 
 /**
-- 
2.7.4

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux