aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Mitchell <ehem+freebsd@m5p.com>2021-05-14 04:36:02 +0000
committerRoger Pau Monné <royger@FreeBSD.org>2023-04-14 13:58:51 +0000
commit2794893ebff0c0cab62692fdf07b8632bcfe4d35 (patch)
tree15c6538546fc1ddc691898faeeb66f7cc7c9f983
parentff73b1d69b90e33e18e60a10383b75058c7639c1 (diff)
downloadsrc-2794893ebff0c0cab62692fdf07b8632bcfe4d35.tar.gz
src-2794893ebff0c0cab62692fdf07b8632bcfe4d35.zip
xen/intr: do full xenisrc initialization during binding
Keeping released xenisrcs in a known state simplifies allocation, but forces the allocation function to maintain that state. This turns into a problem when trying to allow for interchangeable allocation functions. Fix this issue by ensuring xenisrcs are always *fully* initialized during binding. Reviewed by: royger
-rw-r--r--sys/x86/xen/xen_intr.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c
index b3996e6cf1aa..1bfe941bc67b 100644
--- a/sys/x86/xen/xen_intr.c
+++ b/sys/x86/xen/xen_intr.c
@@ -406,10 +406,6 @@ xen_intr_release_isrc(struct xenisrc *isrc)
/* not reachable from xen_intr_port_to_isrc[], unlock */
mtx_unlock(&xen_intr_isrc_lock);
- isrc->xi_cpu = 0;
- isrc->xi_port = INVALID_EVTCHN;
- isrc->xi_cookie = NULL;
-
mtx_lock(&xen_intr_x86_lock);
isrc->xi_type = EVTCHN_TYPE_UNBOUND;
mtx_unlock(&xen_intr_x86_lock);
@@ -456,8 +452,11 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port,
isrc = xen_intr_alloc_isrc(type);
if (isrc == NULL)
return (ENOSPC);
+
+ isrc->xi_cookie = NULL;
isrc->xi_port = local_port;
isrc->xi_close = false;
+ isrc->xi_cpu = 0;
refcount_init(&isrc->xi_refcount, 1);
mtx_lock(&xen_intr_isrc_lock);
xen_intr_port_to_isrc[isrc->xi_port] = isrc;