Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3474535imu; Sun, 11 Nov 2018 15:57:12 -0800 (PST) X-Google-Smtp-Source: AJdET5fq65r8tLddP2RzMuzzem8N7EEwNPpsE1NqnsZasKyUfljlPEPEFB9TRz0IZ0671UoMIvqr X-Received: by 2002:a65:4b82:: with SMTP id t2mr15645009pgq.189.1541980632605; Sun, 11 Nov 2018 15:57:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980632; cv=none; d=google.com; s=arc-20160816; b=YJowPplBrvR4Wkc5R024RXE/dybrCRmARCOD3N+6N+Q/Ifi7duDcEpMzFWL8dLsCQ5 EKg1vLvHUDjFLXhQSBolStFInJFn9jvBRk6P0umJ3g418XgmrpOrlNJdlrL+Ohgr6exz bBIHfSy2/vLF21kF66/mP2gps1sKikm8XTN9biMUct7f9rZTXRyP2MBf62hZgA3Uvlju uFnsW4QCCLy577OLJUxNyBqUyDees7J1+QsqxLdp6bZ5Z2pnRvwMBpiKZIlHvTRR9pDh 4F0dFALFdlLF1Uf+QFaLNzbiEnegBi/QF/bx4jfGECemSR1pW73DKGMs9h3BtPb+qqsI H84g== 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=vicePyj3QOJU991vULhin4Cy+3VV17do/u1FUb/TdJQ=; b=TLBKveOhFYLI6Bd4TMqAPWgA7CnecZC22s+wWnmxsqSH007tvC0Icxk5J2Kb/z7ZFV sP4An8Agme5AVlIzQIHxHpZONBf+rSP6Yboov1tMcbIAlYVGjV1XrOPOSBsH4nDpzqF4 MVy5+KYKQzk4oivDusXZDtJpiPEotE8qwmJbldEZXBNPlfS+b0RHZjwZpozGdKsM7wPE t2OH1qefyJEyHrmYjsF727w9A+NU/ENB5KcWKR5TErGGzmR8ZGgVbm18mTQeylOUE50k omD03AhD/CSl+jqmpyqwkuifL4JHbdcZi5hAsN32HVXkCqw787fu0rJo5eKqHKCT6fFn jLog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LMEuViqh; 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 b1-v6si13907860pgw.151.2018.11.11.15.56.57; Sun, 11 Nov 2018 15:57:12 -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=LMEuViqh; 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 S1732908AbeKLJq5 (ORCPT + 99 others); Mon, 12 Nov 2018 04:46:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:35336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732552AbeKLISN (ORCPT ); Mon, 12 Nov 2018 03:18:13 -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 9DF652154B; Sun, 11 Nov 2018 22:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975297; bh=LzDnLZgnfbRT65tqPAPG75W9XLCSUlHBTqnT2P6DJ1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LMEuViqhBNzIwKmnRnN2ZNNOEDSNs6CW0tTt8Q2lon77BNGr8WcvGPk69zvnt4yoS CABF33a83DUZ71sGdz8pHrtMPqztk2+xRh7PjHXo+xKIyc5h5bA5M/ftdyhYVryktu byfmX48AxNpXwY0bPmBRqNdwLqO+GdTJ25NEJLb0= 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.19 217/361] libnvdimm: Hold reference on parent while scheduling async init Date: Sun, 11 Nov 2018 14:19:24 -0800 Message-Id: <20181111221650.286152525@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-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 @@ -488,6 +488,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) @@ -507,6 +509,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);