]> git.baikalelectronics.ru Git - kernel.git/commit
udp: Prevent reuseport_select_sock from reading uninitialized socks
authorBaptiste Lepers <baptiste.lepers@gmail.com>
Thu, 7 Jan 2021 05:11:10 +0000 (16:11 +1100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 9 Jan 2021 03:15:40 +0000 (19:15 -0800)
commit57017a5d1ca7504051ce605b6b0a35410150a45f
treefbd086182ba7049c4a7b6552809ee757b426a84f
parent96ec7031f351a6e6b042e68d4b2596cb976fa1cf
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: 94179daae74be ("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>
net/core/sock_reuseport.c