arm/mm: release grant lock on xenmem_add_to_physmap_one() error paths

Commit 55021ff9ab ("xen/arm: add_to_physmap_one: Avoid to map mfn 0 if
an error occurs") introduced error paths not releasing the grant table
lock. Replace them by a suitable check after the lock was dropped.

This is XSA-235.

Reported-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <julien.grall@arm.com>
master commit: 59546c1897
master date: 2017-08-23 17:45:45 +0200
This commit is contained in:
Jan Beulich committed 2017-08-23 17:52:54 +02:00
1 parent c3c2df8d32
commit df8c4fa0e0
1 file changed
+11 -4
+11 -4
View File
@@ -1166,7 +1166,7 @@ int xenmem_add_to_physmap_one(
if ( idx < nr_status_frames(d->grant_table) )
mfn = virt_to_mfn(d->grant_table->status[idx]);
else
return -EINVAL;
mfn = mfn_x(INVALID_MFN);
}
else
{
@@ -1177,14 +1177,21 @@ int xenmem_add_to_physmap_one(
if ( idx < nr_grant_frames(d->grant_table) )
mfn = virt_to_mfn(d->grant_table->shared_raw[idx]);
else
return -EINVAL;
mfn = mfn_x(INVALID_MFN);
}
d->arch.grant_table_gfn[idx] = gfn;
if ( mfn != mfn_x(INVALID_MFN) )
{
d->arch.grant_table_gfn[idx] = gfn;
t = p2m_ram_rw;
t = p2m_ram_rw;
}
grant_write_unlock(d->grant_table);
if ( mfn == mfn_x(INVALID_MFN) )
return -EINVAL;
break;
case XENMAPSPACE_shared_info:
if ( idx != 0 )
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.