mirror of https://github.com/schoebel/mars
infra: fix racy NULL deref on thread termination
This commit is contained in:
parent
2b2e07d24d
commit
b0171749a4
|
@ -652,12 +652,13 @@ extern void brick_thread_stop_nowait(struct task_struct *k);
|
||||||
|
|
||||||
#define brick_thread_stop(_thread) \
|
#define brick_thread_stop(_thread) \
|
||||||
do { \
|
do { \
|
||||||
if (likely(_thread)) { \
|
struct task_struct *__thread__ = (_thread); \
|
||||||
BRICK_INF("stopping thread '%s'\n", (_thread)->comm); \
|
if (likely(__thread__)) { \
|
||||||
kthread_stop(_thread); \
|
BRICK_INF("stopping thread '%s'\n", __thread__->comm); \
|
||||||
BRICK_INF("thread '%s' finished.\n", (_thread)->comm); \
|
kthread_stop(__thread__); \
|
||||||
remove_binding(_thread); \
|
BRICK_INF("thread '%s' finished.\n", __thread__->comm); \
|
||||||
put_task_struct(_thread); \
|
remove_binding(__thread__); \
|
||||||
|
put_task_struct(__thread__); \
|
||||||
_thread = NULL; \
|
_thread = NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
Loading…
Reference in New Issue