Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp689706pxb; Tue, 5 Apr 2022 18:54:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPWaa+TkK8NlY75QzD/7m+ahRXDuRquPX/WDSo/4WN2kV0P5JR3ySbyfXaw+P4H8zR0+ZF X-Received: by 2002:a17:90a:2a84:b0:1ca:aefa:91b3 with SMTP id j4-20020a17090a2a8400b001caaefa91b3mr7468491pjd.104.1649210001637; Tue, 05 Apr 2022 18:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649210001; cv=none; d=google.com; s=arc-20160816; b=i/MADgS1xb2cyU++9OYrAXbXUxw7s9hHI4fn/Xg/RRg4OsS9GNSAgNxtci5gW3LIx+ Wg/WSCUftsmSqvhFINiH0+Kv1FpkkRxn1fcEdVEqlCEFidQDzrJV+XHPhjZ2tcJ0y+AX 8h91ku3r4qDrNkwrTzLJNogiF8RF91i6TgSOLXomSRaOxminRokbShQsLnjInByoDCwC vji5MiBn/m6eiNnTOV+0cGc41RO+A5/4N0kCjYCOd83bn37R57vP1n+evWgVwYM3Xtjv 83EdzcMJWqPQZCExdV6TRNMR/Th18xxfglqRVwLfHnfTiwc6D7ZjeaV8uMGuucfV6D/5 4NDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ldPHDo3b8391BaQeJq+2foBvq0q5GaRYOJBLEcw7oPQ=; b=gU7rHhgQ5PyfvVEiB3C0gONcNssoTbVTzJbwxHt1dybQB1XvI/XBxmTy1bH9+zteIo g4lBuPTw9RSuL1BQ7F37VkHdGK3gpOCW3PgWLZL4YoAhE3XRhuYKAfW2ly1O4bYjudUU e2DDO7HdNob/ISxVXKQUamtmBTSO5Io2xQi+tkuRRQR5VBwIGuEDs+1pztrXmDcPbpVA zbTY+L9/pNjnb4j6YLpdplaljKTD7BBnMiGkK7FiZ5ieyBcCIXpowNqLgNUqzptuVM4L 1p4RGRds7PK6FeEPXiEnqxokuJC5zYdBuM0+Vn+ZnW+yfUIWbJq2J0gHLxBuy4mey7LA hKNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jYDcs5Et; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h12-20020a63c00c000000b003816043ef0fsi15115641pgg.260.2022.04.05.18.53.06; Tue, 05 Apr 2022 18:53:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jYDcs5Et; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348852AbiDEKtZ (ORCPT + 99 others); Tue, 5 Apr 2022 06:49:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240437AbiDEIb5 (ORCPT ); Tue, 5 Apr 2022 04:31:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A789B716D6; Tue, 5 Apr 2022 01:24:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF64561496; Tue, 5 Apr 2022 08:24:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC018C385A1; Tue, 5 Apr 2022 08:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649147062; bh=yPbW51Y7C3MLYP3n2rknBoXxKAda+YKO1ZgJgoQD8m4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jYDcs5Et+YTKTIMelbpRMjxtKQYy9WyKhr6aMVWOGn+BhS+l1iuctrF3aszR3he8U lHx/tGxY1a3CDPPULGYl7F4xbhVWmqK8m1GITYfd81RI9gOOxRuqrRssovF6+yay/J Kn8RPBDOnT+kLDXXYdVs0EgwZvkhejAEUu5Bsx3w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.17 0988/1126] scsi: qla2xxx: Fix missed DMA unmap for NVMe ls requests Date: Tue, 5 Apr 2022 09:28:55 +0200 Message-Id: <20220405070436.495506569@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070407.513532867@linuxfoundation.org> References: <20220405070407.513532867@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arun Easi commit c85ab7d9e27a80e48d5b7d7fb2fe2b0fdb2de523 upstream. At NVMe ELS request time, request structure is DMA mapped and never unmapped. Fix this by calling the unmap on ELS completion. Link: https://lore.kernel.org/r/20220310092604.22950-5-njavali@marvell.com Fixes: e84067d74301 ("scsi: qla2xxx: Add FC-NVMe F/W initialization and transport registration") Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_nvme.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -175,6 +175,18 @@ out: qla2xxx_rel_qpair_sp(sp->qpair, sp); } +static void qla_nvme_ls_unmap(struct srb *sp, struct nvmefc_ls_req *fd) +{ + if (sp->flags & SRB_DMA_VALID) { + struct srb_iocb *nvme = &sp->u.iocb_cmd; + struct qla_hw_data *ha = sp->fcport->vha->hw; + + dma_unmap_single(&ha->pdev->dev, nvme->u.nvme.cmd_dma, + fd->rqstlen, DMA_TO_DEVICE); + sp->flags &= ~SRB_DMA_VALID; + } +} + static void qla_nvme_release_ls_cmd_kref(struct kref *kref) { struct srb *sp = container_of(kref, struct srb, cmd_kref); @@ -191,6 +203,8 @@ static void qla_nvme_release_ls_cmd_kref spin_unlock_irqrestore(&priv->cmd_lock, flags); fd = priv->fd; + + qla_nvme_ls_unmap(sp, fd); fd->done(fd, priv->comp_status); out: qla2x00_rel_sp(sp); @@ -361,6 +375,8 @@ static int qla_nvme_ls_req(struct nvme_f dma_sync_single_for_device(&ha->pdev->dev, nvme->u.nvme.cmd_dma, fd->rqstlen, DMA_TO_DEVICE); + sp->flags |= SRB_DMA_VALID; + rval = qla2x00_start_sp(sp); if (rval != QLA_SUCCESS) { ql_log(ql_log_warn, vha, 0x700e, @@ -368,6 +384,7 @@ static int qla_nvme_ls_req(struct nvme_f wake_up(&sp->nvme_ls_waitq); sp->priv = NULL; priv->sp = NULL; + qla_nvme_ls_unmap(sp, fd); qla2x00_rel_sp(sp); return rval; }