kern/83930: crypto_q_mtx recursion when unloading hifn.ko.

Pawe³ Jakub Dawidek pjd at FreeBSD.org
Fri Jul 22 23:00:33 GMT 2005


>Number:         83930
>Category:       kern
>Synopsis:       crypto_q_mtx recursion when unloading hifn.ko.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 22 23:00:32 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Pawel Jakub Dawidek
>Release:        FreeBSD 5.x
>Organization:
>Environment:
>Description:
I had a panic related to mutex recursion when unloading hifn.ko module.
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.
>How-To-Repeat:
>Fix:
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();
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list