[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libs/evtchn: Remove active handler on clean-up or failure



commit 0de212b03066571523f3174535bb4fb1264ca1de
Author:     Julien Grall <julien.grall@xxxxxxxxxx>
AuthorDate: Fri Nov 10 17:10:50 2017 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Tue Nov 14 13:54:29 2017 +0000

    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>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    Release-acked-by: Julien Grall <julien.grall@xxxxxxxxxx>
---
 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 14b7549..2dba58b 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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.