Skip to content

Commit

Permalink
rxrpc: Fix uninitialised variable in rxrpc_send_data()
Browse files Browse the repository at this point in the history
[ Upstream commit 7a310f8 ]

Fix the uninitialised txb variable in rxrpc_send_data() by moving the code
that loads it above all the jumps to maybe_error, txb being stored back
into call->tx_pending right before the normal return.

Fixes: b0f571e ("rxrpc: Fix locking in rxrpc's sendmsg")
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lists.infradead.org/pipermail/linux-afs/2024-October/008896.html
Signed-off-by: David Howells <[email protected]>
cc: Marc Dionne <[email protected]>
cc: [email protected]
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
dhowells authored and gregkh committed Oct 17, 2024
1 parent 2daffbd commit 446be55
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions net/rxrpc/sendmsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
sk_clear_bit(SOCKWQ_ASYNC_NOSPACE, sk);

reload:
txb = call->tx_pending;
call->tx_pending = NULL;
if (txb)
rxrpc_see_txbuf(txb, rxrpc_txbuf_see_send_more);

ret = -EPIPE;
if (sk->sk_shutdown & SEND_SHUTDOWN)
goto maybe_error;
Expand All @@ -329,11 +334,6 @@ static int rxrpc_send_data(struct rxrpc_sock *rx,
goto maybe_error;
}

txb = call->tx_pending;
call->tx_pending = NULL;
if (txb)
rxrpc_see_txbuf(txb, rxrpc_txbuf_see_send_more);

do {
if (!txb) {
size_t remain, bufsize, chunk, offset;
Expand Down

0 comments on commit 446be55

Please sign in to comment.