mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
udp: Prevent reuseport_select_sock from reading uninitialized socks
reuse->socks[] is modified concurrently by reuseport_add_sock. To
prevent reading values that have not been fully initialized, only read
the array up until the last known safe index instead of incorrectly
re-reading the last index of the array.
Fixes: acdcecc612
("udp: correct reuseport selection with connected sockets")
Signed-off-by: Baptiste Lepers <baptiste.lepers@gmail.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20210107051110.12247-1-baptiste.lepers@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
53475c5dd8
commit
fd2ddef043
@@ -293,7 +293,7 @@ select_by_hash:
|
|||||||
i = j = reciprocal_scale(hash, socks);
|
i = j = reciprocal_scale(hash, socks);
|
||||||
while (reuse->socks[i]->sk_state == TCP_ESTABLISHED) {
|
while (reuse->socks[i]->sk_state == TCP_ESTABLISHED) {
|
||||||
i++;
|
i++;
|
||||||
if (i >= reuse->num_socks)
|
if (i >= socks)
|
||||||
i = 0;
|
i = 0;
|
||||||
if (i == j)
|
if (i == j)
|
||||||
goto out;
|
goto out;
|
||||||
|
Reference in New Issue
Block a user