diff options
author | David Howells <dhowells@redhat.com> | 2016-09-17 10:49:11 +0100 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2016-09-17 10:51:54 +0100 |
commit | 816c9fce12f3745abc959c0fca8ace1c2c51421c (patch) | |
tree | 98af1e193f2abe3a28347fbbbc4cc12a45cdefb7 /Documentation | |
parent | 2e2ea51dec2ab6a81950d4b436eb66ebf45dd507 (diff) |
rxrpc: Fix handling of the last packet in rxrpc_recvmsg_data()
The code for determining the last packet in rxrpc_recvmsg_data() has been
using the RXRPC_CALL_RX_LAST flag to determine if the rx_top pointer points
to the last packet or not. This isn't a good idea, however, as the input
code may be running simultaneously on another CPU and that sets the flag
*before* updating the top pointer.
Fix this by the following means:
(1) Restrict the use of RXRPC_CALL_RX_LAST to the input routines only.
There's otherwise a synchronisation problem between detecting the flag
and checking tx_top. This could probably be dealt with by appropriate
application of memory barriers, but there's a simpler way.
(2) Set RXRPC_CALL_RX_LAST after setting rx_top.
(3) Make rxrpc_rotate_rx_window() consult the flags header field of the
DATA packet it's about to discard to see if that was the last packet.
Use this as the basis for ending the Rx phase. This shouldn't be a
problem because the recvmsg side of things is guaranteed to see the
packets in order.
(4) Make rxrpc_recvmsg_data() return 1 to indicate the end of the data if:
(a) the packet it has just processed is marked as RXRPC_LAST_PACKET
(b) the call's Rx phase has been ended.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions