Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 977131da authored by Dinesh K Garg's avatar Dinesh K Garg
Browse files

md: Null check allocated mem pools before releasing



If there is any error during construction of dm-req-crypt based device,
it calls for dm-req-crypt destruction. In destructor, it calls for
kmem_cache_destroy without checking if corresponding pools were allocated.
This causes device to crash. Adding null checks to ensure mem pools are
released only if those were allocated.

Change-Id: I07da1635cc99696b231aeace834855613862213f
Signed-off-by: default avatarDinesh K Garg <dineshg@codeaurora.org>
parent c049a981
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1041,7 +1041,10 @@ static void req_crypt_dtr(struct dm_target *ti)
		destroy_workqueue(req_crypt_queue);
		req_crypt_queue = NULL;
	}
	if (_req_dm_scatterlist_pool)
		kmem_cache_destroy(_req_dm_scatterlist_pool);

	if (_req_crypt_io_pool)
		kmem_cache_destroy(_req_crypt_io_pool);

	if (dev) {