diff options
author | Ian Campbell <Ian.Campbell@citrix.com> | 2013-02-06 23:41:37 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-02-14 10:47:40 -0800 |
commit | 1d08d86d53d881952af35f841d8cf5ff23f726d9 (patch) | |
tree | add575988e3b2c7abf9ad609835f698f733fe815 | |
parent | f0457844e605984a12b8043c3e21554b9b1fc8a5 (diff) | |
download | kernel_samsung_aries-1d08d86d53d881952af35f841d8cf5ff23f726d9.zip kernel_samsung_aries-1d08d86d53d881952af35f841d8cf5ff23f726d9.tar.gz kernel_samsung_aries-1d08d86d53d881952af35f841d8cf5ff23f726d9.tar.bz2 |
xen/netback: free already allocated memory on failure in xen_netbk_get_requests
[ Upstream commit 4cc7c1cb7b11b6f3515bd9075527576a1eecc4aa ]
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/net/xen-netback/netback.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c index 9eb5fd3..40e8a33 100644 --- a/drivers/net/xen-netback/netback.c +++ b/drivers/net/xen-netback/netback.c @@ -937,7 +937,7 @@ static struct gnttab_copy *xen_netbk_get_requests(struct xen_netbk *netbk, pending_idx = netbk->pending_ring[index]; page = xen_netbk_alloc_page(netbk, skb, pending_idx); if (!page) - return NULL; + goto err; netbk->mmap_pages[pending_idx] = page; @@ -961,6 +961,17 @@ static struct gnttab_copy *xen_netbk_get_requests(struct xen_netbk *netbk, } return gop; +err: + /* Unwind, freeing all pages and sending error responses. */ + while (i-- > start) { + xen_netbk_idx_release(netbk, (unsigned long)shinfo->frags[i].page, + 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, |