# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 8bccc5d192be551cfe12e1c4d38bb49144f980aa
# Parent 5eca8383a521939f0d74e68eaddb049c5057742a
[POWERPC][XEN] Don't leak frame_list and don'r post process gnttab if OP fails
Signed-off-by: Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
---
arch/powerpc/platforms/xen/gnttab.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diff -r 5eca8383a521 -r 8bccc5d192be arch/powerpc/platforms/xen/gnttab.c
--- a/arch/powerpc/platforms/xen/gnttab.c Tue Feb 06 16:21:30 2007 -0500
+++ b/arch/powerpc/platforms/xen/gnttab.c Tue Feb 06 16:30:08 2007 -0500
@@ -244,10 +244,10 @@ static void gnttab_post_map_grant_ref(
int HYPERVISOR_grant_table_op(unsigned int cmd, void *op, unsigned int count)
{
- void *desc = NULL;
+ void *desc;
void *frame_list = NULL;
int argsize;
- int ret;
+ int ret = -ENOMEM;
switch (cmd) {
case GNTTABOP_map_grant_ref:
@@ -292,17 +292,14 @@ int HYPERVISOR_grant_table_op(unsigned i
}
desc = xencomm_map_no_alloc(op, argsize);
-
- if (desc == NULL)
- return -ENOSPC;
-
- ret = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_grant_table_op), cmd,
- desc, count);
- if (cmd == GNTTABOP_map_grant_ref)
- gnttab_post_map_grant_ref(op, count);
-
+ if (desc) {
+ ret = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_grant_table_op),
+ cmd, desc, count);
+ if (!ret && cmd == GNTTABOP_map_grant_ref)
+ gnttab_post_map_grant_ref(op, count);
+ xencomm_free(desc);
+ }
xencomm_free(frame_list);
- xencomm_free(desc);
return ret;
}
_______________________________________________
Xen-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel
|