From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andres Lagar-Cavilla Subject: [PATCH] x86/mem_sharing: Rectify test for "empty" physmap entry in sharing_add_to_physmap Date: Wed, 18 Apr 2012 09:06:40 -0400 Message-ID: <495d3df95c1d59f55d5a.1334754400@xdev.gridcentric.ca> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: andres@gridcentric.ca, tim@xen.org List-Id: xen-devel@lists.xenproject.org xen/arch/x86/mm/mem_sharing.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) Signed-off-by: Andres Lagar-Cavilla diff -r 8609bbbba141 -r 495d3df95c1d xen/arch/x86/mm/mem_sharing.c --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -1073,9 +1073,11 @@ int mem_sharing_add_to_physmap(struct do if ( spage->sharing->handle != sh ) goto err_unlock; - /* Make sure the target page is a hole in the physmap */ + /* Make sure the target page is a hole in the physmap. This is not as + * simple a test as we'd like it to be. Non-existent p2m entries return + * invalid mfn and p2m_mmio_dm type when queried. */ if ( mfn_valid(cmfn) || - (!(p2m_is_ram(cmfn_type))) ) + ( (!(p2m_is_ram(cmfn_type))) && (cmfn_type != p2m_mmio_dm) ) ) { ret = XENMEM_SHARING_OP_C_HANDLE_INVALID; goto err_unlock;