Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp265031pxx; Wed, 28 Oct 2020 04:29:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0zrxNl4IfCkDFiein3wAV1ENQzMJkHU+QysopW14RBInGWP1+qGYtDC68+oQqbVG8zoxc X-Received: by 2002:aa7:c948:: with SMTP id h8mr6922110edt.171.1603884582002; Wed, 28 Oct 2020 04:29:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603884581; cv=none; d=google.com; s=arc-20160816; b=opRnyY+E1QoyYSBGtK3c3Rw9L5019iSJ+pSfnpoB+m/DZ8JngNEYe6OGZfcfY90zAB ErwuOj6PgkuL7JGwjFiLj/ZI0LMdN22bwogzm2mmTaRnIXF/9I/2tlZpK9iCZl3noaG+ E8XBOUCneoZAedFJmXI2lUZYZZXeuEhEyeBJBGNJm8Y+tqEoyoCCwHJFQ/gMmFoD6LNL 0HR5t+w0pxUnsyTgDukJCh2VeIDBj/AF/WpzrH2QufOlu7ja6qrLttmp/r+ewpGsLam3 HgUMPCqxbrT1cLK1d8SAJNSv28CY/8BDmo1VoSmkm9bNWnEwLuaefGoq6Ms8XmEDyul3 ujZg== 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=3n/+ntVEB9azOo3a1ZmmSIoiodqhTqPbKn1yjx5rZ2w=; b=YnZIdlLLFgcKnim3Pu7Eg7Dz9P60Xl0I2SzRD4EdmSTNQB5ymFMGZaurMVuz6gL0VF lmQVCBbeCsy1gbAEbRAxkSck3Da/bk13D2qxxb56JE7aJvR4VUYJPFlqtj1I8NoPypXT x3KvR8hjfjpqL5xkaQKvkn7Pc1wlKgLWTgO00b8jjiqgbstY4MFjitijqGw+dphgPFOa 6OANurkLZ21MK/zcws7ykjgIEMFYswLvVufMFuTR8Ai9bC7kbO93oRb8Wf3Ad9aeRSzm Phugh7y94poapo6Wfy+qM3gpCaPMPjvsCKHZ45AhIgeAk9AVlNjcj9CURUduwkHpRfHS ZdQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rIkeZWkt; 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 i19si2816688ejh.153.2020.10.28.04.29.19; Wed, 28 Oct 2020 04:29:41 -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=rIkeZWkt; 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 S2901202AbgJ0PEj (ORCPT + 99 others); Tue, 27 Oct 2020 11:04:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:35786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1789247AbgJ0PBt (ORCPT ); Tue, 27 Oct 2020 11:01:49 -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 12CBE22264; Tue, 27 Oct 2020 15:01:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810908; bh=KPWWdGlgsEDdqOW/bpQppnc2qSGUzNyFrXjoUxf3tiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rIkeZWkt7FlCpVWzLpFNd1b92w5AKgMf5rJFvTWj4GTWpraSRe8gyxraRVGlHuWg7 7sOfv34Qb+9ZsWdvO7T+kwm+q5MeUMGQ0k9ofbgT1oTAWqHOcZN/JFrWdQ3cJT+z/C oDT+9RONU12U5UCN7lhqMaAT4kNGVyAu+lBVgNxc= 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 5.8 305/633] scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs() Date: Tue, 27 Oct 2020 14:50:48 +0100 Message-Id: <20201027135536.980440664@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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 9b81cfbbc5c53..239e04c03cf90 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -3020,6 +3020,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); @@ -3029,7 +3030,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, BEISCSI_EQ_DELAY_DEF); if (ret) { @@ -3086,6 +3086,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) { @@ -3095,7 +3096,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