]> xenbits.xensource.com Git - xen.git/commitdiff
Add two arch hooks to gnttab_release_mappings().
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 15 Mar 2007 10:43:13 +0000 (10:43 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 15 Mar 2007 10:43:13 +0000 (10:43 +0000)
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
xen/common/grant_table.c
xen/include/asm-ia64/grant_table.h
xen/include/asm-powerpc/grant_table.h
xen/include/asm-x86/grant_table.h

index 1af842a52835380d41bfbd80d588c0aa6ff3cd85..2ea6ff37eb15189557fa846ed7f0fced6f8697fe 100644 (file)
@@ -1392,8 +1392,7 @@ gnttab_release_mappings(
             {
                 BUG_ON(!(act->pin & GNTPIN_hstr_mask));
                 act->pin -= GNTPIN_hstr_inc;
-                /* Done implicitly when page tables are destroyed. */
-                /* put_page(mfn_to_page(act->frame)); */
+                gnttab_release_put_page(mfn_to_page(act->frame));
             }
         }
         else
@@ -1409,8 +1408,7 @@ gnttab_release_mappings(
             {
                 BUG_ON(!(act->pin & GNTPIN_hstw_mask));
                 act->pin -= GNTPIN_hstw_inc;
-                /* Done implicitly when page tables are destroyed. */
-                /* put_page_and_type(mfn_to_page(act->frame)); */
+                gnttab_release_put_page_and_type(mfn_to_page(act->frame));
             }
 
             if ( (act->pin & (GNTPIN_devw_mask|GNTPIN_hstw_mask)) == 0 )
index 45d7dac7e942eb47be436b77aac3a49a51b17ddb..f10d92e4194f473cf774a65b47145486ded8043c 100644 (file)
@@ -64,4 +64,7 @@ static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
        clear_bit(nr, addr);
 }
 
+#define gnttab_release_put_page(page)           put_page((page))
+#define gnttab_release_put_page_and_type(page)  put_page_and_type((page))
+
 #endif /* __ASM_GRANT_TABLE_H__ */
index 334a925cbb95302e17a8575ad991ea6a290c6d14..e8ca87cbb404b3ffff9211e1180c95c31130ca26 100644 (file)
@@ -69,4 +69,17 @@ static inline uint cpu_foreign_map_order(void)
     /* 16 GiB */
     return 34 - PAGE_SHIFT;
 }
+
+#if 0
+/*
+ * without put_page()/put_page_and_type() page might be leaked.
+ * with put_page()/put_page_and_type() freed page might be accessed.
+ */
+#define gnttab_release_put_page(page)           put_page((page))
+#define gnttab_release_put_page_and_type(page)  put_page_and_type((page))
+#else
+#define gnttab_release_put_page(page)           do { } while (0)
+#define gnttab_release_put_page_and_type(page)  do { } while (0)
+#endif
+
 #endif  /* __ASM_PPC_GRANT_TABLE_H__ */
index 32dc43b898a413cafbcff9585485f2e2751589a3..f0c49bac3bda001f53ad1aed9079eab57d2e33a1 100644 (file)
@@ -38,4 +38,14 @@ static inline void gnttab_clear_flag(unsigned long nr, uint16_t *addr)
     clear_bit(nr, addr);
 }
 
+#define gnttab_release_put_page(page)                           \
+    do {                                                        \
+        /* Done implicitly when page tables are destroyed. */   \
+    } while (0)
+
+#define gnttab_release_put_page_and_type(page)                  \
+    do {                                                        \
+        /* Done implicitly when page tables are destroyed. */   \
+    } while (0)
+
 #endif /* __ASM_GRANT_TABLE_H__ */