lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 06 Feb 2009 10:00:24 +0100
From:	Jesper Dangaard Brouer <jdb@...x.dk>
To:	David Miller <davem@...emloft.net>
Cc:	netdev@...r.kernel.org
Subject: [RFC] [PATCH] Fix UDP short packet false positive

On Thu, 2009-02-05 at 15:06 -0800, David Miller wrote:
> From: Jesper Dangaard Brouer <jdb@...x.dk>
> Date: Thu, 05 Feb 2009 13:47:07 +0100
>
> > The UDP header pointer assignment must happen after calling
> > pskb_may_pull().  As pskb_may_pull() can potentially alter the SKB
> > buffer.
>
> Excellent work!

Thanks :-)

I'm wondering if the ip_hdr() pointer can be changed by the
pskb_may_pull(), but I assume it cannot as it should already be in the
linear area... right?

Well the patch below, shows what I mean...

diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index cc3a0a0..7390af6 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1232,20 +1232,23 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
 {
 	struct sock *sk;
 	struct udphdr *uh;
 	unsigned short ulen;
 	struct rtable *rt = (struct rtable*)skb->dst;
-	__be32 saddr = ip_hdr(skb)->saddr;
-	__be32 daddr = ip_hdr(skb)->daddr;
+	__be32 saddr;
+	__be32 daddr;
 	struct net *net = dev_net(skb->dev);
 
 	/*
 	 *  Validate the packet.
 	 */
 	if (!pskb_may_pull(skb, sizeof(struct udphdr)))
 		goto drop;		/* No space for header. */
 
+	saddr = ip_hdr(skb)->saddr;
+	daddr = ip_hdr(skb)->daddr;
+
 	uh   = udp_hdr(skb);
 	ulen = ntohs(uh->len);
 	if (ulen > skb->len)
 		goto short_packet;
 


-- 
Med venlig hilsen / Best regards
  Jesper Brouer
  ComX Networks A/S
  Linux Network developer
  Cand. Scient Datalog / MSc.
  Author of http://adsl-optimizer.dk
  LinkedIn: http://www.linkedin.com/in/brouer
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ