Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2548634imu; Thu, 29 Nov 2018 06:44:16 -0800 (PST) X-Google-Smtp-Source: AFSGD/VMR0O6rlzaKA+Qn70+qTy3+OP0APeOmO/0D+v8vaEPekoiSkgble7omKU2IqLi5zERlAkR X-Received: by 2002:a62:11c7:: with SMTP id 68mr1645059pfr.21.1543502656118; Thu, 29 Nov 2018 06:44:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502656; cv=none; d=google.com; s=arc-20160816; b=08oxo1TFKmw07xAaGV3Jz4oBSp82RdJNVXhM5/KP9HDWC14MrBsq4lgTY/zBNml4hk 5XvWjfbZ/bljsZkpqqXHrC/wz0CHO4cZlc/HWvOWXvi857rBWWuf0ccsqfnSyQxrVubf kyaqOtoxE9ebHORw1+75gL+D5BpYG5pIOlmIFXL58+/AgCrNxeKYv9RCFwDTmPQEMN0W f+ANT7jhDiGsXBIDvY65W0Ef6hGKXv/ErLuGKZeXcJSnwKxaJL5+6tJZ4z9NkLu+ZQmF q+ilwtWVUDowKXuKrUiAj9zeAQ0ra10APJv0zZi7ZeS4JHQ1OgqW0yjFI3Mb64s+GK3J q1XA== 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=ffthip1mJuvQn6kx/04jTkeymfuSswClHz31BH4R48w=; b=kcmC8NHY0NMitsZ1nHmi/LSI4h4t/qgQ61BlFAEjp1/HmtxmyVfc/9ZPlVlgcjfpBL suxmKP3JRZaMVALfXppv5BBdYoTzvp5uijAJJlUClfEWg08xPt/E9r+ObLqZ4rbDJIpc xryttykZfiJQGEVgdHkrAoKL9rOKKCub/vqz4tIFYjImyIYyxDvYDf7ce7KLeXhmlMO4 CboTtLpkYQYvWNatus2wYOgBAD8OGvBEt58hfeihYCYZn62jgs1FfZBhnlMdM9Y7L2ej jouxRiZ7nJnoKHw/KWUKI9LcPxWI6teWYVSFXYEAaGc7Uw0IAIPQvj1gS44A2XcgQI7c L1Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HCIDZNdw; 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 144si2080406pga.322.2018.11.29.06.44.01; Thu, 29 Nov 2018 06:44: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=HCIDZNdw; 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 S2387996AbeK3Bdr (ORCPT + 99 others); Thu, 29 Nov 2018 20:33:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:34566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731863AbeK3Bdp (ORCPT ); Thu, 29 Nov 2018 20:33:45 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 93DFB213A2; Thu, 29 Nov 2018 14:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501693; bh=vpvGs1d21MLliqAf5WTTOqDHu2uzmmBQyS6YlZxqm1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HCIDZNdwIcE+VWfs6TY/Vh4AkpCzvJXLU6w6c9Y2+udbMZS1gYeGkdbW9z2xwVOcK lIPKww9ogJTTg79uKAj1MwoBTCLYxp0wX8wuYRFv1cge3bPd8AHfLHzSM9oq2v4jOO UfKOXvg9st0wv6r7jlar/Osb2Aq/k2bVVQ9u3m/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeffy Chen , "Rafael J. Wysocki" , Sudip Mukherjee Subject: [PATCH 4.14 087/100] driver core: Move device_links_purge() after bus_remove_device() Date: Thu, 29 Nov 2018 15:12:57 +0100 Message-Id: <20181129140106.334832162@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140058.768942700@linuxfoundation.org> References: <20181129140058.768942700@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeffy Chen commit 2ec16150179888b81717d1d3ce84e634f4736af2 upstream. The current ordering of code in device_del() triggers a WARN_ON() in device_links_purge(), because of an unexpected link status. The device_links_unbind_consumers() call in device_release_driver() has to take place before device_links_purge() for the status of all links to be correct, so move the device_links_purge() call in device_del() after the invocation of bus_remove_device() which calls device_release_driver(). Fixes: 9ed9895370ae (driver core: Functional dependencies tracking support) Signed-off-by: Jeffy Chen Reviewed-by: Rafael J. Wysocki Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1973,7 +1973,6 @@ void device_del(struct device *dev) blocking_notifier_call_chain(&dev->bus->p->bus_notifier, BUS_NOTIFY_DEL_DEVICE, dev); - device_links_purge(dev); dpm_sysfs_remove(dev); if (parent) klist_del(&dev->p->knode_parent); @@ -2001,6 +2000,7 @@ void device_del(struct device *dev) device_pm_remove(dev); driver_deferred_probe_del(dev); device_remove_properties(dev); + device_links_purge(dev); /* Notify the platform of the removal, in case they * need to do anything...