Skip to content
Commit 488b6d91 authored by Vadim Fedorenko's avatar Vadim Fedorenko Committed by Paolo Abeni
Browse files

net-timestamp: make sk_tskey more predictable in error path



When SOF_TIMESTAMPING_OPT_ID is used to ambiguate timestamped datagrams,
the sk_tskey can become unpredictable in case of any error happened
during sendmsg(). Move increment later in the code and make decrement of
sk_tskey in error path. This solution is still racy in case of multiple
threads doing snedmsg() over the very same socket in parallel, but still
makes error path much more predictable.

Fixes: 09c2d251 ("net-timestamp: add key to disambiguate concurrent datagrams")
Reported-by: default avatarAndy Lutomirski <luto@amacapital.net>
Signed-off-by: default avatarVadim Fedorenko <vadfed@meta.com>
Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20240213110428.1681540-1-vadfed@meta.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 2ec197fd
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment