All of lore.kernel.org
 help / color / mirror / Atom feed
From: Diego Ongaro <diego.ongaro@citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] gnttab_setup_table error case
Date: Wed, 30 Jul 2008 14:17:39 +0100	[thread overview]
Message-ID: <489069F3.7070200@citrix.com> (raw)

gnttab_setup_table should set an error status code if the gmfn it gets
for a grant table page is invalid.

I ran into this issue when I tried to set up the grant table during hvm
domain creation, and it caused a BUG_ON later down the line. With this
patch, the hypercall will gracefully fail instead.

Signed-off-by: Diego Ongaro <diego.ongaro@citrix.com>
---
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -913,8 +913,15 @@ gnttab_setup_table(
     op.status = GNTST_okay;
     for ( i = 0; i < op.nr_frames; i++ )
     {
         gmfn = gnttab_shared_gmfn(d, d->grant_table, i);
+        if ( gmfn == -1 )
+        {
+            gdprintk(XENLOG_INFO,
+                    "grant table gmfn unavailable\n");
+            op.status = GNTST_general_error;
+            goto out3;
+        }
         (void)copy_to_guest_offset(op.frame_list, i, &gmfn, 1);
     }
 
  out3:

             reply	other threads:[~2008-07-30 13:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 13:17 Diego Ongaro [this message]
2008-07-31  2:08 ` [PATCH] gnttab_setup_table error case Qing He
2008-07-31  8:58   ` Samuel Thibault
2008-07-31 13:12     ` Diego Ongaro

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=489069F3.7070200@citrix.com \
    --to=diego.ongaro@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.