]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[retry] Process at most one timer's expiry in each call to retry_step()
authorMichael Brown <mcb30@ipxe.org>
Mon, 8 Nov 2010 03:06:14 +0000 (03:06 +0000)
committerMichael Brown <mcb30@ipxe.org>
Mon, 8 Nov 2010 03:35:36 +0000 (03:35 +0000)
commit66e7619099a5810908fdc09124b4f254c54c3563
tree842e901d222221816de66e32403474c888655134
parent13e4b9ec498e4374cf7208b18723e87796aa1735
[retry] Process at most one timer's expiry in each call to retry_step()

Calling a timer's expiry method may cause arbitrary consequences,
including arbitrary modifications of the list of retry timers.
list_for_each_entry_safe() guards against only deletion of the current
list entry; it provides no protection against other list
modifications.  In particular, if a timer's expiry method causes the
subsequent timer in the list to be deleted, then the next loop
iteration will access a timer that may no longer exist.

This is a particularly nasty bug, since absolutely none of the
list-manipulation or reference-counting assertion checks will be
triggered.  (The first assertion failure happens on the next iteration
through list_for_each_entry(), showing that the list has become
corrupted but providing no clue as to when this happened.)

Fix by stopping traversal of the list of retry timers as soon as we
hit an expired timer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/net/retry.c