This is a note to let you know that I've just added the patch titled

    macvtap: zerocopy: fix offset calculation when building skb

to the 3.4-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     macvtap-zerocopy-fix-offset-calculation-when-building-skb.patch
and it can be found in the queue-3.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 3afc9621f15701c557e60f61eba9242bac2771dd Mon Sep 17 00:00:00 2001
From: Jason Wang <[email protected]>
Date: Wed, 2 May 2012 11:41:30 +0800
Subject: macvtap: zerocopy: fix offset calculation when building skb

From: Jason Wang <[email protected]>

commit 3afc9621f15701c557e60f61eba9242bac2771dd upstream.

This patch fixes the offset calculation when building skb:

- offset1 were used as skb data offset not vector offset
- reset offset to zero only when we advance to next vector

Signed-off-by: Jason Wang <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Cc: Ben Hutchings <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/net/macvtap.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -506,10 +506,11 @@ static int zerocopy_sg_from_iovec(struct
                if (copy > size) {
                        ++from;
                        --count;
-               }
+                       offset = 0;
+               } else
+                       offset += size;
                copy -= size;
                offset1 += size;
-               offset = 0;
        }
 
        if (len == offset1)
@@ -520,13 +521,13 @@ static int zerocopy_sg_from_iovec(struct
                int num_pages;
                unsigned long base;
 
-               len = from->iov_len - offset1;
+               len = from->iov_len - offset;
                if (!len) {
-                       offset1 = 0;
+                       offset = 0;
                        ++from;
                        continue;
                }
-               base = (unsigned long)from->iov_base + offset1;
+               base = (unsigned long)from->iov_base + offset;
                size = ((base & ~PAGE_MASK) + len + ~PAGE_MASK) >> PAGE_SHIFT;
                if (i + size > MAX_SKB_FRAGS)
                        return -EMSGSIZE;
@@ -548,7 +549,7 @@ static int zerocopy_sg_from_iovec(struct
                        len -= size;
                        i++;
                }
-               offset1 = 0;
+               offset = 0;
                ++from;
        }
        return 0;


Patches currently in stable-queue which might be from [email protected] are

queue-3.4/macvtap-zerocopy-put-page-when-fail-to-get-all-requested-user-pages.patch
queue-3.4/macvtap-zerocopy-fix-truesize-underestimation.patch
queue-3.4/macvtap-zerocopy-fix-offset-calculation-when-building-skb.patch
queue-3.4/macvtap-zerocopy-set-skbtx_dev_zerocopy-only-when-skb-is-built-successfully.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to