Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp5846089ybn; Sun, 29 Sep 2019 07:00:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxHYhYjOuXcH8jtWcKToEwTMM780mudD7crqUGfCx4nNZLR/FDQTiD2b/mC9Virrx3ET1BQ X-Received: by 2002:a17:906:6d4:: with SMTP id v20mr15266282ejb.223.1569765632442; Sun, 29 Sep 2019 07:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569765632; cv=none; d=google.com; s=arc-20160816; b=ZH0qFT9BTB0j/TIyZLmXajchLuD8EOnTjmLvmJsomHoclic7nxPh3Vq4d0BxsluBrs b5t+kfCgRFcY8/iIsmgqYjapNJrDYyCnftw/WPYi4EQ27FcJEaDx6yhsxUqkaefLBxn/ B2F+2VH3vOR3f/2YYUFKyHM5ILlEQr7HJXpESDGkVZTY8Bq5vfoSfsIaUCznu1AAX0G7 ga8ceb4uZDMtRyN342yUSWhAvCLBMNLKfRl6zQaId7sCmQnK9Ada6i12k8t1F7w2o7+b S+6J5TMYtLLQ88CtLa3EBMuT6hBxUoh7JpEWkwJWG3nQlzyzsse9dN5b0FVhTpSSaIE8 lX6w== 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=c9UlfBGpXs+5yOSAeSsyZHwdZ2g9JTb75o7bZH/AbuY=; b=Kmaliy1Fn+1GObQMPmjpKCzN9ERi9Zl14+0pKDkwhgCWu/Z531objy5orisdsOJpTm PzRG7U3s0PH9VQJ1ddjGtx1EWsgoX892ZxVDjIkH8pOYAkbKBcL4SqQL0pdvzjUMMIPY lB/+IG5WabUBK0KjBEWb2/oTUJSAyk8uAq+MZxT6xeRDyTYEOuuWdwdsLQeb4jAaLQJA B6P5z8X1VQ64AXgKePLIynE6SRQvCQgYDLWTX6Y1vk9TZZZCB++pdLbiA2isc0WeLG2o RgMtDr8dF8YkSS7NztspcEeD76SXtqhIYLHxOpNJ3C85BlqYWSDI8sYXHm/WmepjveJR F8vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OLMZ2kkP; 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 si30si5563792ejb.92.2019.09.29.07.00.08; Sun, 29 Sep 2019 07:00:32 -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=OLMZ2kkP; 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 S1729567AbfI2N6o (ORCPT + 99 others); Sun, 29 Sep 2019 09:58:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:39534 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729530AbfI2N6n (ORCPT ); Sun, 29 Sep 2019 09:58:43 -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 0D104218DE; Sun, 29 Sep 2019 13:58:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569765522; bh=o3LJsIv4ejrSMRZyry6Gv9gFeMdkXt4FuLD2PHuDnDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OLMZ2kkPGmdNzxGQYU7LH3E3QBrEFQMGZN5yTrhjn01lX+aGL6h+QXoXhqljLvcPo YE7uxj08odetnw/P1xlVyEGKc9Dcp97nR938lKn+GOSrWkc0px1g41gbktmpC8hSJm bxfuI/8SvZGZU6DPnfhfl/q8GG1Wy8I0V5VwxjQY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dexuan Cui , Lorenzo Pieralisi , Sasha Levin Subject: [PATCH 4.19 45/63] PCI: hv: Avoid use of hv_pci_dev->pci_slot after freeing it Date: Sun, 29 Sep 2019 15:54:18 +0200 Message-Id: <20190929135039.530989431@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190929135031.382429403@linuxfoundation.org> References: <20190929135031.382429403@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 [ Upstream commit 533ca1feed98b0bf024779a14760694c7cb4d431 ] 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: Sasha Levin --- drivers/pci/controller/pci-hyperv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 5dadc964ad3b4..5c28498466415 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -2706,8 +2706,8 @@ static int hv_pci_remove(struct hv_device *hdev) /* 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; } -- 2.20.1