From: Hyunchul Lee Date: Mon, 30 Aug 2021 04:27:43 +0000 (+0900) Subject: ksmbd: smbd: fix dma mapping error in smb_direct_post_send_data X-Git-Tag: v5.15-rc1~34^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72d6cbb533d4309734606027fe083c4edb0aa7aa;p=thirdparty%2Fkernel%2Flinux.git ksmbd: smbd: fix dma mapping error in smb_direct_post_send_data Becase smb direct header is mapped and msg->num_sge already is incremented, the decrement should be removed from the condition. Signed-off-by: Hyunchul Lee Signed-off-by: Namjae Jeon Signed-off-by: Steve French --- diff --git a/fs/ksmbd/transport_rdma.c b/fs/ksmbd/transport_rdma.c index 58f530056ac01..52b2556e76b1b 100644 --- a/fs/ksmbd/transport_rdma.c +++ b/fs/ksmbd/transport_rdma.c @@ -1168,7 +1168,7 @@ static int smb_direct_post_send_data(struct smb_direct_transport *t, pr_err("failed to map buffer\n"); ret = -ENOMEM; goto err; - } else if (sg_cnt + msg->num_sge > SMB_DIRECT_MAX_SEND_SGES - 1) { + } else if (sg_cnt + msg->num_sge > SMB_DIRECT_MAX_SEND_SGES) { pr_err("buffer not fitted into sges\n"); ret = -E2BIG; ib_dma_unmap_sg(t->cm_id->device, sg, sg_cnt,