rx: Don't adjust non-existent events
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 24 Dec 2011 17:23:48 +0000 (17:23 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sun, 25 Dec 2011 05:45:52 +0000 (21:45 -0800)
commit5f939c64e575dab937feda819937ce3087a2d2e8
tree1a9e838bcae4c0d68cf2286d89f25a80ae44e7d8
parente18c620aa0e49fde31beaa8327bf02eb87d89e3f
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 <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>
src/rx/rx_event.c