The locking is inconsistent with the rest of the service handlers in the
amf service library.  In some error conditions the locks are not managed
properly.

Regards
-steve
Index: lib/amf.c
===================================================================
--- lib/amf.c	(revision 1468)
+++ lib/amf.c	(working copy)
@@ -223,16 +223,16 @@
 		ufds.events = POLLIN;
 		ufds.revents = 0;
 
+		pthread_mutex_lock (&amfInstance->dispatch_mutex);
+
 		error = saPollRetry (&ufds, 1, timeout);
 		if (error != SA_AIS_OK) {
 			goto error_nounlock;
 		}
 
-		pthread_mutex_lock (&amfInstance->dispatch_mutex);
-
 		error = saPollRetry (&ufds, 1, 0);
 		if (error != SA_AIS_OK) {
-			goto error_nounlock;
+			goto error_unlock;
 		}
 
 		/*
@@ -240,8 +240,6 @@
 		 */
 		if (amfInstance->finalize == 1) {
 			error = SA_AIS_OK;
-			pthread_mutex_unlock (&amfInstance->dispatch_mutex);
-
 			goto error_unlock;
 		}
 
@@ -382,7 +380,7 @@
 			break;
 		default:
 			error = SA_AIS_ERR_LIBRARY;	
-			goto error_nounlock;
+			goto error_put;
 			break;
 		}
 
@@ -400,9 +398,13 @@
 		}
 	} while (cont);
 
+	goto error_put;
+
 error_unlock:
-	saHandleInstancePut (&amfHandleDatabase, amfHandle);
-error_nounlock:
+        pthread_mutex_unlock (&clmInstance->dispatch_mutex);
+
+error_put:
+        saHandleInstancePut (&clmHandleDatabase, clmHandle);
 	return (error);
 }
 
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to