aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2010-05-05 23:44:34 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-05-26 17:32:03 -0400
commitb7e608824a5eb85c1c324d3822760cbfb3a34dce (patch)
treed665c14a03703d3f829d27bd595b2ebc56583055 /net
parent4640b4e7d9919e9629fe8456df94f71658431ef9 (diff)
ipv4: udp: fix short packet and bad checksum logging
commit ccc2d97cb7c798e785c9f198de243e2b59f7073b upstream. commit 2783ef23 moved the initialisation of saddr and daddr after pskb_may_pull() to avoid a potential data corruption. Unfortunately also placing it after the short packet and bad checksum error paths, where these variables are used for logging. The result is bogus output like [92238.389505] UDP: short packet: From 2.0.0.0:65535 23715/178 to 0.0.0.0:65535 Moving the saddr and daddr initialisation above the error paths, while still keeping it after the pskb_may_pull() to keep the fix from commit 2783ef23. Signed-off-by: Bjørn Mork <bjorn@mork.no> Acked-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/udp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 16190cac0b69..955f0b2c9c16 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1527,6 +1527,9 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1527 1527
1528 uh = udp_hdr(skb); 1528 uh = udp_hdr(skb);
1529 ulen = ntohs(uh->len); 1529 ulen = ntohs(uh->len);
1530 saddr = ip_hdr(skb)->saddr;
1531 daddr = ip_hdr(skb)->daddr;
1532
1530 if (ulen > skb->len) 1533 if (ulen > skb->len)
1531 goto short_packet; 1534 goto short_packet;
1532 1535
@@ -1540,9 +1543,6 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
1540 if (udp4_csum_init(skb, uh, proto)) 1543 if (udp4_csum_init(skb, uh, proto))
1541 goto csum_error; 1544 goto csum_error;
1542 1545
1543 saddr = ip_hdr(skb)->saddr;
1544 daddr = ip_hdr(skb)->daddr;
1545
1546 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST)) 1546 if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
1547 return __udp4_lib_mcast_deliver(net, skb, uh, 1547 return __udp4_lib_mcast_deliver(net, skb, uh,
1548 saddr, daddr, udptable); 1548 saddr, daddr, udptable);