Index: uspace/srv/net/socket/socket_client.c
===================================================================
--- uspace/srv/net/socket/socket_client.c	(revision aadf01ebd2c032bc8dd43a6e06ae5715e6c2710f)
+++ uspace/srv/net/socket/socket_client.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -580,5 +580,8 @@
 		fibril_rwlock_write_unlock(&socket_globals.lock);
 		fibril_condvar_wait(&socket->accept_signal, &socket->accept_lock);
+		// drop the accept lock to avoid deadlock
+		fibril_mutex_unlock(&socket->accept_lock);
 		fibril_rwlock_write_lock(&socket_globals.lock);
+		fibril_mutex_lock(&socket->accept_lock);
 	}
 	-- socket->blocked;
@@ -801,5 +804,8 @@
 		fibril_rwlock_read_unlock(&socket_globals.lock);
 		fibril_condvar_wait(&socket->receive_signal, &socket->receive_lock);
+		// drop the receive lock to avoid deadlock
+		fibril_mutex_unlock(&socket->receive_lock);
 		fibril_rwlock_read_lock(&socket_globals.lock);
+		fibril_mutex_lock(&socket->receive_lock);
 	}
 	-- socket->blocked;
Index: uspace/srv/net/tl/icmp/icmp.c
===================================================================
--- uspace/srv/net/tl/icmp/icmp.c	(revision aadf01ebd2c032bc8dd43a6e06ae5715e6c2710f)
+++ uspace/srv/net/tl/icmp/icmp.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -175,5 +175,5 @@
 /** Requests an echo message.
  *  Sends a packet with specified parameters to the target host and waits for the reply upto the given timeout.
- *  Blocks the caller until the reply or the timeout occurres.
+ *  Blocks the caller until the reply or the timeout occurs.
  *  @param[in] id The message identifier.
  *  @param[in] sequence The message sequence parameter.
@@ -221,6 +221,6 @@
 
 /** Tries to set the pending reply result as the received message type.
- *  If the reply data are still present, the reply timeouted and the parent fibril is awaken.
- *  The global lock is not released in this case to be reused by the parent fibril.
+ *  If the reply data is not present, the reply timed out and the other fibril
+ *  is already awake.
  *  Releases the packet.
  *  @param[in] packet The received reply message.
@@ -334,5 +334,5 @@
 	}
 
-	// unlock the globals and wait for a reply
+	// unlock the globals so that we can wait for the reply
 	fibril_rwlock_write_unlock(&icmp_globals.lock);
 
@@ -340,18 +340,16 @@
 	icmp_send_packet(ICMP_ECHO, 0, packet, header, 0, ttl, tos, dont_fragment);
 
-	// wait for a reply
+	// wait for the reply
 	// timeout in microseconds
 	if(ERROR_OCCURRED(fibril_condvar_wait_timeout(&reply->condvar, &reply->mutex, timeout * 1000))){
 		result = ERROR_CODE;
-
-		// lock the globals again and clean up
-		fibril_rwlock_write_lock(&icmp_globals.lock);
 	}else{
 		// read the result
 		result = reply->result;
-
-		// release the reply structure
-		fibril_mutex_unlock(&reply->mutex);
-	}
+	}
+
+	// drop the reply mutex before locking the globals again
+	fibril_mutex_unlock(&reply->mutex);
+	fibril_rwlock_write_lock(&icmp_globals.lock);
 
 	// destroy the reply structure
@@ -636,10 +634,8 @@
 		// set the result
 		reply->result = type;
-		// notify the main fibril
+		// notify the waiting fibril
 		fibril_condvar_signal(&reply->condvar);
-	}else{
-		// unlock only if no reply
-		fibril_rwlock_write_unlock(&icmp_globals.lock);
-	}
+	}
+	fibril_rwlock_write_unlock(&icmp_globals.lock);
 	return EOK;
 }
Index: uspace/srv/net/tl/udp/udp.c
===================================================================
--- uspace/srv/net/tl/udp/udp.c	(revision aadf01ebd2c032bc8dd43a6e06ae5715e6c2710f)
+++ uspace/srv/net/tl/udp/udp.c	(revision 936835e135a18adfccf27258eb51edd1dd5fe962)
@@ -418,5 +418,4 @@
 	struct sockaddr * addr;
 	size_t addrlen;
-	fibril_rwlock_t lock;
 	ipc_call_t answer;
 	int answer_count;
@@ -433,5 +432,4 @@
 
 	socket_cores_initialize(&local_sockets);
-	fibril_rwlock_initialize(&lock);
 
 	while(keep_on_going){
@@ -453,8 +451,6 @@
 				break;
 			case NET_SOCKET:
-				fibril_rwlock_write_lock(&lock);
 				*SOCKET_SET_SOCKET_ID(answer) = SOCKET_GET_SOCKET_ID(call);
 				res = socket_create(&local_sockets, app_phone, NULL, SOCKET_SET_SOCKET_ID(answer));
-				fibril_rwlock_write_unlock(&lock);
 				if(res == EOK){
 					if(tl_get_ip_packet_dimension(udp_globals.ip_phone, &udp_globals.dimensions, DEVICE_INVALID_ID, &packet_dimension) == EOK){
@@ -469,9 +465,7 @@
 				res = data_receive((void **) &addr, &addrlen);
 				if(res == EOK){
-					fibril_rwlock_read_lock(&lock);
 					fibril_rwlock_write_lock(&udp_globals.lock);
 					res = socket_bind(&local_sockets, &udp_globals.sockets, SOCKET_GET_SOCKET_ID(call), addr, addrlen, UDP_FREE_PORTS_START, UDP_FREE_PORTS_END, udp_globals.last_used_port);
 					fibril_rwlock_write_unlock(&udp_globals.lock);
-					fibril_rwlock_read_unlock(&lock);
 					free(addr);
 				}
@@ -480,5 +474,4 @@
 				res = data_receive((void **) &addr, &addrlen);
 				if(res == EOK){
-					fibril_rwlock_read_lock(&lock);
 					fibril_rwlock_write_lock(&udp_globals.lock);
 					res = udp_sendto_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), addr, addrlen, SOCKET_GET_DATA_FRAGMENTS(call), SOCKET_SET_DATA_FRAGMENT_SIZE(answer), SOCKET_GET_FLAGS(call));
@@ -488,14 +481,11 @@
 						answer_count = 2;
 					}
-					fibril_rwlock_read_unlock(&lock);
 					free(addr);
 				}
 				break;
 			case NET_SOCKET_RECVFROM:
-				fibril_rwlock_read_lock(&lock);
 				fibril_rwlock_write_lock(&udp_globals.lock);
 				res = udp_recvfrom_message(&local_sockets, SOCKET_GET_SOCKET_ID(call), SOCKET_GET_FLAGS(call), &addrlen);
 				fibril_rwlock_write_unlock(&udp_globals.lock);
-				fibril_rwlock_read_unlock(&lock);
 				if(res > 0){
 					*SOCKET_SET_READ_DATA_LENGTH(answer) = res;
@@ -506,9 +496,7 @@
 				break;
 			case NET_SOCKET_CLOSE:
-				fibril_rwlock_write_lock(&lock);
 				fibril_rwlock_write_lock(&udp_globals.lock);
 				res = socket_destroy(udp_globals.net_phone, SOCKET_GET_SOCKET_ID(call), &local_sockets, &udp_globals.sockets, NULL);
 				fibril_rwlock_write_unlock(&udp_globals.lock);
-				fibril_rwlock_write_unlock(&lock);
 				break;
 			case NET_SOCKET_GETSOCKOPT:
