From: Simon Wilkinson Date: Sat, 24 Dec 2011 17:23:48 +0000 (+0000) Subject: rx: Don't adjust non-existent events X-Git-Tag: openafs-stable-1_8_0pre1~2910 X-Git-Url: http://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=5f939c64e575dab937feda819937ce3087a2d2e8 rx: Don't adjust non-existent events If we notice that time has gone backwards (that is, the current time is older than the time of the last event we fired), then we reschedule all pending events. On Windows, immediately after we have resumed from a suspend, this code path can be executed with an empty event tree, causing an exception: FAULTING_IP: afsrpc!adjustTimes+cf [c:\src\openafs\openafs.git\repo\src\rx\rx_event.c @ 213] 00000000`61041847 4c8b4030 mov r8,qword ptr [rax+30h] EXCEPTION_RECORD: ffffffffffffffff -- (.exr 0xffffffffffffffff) ExceptionAddress: 0000000061041847 (afsrpc!adjustTimes+0x00000000000000cf) ExceptionCode: c0000005 (Access violation) ExceptionFlags: 00000000 NumberParameters: 2 Parameter[0]: 0000000000000000 Parameter[1]: 0000000000000030 Attempt to read from address 0000000000000030 Resolve this by checking for an empty tree before we attempt to adjust event times. If the tree is empty, we just zero the last event time (so we don't keep running the adjustTimes routine), and continue as normal. Change-Id: I42a42ff1bd53a9d5c4733efc7ac5f629426b3aa1 Reviewed-on: http://gerrit.openafs.org/6425 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- diff --git a/src/rx/rx_event.c b/src/rx/rx_event.c index 4bf2b6e..0053b28 100644 --- a/src/rx/rx_event.c +++ b/src/rx/rx_event.c @@ -203,6 +203,10 @@ adjustTimes(void) clock_Sub(&adjTime, &now); + /* If there are no events in the tree, then there's nothing to adjust */ + if (eventTree.first == NULL) + goto out; + node = opr_rbtree_first(&eventTree.head); while(node) { struct rxevent *event = opr_containerof(node, struct rxevent, node);