Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp355315img; Tue, 26 Feb 2019 01:01:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IbcF7lTuXovv/Xq67q7TJUoJQHvI9veZ6DyMnlYO8a5Umy4qKU0cBgD3xr8c7DVArRtmf5E X-Received: by 2002:a62:f204:: with SMTP id m4mr24583367pfh.58.1551171705987; Tue, 26 Feb 2019 01:01:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551171705; cv=none; d=google.com; s=arc-20160816; b=jJJMto3p61aABb7eT+FZA6l/ZxD9C0bMPrxta2jUTROyVQXJv44KuGFslRvMF9JXYJ IxcdSiHFyRn3m0+KTUmYct/8+cahmeJCsiI0bnEHu9TROfk45LXlns16UdX/DtwQ2/ir CEibrYoWxmh/yV1QIM0TtD6f9xY3t8bcttJXiD8M84xm56gR2TS7Jdpj0/MBVANvwJh2 4ejaPnGisKeXm/k0Qcxtb5gEzveEz+4W7mHWILe4IwYast/4G28H1sPx7VNSlOGU16gf za2TZrUAz5YafuAf2/0Yn3vPL0XNc6gK28yRrTsC8xO3AlDlE/RJxoGNaUyl68gRGx5K cCFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=DWYIWmqfzyOJzF38BTSz+UYxjHX0n/lUwm3yHekvd4g=; b=WrBQkXYH8ZXex23zYa/8jmmkomWCyePBfeQyc46R0rmPjJfckzIIPSjaE6ZO0cfwvy 6gP2B5q5Jmf4SYc7bFfTebaZ6zLJAX3NcUIJSGyZvencFTuqo3dKfWyuDvddjTPeKqjl eU9Ala4UGnXjjXKgKh1xP58oTIB/Q1k7h7sGcokcaPpvZiJHrxysbziZ6bK0egTB0rYs dQrpE4Y/aMD/z5y5NZmOoWvC09NMuTuoHLtuxeicLK2TOze5Z5QTtyXe4gmhaUHn2dCO Qjvgo0r5+MYeAMZ9uRBbaaGU4DRUBFVYSrNn0rew7IQEqztwNr2kuoJibuq1DmQRgcWX p7aw== ARC-Authentication-Results: i=1; mx.google.com; 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 m22si10997906pgv.562.2019.02.26.01.01.29; Tue, 26 Feb 2019 01:01:45 -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; 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 S1727126AbfBZJBI (ORCPT + 99 others); Tue, 26 Feb 2019 04:01:08 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:19229 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725941AbfBZJBI (ORCPT ); Tue, 26 Feb 2019 04:01:08 -0500 X-IronPort-AV: E=Sophos;i="5.58,415,1544482800"; d="scan'208";a="297336832" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Feb 2019 10:01:06 +0100 Date: Tue, 26 Feb 2019 10:01:04 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Yoshihiro Shimoda cc: Julia Lawall , "linux-kernel@vger.kernel.org" , Kishon Vijay Abraham I , "Sergei Shtylyov (sergei.shtylyov@cogentembedded.com)" Subject: RE: question about drivers/phy/renesas/phy-rcar-gen2.c In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 26 Feb 2019, Yoshihiro Shimoda wrote: > Hello, > (Sergei made this code, so I added his email as CC) > > I'm sorry for the delayed response. > > > From: Julia Lawall, Sent: Sunday, February 3, 2019 4:03 PM > > > > Hello, > > > > I was wondering whether phy-rcar-gen2.c would use dynamically allocated > > device nodes? > > I'm sorry, but what is "dynamically allocated device nodes"? Device nodes for which there will be a meor leak if one doesn't put of_node_put. julia > > Best regards, > Yoshihiro Shimoda > > > If so, it looks like the following code could cause a > > use-after-free, due to not incrementing th reference count: > > > > for_each_child_of_node(dev->of_node, np) { > > struct rcar_gen2_channel *channel = drv->channels + i; > > u32 channel_num; > > int error, n; > > > > channel->of_node = np; > > ... > > } > > > > On the other hand, if the reference cound it incrememnted, preventing > > memory leaks in the case where the probe function fails would entail some > > complex rewriting of the code, so I thought it would be better to ask > > first. > > > > thanks, > > julia >