rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA
authorDavid Howells <dhowells@redhat.com>
Mon, 20 Jul 2020 11:41:46 +0000 (12:41 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 21 Jul 2020 00:47:10 +0000 (17:47 -0700)
rxrpc_sendmsg() returns EPIPE if there's an outstanding error, such as if
rxrpc_recvmsg() indicating ENODATA if there's nothing for it to read.

Change rxrpc_recvmsg() to return EAGAIN instead if there's nothing to read
as this particular error doesn't get stored in ->sk_err by the networking
core.

Also change rxrpc_sendmsg() so that it doesn't fail with delayed receive
errors (there's no way for it to report which call, if any, the error was
caused by).

Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both")
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rxrpc/recvmsg.c
net/rxrpc/sendmsg.c

index 2989742a4aa118eb433d1e1dfe8013b7c55c85f4..490b1927215c78aa5ec2775984a5d7ef2ccc0b8e 100644 (file)
@@ -543,7 +543,7 @@ try_again:
            list_empty(&rx->recvmsg_q) &&
            rx->sk.sk_state != RXRPC_SERVER_LISTENING) {
                release_sock(&rx->sk);
-               return -ENODATA;
+               return -EAGAIN;
        }
 
        if (list_empty(&rx->recvmsg_q)) {
index 1304b8608f56e4862143f4dd00020c2874b639f8..03a30d014bb6b4818824bf991339828d4292a50e 100644 (file)
@@ -304,7 +304,7 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
        /* this should be in poll */
        sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);
 
-       if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
+       if (sk->sk_shutdown & SEND_SHUTDOWN)
                return -EPIPE;
 
        more = msg->msg_flags & MSG_MORE;