BUG/MEDIUM: tasks: Make sure we switch wait queues in task_set_affinity().

In task_set_affinity(), leave the wait_queue if any before changing the
affinity, and re-enter a wait queue once it is done. If we don't do that,
the task may stay in the wait queue of another thread, and we later may
end up modifying that wait queue while holding no lock, which could lead
to memory corruption.

THis should be backported to 2.1, 2.0 and 1.9.

(cherry picked from commit 0742c314c35c2c96b72e42076c76d6a6786045ba)
Signed-off-by: Willy Tarreau <w@1wt.eu>
(cherry picked from commit 279698ebdef2c00e7a01544af0321438b69ea7d1)
Signed-off-by: Willy Tarreau <w@1wt.eu>
1 file changed