[xen master] x86: check paging mode earlier in xenmem_add_to_physmap_one()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] x86: check paging mode earlier in xenmem_add_to_physmap_one()

patchbot
commit f38f3dccf1e1a8aabcf57364326fc8f44cddc41a
Author:     Jan Beulich <[hidden email]>
AuthorDate: Tue Nov 28 13:14:43 2017 +0100
Commit:     Jan Beulich <[hidden email]>
CommitDate: Tue Nov 28 13:14:43 2017 +0100

    x86: check paging mode earlier in xenmem_add_to_physmap_one()
   
    There's no point in deferring this until after some initial processing,
    and it's actively wrong for the XENMAPSPACE_gmfn_foreign handling to not
    have such a check at all.
   
    Signed-off-by: Jan Beulich <[hidden email]>
    Reviewed-by: George Dunlap <[hidden email]>
    Acked-by: Andrew Cooper <[hidden email]>
    Release-acked-by: Julien Grall <[hidden email]>
---
 xen/arch/x86/mm.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 86c822d..6ec6e68 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -4081,6 +4081,9 @@ int xenmem_add_to_physmap_one(
     mfn_t mfn = INVALID_MFN;
     p2m_type_t p2mt;
 
+    if ( !paging_mode_translate(d) )
+        return -EACCES;
+
     switch ( space )
     {
         case XENMAPSPACE_shared_info:
@@ -4117,7 +4120,7 @@ int xenmem_add_to_physmap_one(
             break;
     }
 
-    if ( !paging_mode_translate(d) || mfn_eq(mfn, INVALID_MFN) )
+    if ( mfn_eq(mfn, INVALID_MFN) )
     {
         rc = -EINVAL;
         goto put_both;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog