Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jul 2005 00:53:20 +0200 (CEST)
From:      Paweł Jakub Dawidek <pjd@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        sam@FreeBSD.org
Subject:   kern/83930: crypto_q_mtx recursion when unloading hifn.ko.
Message-ID:  <20050722225320.0F460ACAF4@darkness.comp.waw.pl>
Resent-Message-ID: <200507222300.j6MN0W6m034849@freefall.freebsd.org>

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

>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:



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