Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp927085pxb; Wed, 6 Apr 2022 04:31:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbFuEgqnr3YJ7SAFH7B9jLeADNQI3Vx2XYU7G7STisojPYMrf74JU1NCiYNXkUm5h2K7d1 X-Received: by 2002:a17:902:e5ca:b0:156:762b:e48f with SMTP id u10-20020a170902e5ca00b00156762be48fmr7983719plf.140.1649244679682; Wed, 06 Apr 2022 04:31:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649244679; cv=none; d=google.com; s=arc-20160816; b=PbcS13dffuFzr6d2uECYfoffYv8nPBlDtYju53NI6pLXhgr5dds5x6Ty0QBU6jZABe 6FmyciHHMj7a2xv+uTRBKPXx/a/CKcRhHhASAMTnHD8B7quxk/liuh2hdwSLwxpAYz+C rSTX1r1HydjFueOxCxigD87is9/YHNmcbakPkvwxBFVaDaqhWxHK0TkpAIx7c11dSDMb zNEtyXFKhe+HT53J8xFTBObRmASyKwYnq7v+PwswljKtSH7mCiW10vFXgTzvAHGtyKk9 SpXNnAe/hm8UYrvIv9KvWGL+o+/rLQoWCMJT5o/TNGzZoo/w55oHajqt0g4Doa9jz+eX UKUQ== 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=kw6WH3KNIPhEJ4t9JClAz0l8Obwr0vf7COwN28IBMSc=; b=YfwV/3XrpOhTDcrhf2yxXB5VIafkK2J2U9B3HzkXpAzK8WgpnEHmXc3Fbx/5qbGhDO prtYXJZEptgrY0Wkarlhf8wOZ5CDqbwPkS4dBSBolJGFcttEqt1fXAcW1G2k5G1ZB33H pu3qxfibgZx4zAvhQ6ymS/E7ZZfkokkzVn9jY+0fckNaMSvNJsuaNRDCXWqorxKeKhkA sUVEQX+mMecG0lZKGhitX4y/+In1ImHLNbVz2KX39bmb8KtUAIA2oVuu+fGnkNJbuXQw t9V4c+Jaj0DuqKqhrhAATQxZclAaLuuofDSs0XBWl72Qi4x6dSupUng4FVFgOeL6PzH9 tfkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tJ7nRUde; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w63-20020a17090a6bc500b001c68744da0dsi4870003pjj.39.2022.04.06.04.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:31:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tJ7nRUde; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DFEE0607011; Wed, 6 Apr 2022 02:53:13 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1846557AbiDFCEo (ORCPT + 99 others); Tue, 5 Apr 2022 22:04:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353548AbiDEKIM (ORCPT ); Tue, 5 Apr 2022 06:08:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2025C1C92; Tue, 5 Apr 2022 02:55:15 -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 7CE3661500; Tue, 5 Apr 2022 09:55:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90456C385A2; Tue, 5 Apr 2022 09:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649152514; bh=WOTxXQzAn+H/xWxyf4seipZltQdXkhVEK3b7in5mAPY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJ7nRUde9wm+Z1edLwnlG13/LgoLhGRN0c1H9ltgCyRMFibgVE8pn1/if7lkXNOzY y9w+I8BzqPd7lkxijDX+Uoib4Rl5/S+oqSizNwAAbD2qorxg2Ti138gut6aU5NWeLp QCUHW8xgTpWqzoakHNOsqr9RG2oTaAunPvT1chGo= 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.15 804/913] scsi: qla2xxx: Fix missed DMA unmap for NVMe ls requests Date: Tue, 5 Apr 2022 09:31:06 +0200 Message-Id: <20220405070403.932194400@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070339.801210740@linuxfoundation.org> References: <20220405070339.801210740@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=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 @@ -170,6 +170,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); @@ -186,6 +198,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); @@ -356,6 +370,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, @@ -363,6 +379,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; }