Index: generic/include/ipc/ipc.h
===================================================================
--- generic/include/ipc/ipc.h	(revision c778c1a5271c971524259937fb765673c3c952fc)
+++ generic/include/ipc/ipc.h	(revision 214c5a0de22038eb80f19e56f2874756e13772d0)
@@ -225,5 +225,5 @@
 extern void task_print_list(void);
 extern int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox);
-extern void ipc_cleanup(task_t *task);
+void ipc_cleanup(void);
 extern int ipc_phone_hangup(phone_t *phone, int aggressive);
 extern void ipc_backsend_err(phone_t *phone, call_t *call, __native err);
Index: generic/src/console/cmd.c
===================================================================
--- generic/src/console/cmd.c	(revision c778c1a5271c971524259937fb765673c3c952fc)
+++ generic/src/console/cmd.c	(revision 214c5a0de22038eb80f19e56f2874756e13772d0)
@@ -309,5 +309,5 @@
 static cmd_info_t ipc_task_info = {
 	.name = "ipc_task",
-	.description = "Show memory zone structure.",
+	.description = "ipc_task <taskid> Show IPC information of given task",
 	.func = cmd_ipc_task,
 	.argc = 1,
Index: generic/src/ipc/ipc.c
===================================================================
--- generic/src/ipc/ipc.c	(revision c778c1a5271c971524259937fb765673c3c952fc)
+++ generic/src/ipc/ipc.c	(revision 214c5a0de22038eb80f19e56f2874756e13772d0)
@@ -370,29 +370,30 @@
 }
 
-/** Cleans up all IPC communication of the given task
- *
- *
- */
-void ipc_cleanup(task_t *task)
+/** Cleans up all IPC communication of the current task
+ *
+ * Note: ipc_hangup sets returning answerbox to TASK->answerbox, you
+ * have to change it as well if you want to cleanup other current then current.
+ */
+void ipc_cleanup(void)
 {
 	int i;
 	call_t *call;
 	phone_t *phone;
-	
+
 	/* Disconnect all our phones ('ipc_phone_hangup') */
 	for (i=0;i < IPC_MAX_PHONES; i++)
-		ipc_phone_hangup(&task->phones[i], 1);
+		ipc_phone_hangup(&TASK->phones[i], 1);
 
 	/* Disconnect all connected irqs */
-	ipc_irq_cleanup(&task->answerbox);
+	ipc_irq_cleanup(&TASK->answerbox);
 
 	/* Disconnect all phones connected to our answerbox */
 restart_phones:
-	spinlock_lock(&task->answerbox.lock);
-	while (!list_empty(&task->answerbox.connected_phones)) {
-		phone = list_get_instance(task->answerbox.connected_phones.next,
+	spinlock_lock(&TASK->answerbox.lock);
+	while (!list_empty(&TASK->answerbox.connected_phones)) {
+		phone = list_get_instance(TASK->answerbox.connected_phones.next,
 					  phone_t, link);
 		if (! spinlock_trylock(&phone->lock)) {
-			spinlock_unlock(&task->answerbox.lock);
+			spinlock_unlock(&TASK->answerbox.lock);
 			goto restart_phones;
 		}
@@ -407,8 +408,7 @@
 
 	/* Answer all messages in 'calls' and 'dispatched_calls' queues */
-	spinlock_lock(&task->answerbox.lock);
-	ipc_cleanup_call_list(&task->answerbox.dispatched_calls);
-	ipc_cleanup_call_list(&task->answerbox.calls);
-	spinlock_unlock(&task->answerbox.lock);
+	ipc_cleanup_call_list(&TASK->answerbox.dispatched_calls);
+	ipc_cleanup_call_list(&TASK->answerbox.calls);
+	spinlock_unlock(&TASK->answerbox.lock);
 	
 	/* Wait for all async answers to arrive */
@@ -418,8 +418,12 @@
 		 * it, when we are in cleanup */
 		for (i=0;i < IPC_MAX_PHONES; i++) {
-			if (task->phones[i].state == IPC_PHONE_HUNGUP && \
-			    atomic_get(&task->phones[i].active_calls) == 0)
-				task->phones[i].state = IPC_PHONE_FREE;
-			if (task->phones[i].state != IPC_PHONE_FREE)
+			if (TASK->phones[i].state == IPC_PHONE_HUNGUP && \
+			    atomic_get(&TASK->phones[i].active_calls) == 0)
+				TASK->phones[i].state = IPC_PHONE_FREE;
+			
+			if (TASK->phones[i].state == IPC_PHONE_CONNECTED)
+				ipc_phone_hangup(&TASK->phones[i], 1);
+			
+			if (TASK->phones[i].state != IPC_PHONE_FREE)
 				break;
 		}
@@ -428,9 +432,9 @@
 			break;
 		
-		call = ipc_wait_for_call(&task->answerbox, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
+		call = ipc_wait_for_call(&TASK->answerbox, SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE);
 		ASSERT((call->flags & IPC_CALL_ANSWERED) || (call->flags & IPC_CALL_NOTIF));
 		ASSERT(! (call->flags & IPC_CALL_STATIC_ALLOC));
 		
-		atomic_dec(&task->active_calls);
+		atomic_dec(&TASK->active_calls);
 		ipc_call_free(call);
 	}
