mirror of
https://github.com/schoebel/mars
synced 2024-12-28 18:03:12 +00:00
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) \
|
||||
do { \
|
||||
if (likely(_thread)) { \
|
||||
BRICK_INF("stopping thread '%s'\n", (_thread)->comm); \
|
||||
kthread_stop(_thread); \
|
||||
BRICK_INF("thread '%s' finished.\n", (_thread)->comm); \
|
||||
remove_binding(_thread); \
|
||||
put_task_struct(_thread); \
|
||||
struct task_struct *__thread__ = (_thread); \
|
||||
if (likely(__thread__)) { \
|
||||
BRICK_INF("stopping thread '%s'\n", __thread__->comm); \
|
||||
kthread_stop(__thread__); \
|
||||
BRICK_INF("thread '%s' finished.\n", __thread__->comm); \
|
||||
remove_binding(__thread__); \
|
||||
put_task_struct(__thread__); \
|
||||
_thread = NULL; \
|
||||
} \
|
||||
} while (0)
|
||||
|
Loading…
Reference in New Issue
Block a user