Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Mutex error happen, after ioctl(CIOCFSESSION) for crypto(4)



Hi! all,


I meet with this Mutex error.

  Mutex error: mutex_vector_enter: locking against myself

  lock address : 0x00000000c0519f14
  current cpu  :                  0
  current lwp  : 0x00000000c2f282e0
  owner field  : 0x0000000000010100 wait/spin:                0/1

  panic: lock error
  Stopped in pid 44.1 (a.out) at  netbsd:cpu_Debugger+0x4:        bx      r14
  db>


I think, cryptodev.c has mutex problem.  It returns in the state of
entered mutex, if 'ces == NULL'.


Index: cryptodev.c
===================================================================
RCS file: /cvsroot/src/sys/opencrypto/cryptodev.c,v
retrieving revision 1.44
diff -u -r1.44 cryptodev.c
--- cryptodev.c 24 May 2008 16:42:00 -0000      1.44
+++ cryptodev.c 3 Nov 2008 05:04:14 -0000
@@ -278,10 +278,11 @@
                mutex_spin_enter(&crypto_mtx);
                ses = *(u_int32_t *)data;
                cse = csefind(fcr, ses);
-               if (cse == NULL)
-                       return EINVAL;
-               csedelete(fcr, cse);
-               error = csefree(cse);
+               if (cse != NULL) {
+                       csedelete(fcr, cse);
+                       error = csefree(cse);
+               } else
+                       error = EINVAL;
                mutex_spin_exit(&crypto_mtx);
                break;
        case CIOCNFSESSION:


In addition, the manual of crypto(4) might be wrong if it adds it.

     man 4 crypto -->

     CIOCFSESSION void
               Destroys the /dev/crypto session associated with the file-
               descriptor argument.

     <-- man 4 crypto

Thanks,
--
kiyohara


Home | Main Index | Thread Index | Old Index