From: "Javier González" <jg@lightnvm.io>
To: mb@lightnvm.io
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
"Javier González" <javier@cnexlabs.com>
Subject: [PATCH 3/5] lightnvm: pblk: fix memory leak on error path
Date: Sat, 22 Apr 2017 01:32:47 +0200 [thread overview]
Message-ID: <1492817569-13532-4-git-send-email-javier@cnexlabs.com> (raw)
In-Reply-To: <1492817569-13532-1-git-send-email-javier@cnexlabs.com>
When write recovery fails, Free memory for the recovery structure.
Fixes: a4bd217b4326 "lightnvm: physical block device (pblk) target"
Signed-off-by: Javier González <javier@cnexlabs.com>
---
drivers/lightnvm/pblk-write.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/lightnvm/pblk-write.c b/drivers/lightnvm/pblk-write.c
index 74f7413..a896190 100644
--- a/drivers/lightnvm/pblk-write.c
+++ b/drivers/lightnvm/pblk-write.c
@@ -142,6 +142,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)
/* Logic error */
if (bit > c_ctx->nr_valid) {
WARN_ONCE(1, "pblk: corrupted write request\n");
+ mempool_free(recovery, pblk->rec_pool);
goto out;
}
@@ -149,6 +150,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)
entry = pblk_rb_sync_scan_entry(&pblk->rwb, &ppa);
if (!entry) {
pr_err("pblk: could not scan entry on write failure\n");
+ mempool_free(recovery, pblk->rec_pool);
goto out;
}
@@ -162,6 +164,7 @@ static void pblk_end_w_fail(struct pblk *pblk, struct nvm_rq *rqd)
ret = pblk_recov_setup_rq(pblk, c_ctx, recovery, comp_bits, c_entries);
if (ret) {
pr_err("pblk: could not recover from write failure\n");
+ mempool_free(recovery, pblk->rec_pool);
goto out;
}
--
2.7.4
next prev parent reply other threads:[~2017-04-21 23:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-21 23:32 [PATCH 0/5] lightnvm: pblk extra patches for 4.12 Javier González
2017-04-21 23:32 ` [PATCH 1/5] lightnvm: pblk: fix race condition on line retry Javier González
2017-04-22 8:51 ` Matias Bjørling
2017-04-21 23:32 ` [PATCH 2/5] lightnvm: pblk: fix bad error check Javier González
2017-04-22 8:52 ` Matias Bjørling
2017-04-21 23:32 ` Javier González [this message]
2017-04-22 8:57 ` [PATCH 3/5] lightnvm: pblk: fix memory leak on error path Matias Bjørling
2017-04-21 23:32 ` [PATCH 4/5] lightnvm: pblk: free metadata on line alloc failure Javier González
2017-04-22 9:02 ` Matias Bjørling
2017-04-21 23:32 ` [PATCH 5/5] lightnvm: pblk: fix erase counters on error fail Javier González
2017-04-22 9:22 ` Matias Bjørling
2017-04-22 9:31 ` Javier González
2017-04-23 17:59 ` Matias Bjørling
2017-04-23 18:18 ` Javier González
2017-04-23 18:00 ` [PATCH 0/5] lightnvm: pblk extra patches for 4.12 Matias Bjørling
2017-04-23 22:58 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1492817569-13532-4-git-send-email-javier@cnexlabs.com \
--to=jg@lightnvm.io \
--cc=javier@cnexlabs.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mb@lightnvm.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).