]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[arp] Prevent ARP cache entries from being deleted mid-transmission
authorMichael Brown <mcb30@ipxe.org>
Sun, 1 Jul 2012 17:24:15 +0000 (18:24 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sun, 1 Jul 2012 17:31:23 +0000 (18:31 +0100)
commit19859d8eada26eeeb881054efc242cf2ed5609fb
treed3185a890d2de1840a72aafb3509946057eae1e5
parent55f52bb77a708ede94176c354fb5f27177fd5e99
[arp] Prevent ARP cache entries from being deleted mid-transmission

Each ARP cache entry maintains a transmission queue, which is sent out
as soon as the link-layer address is known.  If multiple packets are
queued, then it is possible for memory pressure to cause the ARP cache
discarder to be invoked during transmission of the first packet, which
may cause the ARP cache entry to be deleted before the second packet
can be sent.  This results in an invalid pointer dereference.

Avoid this problem by reference-counting ARP cache entries and
ensuring that an extra reference is held while processing the
transmission queue, and by using list_first_entry() rather than
list_for_each_entry_safe() to traverse the queue.

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