Skip to content

Commit 0eb362d

Browse files
dhowellsdavem330
authored andcommitted
rxrpc: Make it so that a waiting process can be aborted
When sendmsg() creates an rxrpc call, it queues it to wait for a connection and channel to be assigned and then waits before it can start shovelling data as the encrypted DATA packet content includes a summary of the connection parameters. However, sendmsg() may get interrupted before a connection gets assigned and further sendmsg() calls will fail with EBUSY until an assignment is made. Fix this so that the call can at least be aborted without failing on EBUSY. We have to be careful here as sendmsg() mustn't be allowed to start the call timer if the call doesn't yet have a connection assigned as an oops may follow shortly thereafter. Fixes: 540b1c4 ("rxrpc: Fix deadlock between call creation and sendmsg/recvmsg") Reported-by: Marc Dionne <marc.dionne@auristor.com> Signed-off-by: David Howells <dhowells@redhat.com> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: linux-afs@lists.infradead.org cc: netdev@vger.kernel.org cc: linux-kernel@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0d098d8 commit 0eb362d

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

net/rxrpc/sendmsg.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,10 +656,13 @@ int rxrpc_do_sendmsg(struct rxrpc_sock *rx, struct msghdr *msg, size_t len)
656656
goto out_put_unlock;
657657
} else {
658658
switch (rxrpc_call_state(call)) {
659-
case RXRPC_CALL_UNINITIALISED:
660659
case RXRPC_CALL_CLIENT_AWAIT_CONN:
661-
case RXRPC_CALL_SERVER_PREALLOC:
662660
case RXRPC_CALL_SERVER_SECURING:
661+
if (p.command == RXRPC_CMD_SEND_ABORT)
662+
break;
663+
fallthrough;
664+
case RXRPC_CALL_UNINITIALISED:
665+
case RXRPC_CALL_SERVER_PREALLOC:
663666
rxrpc_put_call(call, rxrpc_call_put_sendmsg);
664667
ret = -EBUSY;
665668
goto error_release_sock;

0 commit comments

Comments
 (0)