]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 Jul 2020 16:47:15 +0000 (18:47 +0200)
[ Upstream commit 639f181f0ee20d3249dbc55f740f0167267180f0 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/rxrpc/recvmsg.c
net/rxrpc/sendmsg.c

index 8578c39ec83959b99dc50fb00fb70968e09ad18e..6896a33ef84274cb88574c67124d70261ef8f0bf 100644 (file)
@@ -464,7 +464,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 5e9c43d4a314ba854acbc3d9f01f70100f0b0b3f..49d03c8c64da9feecfa7b2715e6ef48b7faa3c30 100644 (file)
@@ -306,7 +306,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;