From owner-p4-projects@FreeBSD.ORG Tue Dec 5 04:59:25 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3376916A40F; Tue, 5 Dec 2006 04:59:25 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EFAD216A417 for ; Tue, 5 Dec 2006 04:59:24 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id D9F9143C9D for ; Tue, 5 Dec 2006 04:58:47 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kB54xOXO060308 for ; Tue, 5 Dec 2006 04:59:24 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kB54xOZp060304 for perforce@freebsd.org; Tue, 5 Dec 2006 04:59:24 GMT (envelope-from sam@freebsd.org) Date: Tue, 5 Dec 2006 04:59:24 GMT Message-Id: <200612050459.kB54xOZp060304@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 111111 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Dec 2006 04:59:25 -0000 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 }