aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/tmem_xen.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-06-21 19:19:25 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-06-21 19:19:25 +0100
commit5afab625f400e571b78aaf3b7d2f5644c06d07b3 (patch)
tree28deac6896ee1fcad69373b3fa92ec345c618e67 /xen/common/tmem_xen.c
parent3d5e6a3ff38302913fff925660e947b0256166f7 (diff)
downloadxen-5afab625f400e571b78aaf3b7d2f5644c06d07b3.tar.gz
xen-5afab625f400e571b78aaf3b7d2f5644c06d07b3.tar.bz2
xen-5afab625f400e571b78aaf3b7d2f5644c06d07b3.zip
Enable tmem functionality for PV on HVM guests. Guest kernel
must still be tmem-enabled to use this functionality (e.g. won't work for Windows), but upstream Linux tmem (aka cleancache and frontswap) patches apply cleanly on top of PV on HVM patches. Also, fix up some ASSERTS and code used only when bad guest mfns are passed to tmem. Previous code could crash Xen if a buggy/malicious guest passes bad gmfns. Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Diffstat (limited to 'xen/common/tmem_xen.c')
-rw-r--r--xen/common/tmem_xen.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xen/common/tmem_xen.c b/xen/common/tmem_xen.c
index 41c37bc57f..922403297e 100644
--- a/xen/common/tmem_xen.c
+++ b/xen/common/tmem_xen.c
@@ -101,7 +101,7 @@ static inline void *cli_mfn_to_va(tmem_cli_mfn_t cmfn, unsigned long *pcli_mfn)
p2m_type_t t;
cli_mfn = mfn_x(gfn_to_mfn(current->domain, cmfn, &t));
- if (t != p2m_ram_rw)
+ if (t != p2m_ram_rw || cli_mfn == INVALID_MFN)
return NULL;
if (pcli_mfn != NULL)
*pcli_mfn = cli_mfn;