Index: kernel/generic/src/synch/mutex.c
===================================================================
--- kernel/generic/src/synch/mutex.c	(revision 82cbf8c6161e2ff15d39a43b59096447a98acc21)
+++ kernel/generic/src/synch/mutex.c	(revision b63b02ec1ec110cc8397bdc301aaba9426cf74c4)
@@ -46,10 +46,12 @@
 /** Initialize mutex.
  *
- * @param mtx  Mutex.
- * @param type Type of the mutex.
+ * @param mtx   Mutex.
+ * @param type  Type of the mutex.
  */
 void mutex_initialize(mutex_t *mtx, mutex_type_t type)
 {
 	mtx->type = type;
+	mtx->owner = NULL;
+	mtx->nesting = 0;
 	semaphore_initialize(&mtx->sem, 1);
 }
@@ -57,6 +59,7 @@
 /** Find out whether the mutex is currently locked.
  *
- * @param mtx		Mutex.
- * @return 		True if the mutex is locked, false otherwise.
+ * @param mtx  Mutex.
+ *
+ * @return  True if the mutex is locked, false otherwise.
  */
 bool mutex_locked(mutex_t *mtx)
@@ -71,10 +74,10 @@
  * Timeout mode and non-blocking mode can be requested.
  *
- * @param mtx   Mutex.
- * @param usec  Timeout in microseconds.
- * @param flags Specify mode of operation.
+ * @param mtx    Mutex.
+ * @param usec   Timeout in microseconds.
+ * @param flags  Specify mode of operation.
  *
- * For exact description of possible combinations of
- * usec and flags, see comment for waitq_sleep_timeout().
+ * For exact description of possible combinations of usec and flags, see
+ * comment for waitq_sleep_timeout().
  *
  * @return See comment for waitq_sleep_timeout().
@@ -85,8 +88,21 @@
 	int rc;
 
-	if ((mtx->type == MUTEX_PASSIVE) && (THREAD)) {
+	if (mtx->type == MUTEX_PASSIVE && THREAD) {
 		rc = _semaphore_down_timeout(&mtx->sem, usec, flags);
+	} else if (mtx->type == MUTEX_RECURSIVE) {
+		assert(THREAD);
+
+		if (mtx->owner == THREAD) {
+			mtx->nesting++;
+			return ESYNCH_OK_ATOMIC;
+		} else {
+			rc = _semaphore_down_timeout(&mtx->sem, usec, flags);
+			if (SYNCH_OK(rc)) {
+				mtx->owner = THREAD;
+				mtx->nesting = 1;
+			}
+		}
 	} else {
-		assert((mtx->type == MUTEX_ACTIVE) || (!THREAD));
+		assert((mtx->type == MUTEX_ACTIVE) || !THREAD);
 		assert(usec == SYNCH_NO_TIMEOUT);
 		assert(!(flags & SYNCH_FLAGS_INTERRUPTIBLE));
@@ -114,8 +130,14 @@
 /** Release mutex.
  *
- * @param mtx Mutex.
+ * @param mtx  Mutex.
  */
 void mutex_unlock(mutex_t *mtx)
 {
+	if (mtx->type == MUTEX_RECURSIVE) {
+		assert(mtx->owner == THREAD);
+		if (--mtx->nesting > 0)
+			return;
+		mtx->owner = NULL;
+	}
 	semaphore_up(&mtx->sem);
 }
