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

[win-pv-devel] [PATCH 15/15] Add missing magic number checks



We should sanity check the magic number in an event channel whenever one is
passed to an EVTCHN method or when one is recovered from a list.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenbus/evtchn.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c
index dd608ba..3360a29 100644
--- a/src/xenbus/evtchn.c
+++ b/src/xenbus/evtchn.c
@@ -644,6 +644,8 @@ EvtchnBind(
     KIRQL                       Irql;
     NTSTATUS                    status;
 
+    ASSERT3U(Channel->Magic, ==, XENBUS_EVTCHN_CHANNEL_MAGIC);
+
     status = STATUS_INVALID_PARAMETER;
     if (Cpu >= (ULONG)KeNumberProcessors)
         goto fail1;
@@ -989,6 +991,8 @@ EvtchnSuspendCallbackEarly(
 
         Channel = CONTAINING_RECORD(ListEntry, XENBUS_EVTCHN_CHANNEL, 
ListEntry);
 
+        ASSERT3U(Channel->Magic, ==, XENBUS_EVTCHN_CHANNEL_MAGIC);
+
         if (Channel->Active) {
             ULONG       LocalPort = Channel->LocalPort;
             NTSTATUS    status;
@@ -1044,6 +1048,8 @@ EvtchnDebugCallback(
 
             Channel = CONTAINING_RECORD(ListEntry, XENBUS_EVTCHN_CHANNEL, 
ListEntry);
 
+            ASSERT3U(Channel->Magic, ==, XENBUS_EVTCHN_CHANNEL_MAGIC);
+
             ModuleLookup((ULONG_PTR)Channel->Caller, &Name, &Offset);
 
             if (Name != NULL) {
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel


 


Rackspace

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