Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2005 12:33:51 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        freebsd-current@freebsd.org
Subject:   crypto_q_mtx recursion.
Message-ID:  <20050311113351.GC9291@darkness.comp.waw.pl>

next in thread | raw e-mail | index | archive | help

--E+r5CZjTUHNgkElv
Content-Type: text/plain; charset=iso-8859-2
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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 =3D 0;

	[...]

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

	[...]

	if (unlock)
		CRYPTO_Q_LOCK();

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

--E+r5CZjTUHNgkElv
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFCMYIfForvXbEpPzQRAsCtAJ9aaGcM8dzT/jnHGxAmrNyPhx98vACdGC99
7o/U8Lch2UJZ5ZWOe03U7qw=
=Iakb
-----END PGP SIGNATURE-----

--E+r5CZjTUHNgkElv--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050311113351.GC9291>