diff options
author | David Howells <dhowells@redhat.com> | 2017-02-24 21:57:13 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-26 21:30:12 -0500 |
commit | d7e15835ab278443da5c0cfe6573f8f793ed40a3 (patch) | |
tree | 50aafc55faa4652e5e2b33657271662cf138cc8c /lib | |
parent | edb9d1bff4bbe19b8ae0e71b1f38732591a9eeb2 (diff) | |
download | linux-d7e15835ab278443da5c0cfe6573f8f793ed40a3.tar.bz2 |
rxrpc: Kernel calls get stuck in recvmsg
Calls made through the in-kernel interface can end up getting stuck because
of a missed variable update in a loop in rxrpc_recvmsg_data(). The problem
is like this:
(1) A new packet comes in and doesn't cause a notification to be given to
the client as there's still another packet in the ring - the
assumption being that if the client will keep drawing off data until
the ring is empty.
(2) The client is in rxrpc_recvmsg_data(), inside the big while loop that
iterates through the packets. This copies the window pointers into
variables rather than using the information in the call struct
because:
(a) MSG_PEEK might be in effect;
(b) we need a barrier after reading call->rx_top to pair with the
barrier in the softirq routine that loads the buffer.
(3) The reading of call->rx_top is done outside of the loop, and top is
never updated whilst we're in the loop. This means that even through
there's a new packet available, we don't see it and may return -EFAULT
to the caller - who will happily return to the scheduler and await the
next notification.
(4) No further notifications are forthcoming until there's an abort as the
ring isn't empty.
The fix is to move the read of call->rx_top inside the loop - but it needs
to be done before the condition is checked.
Reported-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Tested-by: Marc Dionne <marc.dionne@auristor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions