staging/lustre/ptlrpc: race in pinger (use-after-free situation)
authorDmitry Eremin <[email protected]>
Mon, 22 Jul 2013 16:06:31 +0000 (00:06 +0800)
committerGreg Kroah-Hartman <[email protected]>
Tue, 23 Jul 2013 19:39:24 +0000 (12:39 -0700)
commit2080205729edf2a59296f17081c9aa25a7ed6368
tree21b2f25eb1f1c9a47d2aa040d9132521bdc01c2d
parentc5b60ba79d67797ab6fffcab5edd9364b14d1dd7
staging/lustre/ptlrpc: race in pinger (use-after-free situation)

The race is result of use-after-free situation:

~ ptlrpc_stop_pinger()          ~ ptlrpc_pinger_main()
---------------------------------------------------------------
thread_set_flags(SVC_STOPPING)
cfs_waitq_signal(pinger_thread) ...
...                             thread_set_flags(SVC_STOPPED)
l_wait_event(thread_is_stopped)
OBD_FREE_PTR(pinger_thread)
...                             cfs_waitq_signal(pinger_thread)
---------------------------------------------------------------

The memory used by pinger_thread might have been freed and
reallocated to something else, when ptlrpc_pinger_main()
used it in cvs_waitq_signal().

Signed-off-by: Li Wei <[email protected]>
Signed-off-by: Dmitry Eremin <[email protected]>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3032
Lustre-change: http://review.whamcloud.com/6040
Reviewed-by: Faccini Bruno <[email protected]>
Reviewed-by: Mike Pershin <[email protected]>
Reviewed-by: Andreas Dilger <[email protected]>
Signed-off-by: Peng Tao <[email protected]>
Signed-off-by: Andreas Dilger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
drivers/staging/lustre/lustre/ptlrpc/pinger.c