xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xen.org
Cc: andres@gridcentric.ca, tim@xen.org
Subject: [PATCH] x86/mm: Fix locking on hap enable failure
Date: Fri, 13 Apr 2012 17:18:06 -0400	[thread overview]
Message-ID: <15a3c740419f53702b0c.1334351886@xdev.gridcentric.ca> (raw)

 xen/arch/x86/mm/hap/hap.c |  3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


If enabling hap fails due to out of memory, the locking on the clean up path is
broken.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>

diff -r 8ec52231c03d -r 15a3c740419f xen/arch/x86/mm/hap/hap.c
--- a/xen/arch/x86/mm/hap/hap.c
+++ b/xen/arch/x86/mm/hap/hap.c
@@ -585,13 +585,14 @@ int hap_enable(struct domain *d, u32 mod
         unsigned int r;
         paging_lock(d);
         r = hap_set_allocation(d, 256, NULL);
-        paging_unlock(d);
         if ( r != 0 )
         {
             hap_set_allocation(d, 0, NULL);
+            paging_unlock(d);
             rv = -ENOMEM;
             goto out;
         }
+        paging_unlock(d);
     }
 
     /* Allow p2m and log-dirty code to borrow our memory */

             reply	other threads:[~2012-04-13 21:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13 21:18 Andres Lagar-Cavilla [this message]
2012-04-18 12:40 ` [PATCH] x86/mm: Fix locking on hap enable failure Tim Deegan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15a3c740419f53702b0c.1334351886@xdev.gridcentric.ca \
    --to=andres@lagarcavilla.org \
    --cc=andres@gridcentric.ca \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).