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 371F4C7EE37 for ; Thu, 2 Mar 2023 07:50:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229625AbjCBHue convert rfc822-to-8bit (ORCPT ); Thu, 2 Mar 2023 02:50:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229591AbjCBHuc (ORCPT ); Thu, 2 Mar 2023 02:50:32 -0500 Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBE95303DD; Wed, 1 Mar 2023 23:50:18 -0800 (PST) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-172afa7bee2so17227289fac.6; Wed, 01 Mar 2023 23:50:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m9NdTpfDEMV32UTE9lZbQp6kQQhUJVdsU2kqbFsl+ZA=; b=tsmDfvCtJ9Aqml+rjvoBdolA55BW0s8ZxrfanyNdpKTbzx1b/2Gsc8g4BBBxCwTmMS 88/CyZgPpGniroEjeZ1nCocMcTRvhWbvuWWh1vEsYYJyn+I4htZfeJ8+l6ak7IPwnrMN OUzUoTrAj0Rzu9/0c9ZS+SbZ00patwiEPYFtlMNoPdK4VsyKmtxnPvo7FJhuGn9sLVat y5udvpN/0cLELUluNjR8NoyxRdGchGRGSDg0Tbx3VDViXK3/qOBD/zHmbsWYtdqeuuN2 o4/GSVWrZy+/khK7H7Ui+NZd5fZqkVLkDkvbRCuo1egOZhmGpGi+4l5MeRkXLOHBQ8X+ vbFQ== X-Gm-Message-State: AO0yUKWYxhaabFvVMNGMkZvySXZPceWN1bCFyoRhm/wNQlwNP5eh/nGp DPR1VKuKS2qDF61WvVyW440ORCh+1zV3kQ== X-Google-Smtp-Source: AK7set8c9joX8ey0qbKnqu7pgCE8rSUDqWoyXNHH1uUotJKnAAQXnNfkwOhnn6pSu88jbBpjT8w8EA== X-Received: by 2002:a05:6870:d202:b0:176:4a5b:10a6 with SMTP id g2-20020a056870d20200b001764a5b10a6mr655719oac.24.1677743418034; Wed, 01 Mar 2023 23:50:18 -0800 (PST) Received: from mail-oi1-f173.google.com (mail-oi1-f173.google.com. [209.85.167.173]) by smtp.gmail.com with ESMTPSA id eg41-20020a05687098a900b001724742cfcesm5170181oab.38.2023.03.01.23.50.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Mar 2023 23:50:17 -0800 (PST) Received: by mail-oi1-f173.google.com with SMTP id q15so12854064oiw.11; Wed, 01 Mar 2023 23:50:17 -0800 (PST) X-Received: by 2002:a81:ad1b:0:b0:52f:1c23:ef1 with SMTP id l27-20020a81ad1b000000b0052f1c230ef1mr5784211ywh.5.1677743396691; Wed, 01 Mar 2023 23:49:56 -0800 (PST) MIME-Version: 1.0 References: <20230301185209.274134-1-jjhiblot@traphandler.com> <20230301185209.274134-3-jjhiblot@traphandler.com> In-Reply-To: <20230301185209.274134-3-jjhiblot@traphandler.com> From: Geert Uytterhoeven Date: Thu, 2 Mar 2023 08:49:44 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/3] of: irq: make callers of of_irq_parse_one() release the device node To: Jean-Jacques Hiblot Cc: saravanak@google.com, clement.leger@bootlin.com, Magnus Damm , Russell King , Michael Ellerman , Nicholas Piggin , Christophe Leroy , zajec5@gmail.com, Daniel Lezcano , Thomas Gleixner , Claudiu Beznea , Marc Zyngier , afaerber@suse.de, Manivannan Sadhasivam , Palmer Dabbelt , Paul Walmsley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Rob Herring , Frank Rowand , Bjorn Helgaas , Nishanth Menon , ssantosh@kernel.org, mathias.nyman@intel.com, gregkh@linuxfoundation.org, thierry.reding@gmail.com, jonathanh@nvidia.com, linux-renesas-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-wireless@vger.kernel.org, linux-actions@lists.infradead.org, linux-riscv@lists.infradead.org, linux-sunxi@lists.linux.dev, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jean-Jacques, Thanks for your patch! On Wed, Mar 1, 2023 at 7:53 PM Jean-Jacques Hiblot wrote: > of_irq_parse_one() does a get() on the device node returned in out_irq->np. > Callers of of_irq_parse_one() must do a put() when they are done with it. What does "be done with it" really mean here? > Signed-off-by: Jean-Jacques Hiblot > --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c > +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c > @@ -184,6 +184,7 @@ static int __init rcar_gen2_regulator_quirk(void) > kfree(quirk); > continue; > } > + of_node_put(argsa->np); The quirk object, which is a container of argsa, is still used below, and stored in a linked list. I agree argsa->np is not dereferenced, but the pointer itself is still compared to other pointers. IIUIC, calling of_node_put() might cause the reference count to drop to zero, and the underlying struct node object to be deallocated. So when a future reference to the same DT node will be taken, a new struct node object will be allocated, and the pointer comparison below will fail? Or am I missing something? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds