Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3564514pxb; Mon, 24 Jan 2022 12:19:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJydb06NXLKZFeoLADjwO8ZAQ1AfKO2zP+josdUN/wXnTR9ZHlbaR4pxS0stWmBIgJlZhXXT X-Received: by 2002:a17:902:d48e:b0:14b:6094:9b01 with SMTP id c14-20020a170902d48e00b0014b60949b01mr3546900plg.137.1643055473537; Mon, 24 Jan 2022 12:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643055473; cv=none; d=google.com; s=arc-20160816; b=SwUQrIKDMcmtoDIjWvyC5bPjrfxkNg3KbNEfId//fzpes8EWBmH/bKZyGD2EXRM/yl lKeMv9Oy/R191em8b54Ar6vXsOJFMeOcBhLvFkZgbA2lka4KlaLTqOHpFDpW63YNSy6v NEyEDCaQYJUnkQ5aV8i15RhcxqptD2zH2FioC9OJIe/jGE2WCOOmo9WKM9Mfrq54aktU GOWlRW+OoxmILdR+2dBBXtl51ysucwvggg4RCZ45YwCFsZuEJfOProOR8TXnmOAnRbCz otu2XTZw/X9WH7QBpVQ6atkymBNYDAUp69HhuVwNewC+DXbnP8SancWaVCO5deff4X4l m7Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fgrevbaXMMl6ChR56vADCp15j3ZJakrFFyGg69l/rUk=; b=TRFBlc8/X7EPWwQ2tsVdqXaHkS+CZFfzSW1BBQ3pJYGz4sp7r8JfvN6LDB8WKTy127 KwSXd2nXS+/Y7ZJE/7OfeD3qyHfenBSdpQfTg973FeAoB1p6wZ3y6ihDc0z052Ah/HDM iBsjpeF9+V2o+PXIKhN9aV2yZGSSzVkgUO+awL/kkxBmbRpAFaO/z7XvGo91rR/4J0in Q4WAvyliTk+cSv9uy2vu0/3MohT7SDW0bBZQ7qXks5Y2iMRxI4c4X+pATiscVb2awO+l kVM9QN2vMvp1hsV8+V3qiAoy+edlo2qcTb+6cWa6DvNj95oUnpZe/MJqHNoYQ3sZdbbe aG5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V76TyIBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j4si3781460pld.288.2022.01.24.12.17.40; Mon, 24 Jan 2022 12:17:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V76TyIBe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349614AbiAXTVD (ORCPT + 99 others); Mon, 24 Jan 2022 14:21:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345498AbiAXTNC (ORCPT ); Mon, 24 Jan 2022 14:13:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DF85C0604D6; Mon, 24 Jan 2022 11:04:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F1B2D60010; Mon, 24 Jan 2022 19:04:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC4EBC340E7; Mon, 24 Jan 2022 19:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051044; bh=u7PT4VEBoCpl1z4UKdzURqBUvQQ7yDGByyBCzgv/Jh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V76TyIBe8RPJN1iGLHM4VcdR6etueX3OwGDw/hK4ARcmpLwCnUTKaKNInTmheN53R ESeR3eycTOKcKZtMWBaDIhm+18u+PgNlJ3WPPR9Cd/KZ/PtZA/UJsfUMbJkMlX/iP/ JEX6GdbuUxR3x54C0QaXVi29AGBIG4fHGaBCANw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Orlando Chamberlain , Aditya Garg , Andy Shevchenko , Lee Jones Subject: [PATCH 4.14 004/186] mfd: intel-lpss: Fix too early PM enablement in the ACPI ->probe() Date: Mon, 24 Jan 2022 19:41:19 +0100 Message-Id: <20220124183937.253355140@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Shevchenko commit c9e143084d1a602f829115612e1ec79df3727c8b upstream. The runtime PM callback may be called as soon as the runtime PM facility is enabled and activated. It means that ->suspend() may be called before we finish probing the device in the ACPI case. Hence, NULL pointer dereference: intel-lpss INT34BA:00: IRQ index 0 not found BUG: kernel NULL pointer dereference, address: 0000000000000030 ... Workqueue: pm pm_runtime_work RIP: 0010:intel_lpss_suspend+0xb/0x40 [intel_lpss] To fix this, first try to register the device and only after that enable runtime PM facility. Fixes: 4b45efe85263 ("mfd: Add support for Intel Sunrisepoint LPSS devices") Reported-by: Orlando Chamberlain Reported-by: Aditya Garg Signed-off-by: Andy Shevchenko Tested-by: Aditya Garg Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20211101190008.86473-1-andriy.shevchenko@linux.intel.com Signed-off-by: Greg Kroah-Hartman --- drivers/mfd/intel-lpss-acpi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/drivers/mfd/intel-lpss-acpi.c +++ b/drivers/mfd/intel-lpss-acpi.c @@ -80,6 +80,7 @@ static int intel_lpss_acpi_probe(struct { struct intel_lpss_platform_info *info; const struct acpi_device_id *id; + int ret; id = acpi_match_device(intel_lpss_acpi_ids, &pdev->dev); if (!id) @@ -93,10 +94,14 @@ static int intel_lpss_acpi_probe(struct info->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); info->irq = platform_get_irq(pdev, 0); + ret = intel_lpss_probe(&pdev->dev, info); + if (ret) + return ret; + pm_runtime_set_active(&pdev->dev); pm_runtime_enable(&pdev->dev); - return intel_lpss_probe(&pdev->dev, info); + return 0; } static int intel_lpss_acpi_remove(struct platform_device *pdev)