From: Jesper Dangaard Brouer <jdb@comx.dk>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH] Fix UDP short packet false positive
Date: Thu, 05 Feb 2009 13:47:07 +0100 [thread overview]
Message-ID: <1233838027.20497.132.camel@localhost.localdomain> (raw)
In-Reply-To: <1233837840.20497.129.camel@localhost.localdomain>
The UDP header pointer assignment must happen after calling
pskb_may_pull(). As pskb_may_pull() can potentially alter the SKB
buffer.
This was exposted by running multicast traffic through the NIU driver,
as it won't prepull the protocol headers into the linear area on
receive.
Signed-off-by: Jesper Dangaard Brouer <hawk@comx.dk>
---
net/ipv4/udp.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 1ab180b..cc3a0a0 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -1231,7 +1231,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
int proto)
{
struct sock *sk;
- struct udphdr *uh = udp_hdr(skb);
+ struct udphdr *uh;
unsigned short ulen;
struct rtable *rt = (struct rtable*)skb->dst;
__be32 saddr = ip_hdr(skb)->saddr;
@@ -1244,6 +1244,7 @@ int __udp4_lib_rcv(struct sk_buff *skb, struct udp_table *udptable,
if (!pskb_may_pull(skb, sizeof(struct udphdr)))
goto drop; /* No space for header. */
+ uh = udp_hdr(skb);
ulen = ntohs(uh->len);
if (ulen > skb->len)
goto short_packet;
next prev parent reply other threads:[~2009-02-05 12:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-03 13:38 BUG: NIU driver: strange issues with multicast "UDP: short packet" Jesper Dangaard Brouer
2009-02-03 23:38 ` David Miller
2009-02-04 8:55 ` Jesper Dangaard Brouer
2009-02-04 9:00 ` David Miller
2009-02-04 9:32 ` Jesper Dangaard Brouer
2009-02-04 9:34 ` David Miller
2009-02-05 12:44 ` Jesper Dangaard Brouer
2009-02-05 12:47 ` Jesper Dangaard Brouer [this message]
2009-02-05 23:06 ` [PATCH] Fix UDP short packet false positive David Miller
2009-02-06 9:00 ` [RFC] " Jesper Dangaard Brouer
2009-02-06 9:08 ` David Miller
2009-02-06 9:55 ` [PATCH] udp: Fix potential wrong ip_hdr(skb) pointers Jesper Dangaard Brouer
2009-02-06 9:59 ` David Miller
2009-02-06 10:04 ` Eric Dumazet
2009-02-06 10:49 ` Jesper Dangaard Brouer
2009-02-06 11:11 ` David Miller
2009-02-04 11:52 ` BUG: NIU driver: strange issues with multicast "UDP: short packet" Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233838027.20497.132.camel@localhost.localdomain \
--to=jdb@comx.dk \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).