UBI: Fastmap: Ensure that all fastmap work is done upon WL shutdown
...otherwise the deferred work might run after datastructures
got freed and corrupt memory.
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Guido MartÃnez <guido@vanguardiasur.com.ar>
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index ae174f4..bf66890 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1856,6 +1856,9 @@
*/
static void shutdown_work(struct ubi_device *ubi)
{
+#ifdef CONFIG_MTD_UBI_FASTMAP
+ flush_work(&ubi->fm_work);
+#endif
while (!list_empty(&ubi->works)) {
struct ubi_work *wrk;