git: 2794893ebff0 - main - xen/intr: do full xenisrc initialization during binding
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 14 Apr 2023 14:00:57 UTC
The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=2794893ebff0c0cab62692fdf07b8632bcfe4d35 commit 2794893ebff0c0cab62692fdf07b8632bcfe4d35 Author: Elliott Mitchell <ehem+freebsd@m5p.com> AuthorDate: 2021-05-14 04:36:02 +0000 Commit: Roger Pau Monné <royger@FreeBSD.org> CommitDate: 2023-04-14 13:58:51 +0000 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 --- sys/x86/xen/xen_intr.c | 7 +++---- 1 file 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;