Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp230821pxx; Wed, 28 Oct 2020 03:32:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy10ehzszvxu++NgLmTrLp6jgRI6KfgPUWKAahEEhnwFa62V3Mjxm09HATlIygLIkEwiR9M X-Received: by 2002:a17:906:a0cb:: with SMTP id bh11mr7115613ejb.314.1603881122313; Wed, 28 Oct 2020 03:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603881122; cv=none; d=google.com; s=arc-20160816; b=MZqHt5WASXGsw0Xlo7dhb+b8CKv3OGdarbtFqAowiJPF87KfkKdczAnpznQAphI4uM 46nFM0YBQHmOQLxl9BOFzdfBQI692LhEdmGm9bMV7+INjoUNxHdl7sJJW0zha+K4wup3 RYVxMdGUP2J/17qKCSmZRbKeSVpGYvOmnxtWkh3C6XVF9fmwzGMmdnBc9u51KYyvz1p+ YWNlWrUGqik34ZYDNzfuBVLP6SlttLGcYSxJSleYZoIULZhQGPGdyIULS81yDLLlB/UR v/D57RwprZJAkiRaOj7Lih+KKgoBMwKJw6MZ5cyAj9Mo3xO5aJVlzCYudgU37sUjU+k1 uTQA== 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=rkRHTDncMnPVNzktUqGniGCA5O9Xh/xJ1FldR4GrpIU=; b=MMac80VI0ClDFIeded0krZMJOhtAaxSugDZWv275zp2+cDSszf7JNN9Txs/bAD5nLv EnWNDwjYUbf2QCEKfyM/mXlsmutMwo00Tjak7zQKWAqugnWtpI1CMhKLnu6JdCzjYgGR ctLKStaSrJjboXyvu7Xt1ffa6QVRzvf8A4DW6wVRjM3Jzvu+mg69tMBZj95ZHxudD5Jk l+4+CMfAkC5mjtDNRP8yrl73/PWwy/z1QRqRuUaP6lfnHHlk8nbtcdkfeRkHeEyDayS4 bEuzJUQjWmw75AinSC7HGYf27NSm7O1OjLp0sXTK1lAY7zcQTNMnVsjJXATm80E1WmEy nEeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=E3KzvuDb; 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 o10si2705925ejr.482.2020.10.28.03.31.40; Wed, 28 Oct 2020 03:32:02 -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=E3KzvuDb; 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 S1750713AbgJ0Omv (ORCPT + 99 others); Tue, 27 Oct 2020 10:42:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:37322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761146AbgJ0OiL (ORCPT ); Tue, 27 Oct 2020 10:38:11 -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 0AA23206B2; Tue, 27 Oct 2020 14:38:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809490; bh=aSw54oaDqKzer7m5dsAtXLJBoKEtZpE3k3yBXhPAoy4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E3KzvuDbzjkzYgU3dgALzP/adR0GcScjfLG5SwIdqgfBeAsdGwV2yiVGriHLFsjMW wkd1j9U72u2VUgQu95QsZjCnWo3kB/kpZjtXfwrtL667UhpaJofTtI60ZOCIoKeZm3 Dgf90Ur+htaHaevP9h3H4udMbCDmS+qb80jukeco= 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.4 184/408] scsi: be2iscsi: Fix a theoretical leak in beiscsi_create_eqs() Date: Tue, 27 Oct 2020 14:52:02 +0100 Message-Id: <20201027135503.625880240@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 0760d0bd8a10b..0fa455357594e 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