netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4: udp: fix short packet and bad checksum logging
@ 2010-05-06 13:44 Bjørn Mork
  2010-05-06 13:44 ` [PATCH] ipv6: udp: make short packet logging consistent with ipv4 Bjørn Mork
  2010-05-06 14:48 ` [PATCH] ipv4: udp: fix short packet and bad checksum logging Eric Dumazet
  0 siblings, 2 replies; 6+ messages in thread
From: Bjørn Mork @ 2010-05-06 13:44 UTC (permalink / raw)
  To: netdev; +Cc: Bjørn Mork, stable

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>
Cc: stable@kernel.org
---
 net/ipv4/udp.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 8fef859..c36522a 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,
 
 	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;
 
@@ -1540,9 +1543,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;
-
 	if (rt->rt_flags & (RTCF_BROADCAST|RTCF_MULTICAST))
 		return __udp4_lib_mcast_deliver(net, skb, uh,
 				saddr, daddr, udptable);
-- 
1.5.6.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-05-07  4:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06 13:44 [PATCH] ipv4: udp: fix short packet and bad checksum logging Bjørn Mork
2010-05-06 13:44 ` [PATCH] ipv6: udp: make short packet logging consistent with ipv4 Bjørn Mork
2010-05-06 14:49   ` Eric Dumazet
2010-05-07  4:50     ` David Miller
2010-05-06 14:48 ` [PATCH] ipv4: udp: fix short packet and bad checksum logging Eric Dumazet
2010-05-07  4:48   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).