[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171013124647.32668-6-m@bjorling.me>
Date: Fri, 13 Oct 2017 14:45:54 +0200
From: Matias Bjørling <m@...rling.me>
To: axboe@...com
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Rakesh Pandit <rakesh@...era.com>,
Matias Bjørling <m@...rling.me>
Subject: [GIT PULL 05/58] lightnvm: pblk: fix error path in pblk_lines_alloc_metadata
From: Rakesh Pandit <rakesh@...era.com>
Use appropriate memory free calls based on allocation type used and
also fix number of times free is called if kmalloc fails.
Signed-off-by: Rakesh Pandit <rakesh@...era.com>
Reviewed-by: Javier González <javier@...xlabs.com>
Signed-off-by: Matias Bjørling <m@...rling.me>
---
drivers/lightnvm/pblk-init.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/lightnvm/pblk-init.c b/drivers/lightnvm/pblk-init.c
index 6df65d1..05665a7 100644
--- a/drivers/lightnvm/pblk-init.c
+++ b/drivers/lightnvm/pblk-init.c
@@ -630,7 +630,10 @@ static int pblk_lines_alloc_metadata(struct pblk *pblk)
fail_free_emeta:
while (--i >= 0) {
- vfree(l_mg->eline_meta[i]->buf);
+ if (l_mg->emeta_alloc_type == PBLK_VMALLOC_META)
+ vfree(l_mg->eline_meta[i]->buf);
+ else
+ kfree(l_mg->eline_meta[i]->buf);
kfree(l_mg->eline_meta[i]);
}
--
2.9.3
Powered by blists - more mailing lists