xen/9pfs: Fix data ring granting
PATCH 1/1 xen/9pfs: Fix data ring granting
xen_9pfs_front_alloc_dataring() is granting the backend access to the data ring by using gnttab_grant_foreign_access() for each memory page of the ring.
Unfortunately the pages passed to gnttab_grant_foreign_access() are not referenced by the consecutive PFNs, but by GFNs, which might be not consecutive if the system is running as a PV guest.
Fix that by not using "virt_to_gfn(bytes) + i" as parameter, but "pfn_to_gfn(virt_to_pfn(bytes) + i)" instead.
Fixes 71ebd71921e4 ("xen/9pfs: connect to the backend")
Signed-off-by Juergen Gross <[email protected]>
--- net/9p/trans_xen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/9p/trans_xen.c +2 -1
@@ -347,7 +347,8 @@ static int xen_9pfs_front_alloc_dataring(struct xenbus_device *dev, }for (; i < (1 << order); i++) { ret =gnttab_grant_foreign_access ( - dev->otherend_id,virt_to_gfn (bytes) + i,0 ); + dev->otherend_id, +pfn_to_gfn (virt_to_pfn (bytes) + i),0 );if (ret <0 ) goto out; ring->intf->ref[i] = ret;
Signature · 1 line
2.51.0