diff options
authorBjørn Mork <>2010-05-06 03:44:34 +0000
committerGreg Kroah-Hartman <>2010-05-26 14:29:13 -0700
commit5f4213d39b4965791875f6e10f6f7268ba8dfc2c (patch)
parent1cd8211f07663ebeac04b19ac849de7ed5eef969 (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 23715/178 to 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 <> Acked-by: Eric Dumazet <> Signed-off-by: David S. Miller <> Signed-off-by: Greg Kroah-Hartman <>
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 0fa9f70e4b19..c322f4429fc9 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1292,6 +1292,9 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
uh = udp_hdr(skb);
ulen = ntohs(uh->len);
+ saddr = ip_hdr(skb)->saddr;
+ daddr = ip_hdr(skb)->daddr;
if (ulen > skb->len)
goto short_packet;
@@ -1305,9 +1308,6 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
if (udp4_csum_init(skb, uh, proto))
goto csum_error;
- saddr = ip_hdr(skb)->saddr;
- daddr = ip_hdr(skb)->daddr;
return __udp4_lib_mcast_deliver(net, skb, uh,
saddr, daddr, udptable);