Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2984656imu; Mon, 19 Nov 2018 09:00:08 -0800 (PST) X-Google-Smtp-Source: AJdET5d9+yfDFSXXlLmTfRBjXfY33ho5zvutQHfeKVkiU/mlPr4cEHkvTyojwhZ/oRoK+DT7h8Hv X-Received: by 2002:a17:902:b104:: with SMTP id q4-v6mr23276933plr.5.1542646807992; Mon, 19 Nov 2018 09:00:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542646807; cv=none; d=google.com; s=arc-20160816; b=SJPuyz6h6LFe/omRljRh697etf9ZNTUu45hlkNLlIMtI0n4Trvl5gH2Hlrgs5YZTli JgUd5uDLc72ov3JqntjprXYi9IO4KqPIVwqFouAo9NOd2965oIkpEdubT9A43Kd3xDMi 18F/JQsYTpYwjHNU1pjWO9q8oe4AZvaq3ABUWf9rQ07rIpYM5K6j5tNgLk0dpa4Bd5Jz aeuC8Ee75UVDAbDX/DbEt7BHZRekK/rVxag5+IHZyyYVjCObkHVEPqPEnUiO8NigeWk6 uSv43YkJPK3kv7iK/s1LN+IWp56rKLNX2kbIxV2U3m63C/AN7sChLgNIYvs+QRjtg3Nj 63aA== 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=XG/hCZTLyTpVGWhp2Z9WX0v5MHjFzW9XCn8+frNMhps=; b=dEQZElbYUJug2iqwMktI+kI6NhCVPUAubk8qZv68NP65EZWxvtuhGgiFyaaya83aBW QtecVs8KLeRVvp6UCnkgpwy6ymiqzbjgrfSe2iXQaJQbIuA0S25PqnSKmLeIrKw4OCq/ kzTviBZzL2fo1rJl4Xd2huV7XfBNfTVHiy1uvYxcneExw5dQtINkuyf6Xc2BmBuK+x2M +wtFrL9otNghJj3FqOtG0jSKtT0XM41v7A4VwviiXZEirVNr6SnWPC1myRelNSh8mICi 2Jc/6vwic6+1qozF5FVnkNP2HsTrUyMo8Mh+XPZg3I+VFE+oPGQB8p2yhdAuAmmoZYFW gXyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DihVuKu8; 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 y5si37480973pgk.49.2018.11.19.08.59.52; Mon, 19 Nov 2018 09:00:07 -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=DihVuKu8; 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 S2404694AbeKTDWQ (ORCPT + 99 others); Mon, 19 Nov 2018 22:22:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:33852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403845AbeKTDWP (ORCPT ); Mon, 19 Nov 2018 22:22:15 -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 849492146D; Mon, 19 Nov 2018 16:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542646680; bh=aQSW9SxCW2ZNa38WFcPEbvByg3hDjaJg5S/JYwXzCwo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DihVuKu8KARsfN/Qfrpr3hJSwRJoAYUjiOxlHxBwXPYh+xwo2jUBvJQy1zxMOTvjt Fz6ND3COwTD52mtDAZzMXwpT/SPw+DsvkMjGwqpCcKa9bjYY3PYLMdRAWBp4WOPzpY M+E+Z1zG2pb9/tyHuilrgONVIN+z2DG107mbQpPU= 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.4 049/160] libnvdimm: Hold reference on parent while scheduling async init Date: Mon, 19 Nov 2018 17:28:08 +0100 Message-Id: <20181119162636.264023428@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162630.031306128@linuxfoundation.org> References: <20181119162630.031306128@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.4-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 @@ -158,6 +158,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) @@ -175,6 +177,8 @@ static void nd_async_device_unregister(v void __nd_device_register(struct device *dev) { 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);