[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH for-4.10] libs/evtchn: Remove active handler on clean-up or failure
Commit 89d55473ed16543044a31d1e0d4660cf5a3f49df "xentoolcore_restrict_all: Implement for libxenevtchn" added a call to register allowing to restrict the event channel. However, the call to deregister the handler was not performed if open failed or when closing the event channel. This will result to corrupt the list of handlers and potentially crash the application later one. Fix it by calling xentoolcore_deregister_active_handle on failure and closure. Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx> --- This patch is fixing a bug introduced after the code freeze by "xentoolcore_restrict_all: Implement for libxenevtchn". The call to xentoolcore_deregister_active_handle is done at the same place as for the grants. But I am not convinced this is thread safe as there are potential race between close the event channel and restict handler. Do we care about that? --- tools/libs/evtchn/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/libs/evtchn/core.c b/tools/libs/evtchn/core.c index 14b7549a6b..2dba58bf00 100644 --- a/tools/libs/evtchn/core.c +++ b/tools/libs/evtchn/core.c @@ -56,6 +56,7 @@ xenevtchn_handle *xenevtchn_open(xentoollog_logger *logger, unsigned open_flags) err: osdep_evtchn_close(xce); + xentoolcore__deregister_active_handle(&xce->tc_ah); xtl_logger_destroy(xce->logger_tofree); free(xce); return NULL; @@ -69,6 +70,7 @@ int xenevtchn_close(xenevtchn_handle *xce) return 0; rc = osdep_evtchn_close(xce); + xentoolcore__deregister_active_handle(&xce->tc_ah); xtl_logger_destroy(xce->logger_tofree); free(xce); return rc; -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |