Commit c3c87e14 authored by Vadim Fedorenko's avatar Vadim Fedorenko Committed by Greg Kroah-Hartman
Browse files

net-timestamp: make sk_tskey more predictable in error path



[ Upstream commit 488b6d91 ]

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>
Stable-dep-of: 3301ab7d ("net/ipv6: release expired exception dst cached in socket")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f117cba6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment