crypto_q_mtx recursion.

From: Pawel Jakub Dawidek <pjd_at_FreeBSD.org>
Date: Fri, 11 Mar 2005 12:33:51 +0100
Hi.

I had a panic related to mutex recursion, the code path is as follows:

	crypto_dispatch()
	CRYPTO_Q_LOCK()
	crypto_invoke()
	crypto_done()
	cryptodev_cb() (via crp->crp_callback)
	crypto_dispatch()
	CRYPTO_Q_LOCK() <- recursion.

Not sure how to fix it. Calling 'locked' version of crypto_dispatch()
is not an option, as we can call cryptodev_cb() with or without
crypto_q_mtx held.
The only fix I can came up with right not is a "pseudo-recursion" in
crypto_dispatch():

	int unlock = 0;

	[...]

	if (!mtx_owned(&crypto_q_mtx)) {
		unlock = 1;
		CRYPTO_Q_LOCK();
	}

	[...]

	if (unlock)
		CRYPTO_Q_LOCK();

-- 
Pawel Jakub Dawidek                       http://www.wheel.pl
pjd_at_FreeBSD.org                           http://www.FreeBSD.org
FreeBSD committer                         Am I Evil? Yes, I Am!

Received on Fri Mar 11 2005 - 10:33:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:29 UTC