Date: Tue, 5 Dec 2006 04:59:24 GMT From: Sam Leffler <sam@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 111111 for review Message-ID: <200612050459.kB54xOZp060304@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=111111 Change 111111 by sam@sam_ebb on 2006/12/05 04:59:17 we don't need Giant for the symmetric crypto ops; keep Giant for now for the key ops as we need it or tsleep will panic--we'll eliminate that with upcoming mods Affected files ... .. //depot/projects/crypto/sys/opencrypto/cryptodev.c#6 edit Differences ... ==== //depot/projects/crypto/sys/opencrypto/cryptodev.c#6 (text+ko) ==== @@ -167,10 +167,6 @@ u_int32_t ses; int error = 0, crid; - /* - * XXX: Not sure Giant is needed, but better safe than sorry - */ - mtx_lock(&Giant); switch (cmd) { case CIOCGSESSION: case CIOCGSESSION2: @@ -203,7 +199,6 @@ txform = &enc_xform_arc4; break; default: - mtx_unlock(&Giant); return (EINVAL); } @@ -240,7 +235,6 @@ thash = &auth_hash_null; break; default: - mtx_unlock(&Giant); return (EINVAL); } @@ -319,26 +313,23 @@ case CIOCFSESSION: ses = *(u_int32_t *)data; cse = csefind(fcr, ses); - if (cse == NULL) { - mtx_unlock(&Giant); + if (cse == NULL) return (EINVAL); - } csedelete(fcr, cse); error = csefree(cse); break; case CIOCCRYPT: cop = (struct crypt_op *)data; cse = csefind(fcr, cop->ses); - if (cse == NULL) { - mtx_unlock(&Giant); + if (cse == NULL) return (EINVAL); - } error = cryptodev_op(cse, cop, active_cred, td); break; case CIOCKEY: case CIOCKEY2: if (!crypto_userasymcrypto) return (EPERM); /* XXX compat? */ + mtx_lock(&Giant); kop = (struct crypt_kop *)data; if (cmd == CIOCKEY) { /* NB: crypto core enforces s/w driver use */ @@ -346,6 +337,7 @@ CRYPTOCAP_F_HARDWARE | CRYPTOCAP_F_SOFTWARE; } error = cryptodev_key(kop); + mtx_unlock(&Giant); break; case CIOCASYMFEAT: if (!crypto_userasymcrypto) { @@ -364,8 +356,8 @@ break; default: error = EINVAL; + break; } - mtx_unlock(&Giant); return (error); #undef SES2 }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200612050459.kB54xOZp060304>