mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
xen/netback: free already allocated memory on failure in xen_netbk_get_requests
[ Upstream commit 4cc7c1cb7b ]
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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f0457844e6
commit
1d08d86d53
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user