summaryrefslogtreecommitdiff
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2017-11-08 13:44:55 +0100
committerShaohua Li <shli@fb.com>2017-11-10 11:43:04 -0800
commit0202ce8a90efdc81600e7bf9712d8c324081a924 (patch)
treef260f7241e8fc6e3ed5253374f0eca0e8b9e696a /drivers/md/md.c
parent97f0eb9f0fec0563c1c796d95123e871b8bb65c0 (diff)
md: release allocated bitset sync_set
Patch fixes kmemleak on md_stop() path used likely only by dm-raid wrapper. Code of md is using mddev_put() where both bitsets are released however this freeing is not shared. Also set NULL to bio_set and sync_set pointers just like mddev_put is doing. Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 15e4668f594c..e014d39159d7 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5852,8 +5852,14 @@ void md_stop(struct mddev *mddev)
* This is called from dm-raid
*/
__md_stop(mddev);
- if (mddev->bio_set)
+ if (mddev->bio_set) {
bioset_free(mddev->bio_set);
+ mddev->bio_set = NULL;
+ }
+ if (mddev->sync_set) {
+ bioset_free(mddev->sync_set);
+ mddev->sync_set = NULL;
+ }
}
EXPORT_SYMBOL_GPL(md_stop);