lkml.org 
[lkml]   [2014]   [Dec]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/6] UBI: Fastmap: Fix memory leaks while closing the WL sub-system
On Sun, Nov 30, 2014 at 12:35:35PM +0100, Richard Weinberger wrote:
> Add a ubi_fastmap_close() to free all resources used by fastmap
> at WL shutdown.
>
> Signed-off-by: Richard Weinberger <richard@nod.at>

Either for this patch, or for a v3 if you move the
-flush_work/+ubi_fastmap_close to shutdown_work:

Tested-by: Guido Martínez <guido@vanguardiasur.com.ar>
Reviewed-by: Guido Martínez <guido@vanguardiasur.com.ar>

> ---
> drivers/mtd/ubi/wl.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
> index c2822f7..47b215f 100644
> --- a/drivers/mtd/ubi/wl.c
> +++ b/drivers/mtd/ubi/wl.c
> @@ -2064,6 +2064,23 @@ static void protection_queue_destroy(struct ubi_device *ubi)
> }
> }
>
> +static void ubi_fastmap_close(struct ubi_device *ubi)
> +{
> +#ifdef CONFIG_MTD_UBI_FASTMAP
> + int i;
> +
> + flush_work(&ubi->fm_work);
> + return_unused_pool_pebs(ubi, &ubi->fm_pool);
> + return_unused_pool_pebs(ubi, &ubi->fm_wl_pool);
> +
> + if (ubi->fm) {
> + for (i = 0; i < ubi->fm->used_blocks; i++)
> + kfree(ubi->fm->e[i]);
> + }
> + kfree(ubi->fm);
> +#endif
> +}
> +
> /**
> * ubi_wl_close - close the wear-leveling sub-system.
> * @ubi: UBI device description object
> @@ -2071,9 +2088,7 @@ static void protection_queue_destroy(struct ubi_device *ubi)
> void ubi_wl_close(struct ubi_device *ubi)
> {
> dbg_wl("close the WL sub-system");
> -#ifdef CONFIG_MTD_UBI_FASTMAP
> - flush_work(&ubi->fm_work);
> -#endif
> + ubi_fastmap_close(ubi);
> shutdown_work(ubi);
> protection_queue_destroy(ubi);
> tree_destroy(&ubi->used);

--
Guido Martínez, VanguardiaSur
www.vanguardiasur.com.ar


\
 
 \ /
  Last update: 2014-12-17 21:41    [W:0.111 / U:4.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site