[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v1 05/21] hw/i386/kvm/xen_gnttab: Fix error handling in xen_be_gnttab_map_refs()



On 24/11/2026 16:22, David Woodhouse wrote:
From: David Woodhouse <dwmw@xxxxxxxxxxxx>

When the grant's target page cannot be mapped, the failure path calls
gnt_unref(), which asserts that the map_track[] refcount is non-zero —
but the refcount was only incremented after a successful mapping. Take
the reference as soon as gnt_ref() succeeds, so the failure path stays
balanced.

Refuse writable mappings, including a write upgrade of an existing
mapping, when the underlying memory region is read-only, and set errno
when the upgrade fails.

Fixes: b08d88e30f06 ("hw/xen: Add emulated implementation of grant table 
operations")
Reported-by: Hui Peng <benquike@xxxxxxxxx>
Closes: https://gitlab.com/qemu-project/qemu/-/work_items/4525
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
  hw/i386/kvm/xen_gnttab.c | 12 ++++++++++--
  1 file changed, 10 insertions(+), 2 deletions(-)

Reviewed-by: Paul Durrant <paul@xxxxxxx>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.