From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8592C433EF for ; Wed, 6 Jul 2022 08:23:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231889AbiGFIX5 (ORCPT ); Wed, 6 Jul 2022 04:23:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231945AbiGFIXj (ORCPT ); Wed, 6 Jul 2022 04:23:39 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90AB6240B8; Wed, 6 Jul 2022 01:23:35 -0700 (PDT) Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 8EEA0660193A; Wed, 6 Jul 2022 09:23:32 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1657095813; bh=zMavF5qlus89eOAZ65TVOYCbV1BgOtLseFPdJnK0pqc=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=XBoOLVBqow1+SY/p9pYfbIE9SrKkWJZkosm8xUMr4t715qcbeAmaYTjUDICvFemnD kx/OwMFwl4oSZX+spu2Q2emzF3xoeZqeA1Sa14iGDe5MLuBvC7UD3Df8RGsif7e8VR voC7H8mW5SJybbsAbxw3Tp2XgqSRboNj3wfyePdcbYzRqzSfrjDyQVfWgFVFF3DaXz U1yaTLwlOZBO3uxAMhNSz3Ntpj5ISldD5/s7gUsTftPTbEQ4HE7GSBBYoa3op2IXpe 9v73g8MZ5YyNDfB2hGLYXQVCBBcAGe7JyqYauDdF1sLxq+N7RBmOxWHKzOegu3pJQR b5fUX5i7N99vw== Message-ID: <03ba07c0-af10-4a99-7d5f-15d9a0cf853b@collabora.com> Date: Wed, 6 Jul 2022 10:23:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH v2] PM: domains: Ensure genpd_debugfs_dir exists before remove Content-Language: en-US To: Hsin-Yi Wang , Greg Kroah-Hartman Cc: "Rafael J . Wysocki" , Kevin Hilman , Ulf Hansson , Pavel Machek , Len Brown , Pin-yen Lin , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220705171649.969194-1-hsinyi@chromium.org> From: AngeloGioacchino Del Regno In-Reply-To: <20220705171649.969194-1-hsinyi@chromium.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 05/07/22 19:16, Hsin-Yi Wang ha scritto: > Both genpd_debug_add() and genpd_debug_remove() may be called > indirectly by other drivers while genpd_debugfs_dir is not yet > set. For example, drivers can call pm_genpd_init() in probe or > pm_genpd_init() in probe fail/cleanup path: > > pm_genpd_init() > --> genpd_debug_add() > > pm_genpd_remove() > --> genpd_remove() > --> genpd_debug_remove() > > At this time, genpd_debug_init() may not yet be called. > > genpd_debug_add() checks that if genpd_debugfs_dir is NULL, it > will return directly. Make sure this is also checked > in pm_genpd_remove(), otherwise components under debugfs root > which has the same name as other components under pm_genpd may > be accidentally removed, since NULL represents debugfs root. > > Fixes: 718072ceb211 ("PM: domains: create debugfs nodes when adding power domains") > Signed-off-by: Hsin-Yi Wang Reviewed-by: AngeloGioacchino Del Regno