Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2092816ybp; Thu, 10 Oct 2019 02:03:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwjpng9o3DKDtk3CN7VXRUaMiGNyDdMiHTiUp55liWbMx21p/OiSy3DSp4LgiAuPSbF6/n X-Received: by 2002:a50:b723:: with SMTP id g32mr7122548ede.13.1570698238821; Thu, 10 Oct 2019 02:03:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570698238; cv=none; d=google.com; s=arc-20160816; b=Zw6Gd9vK/jxM6wAizIr3GosTI0O1s67zSyOOtXkQOuoeXv5TVcfZDFndq81mzkYy1k NrqxiupfHPY3BPfbdCNkgBDPW4HJNB89D8bBdWjNTSYnR00ajAcCBKa34vVgCvAyM70h zriVxxmvL8CAm963Ulx4L+AYXF/NjfvUYqqQxF/T10SOVoE7HBIGUrU7Snoy2/cZC2CZ pwL1wm3kepyiDje7pMvWmBTfK/8wE1rLeLeAxmUoXiMrfHRk4h/Asb1P8zqSe03vAdn0 +T/aju+7wJW6rjJtjACME6kGE21sEYciQXHt6wOiTzMemPkS4QXNRbRYSZfNF1wjBwcM osZg== 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=9qwzCUcQRnI5nSvcPdpWKPspy5sKZd5pEPfqUXe6ok4=; b=XQqmOhNyL5cy9/my4MaT/xjqJl3+bChHigD4bHWwu/bMfzoTqCIv/PI+6sfa5gwIE9 gQxAjNZR08PPF8qv9sJbY8iqaZBZzUyZoxCBmK43Ox9liBdUUeFw/ljotCdvrrrVKRlA 1wR8fekHPJeo+J4SlthrdByUCLHPEIAtAVXm5Tg3tpO9cBDjZEsbtici1u7WKwImBo+p z4+xBXIV0oWs5qWvUOvzonx5/Q+YWUrzE2OJZdSCj6tLSq4Z9u9LLNCVPxLtvVQaau7+ 4hEIXCV/NYquIWdtV6TOAZWoq6sr72+M0E6bzJbuX2zTwBoMrmo7tG/Rem9t4HO7EiyS TuHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r3RI2FjI; 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 t18si2718135ejr.416.2019.10.10.02.03.36; Thu, 10 Oct 2019 02:03:58 -0700 (PDT) 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=r3RI2FjI; 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 S2387993AbfJJIjy (ORCPT + 99 others); Thu, 10 Oct 2019 04:39:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:43708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387983AbfJJIjw (ORCPT ); Thu, 10 Oct 2019 04:39:52 -0400 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 7ACA421BE5; Thu, 10 Oct 2019 08:39:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570696792; bh=R1bCjxSjjgxEB7TD52IG9AYkmyv3+Iqr6N7u8GuakFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r3RI2FjI9vaNTM8hwruc9NniYs1GsU+0N+CJ2kLAQK+a5710s5ZhIkVMU/trDeUIg zRt5xYYVllXrDsntscGi3ypUuZ4rT+OqfzRygQDLgFKI7hcKc4oB/drYHgwMBtSkTR OJhPkPWR7/uNDoebm5qjPFUafGQbVJ1WMSHyFeLw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dexuan Cui , Lorenzo Pieralisi Subject: [PATCH 5.3 054/148] PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it Date: Thu, 10 Oct 2019 10:35:15 +0200 Message-Id: <20191010083614.419687555@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@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: Dexuan Cui commit 533ca1feed98b0bf024779a14760694c7cb4d431 upstream. The slot must be removed before the pci_dev is removed, otherwise a panic can happen due to use-after-free. Fixes: 15becc2b56c6 ("PCI: hv: Add hv_pci_remove_slots() when we unload the driver") Signed-off-by: Dexuan Cui Signed-off-by: Lorenzo Pieralisi Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/pci/controller/pci-hyperv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -2701,8 +2701,8 @@ static int hv_pci_remove(struct hv_devic /* Remove the bus from PCI's point of view. */ pci_lock_rescan_remove(); pci_stop_root_bus(hbus->pci_bus); - pci_remove_root_bus(hbus->pci_bus); hv_pci_remove_slots(hbus); + pci_remove_root_bus(hbus->pci_bus); pci_unlock_rescan_remove(); hbus->state = hv_pcibus_removed; }