Skip to content

Commit

Permalink
svcrdma: Don't leak send_ctxt on Send errors
Browse files Browse the repository at this point in the history
[ Upstream commit 351461f ]

Address a rare send_ctxt leak in the svc_rdma_sendto() error paths.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
chucklever authored and gregkh committed May 22, 2021
1 parent cf6b90e commit e128c0f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/sunrpc/xprtrdma/svc_rdma_sendto.c
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
p = xdr_reserve_space(&sctxt->sc_stream,
rpcrdma_fixed_maxsz * sizeof(*p));
if (!p)
goto err0;
goto err1;

ret = svc_rdma_send_reply_chunk(rdma, rctxt, &rqstp->rq_res);
if (ret < 0)
Expand All @@ -970,11 +970,11 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
*p = pcl_is_empty(&rctxt->rc_reply_pcl) ? rdma_msg : rdma_nomsg;

if (svc_rdma_encode_read_list(sctxt) < 0)
goto err0;
goto err1;
if (svc_rdma_encode_write_list(rctxt, sctxt) < 0)
goto err0;
goto err1;
if (svc_rdma_encode_reply_chunk(rctxt, sctxt, ret) < 0)
goto err0;
goto err1;

ret = svc_rdma_send_reply_msg(rdma, sctxt, rctxt, rqstp);
if (ret < 0)
Expand Down

0 comments on commit e128c0f

Please sign in to comment.