Skip to content

Commit 5349ae5

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: let send_done() cleanup before calling smbd_disconnect_rdma_connection()
We should call ib_dma_unmap_single() and mempool_free() before calling smbd_disconnect_rdma_connection(). And smbd_disconnect_rdma_connection() needs to be the last function to call as all other state might already be gone after it returns. Cc: Steve French <smfrench@gmail.com> Cc: Tom Talpey <tom@talpey.com> Cc: Long Li <longli@microsoft.com> Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Fixes: f198186 ("CIFS: SMBD: Establish SMB Direct connection") Signed-off-by: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent b0b7332 commit 5349ae5

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

fs/smb/client/smbdirect.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -281,18 +281,20 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
281281
log_rdma_send(INFO, "smbd_request 0x%p completed wc->status=%d\n",
282282
request, wc->status);
283283

284-
if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_SEND) {
285-
log_rdma_send(ERR, "wc->status=%d wc->opcode=%d\n",
286-
wc->status, wc->opcode);
287-
smbd_disconnect_rdma_connection(request->info);
288-
}
289-
290284
for (i = 0; i < request->num_sge; i++)
291285
ib_dma_unmap_single(sc->ib.dev,
292286
request->sge[i].addr,
293287
request->sge[i].length,
294288
DMA_TO_DEVICE);
295289

290+
if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_SEND) {
291+
log_rdma_send(ERR, "wc->status=%d wc->opcode=%d\n",
292+
wc->status, wc->opcode);
293+
mempool_free(request, info->request_mempool);
294+
smbd_disconnect_rdma_connection(info);
295+
return;
296+
}
297+
296298
if (atomic_dec_and_test(&request->info->send_pending))
297299
wake_up(&request->info->wait_send_pending);
298300

0 commit comments

Comments
 (0)