Index: uspace/lib/net/generic/packet_remote.c
===================================================================
--- uspace/lib/net/generic/packet_remote.c	(revision c3887ad51d98fb2ab33fb44ebfb8994afaba2cbf)
+++ uspace/lib/net/generic/packet_remote.c	(revision ab9378b44e4fa6398d0ebc438e0bced6f97cbc29)
@@ -38,4 +38,5 @@
 #include <async.h>
 #include <errno.h>
+#include <fibril_synch.h>
 #include <ipc/packet.h>
 #include <sys/mman.h>
@@ -46,4 +47,6 @@
 #include <net/packet.h>
 #include <net/packet_header.h>
+
+static FIBRIL_MUTEX_INITIALIZE(packet_return_lock);
 
 /** Obtain the packet from the packet server as the shared memory block.
@@ -66,4 +69,12 @@
     packet_id_t packet_id, size_t size)
 {
+	/*
+	 * Prevent racing for address space with other invocations
+	 * of packet_return().
+	 *
+	 * XXX This of course does not prevent us racing with other
+	 * competitors for address space mapping.
+	 */
+	fibril_mutex_lock(&packet_return_lock);
 	*packet = (packet_t *) as_get_mappable_page(size);
 	
@@ -79,4 +90,5 @@
 	if (rc != EOK) {
 		munmap(*packet, size);
+		fibril_mutex_unlock(&packet_return_lock);
 		return rc;
 	}
@@ -85,7 +97,9 @@
 	if (rc != EOK) {
 		munmap(*packet, size);
+		fibril_mutex_unlock(&packet_return_lock);
 		return rc;
 	}
 	
+	fibril_mutex_unlock(&packet_return_lock);
 	return result;
 }
