summaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp.c
diff options
context:
space:
mode:
authorWillem de Bruijn <willemb@google.com>2016-04-07 18:12:59 -0400
committerDavid S. Miller <davem@davemloft.net>2016-04-13 22:24:52 -0400
commit31c2e4926fe912f88388bcaa8450fcaa8f2ece47 (patch)
tree0c1883a4c4c478746162c66befa7d5d0f8e79dc8 /net/ipv4/udp.c
parent9f9a45beaa96188085d52d273c2ecb052c7d8d27 (diff)
downloadtalos-obmc-linux-31c2e4926fe912f88388bcaa8450fcaa8f2ece47.tar.gz
talos-obmc-linux-31c2e4926fe912f88388bcaa8450fcaa8f2ece47.zip
udp: do not expect udp headers in recv cmsg IP_CMSG_CHECKSUM
On udp sockets, recv cmsg IP_CMSG_CHECKSUM returns a checksum over the packet payload. Since commit e6afc8ace6dd pulled the headers, taking skb->data as the start of transport header is incorrect. Use the transport header pointer. Also, when peeking at an offset from the start of the packet, only return a checksum from the start of the peeked data. Note that the cmsg does not subtract a tail checkum when reading truncated data. Fixes: e6afc8ace6dd ("udp: remove headers from UDP packets before queueing") Signed-off-by: Willem de Bruijn <willemb@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r--net/ipv4/udp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index d2d294b0a1f1..f1863136d3e4 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1375,7 +1375,7 @@ try_again:
*addr_len = sizeof(*sin);
}
if (inet->cmsg_flags)
- ip_cmsg_recv_offset(msg, skb, sizeof(struct udphdr));
+ ip_cmsg_recv_offset(msg, skb, sizeof(struct udphdr) + off);
err = copied;
if (flags & MSG_TRUNC)
OpenPOWER on IntegriCloud