* re: rxrpc: Fix deadlock between call creation and sendmsg/recvmsg
@ 2017-03-02 13:33 Colin Ian King
2017-03-02 16:13 ` David Howells
0 siblings, 1 reply; 2+ messages in thread
From: Colin Ian King @ 2017-03-02 13:33 UTC (permalink / raw)
To: David Howells; +Cc: David S. Miller, netdev, linux-kernel
I think the following part of the patch is problematic:
call = rxrpc_find_call_by_user_ID(rx, user_call_ID);
if (!call) {
+ ret = -EBADSLT;
if (cmd != RXRPC_CMD_SEND_DATA)
- return -EBADSLT;
+ goto error_release_sock;
+ ret = -EBUSY;
At this point call is null, so the following code is performing a null
pointer dereference on call when accessing call->state.
Detected by CoverityScan CID#1414316 ("Dereference after null check")
+ if (call->state == RXRPC_CALL_UNINITIALISED ||
+ call->state == RXRPC_CALL_CLIENT_AWAIT_CONN ||
+ call->state == RXRPC_CALL_SERVER_PREALLOC ||
+ call->state == RXRPC_CALL_SERVER_SECURING ||
+ call->state == RXRPC_CALL_SERVER_ACCEPTING)
+ goto error_release_sock;
call = rxrpc_new_client_call_for_sendmsg(rx, msg,
user_call_ID,
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: rxrpc: Fix deadlock between call creation and sendmsg/recvmsg
2017-03-02 13:33 rxrpc: Fix deadlock between call creation and sendmsg/recvmsg Colin Ian King
@ 2017-03-02 16:13 ` David Howells
0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2017-03-02 16:13 UTC (permalink / raw)
To: Colin Ian King; +Cc: dhowells, David S. Miller, netdev, linux-kernel
Colin Ian King <colin.king@canonical.com> wrote:
> I think the following part of the patch is problematic:
>
> call = rxrpc_find_call_by_user_ID(rx, user_call_ID);
> if (!call) {
> + ret = -EBADSLT;
> if (cmd != RXRPC_CMD_SEND_DATA)
> - return -EBADSLT;
> + goto error_release_sock;
> + ret = -EBUSY;
>
> At this point call is null, so the following code is performing a null
> pointer dereference on call when accessing call->state.
>
> Detected by CoverityScan CID#1414316 ("Dereference after null check")
>
> + if (call->state == RXRPC_CALL_UNINITIALISED ||
> + call->state == RXRPC_CALL_CLIENT_AWAIT_CONN ||
> + call->state == RXRPC_CALL_SERVER_PREALLOC ||
> + call->state == RXRPC_CALL_SERVER_SECURING ||
> + call->state == RXRPC_CALL_SERVER_ACCEPTING)
> + goto error_release_sock;
> call = rxrpc_new_client_call_for_sendmsg(rx, msg,
> user_call_ID,
Good catch, thanks, I put the state check in the wrong half of the
if-statement.
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-02 16:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-02 13:33 rxrpc: Fix deadlock between call creation and sendmsg/recvmsg Colin Ian King
2017-03-02 16:13 ` David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®