Skip to contentSkip to conversation

lightnvm: pblk: use vfree to free metadata on error path

PATCH In review [email protected] 2 participants 2 messages Jan 22, 2019 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/lightnvm/pblk-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/lightnvm/pblk-core.c +1 -1
index 1ff165351180..1b5ff51faa63 100644
@@ -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);
 	}
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 17 lines · 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")
---
  drivers/lightnvm/pblk-core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/lightnvm/pblk-core.c +0 -0
index 1ff165351180..1b5ff51faa63 100644

drivers/lightnvm/pblk-core.c struct nvm_chk_meta *pblk_get_chunk_meta(struct pblk *pblk) · line 147

Quoted 8 lines
drivers/lightnvm/pblk-core.c +1 -1
@@ -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.