Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6041598ybc; Wed, 27 Nov 2019 13:58:16 -0800 (PST) X-Google-Smtp-Source: APXvYqyD5zCY5gPaK9CNcFNR8Tbh645WrsxbI98IAROmuFDCC3k/ylwXYqBFpEa919PoFn+cAKBk X-Received: by 2002:a05:6402:12ca:: with SMTP id k10mr34444087edx.255.1574891896868; Wed, 27 Nov 2019 13:58:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574891896; cv=none; d=google.com; s=arc-20160816; b=DqJtmee16D7vHfID+0FB3ckIaUURIoPsfHuHWazPHIOK04ajjuDCS6vY/Mj52QdPnj lgvaXL5ns3scB1+ZookoZh46dD/z2y0IjeDXfcRG4KNYeV3ySb7Q5pQb/hcdzYBfzyWB Tv4PxefZuyeFu4U7BG3/JNRlBGOjxwvTS4njrtLQv+xDULRpal23lwuEpKYuy0HdAPyt tKWU2Vu527Ib7Ik+VaqDdUYBwlV//G+tEaRm3G3Pu0L6ifAiu6UznJJqkC1o8Y4sLhD1 yzoZkG5E9KMCNrLD+fGDysTfBPjJR7n80ED1hhiM3f0qilff8aph7O8IrTbAYhRpMAgd RCTQ== 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=6h2kB4z+SIfkX4NtYUnROaVfs4yphZ+tBMNuEE40auk=; b=oVOR5hOhfZIMo7y+eJeAiKvqOg0CgKPlP+i32KgkcrywGJU9jWwmyjbVuJ9ULgAdOr bF/yagRY9noQdzcGUAza3JIwH45sTsAG10KzFOobiaTbwZ21+v7MP4iMnkA0NFENquLf Rpr1dYBDB9ImQriK/Xexj6ngvlPp6V8bzxd+FqUIIEBxWo2j6kioKCYw2TeVMzNZxc3/ hVsEjfXWB8TSMl4wTHBSxk4eHh52y1v3J98fGs6nsRzPUD2YmNSjGcOZFX6jzB39mRVy HOh/BXN9CKqc8aRMvdXUHRbRDwVXBk80oYdXSsJMJFd/1QFcmDdDeTe7h1zLx1Mo5YHj xHZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="KOy/pBi1"; 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 o14si13060003edi.116.2019.11.27.13.57.52; Wed, 27 Nov 2019 13:58:16 -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="KOy/pBi1"; 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 S1730127AbfK0VaE (ORCPT + 99 others); Wed, 27 Nov 2019 16:30:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:47104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728290AbfK0U4S (ORCPT ); Wed, 27 Nov 2019 15:56:18 -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 62CFD2154A; Wed, 27 Nov 2019 20:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888177; bh=OS/5XB3eSaY5RKOQ6B/n+XCJ2R6bB2P+uS/f2k4ORzg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOy/pBi1JtH0H6tGCHDTXcciCSDRHbLE7kOhbW6svNcmE6vlom+AmrYtYk3WyCr6L g61LLmKXQhGS/6kB1krG9A5xaKz6NIY/EygEGdysPhnTzyKkr05Megn6z0Rz5lOToF XbrnsXwnHb/y/c1+VjdbGNvJhTTJmirIQZ/M5oZQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Bobroff , Michael Ellerman , Sasha Levin Subject: [PATCH 4.19 034/306] powerpc/eeh: Fix null deref for devices removed during EEH Date: Wed, 27 Nov 2019 21:28:04 +0100 Message-Id: <20191127203117.281953759@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@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: Sam Bobroff [ Upstream commit bcbe3730531239abd45ab6c6af4a18078b37dd47 ] If a device is removed during EEH processing (either by a driver's handler or as part of recovery), it can lead to a null dereference in eeh_pe_report_edev(). To handle this, skip devices that have been removed. Signed-off-by: Sam Bobroff Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/kernel/eeh_driver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/powerpc/kernel/eeh_driver.c b/arch/powerpc/kernel/eeh_driver.c index 110eba400de7c..af1f3d5f9a0f7 100644 --- a/arch/powerpc/kernel/eeh_driver.c +++ b/arch/powerpc/kernel/eeh_driver.c @@ -281,6 +281,10 @@ static void eeh_pe_report_edev(struct eeh_dev *edev, eeh_report_fn fn, struct pci_driver *driver; enum pci_ers_result new_result; + if (!edev->pdev) { + eeh_edev_info(edev, "no device"); + return; + } device_lock(&edev->pdev->dev); if (eeh_edev_actionable(edev)) { driver = eeh_pcid_get(edev->pdev); -- 2.20.1