tunneling: Check refcount of each page in frags.
authorJesse Gross <jesse@nicira.com>
Mon, 7 Feb 2011 21:05:34 +0000 (13:05 -0800)
committerJesse Gross <jesse@nicira.com>
Mon, 7 Feb 2011 21:47:34 +0000 (13:47 -0800)
We check the refcount of each page in a fragmented skb
to see if we need to do a linearize before computing the
checksum.  However, although we iterate over the list of
pages, we always check the first one.

Reported-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
datapath/tunnel.c

index 40577fbd516c26d65b2825544a712b8c27bf5dfc..95492f76f07d7e51f527afe3338d6d51234a97c0 100644 (file)
@@ -1021,7 +1021,7 @@ static inline bool need_linearize(const struct sk_buff *skb)
         * change them from underneath us and we can skip the linearization.
         */
        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
-               if (unlikely(page_count(skb_shinfo(skb)->frags[0].page) > 1))
+               if (unlikely(page_count(skb_shinfo(skb)->frags[i].page) > 1))
                        return true;
 
        return false;