Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3431188imu; Sun, 11 Nov 2018 14:58:02 -0800 (PST) X-Google-Smtp-Source: AJdET5er0r7aYCw6pYZeWgSQpUbfbKhg+/3GFfOyS2MHwln9YUr3hcLIr7cAp/tfXgf++wkdWOmn X-Received: by 2002:a63:e101:: with SMTP id z1mr15463878pgh.310.1541977082791; Sun, 11 Nov 2018 14:58:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977082; cv=none; d=google.com; s=arc-20160816; b=fT/+gWnOrzu1u4HywF2a7Duzdm4eCfwt0SEY3lLFSJiT50ScyZyqNfKunwQnui7HZj oWyUq7/8twY+D7QuhHuHGlFhug6qZsVy+ExzySQP1NHOXFmNqHsph1wJQK/aLrfQWRW9 g1WectXp9Q9/rK1GMvKPzQ7FKEz1O1ZC251SkG6KGUmZ+njGddxR+K59wERBcR3ug3Lq xCnYX5x2DxOD8CoUWumVhhmo9YNCkoQBfK/LweCod0u5tPLdmCzSYXJwa8zruV9IzZzq SOBiWtOi/jWtuQ32xMkM5vGsVowWFw/YGSDvo5Zbj8+3hSM7u+yQrFZ0p66tQvJ8rNCC rGYQ== 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=ZTZsFKtwVpYvUlcPt01+vI8LYvlI/L6HpipLF/g5la8=; b=mZKWeNq13oJvGCrht9UUft7DKIg5Q3FKyH0ZFTtH4Pc5htqjGR16Qr3bmmjPLXxQTQ PakhwoE13gdtfsEHo3xYCNe/FPzEHEQexP+9FNhwxZjeJ6/RcfrxRrcXsKRw/x9LmaDx EpHycd+DvPedpyfULOMJsk1K/V1FTLJTEw8HHzRujtWE9hFH+RDME0mjSRZpToK5aeij GfUGMqRE7TJY0uYc/jva9XPTMFebxEFTLWNNhr0Cv9oCIZjJIKOLwx88z6JC/Rv+PXjX 9qTFJ82z/o7a1zLlFqk0/sWcrM7/TyY4/CCyeepAQWfNsWSOWXdgSRmn0HrJxVUnRGC3 PHQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZTtyWWg8; 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 t5si8290170pgc.369.2018.11.11.14.57.47; Sun, 11 Nov 2018 14:58:02 -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=ZTtyWWg8; 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 S2403836AbeKLIWp (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:54072 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387600AbeKLIWl (ORCPT ); Mon, 12 Nov 2018 03:22:41 -0500 Received: from localhost (unknown [206.108.79.134]) (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 1AAE421780; Sun, 11 Nov 2018 22:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975564; bh=ouGXA8r0Oby7w6rKy1HT4nZE80wU7c3VB/t7uke+WN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTtyWWg8iIrpLY0mpYrPbcRHUFTWUFko9TdmOuC0j8VE7/nwLwSSm6xJTsuOBkAi3 i56Tl3Wf6++G9m06/YV3JaanyMvwMxaxwaqfaIrTFPpbEOBHAINomXiAafvUA3u7XH y/mMZU3hi355+G+E5bcuZpvTFkoUamJjEJXTbMUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Duyck , Dan Williams Subject: [PATCH 4.14 131/222] libnvdimm: Hold reference on parent while scheduling async init Date: Sun, 11 Nov 2018 14:23:48 -0800 Message-Id: <20181111221659.315096671@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@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: Alexander Duyck commit b6eae0f61db27748606cc00dafcfd1e2c032f0a5 upstream. Unlike asynchronous initialization in the core we have not yet associated the device with the parent, and as such the device doesn't hold a reference to the parent. In order to resolve that we should be holding a reference on the parent until the asynchronous initialization has completed. Cc: Fixes: 4d88a97aa9e8 ("libnvdimm: ...base ... infrastructure") Signed-off-by: Alexander Duyck Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/nvdimm/bus.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -484,6 +484,8 @@ static void nd_async_device_register(voi put_device(dev); } put_device(dev); + if (dev->parent) + put_device(dev->parent); } static void nd_async_device_unregister(void *d, async_cookie_t cookie) @@ -503,6 +505,8 @@ void __nd_device_register(struct device if (!dev) return; dev->bus = &nvdimm_bus_type; + if (dev->parent) + get_device(dev->parent); get_device(dev); async_schedule_domain(nd_async_device_register, dev, &nd_async_domain);