Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp598952pxx; Wed, 28 Oct 2020 12:04:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7/KxKcSNGQFlCZXloYoEoCjJB9zbCHMd7KBTAExkKYcR10ULI/3hfT+LKuq+LfZUv9h2u X-Received: by 2002:a05:6402:187:: with SMTP id r7mr352564edv.360.1603911871006; Wed, 28 Oct 2020 12:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603911870; cv=none; d=google.com; s=arc-20160816; b=WhCcVHjUuRovQulf0stXyOeOpH28yA5IoahAXEgzsR35iyHSDwf+8O2sYGh0/gZMz2 a/qRLhyZF0bphHtdTjDUIUqs9/Xyi4cjn1iGZ14VrfQLWFtBeXZMhqB7TcnyZ4AuF4AD 0B3Fz5txmdqbs81hrGrTMAQ7x/ehTArY9n0RWtL6HafWy+JK3pP8lRh7pmF/r+ZVptgC xXRfEI0skv1Pd8cKeKH6Xa38A0OgomWldIXGdpIF43yy9C4zPg+kbH/G80orlUWg7gtr 08o6knxpZoXTa1l1H+PPy4yfrMRNjrUlrB0X7OFdddE6mso6eE8mE/7E+bPYbVLuQ57G Wt3Q== 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=wGRp5TOer/q9yEDLdObY2o2p39y+yhiItethRc6depw=; b=YJEZClie5XM4U0Kng7yGU7+C7ZDrIJC6+HcnyFlCsUOE4b5KD70scfrTfkxdLuVFOx eNYcEtdCsCtSY65GoPJtTICU3jyAqt+NimAYrRSEPX6XspSx6elWBe+JEwTieRqVh0T9 W+TL6LH4kMRouAC1k3D/f2kTc6o3s6qep6ws2z6NiavuaGSiWKr4/kTqkz1fJP8qAhy9 KKsxHITUl079hl6Muf3iLm6dumSn8oKWyp24F0RasqJ+MTzg7GXIH6IZwghNwmR4/ZtO moNkDXB9plItzfEaOUxmXlbD3QQGm6APKtY13P8NyIFHFTt4YzUjh7pVpTJW8YFJXpoy mObw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VGI8jERr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x19si30189edq.122.2020.10.28.12.04.07; Wed, 28 Oct 2020 12:04:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VGI8jERr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1822560AbgJ0SRb (ORCPT + 99 others); Tue, 27 Oct 2020 14:17:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:60778 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726224AbgJ0OLb (ORCPT ); Tue, 27 Oct 2020 10:11:31 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0525422265; Tue, 27 Oct 2020 14:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807891; bh=eJ6d5q7q6vJKYj/w5rWdhSPdJ6OvBRnmGhkWoG6xm7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VGI8jERrLiLvdvbdGhvJW98VlmrVBbpuF+QQDu7T526RHxd3isQNs+mnGJzw0HmK8 5PPKSU6WL4G+dniiyXUOHt72clos/8BlNpiHAXVc0BlLNRcsVXaEH41tAGOsDR2ilS QDdCOYERCCPMltcux7XC0h4r4g33zvFICjKIea8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.14 080/191] scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs() Date: Tue, 27 Oct 2020 14:48:55 +0100 Message-Id: <20201027134913.528638748@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134909.701581493@linuxfoundation.org> References: <20201027134909.701581493@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 38b2db564d9ab7797192ef15d7aade30633ceeae ] The be_fill_queue() function can only fail when "eq_vaddress" is NULL and since it's non-NULL here that means the function call can't fail. But imagine if it could, then in that situation we would want to store the "paddr" so that dma memory can be released. Link: https://lore.kernel.org/r/20200928091300.GD377727@mwanda Fixes: bfead3b2cb46 ("[SCSI] be2iscsi: Adding msix and mcc_rings V3") Signed-off-by: Dan Carpenter Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/be2iscsi/be_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index b4542e7e2ad5b..86e1eac3a4703 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -3013,6 +3013,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, goto create_eq_error; } + mem->dma = paddr; mem->va = eq_vaddress; ret = be_fill_queue(eq, phba->params.num_eq_entries, sizeof(struct be_eq_entry), eq_vaddress); @@ -3022,7 +3023,6 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, goto create_eq_error; } - mem->dma = paddr; ret = beiscsi_cmd_eq_create(&phba->ctrl, eq, phwi_context->cur_eqd); if (ret) { @@ -3079,6 +3079,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, goto create_cq_error; } + mem->dma = paddr; ret = be_fill_queue(cq, phba->params.num_cq_entries, sizeof(struct sol_cqe), cq_vaddress); if (ret) { @@ -3088,7 +3089,6 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, goto create_cq_error; } - mem->dma = paddr; ret = beiscsi_cmd_cq_create(&phba->ctrl, cq, eq, false, false, 0); if (ret) { -- 2.25.1