* [PATCH] xen/9pfs: Fix data ring granting
@ 2025-12-18 15:48 Juergen Gross
0 siblings, 0 replies; only message in thread
From: Juergen Gross @ 2025-12-18 15:48 UTC (permalink / raw)
To: linux-kernel, v9fs
Cc: ariadne, Juergen Gross, Eric Van Hensbergen, Latchesar Ionkov,
Dominique Martinet, Christian Schoenebeck
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 <jgross@suse.com>
---
net/9p/trans_xen.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c
index 12f752a92332..a2ab633e78be 100644
--- a/net/9p/trans_xen.c
+++ b/net/9p/trans_xen.c
@@ -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;
--
2.51.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-18 15:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-18 15:48 [PATCH] xen/9pfs: Fix data ring granting Juergen Gross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®