Skip to content

Commit d515684

Browse files
ramosian-gliderdavem330
authored andcommitted
ipv6: make sure to initialize sockc.tsflags before first use
In the case udp_sk(sk)->pending is AF_INET6, udpv6_sendmsg() would jump to do_append_data, skipping the initialization of sockc.tsflags. Fix the problem by moving sockc.tsflags initialization earlier. The bug was detected with KMSAN. Fixes: c14ac94 ("sock: enable timestamping using control messages") Signed-off-by: Alexander Potapenko <[email protected]> Acked-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1b33c0d commit d515684

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv6/udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1035,6 +1035,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
10351035
ipc6.hlimit = -1;
10361036
ipc6.tclass = -1;
10371037
ipc6.dontfrag = -1;
1038+
sockc.tsflags = sk->sk_tsflags;
10381039

10391040
/* destination address check */
10401041
if (sin6) {
@@ -1159,7 +1160,6 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
11591160

11601161
fl6.flowi6_mark = sk->sk_mark;
11611162
fl6.flowi6_uid = sk->sk_uid;
1162-
sockc.tsflags = sk->sk_tsflags;
11631163

11641164
if (msg->msg_controllen) {
11651165
opt = &opt_space;

0 commit comments

Comments
 (0)