aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAubrey Li <aubreylee@gmail.com>2007-04-20 01:40:19 +0200
committerAdrian Bunk <bunk@stusta.de>2007-04-20 01:40:19 +0200
commit691d4b9f4f4479edb4c3c63c7dbf5c5fa1ce0979 (patch)
treee8ea595e2c351c5c2ced58db868954cfcfb025c6 /net
parentf1e0381bf5d781ee6c03ec7ddaa91e950869e472 (diff)
[NET]: Fix UDP checksum issue in net poll mode.
In net poll mode, the current checksum function doesn't consider the kind of packet which is padded to reach a specific minimum length. I believe that's the problem causing my test case failed. The following patch fixed this issue. Signed-off-by: Aubrey Li <aubreylee@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'net')
-rw-r--r--net/core/netpoll.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index ea51f8d02eb..62753d3afc7 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -485,6 +485,13 @@ int __netpoll_rx(struct sk_buff *skb)
if (skb->len < len || len < iph->ihl*4)
goto out;
+ /*
+ * Our transport medium may have padded the buffer out.
+ * Now We trim to the true length of the frame.
+ */
+ if (pskb_trim_rcsum(skb, len))
+ goto out;
+
if (iph->protocol != IPPROTO_UDP)
goto out;