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

    macvtap: zerocopy: put page when fail to get all requested user pages

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-put-page-when-fail-to-get-all-requested-user-pages.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 02ce04bb3d28c3333231f43bca677228dbc686fe Mon Sep 17 00:00:00 2001
From: Jason Wang <[email protected]>
Date: Wed, 2 May 2012 11:41:58 +0800
Subject: macvtap: zerocopy: put page when fail to get all requested user pages

From: Jason Wang <[email protected]>

commit 02ce04bb3d28c3333231f43bca677228dbc686fe upstream.

When get_user_pages_fast() fails to get all requested pages, we could not use
kfree_skb() to free it as it has not been put in the skb fragments. So we need
to call put_page() instead.

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 |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -533,9 +533,10 @@ static int zerocopy_sg_from_iovec(struct
                if (i + size > MAX_SKB_FRAGS)
                        return -EMSGSIZE;
                num_pages = get_user_pages_fast(base, size, 0, &page[i]);
-               if (num_pages != size)
-                       /* put_page is in skb free */
-                       return -EFAULT;
+               if (num_pages != size) {
+                       for (i = 0; i < num_pages; i++)
+                               put_page(page[i]);
+               }
                truesize = size * PAGE_SIZE;
                skb->data_len += len;
                skb->len += len;


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