From: 윤정현 <jh0506.yun@samsung.com>
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 13 Feb 2012 06:49:30 +0000 (06:49 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 13 Feb 2012 06:49:30 +0000 (06:49 +0000)
commit0448d8b8e63652ac5faefcc92482b4a20318cb39
treec2af59ee5442df79a1c3907b493045c9693b9000
parent848528b3c9f460b8357db72503992c6ac5619179
From: 윤정현 <jh0506.yun@samsung.com>
Subject: Re: [E-devel] [Patch] ecore_ipc - remove potential risk in
ecore_ipc_shutdown

I found a problem this infinite loop case.

If server is deleted, then ECORE_IPC_EVENT_SERVER_DEL callback
function will be called in client side.
It will happen infinite loop in ecore_ipc_shutdown if
ecore_ipc_shutdown called in this ECORE_IPC_EVENT_SERVER_DEL callback
function.

For example,
server_del_handler =
ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, _server_del_cb, NULL);
static Eina_Bool
_server_del_cb(void *data, int type, void *event)
{
   ecore_ipc_shutdown();
   return EINA_TRUE;
 }

If server is deleted,
1. _ecore_ipc_event_server_del : svr->event_count++
2. _server_del_cb : ecore_ipc_shutdown called
3. ecore_ipc_shutdown : while (servers) ecore_ipc_server_del(eina_list_data_get(servers))
4. ecore_ipc_server_del : can't eina_list_remove(servers, svr) because event_count != 0
5. infinite loop

I think this while code is very dangerous whether user miss or not.
I modified EINA_LIST_FOREACH_SAFE instead of EINA_LIST_FOREACH refer
to ecore_con.
Please review this patch.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/ecore@67874 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33
src/lib/ecore_ipc/ecore_ipc.c