Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4640321ybl; Wed, 22 Jan 2020 01:50:36 -0800 (PST) X-Google-Smtp-Source: APXvYqzNgRwtS90gSv7dvp4hTgR/BS6HkclhobDetKhK9BjWUz2TP05/Q9vlkq409yaE1/DMZCSZ X-Received: by 2002:aca:534f:: with SMTP id h76mr6368189oib.23.1579686636707; Wed, 22 Jan 2020 01:50:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579686636; cv=none; d=google.com; s=arc-20160816; b=phXnR+SsmfVNSE9jeqeKCD6OSci77IIGx+E/hvybzG2c0CCSdWAroJffERh1RQREhD aRZB5eogy2jF5adOJs4EYrPCdHKXawoXuVV7LjrGBbAHH9of8UB2sq+xICHlMkNuz8Li 5gA3/BUJPDvQoWEJp/4LSY+xaC/dN06O8ev79LdrOz9kpNCAoa4QY09EwIOwkYCKty/t w9dh4Vo5U2zCgHhasovh4ReZeO7i31jJ1kDXqDb7qExNK247K1GEfhqPdZTuyghKjAF/ YdoWyN16TSu8oFZAi3d9/OTJ7sTI8PUVUfrgukL/y4afKIKxi4Ll/jlhKbnNqLe/XiGl loHQ== 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=Er6LAAbIAc63YEBV5lAYMI5shOk12pR4uzP16acmwDe7IU6zFZ6ysqhh2YyHp+sKpA fafeTZe+9QZvJNXNLA5vP1e5HR3hNHfjNrc5yR9ic3wYsyBdXbmYPli9b3d16DSPrNZ2 i4ZpX0HolWL1k0EGI/Hw8XQZ6X0z0LHbJ/8k7IUw4nW6+Azsq21mH5r9abVxFMS17KPv L4fw3+uLz1e4Wnl/YS2fprmAvk3uMKmfKPJ4dMGu73jPdn60lnPMuMKjnuIf+Vda3BU3 SMg76DnZ4N4OJADY0J6rOTWCfq+7uISEwzdD9jIjMBHGRaCKc1wAYaJV3+er8GyyJXbg GmRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wmKXIYpQ; 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 n1si20282226oic.225.2020.01.22.01.50.25; Wed, 22 Jan 2020 01:50:36 -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=wmKXIYpQ; 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 S1733258AbgAVJjn (ORCPT + 99 others); Wed, 22 Jan 2020 04:39:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:57838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732572AbgAVJjk (ORCPT ); Wed, 22 Jan 2020 04:39:40 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 DB6912467B; Wed, 22 Jan 2020 09:39:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579685980; bh=e36sjmPaCPPq1/i9Ltj188SqoWa1clYoefAn7mPbTaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wmKXIYpQI4yjC7Z0WovD3x8XMnmYE63miJRwNQGNa7iHhh1c4ofASQQKDyDgV36tp lgw2tOjc5OEKsb+6JjbuVK4hy2xTaWRw5OCqvsGm7bk/GkvkNRAYHSrlMgQax5V5sM XjF+P6R0zlOA7S6RkY8Jbwl4cnyO46qhtNtOz7ps= 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 4.14 59/65] scsi: bnx2i: fix potential use after free Date: Wed, 22 Jan 2020 10:29:44 +0100 Message-Id: <20200122092800.251654611@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200122092750.976732974@linuxfoundation.org> References: <20200122092750.976732974@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);