* [PATCH net] rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA
@ 2020-07-20 11:41 David Howells
2020-07-21 0:47 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: David Howells @ 2020-07-20 11:41 UTC (permalink / raw)
To: netdev; +Cc: dhowells, linux-afs, linux-kernel
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>
---
net/rxrpc/recvmsg.c | 2 +-
net/rxrpc/sendmsg.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/rxrpc/recvmsg.c b/net/rxrpc/recvmsg.c
index 2989742a4aa1..490b1927215c 100644
--- a/net/rxrpc/recvmsg.c
+++ b/net/rxrpc/recvmsg.c
@@ -543,7 +543,7 @@ int rxrpc_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
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)) {
diff --git a/net/rxrpc/sendmsg.c b/net/rxrpc/sendmsg.c
index 1304b8608f56..03a30d014bb6 100644
--- a/net/rxrpc/sendmsg.c
+++ b/net/rxrpc/sendmsg.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA
2020-07-20 11:41 [PATCH net] rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA David Howells
@ 2020-07-21 0:47 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-07-21 0:47 UTC (permalink / raw)
To: dhowells; +Cc: netdev, linux-afs, linux-kernel
From: David Howells <dhowells@redhat.com>
Date: Mon, 20 Jul 2020 12:41:46 +0100
> 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>
Applied and queued up for -stable, thanks David.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-07-21 0:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-20 11:41 [PATCH net] rxrpc: Fix sendmsg() returning EPIPE due to recvmsg() returning ENODATA David Howells
2020-07-21 0:47 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).