PERFORCE change 111111 for review
Sam Leffler
sam at FreeBSD.org
Mon Dec 4 20:59:25 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=111111
Change 111111 by sam at 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
}
More information about the p4-projects
mailing list