[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210301161029.277278930@linuxfoundation.org>
Date: Mon, 1 Mar 2021 17:13:59 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Nikos Tsironis <ntsironis@...ikto.com>,
Ming-Hung Tsai <mtsai@...hat.com>,
Mike Snitzer <snitzer@...hat.com>
Subject: [PATCH 4.14 166/176] dm era: Fix bitset memory leaks
From: Nikos Tsironis <ntsironis@...ikto.com>
commit 904e6b266619c2da5c58b5dce14ae30629e39645 upstream.
Deallocate the memory allocated for the in-core bitsets when destroying
the target and in error paths.
Fixes: eec40579d84873 ("dm: add era target")
Cc: stable@...r.kernel.org # v3.15+
Signed-off-by: Nikos Tsironis <ntsironis@...ikto.com>
Reviewed-by: Ming-Hung Tsai <mtsai@...hat.com>
Signed-off-by: Mike Snitzer <snitzer@...hat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/md/dm-era-target.c | 6 ++++++
1 file changed, 6 insertions(+)
--- a/drivers/md/dm-era-target.c
+++ b/drivers/md/dm-era-target.c
@@ -46,6 +46,7 @@ struct writeset {
static void writeset_free(struct writeset *ws)
{
vfree(ws->bits);
+ ws->bits = NULL;
}
static int setup_on_disk_bitset(struct dm_disk_bitset *info,
@@ -810,6 +811,8 @@ static struct era_metadata *metadata_ope
static void metadata_close(struct era_metadata *md)
{
+ writeset_free(&md->writesets[0]);
+ writeset_free(&md->writesets[1]);
destroy_persistent_data_objects(md);
kfree(md);
}
@@ -847,6 +850,7 @@ static int metadata_resize(struct era_me
r = writeset_alloc(&md->writesets[1], *new_size);
if (r) {
DMERR("%s: writeset_alloc failed for writeset 1", __func__);
+ writeset_free(&md->writesets[0]);
return r;
}
@@ -857,6 +861,8 @@ static int metadata_resize(struct era_me
&value, &md->era_array_root);
if (r) {
DMERR("%s: dm_array_resize failed", __func__);
+ writeset_free(&md->writesets[0]);
+ writeset_free(&md->writesets[1]);
return r;
}
Powered by blists - more mailing lists