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

Commit 82e9455b authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "md: dm-req-crypt does not release the device"

parents a445e77d 95f503fc
Loading
Loading
Loading
Loading
+16 −29
Original line number Diff line number Diff line
@@ -844,21 +844,13 @@ static void req_crypt_dtr(struct dm_target *ti)
{
	DMDEBUG("dm-req-crypt Destructor.\n");

	if (req_crypt_queue) {
		destroy_workqueue(req_crypt_queue);
		req_crypt_queue = NULL;
	}
	if (req_io_pool) {
		mempool_destroy(req_io_pool);
		req_io_pool = NULL;
	}
	if (req_page_pool) {
		mempool_destroy(req_page_pool);
		req_page_pool = NULL;
	}
	if (tfm) {
		crypto_free_ablkcipher(tfm);
		tfm = NULL;
	if (req_io_pool) {
		mempool_destroy(req_io_pool);
		req_io_pool = NULL;
	}
	mutex_lock(&engine_list_mutex);
	kfree(pfe_eng);
@@ -866,6 +858,16 @@ static void req_crypt_dtr(struct dm_target *ti)
	kfree(fde_eng);
	fde_eng = NULL;
	mutex_unlock(&engine_list_mutex);

	if (tfm) {
		crypto_free_ablkcipher(tfm);
		tfm = NULL;
	}
	if (req_crypt_queue) {
		destroy_workqueue(req_crypt_queue);
		req_crypt_queue = NULL;
	}
	dm_put_device(ti, dev);
}


@@ -1014,24 +1016,9 @@ static int req_crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
	}
	err = 0;
ctr_exit:
	if (err != 0) {
		if (req_crypt_queue) {
			destroy_workqueue(req_crypt_queue);
			req_crypt_queue = NULL;
		}
		if (req_io_pool) {
			mempool_destroy(req_io_pool);
			req_io_pool = NULL;
		}
		if (req_page_pool) {
			mempool_destroy(req_page_pool);
			req_page_pool = NULL;
		}
		if (tfm) {
			crypto_free_ablkcipher(tfm);
			tfm = NULL;
		}
	}
	if (err)
		req_crypt_dtr(ti);

	kfree(eng_list);
	return err;
}