crypto_q_mtx recursion.

Pawel Jakub Dawidek pjd at FreeBSD.org
Fri Mar 11 03:33:54 PST 2005


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!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20050311/36fc5b82/attachment.bin


More information about the freebsd-current mailing list