[PATCH] xen/pvcalls: use free_page() for sring in pvcalls_front_remove()
From: Ziheng Wei
Date: Sun Dec 06 2026 - 03:15:12 EST
pvcalls_front_probe() allocates bedata->ring.sring with
__get_free_page(), but pvcalls_front_remove() frees it with kfree(),
causing a page-allocator vs slab-allocator mismatch on disconnect or
probe error unwind.
Use free_page((unsigned long)bedata->ring.sring) instead, matching
pvcalls_front_free_map().
Found by LLM-assisted static analysis. Compile-tested on x86_64.
Fixes: aa7ba3767830 ("xen/pvcalls: implement frontend disconnect")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Ziheng Wei <zihengw03@xxxxxxx>
---
drivers/xen/pvcalls-front.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
index 3e7aa807c..8f250c425 100644
--- a/drivers/xen/pvcalls-front.c
+++ b/drivers/xen/pvcalls-front.c
@@ -1200,7 +1200,7 @@ static void pvcalls_front_remove(struct xenbus_device *dev)
}
if (bedata->ref != -1)
gnttab_end_foreign_access(bedata->ref, NULL);
- kfree(bedata->ring.sring);
+ free_page((unsigned long)bedata->ring.sring);
kfree(bedata);
xenbus_switch_state(dev, XenbusStateClosed);
}
base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
--
2.43.0