git: 2d5e325303cf - main - xen/intr: always set xi_close in xen_intr_bind_isrc()

From: Roger Pau Monné <royger_at_FreeBSD.org>
Date: Wed, 29 Mar 2023 07:52:26 UTC
The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/src/commit/?id=2d5e325303cf9e7470b7846deba30af33046c31a

commit 2d5e325303cf9e7470b7846deba30af33046c31a
Author:     Elliott Mitchell <ehem+freebsd@m5p.com>
AuthorDate: 2022-10-11 19:25:12 +0000
Commit:     Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2023-03-29 07:51:39 +0000

    xen/intr: always set xi_close in xen_intr_bind_isrc()
    
    Appears errors are uncommon since calling xen_intr_release_isrc() on a
    xenisrc with xi_close in an undefined state could be bad.  Fix this
    problematic lurking nasty.
    
    Reviewed by: royger
    MFC after: 1 week
---
 sys/x86/xen/xen_intr.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/x86/xen/xen_intr.c b/sys/x86/xen/xen_intr.c
index 262df1cefeea..37b18c05b8a6 100644
--- a/sys/x86/xen/xen_intr.c
+++ b/sys/x86/xen/xen_intr.c
@@ -6,6 +6,7 @@
  * Copyright (c) 2002-2005, K A Fraser
  * Copyright (c) 2005, Intel Corporation <xiaofeng.ling@intel.com>
  * Copyright (c) 2012, Spectra Logic Corporation
+ * Copyright © 2021-2023, Elliott Mitchell
  *
  * This file may be distributed separately from the Linux kernel, or
  * incorporated into other software packages, subject to the following license:
@@ -420,6 +421,7 @@ xen_intr_bind_isrc(struct xenisrc **isrcp, evtchn_port_t local_port,
 		}
 	}
 	isrc->xi_port = local_port;
+	isrc->xi_close = 0;
 	xen_intr_port_to_isrc[local_port] = isrc;
 	refcount_init(&isrc->xi_refcount, 1);
 	mtx_unlock(&xen_intr_isrc_lock);