]> xenbits.xensource.com Git - pvdrivers/win/xennet.git/commit
Fix multiple completion vulnerability in transmit code
authorPaul Durrant <paul.durrant@citrix.com>
Tue, 26 Jan 2016 11:34:47 +0000 (11:34 +0000)
committerPaul Durrant <paul.durrant@citrix.com>
Tue, 26 Jan 2016 11:47:37 +0000 (11:47 +0000)
commit4abbd6fbcc02492fd745b85c22ff766d55921bcb
tree92bcaa00baa1272f567fc94d61e2c1fc51326417
parent60e6f7fc380032b18903cdc8718a0b548cc0f2a9
Fix multiple completion vulnerability in transmit code

My previous patch 7c3365d5 "Make transmitter robust against a possible
completion race" did not fix the problem. There is still the possibility
that a NET_BUFFER_LIST containing multiple NET_BUFFERs could lead to
multiple completions if the underlying transmit completes quickly (or indeed
synchrnously). This is because a reference is taken before sending each
NET_BUFFER but, if that transmission completes immediately the reference is
dropped back to zero (leading to the NET_BUFFER_LIST being completed) before
the reference is taken for the next NET_BUFFER.

This patch therefore takes an extra reference before sending any NET_BUFFERs
and then drops it when there are no more NET_BUFFERs to send. This ensures
that the reference count on the NET_BUFFER_LIST can only fall to zero once
the whole thing has been processed.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
src/xennet/transmitter.c