All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix mfn check of gnttab_transfer()
@ 2006-04-04 11:06 Isaku Yamahata
  2006-04-04 12:43 ` Keir Fraser
  0 siblings, 1 reply; 3+ messages in thread
From: Isaku Yamahata @ 2006-04-04 11:06 UTC (permalink / raw)
  To: Xen-devel

[-- Attachment #1: Type: text/plain, Size: 51 bytes --]


fix mfn check of gnttab_transfer().

-- 
yamahata

[-- Attachment #2: fix_gnttab_transfer_mfn_check.patch --]
[-- Type: text/plain, Size: 1328 bytes --]

# HG changeset patch
# User yamahata@valinux.co.jp
# Node ID 30e807eee6f168b7a9e12e67b36cc669cbdadcf5
# Parent  d0d3fef37685be264a7f52201f8ef44c030daad3
fix mfn check of gnttab_transfer. gop.mfn is gmfn.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>

diff -r d0d3fef37685 -r 30e807eee6f1 xen/common/grant_table.c
--- a/xen/common/grant_table.c	Mon Apr  3 14:34:20 2006 +0100
+++ b/xen/common/grant_table.c	Tue Apr  4 20:04:24 2006 +0900
@@ -618,8 +618,9 @@ gnttab_transfer(
             return -EFAULT;
         }
 
+        mfn = gmfn_to_mfn(d, gop.mfn);
         /* Check the passed page frame for basic validity. */
-        if ( unlikely(!mfn_valid(gop.mfn)) )
+        if ( unlikely(mfn == INVALID_MFN) || unlikely(!mfn_valid(mfn)) )
         { 
             DPRINTK("gnttab_transfer: out-of-range %lx\n",
                     (unsigned long)gop.mfn);
@@ -627,7 +628,6 @@ gnttab_transfer(
             goto copyback;
         }
 
-        mfn = gmfn_to_mfn(d, gop.mfn);
         page = mfn_to_page(mfn);
         if ( unlikely(IS_XEN_HEAP_FRAME(page)) )
         { 
@@ -639,6 +639,7 @@ gnttab_transfer(
 
         if ( steal_page_for_grant_transfer(d, page) < 0 )
         {
+            DPRINTK("steal_page_for_grant_transfer\n");
             gop.status = GNTST_bad_page;
             goto copyback;
         }

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix mfn check of gnttab_transfer()
  2006-04-04 11:06 [PATCH] fix mfn check of gnttab_transfer() Isaku Yamahata
@ 2006-04-04 12:43 ` Keir Fraser
  2006-04-04 13:05   ` Steven Smith
  0 siblings, 1 reply; 3+ messages in thread
From: Keir Fraser @ 2006-04-04 12:43 UTC (permalink / raw)
  To: Isaku Yamahata; +Cc: Xen-devel


On 4 Apr 2006, at 12:06, Isaku Yamahata wrote:

> fix mfn check of gnttab_transfer().

What's wrong with the mfn check? mfn_valid() will return false for 
INVALID_MFN so there's no need to check for it explicitly.

  -- Keir

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] fix mfn check of gnttab_transfer()
  2006-04-04 12:43 ` Keir Fraser
@ 2006-04-04 13:05   ` Steven Smith
  0 siblings, 0 replies; 3+ messages in thread
From: Steven Smith @ 2006-04-04 13:05 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Isaku Yamahata, Xen-devel, sos22


[-- Attachment #1.1: Type: text/plain, Size: 316 bytes --]

> >fix mfn check of gnttab_transfer().
> What's wrong with the mfn check? mfn_valid() will return false for 
> INVALID_MFN so there's no need to check for it explicitly.
The interesting part here is that the mfn_valid() should be called on
the mfn rather than the gmfn, and I've applied that part.

Steven.


[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

[-- Attachment #2: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-04-04 13:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-04 11:06 [PATCH] fix mfn check of gnttab_transfer() Isaku Yamahata
2006-04-04 12:43 ` Keir Fraser
2006-04-04 13:05   ` Steven Smith

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.