2019-01-22 10:19:48

by Hans Holmberg

[permalink] [raw]
Subject: [PATCH] lightnvm: pblk: use vfree to free metadata on error path

From: Hans Holmberg <[email protected]>

As chunk metadata is allocated using vmalloc, we need to free it
using vfree.

Fixes: 090ee26fd512 ("lightnvm: use internal allocation for chunk log page")
Signed-off-by: Hans Holmberg <[email protected]>
---
drivers/lightnvm/pblk-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
index 1ff165351180..1b5ff51faa63 100644
--- a/drivers/lightnvm/pblk-core.c
+++ b/drivers/lightnvm/pblk-core.c
@@ -141,7 +141,7 @@ struct nvm_chk_meta *pblk_get_chunk_meta(struct pblk *pblk)

ret = nvm_get_chunk_meta(dev, ppa, geo->all_chunks, meta);
if (ret) {
- kfree(meta);
+ vfree(meta);
return ERR_PTR(-EIO);
}

--
2.17.1



2019-01-22 19:50:21

by Matias Bjørling

[permalink] [raw]
Subject: Re: [PATCH] lightnvm: pblk: use vfree to free metadata on error path

On 1/22/19 11:17 AM, [email protected] wrote:
> From: Hans Holmberg <[email protected]>
>
> As chunk metadata is allocated using vmalloc, we need to free it
> using vfree.
>
> Fixes: 090ee26fd512 ("lightnvm: use internal allocation for chunk log page")
> Signed-off-by: Hans Holmberg <[email protected]>
> ---
> drivers/lightnvm/pblk-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/lightnvm/pblk-core.c b/drivers/lightnvm/pblk-core.c
> index 1ff165351180..1b5ff51faa63 100644
> --- a/drivers/lightnvm/pblk-core.c
> +++ b/drivers/lightnvm/pblk-core.c
> @@ -141,7 +141,7 @@ struct nvm_chk_meta *pblk_get_chunk_meta(struct pblk *pblk)
>
> ret = nvm_get_chunk_meta(dev, ppa, geo->all_chunks, meta);
> if (ret) {
> - kfree(meta);
> + vfree(meta);
> return ERR_PTR(-EIO);
> }
>
>

Thanks Hans. Applied for 5.1.