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

    xen/netback: free already allocated memory on failure in 
xen_netbk_get_requests

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:
     
xen-netback-free-already-allocated-memory-on-failure-in-xen_netbk_get_requests.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 c44e0eea7ef736013a0aac90435fc5aecc171983 Mon Sep 17 00:00:00 2001
From: Ian Campbell <[email protected]>
Date: Wed, 6 Feb 2013 23:41:37 +0000
Subject: xen/netback: free already allocated memory on failure in 
xen_netbk_get_requests


From: Ian Campbell <[email protected]>

[ Upstream commit 4cc7c1cb7b11b6f3515bd9075527576a1eecc4aa ]

Signed-off-by: Ian Campbell <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 drivers/net/xen-netback/netback.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -950,7 +950,7 @@ static struct gnttab_copy *xen_netbk_get
                pending_idx = netbk->pending_ring[index];
                page = xen_netbk_alloc_page(netbk, skb, pending_idx);
                if (!page)
-                       return NULL;
+                       goto err;
 
                gop->source.u.ref = txp->gref;
                gop->source.domid = vif->domid;
@@ -972,6 +972,17 @@ static struct gnttab_copy *xen_netbk_get
        }
 
        return gop;
+err:
+       /* Unwind, freeing all pages and sending error responses. */
+       while (i-- > start) {
+               xen_netbk_idx_release(netbk, frag_get_pending_idx(&frags[i]),
+                                     XEN_NETIF_RSP_ERROR);
+       }
+       /* The head too, if necessary. */
+       if (start)
+               xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_ERROR);
+
+       return NULL;
 }
 
 static int xen_netbk_tx_check_gop(struct xen_netbk *netbk,


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

queue-3.4/xen-netback-free-already-allocated-memory-on-failure-in-xen_netbk_get_requests.patch
queue-3.4/netback-correct-netbk_tx_err-to-handle-wrap-around.patch
queue-3.4/xen-netback-shutdown-the-ring-if-it-contains-garbage.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