Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4830026ybl; Wed, 22 Jan 2020 05:31:47 -0800 (PST) X-Google-Smtp-Source: APXvYqx0wpgmVT1+3mmD9Kq9B8Q46l2ccT07vVOKRSA3pddQBEJd5XCTkeya0sP9etwXTrnkq146 X-Received: by 2002:a9d:6d10:: with SMTP id o16mr7461596otp.28.1579699907018; Wed, 22 Jan 2020 05:31:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579699907; cv=none; d=google.com; s=arc-20160816; b=elEUoPBM5oHWdX1phcEH7RbTAE2C4JKiyadngIE1QnrrDaFs+OpnnblWOdV8kDgW0R eEenmlRhBK6DNfmhJGAK6EZ4R3VjiNsQqu8jk8y4P0QE8o+jX4+dseIbCXeypn3es88j SqgjHDxH7hpfzBpaKcbYqc3gP24nscJGGX/kTE0mTr0RfkVzSAKpKLzdlbu9eMqEd8mx pLlzqqmkurJ68nIAqY5Frs7Nvwo1izGF0+lnIh9/WOYHM+6njfA32bj82RE4L6nPtGm6 EMmssLBQiGaP8Ja/8DrYSVkC9GfcLP2kUaftopEyreDRzbboLiDwImmgpiKLPMbQwoBG 7sKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KGlL7lRWYcMWlL2jB9ddutBcJTqXtGmgriuk2dF1wOY=; b=bReowwhxLD8gGOEaL7qc9Z7Ub6IkFwH3xdSiI27S0rdtcL/GWX1GXqaKdwoKLE+Km3 sbRpefcBsvoLT/EnURQix581P1NdJWCAQjWGdKliOpJBCRv0qlmuP5UljP8z4se2CLwp 2smgwiKcl8MT3AoZJQnRSU8l9pSoPBuBuldcEhhLuMY8ife1JzNJASHAm7CTEUEKnMFl jsuZVjN13iJw+frKNqBKZ3wO+Erh2usXOFne62ANcHAe98YYCx/vNR63lYAfzZ8Sdrjc ss7VdW716gHfw4ftYvSXtXl/niOSKL8nv6RqhWioxMyTVh/KYF9QPVMXp/ce9/qDR0/p 6dgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hj0oPHg8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j20si22986789otp.147.2020.01.22.05.31.32; Wed, 22 Jan 2020 05:31:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hj0oPHg8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725989AbgAVN1V (ORCPT + 99 others); Wed, 22 Jan 2020 08:27:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:48472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730097AbgAVN1O (ORCPT ); Wed, 22 Jan 2020 08:27:14 -0500 Received: from localhost (unknown [84.241.205.26]) (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 D89DC2468C; Wed, 22 Jan 2020 13:27:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579699633; bh=e36sjmPaCPPq1/i9Ltj188SqoWa1clYoefAn7mPbTaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hj0oPHg8m69oIlQBrTjsNjZmHcbYCz2ibsdF/aRfBXvJyv61Hx5BKlsSCPHgkMNc2 yWOrDOMo9f8N58DM1axldF3LDbpDvkB183DmPY8beYye+JsG0C1AoLQpeZjDE13Gev mPMuvZ+1QwA97xwGVCTyLN6bwfCCRiGfQ4BE4DY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pan Bian , "Martin K. Petersen" Subject: [PATCH 5.4 203/222] scsi: bnx2i: fix potential use after free Date: Wed, 22 Jan 2020 10:29:49 +0100 Message-Id: <20200122092848.238314727@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092833.339495161@linuxfoundation.org> References: <20200122092833.339495161@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pan Bian commit 29d28f2b8d3736ac61c28ef7e20fda63795b74d9 upstream. The member hba->pcidev may be used after its reference is dropped. Move the put function to where it is never used to avoid potential use after free issues. Fixes: a77171806515 ("[SCSI] bnx2i: Removed the reference to the netdev->base_addr") Link: https://lore.kernel.org/r/1573043541-19126-1-git-send-email-bianpan2016@163.com Signed-off-by: Pan Bian Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -915,12 +915,12 @@ void bnx2i_free_hba(struct bnx2i_hba *hb INIT_LIST_HEAD(&hba->ep_ofld_list); INIT_LIST_HEAD(&hba->ep_active_list); INIT_LIST_HEAD(&hba->ep_destroy_list); - pci_dev_put(hba->pcidev); if (hba->regview) { pci_iounmap(hba->pcidev, hba->regview); hba->regview = NULL; } + pci_dev_put(hba->pcidev); bnx2i_free_mp_bdt(hba); bnx2i_release_free_cid_que(hba); iscsi_host_free(shost);