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

    macvtap: zerocopy: set SKBTX_DEV_ZEROCOPY only when skb is built 
successfully

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-set-skbtx_dev_zerocopy-only-when-skb-is-built-successfully.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 01d6657b388438def19c8baaea28e742b6ed32ec Mon Sep 17 00:00:00 2001
From: Jason Wang <[email protected]>
Date: Wed, 2 May 2012 11:42:06 +0800
Subject: macvtap: zerocopy: set SKBTX_DEV_ZEROCOPY only when skb is built 
successfully

From: Jason Wang <[email protected]>

commit 01d6657b388438def19c8baaea28e742b6ed32ec upstream.

Current the SKBTX_DEV_ZEROCOPY is set unconditionally after
zerocopy_sg_from_iovec(), this would lead NULL pointer when macvtap
fails to build zerocopy skb because destructor_arg was not
initialized. Solve this by set this flag after the skb were built
successfully.

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

--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -716,10 +716,9 @@ static ssize_t macvtap_get_user(struct m
        if (!skb)
                goto err;
 
-       if (zerocopy) {
+       if (zerocopy)
                err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count);
-               skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
-       } else
+       else
                err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len,
                                                   len);
        if (err)
@@ -738,8 +737,10 @@ static ssize_t macvtap_get_user(struct m
        rcu_read_lock_bh();
        vlan = rcu_dereference_bh(q->vlan);
        /* copy skb_ubuf_info for callback when skb has no error */
-       if (zerocopy)
+       if (zerocopy) {
                skb_shinfo(skb)->destructor_arg = m->msg_control;
+               skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY;
+       }
        if (vlan)
                macvlan_start_xmit(skb, vlan->dev);
        else


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