Use correct answerbox to answer IPC_M_PHONE_HUNGUP in kbox thread
commit0b005997aa705c5c511941d3a843eab28f34def7
authorJakub Jermar <jakub@jermar.eu>
Sun, 11 Sep 2016 08:21:11 +0000 (11 10:21 +0200)
committerJakub Jermar <jakub@jermar.eu>
Sun, 11 Sep 2016 08:21:11 +0000 (11 10:21 +0200)
treef37431710655fea5d69f9dca37ac1750ab985858
parent43e2cbcf82bf0d553c0cb190d4043a6eed86a617
Use correct answerbox to answer IPC_M_PHONE_HUNGUP in kbox thread

When ipc_kbox_cleanup() slams the phones connected to the kbox, it
requests answerbox notification. To that end,
ipc_answerbox_slam_phones() allocates a new IPC_M_PHONE_HUNGUP call per
each slammed phone and sends it directly to its own kbox. The allocation
of the call structure happens in the context of the debugee, not the
debugger, so call->callerbox is wrong because it is initialized with
&TASK->answerbox. This causes confusion in _ipc_answer_free_call()
invoked from kbox_proc_phone_hungup(), which picks a wrong answerbox for
the answer. The debugger, in turn, never sees the call answered and
lingers in its own ipc_cleanup() forever.

We correct this by allowing call->callerbox to be NULL, in which case
_ipc_answer_free_call() will use call->sender->answerbox instead.
kernel/generic/src/ipc/ipc.c