Commit 0a80966b authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

net: Verify UDP checksum before handoff to encap

Moving validation of UDP checksum to be done in UDP not encap layer.
Signed-off-by: default avatarTom Herbert <therbert@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 39471ac8
...@@ -1495,6 +1495,10 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) ...@@ -1495,6 +1495,10 @@ int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) { if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) {
int ret; int ret;
/* Verify checksum before giving to encap */
if (udp_lib_checksum_complete(skb))
goto csum_error;
ret = encap_rcv(sk, skb); ret = encap_rcv(sk, skb);
if (ret <= 0) { if (ret <= 0) {
UDP_INC_STATS_BH(sock_net(sk), UDP_INC_STATS_BH(sock_net(sk),
......
...@@ -634,6 +634,10 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) ...@@ -634,6 +634,10 @@ int udpv6_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)
if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) { if (skb->len > sizeof(struct udphdr) && encap_rcv != NULL) {
int ret; int ret;
/* Verify checksum before giving to encap */
if (udp_lib_checksum_complete(skb))
goto csum_error;
ret = encap_rcv(sk, skb); ret = encap_rcv(sk, skb);
if (ret <= 0) { if (ret <= 0) {
UDP_INC_STATS_BH(sock_net(sk), UDP_INC_STATS_BH(sock_net(sk),
......
Markdown is supported
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