[sheepdog] [PATCH] event: refresh event info after unregistering

Liu Yuan namei.unix at gmail.com
Thu Aug 22 06:45:42 CEST 2013


On Thu, Aug 22, 2013 at 12:37:35PM +0900, MORITA Kazutaka wrote:
> From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
> 
> The current code causes a segfault with the following scenario:
> 
>  1. Both worker_thread_request_done() event and client_handler() event
>     become ready with epoll_wait() in do_event_loop().
> 
>  2. do_event_loop() calls worker_thread_request_done(), and it calls
>     clear_client_info().  This can happen when the client connection
>     is already closed (e.g. in put_request(), tx_main()).
> 
>  3. clear_client_info() calls unregister_event(), and it frees the
>     client_handler() event.
> 
>  3. do_event_loop() tries to call client_handler() but the event is
>     already freed and no longer valid.
> 
> To fix the problem, this patch calls event_force_refresh() in
> unregister_event() and make do_event_loop() call epoll_wait() again.
> 
> Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

Applied thanks

Yuan



More information about the sheepdog mailing list