aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2017-03-21 12:14:27 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-03-30 03:41:22 -0400
commitd80caeb9b86d2c8116776953ae3e3c0ddda364f1 (patch)
treea779f52835e7fdccc445a8e6c091e36091de9d05 /net
parentc87ef8734d25509a9e0b6057aec3a6db8b8631ba (diff)
ipv6: make sure to initialize sockc.tsflags before first use
[ Upstream commit d515684d78148884d5fc425ba904c50f03844020 ] 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: c14ac9451c34 ("sock: enable timestamping using control messages") Signed-off-by: Alexander Potapenko <glider@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/udp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c
index e4a8000d59ad..40a289f78d77 100644
--- a/net/ipv6/udp.c
+++ b/net/ipv6/udp.c
@@ -1037,6 +1037,7 @@ int udpv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
1037 ipc6.hlimit = -1; 1037 ipc6.hlimit = -1;
1038 ipc6.tclass = -1; 1038 ipc6.tclass = -1;
1039 ipc6.dontfrag = -1; 1039 ipc6.dontfrag = -1;
1040 sockc.tsflags = sk->sk_tsflags;
1040 1041
1041 /* destination address check */ 1042 /* destination address check */
1042 if (sin6) { 1043 if (sin6) {
@@ -1156,7 +1157,6 @@ do_udp_sendmsg:
1156 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; 1157 fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex;
1157 1158
1158 fl6.flowi6_mark = sk->sk_mark; 1159 fl6.flowi6_mark = sk->sk_mark;
1159 sockc.tsflags = sk->sk_tsflags;
1160 1160
1161 if (msg->msg_controllen) { 1161 if (msg->msg_controllen) {
1162 opt = &opt_space; 1162 opt = &opt_space;