[NET]: Fix UDP checksum issue in net poll mode.
authorAubrey Li <aubreylee@gmail.com>
Thu, 19 Apr 2007 23:40:19 +0000 (01:40 +0200)
committerAdrian Bunk <bunk@stusta.de>
Thu, 19 Apr 2007 23:40:19 +0000 (01:40 +0200)
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>
net/core/netpoll.c

index ea51f8d02eb8654d0533afd7bc5eb38a0e08c7fd..62753d3afc7207a51a031b32b6c12a85d8d5959b 100644 (file)
@@ -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;