Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp350842img; Tue, 26 Feb 2019 00:55:32 -0800 (PST) X-Google-Smtp-Source: AHgI3Iafm9bzBoe0gkqPVBKEDolC7lyWeCxHOyfYVg8ZpOafso0Arbc5FTu15RGs973eF+NI9pmG X-Received: by 2002:a63:101c:: with SMTP id f28mr22799414pgl.224.1551171332599; Tue, 26 Feb 2019 00:55:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551171332; cv=none; d=google.com; s=arc-20160816; b=CFcPGei/sTjY6wNw4gWuwJnMNzFigOgdBWa4z+2eM+ptegH+nfA5LCU0C+gKhv0YmS kuAbblnEZPx2EpxZNIuW155bKWpGe/AatmRXUy73vsT+f/vvPEbxOswAdulD6ViNP8pP AqEFlOzZbbWI00IpaMC0fnVaQI4L9lE0zYl+br9lQAogePcIeUXXP+rN0kMB/9LStRLf oZZUQuAXWeduqyYjxg3m3VJHtcj/1bveXUf21cQaNahp3kYItfo4OF+U7YP+g3PWkDmD NJCS6gJqtcSZG3Fcz957XPEKh+fxqqEtwCdgCs0+uiMr0lsBn1BigqShN+o6C/dlCSyl cx6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=uut/mGcHBmUignsXLibSdvC+dsW8jFf3zzkJ1KrOEW4=; b=efIlf/5P00aoQBOEkeKmYQ6cqBecIpyWVhRplENYpoz7Piji2hYBColTNPGFi6wmTo vGFvp7VuHeQ0WS8JTjsHiazfqlnix1Mp8oWBfQeeAoibe+gHSbfkQkjM2AGVvVHJImJT UMWtJS9U5mi0RqYderzsKHs9rL3AIMMCAqsRNjhT1XkeNlGEbvhGUM+yXVr4zhnTdDrP iXGGGUvdtq1TUevgIbjzePXrbWH1/bSAdJtCd9t7ZEJ/Pc3SJZ815D04KeKPmkd88QB4 P9EtnEEW6ND+b9peT9Sort2yDP4GA2MsRMLQ3v/8vb05Cju4UtVpIb4kApGoJts9W9e0 eBHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@renesasgroup.onmicrosoft.com header.s=selector1-renesas-com header.b=jZJsg06b; 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 l7si5768028pff.162.2019.02.26.00.55.17; Tue, 26 Feb 2019 00:55:32 -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=@renesasgroup.onmicrosoft.com header.s=selector1-renesas-com header.b=jZJsg06b; 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 S1727225AbfBZIy2 (ORCPT + 99 others); Tue, 26 Feb 2019 03:54:28 -0500 Received: from mail-eopbgr1300092.outbound.protection.outlook.com ([40.107.130.92]:48255 "EHLO APC01-HK2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725977AbfBZIy2 (ORCPT ); Tue, 26 Feb 2019 03:54:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uut/mGcHBmUignsXLibSdvC+dsW8jFf3zzkJ1KrOEW4=; b=jZJsg06bJtniUApGLhCHHujuPF9Qp30CIevEbnLUQRXAYD6kh48NTJaM5yL3EJ/GsfqFjyawtTUxrDnvL2CCjhv9rL3EvM0CIJFjuUQu0F7VlfWpZ/vE2Z7UPFnUcBw53hn6WnCj20TxmXNn8J60suD63nJBlD2UnZnr51IPa5k= Received: from TY2PR01MB4812.jpnprd01.prod.outlook.com (20.179.170.147) by TY2PR01MB2843.jpnprd01.prod.outlook.com (20.177.97.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1643.19; Tue, 26 Feb 2019 08:54:21 +0000 Received: from TY2PR01MB4812.jpnprd01.prod.outlook.com ([fe80::44b:a054:4954:f819]) by TY2PR01MB4812.jpnprd01.prod.outlook.com ([fe80::44b:a054:4954:f819%2]) with mapi id 15.20.1643.019; Tue, 26 Feb 2019 08:54:21 +0000 From: Yoshihiro Shimoda To: Julia Lawall CC: "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 Thread-Topic: question about drivers/phy/renesas/phy-rcar-gen2.c Thread-Index: AQHUu458FqHVOGKcBkGy/69gWAAvIKXx6Sww Date: Tue, 26 Feb 2019 08:54:21 +0000 Message-ID: References: In-Reply-To: Accept-Language: ja-JP, en-US Content-Language: ja-JP X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=yoshihiro.shimoda.uh@renesas.com; x-originating-ip: [124.210.22.195] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ed22f04a-a458-427d-05f8-08d69bc80032 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020);SRVR:TY2PR01MB2843; x-ms-traffictypediagnostic: TY2PR01MB2843: x-microsoft-exchange-diagnostics: 1;TY2PR01MB2843;20:GgUj5dQNli3MXbESXWT0qIZCeIV6TVdtFzIwhUC52UDvuDRjAIj+2I/FKEc2o/iZ68pFz8NvxNhUI8RflBRNz3VZ+CHqtM/D0FIx+9XOLXKbzq0u6mVpBKaq8UCenvGwMFN3yX0RKIab5Y8Q8CpxSECZQ4Qbq6bHLaRFX1++9t0= x-microsoft-antispam-prvs: x-forefront-prvs: 096029FF66 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(136003)(376002)(396003)(366004)(346002)(189003)(199004)(68736007)(76176011)(305945005)(4326008)(54906003)(7696005)(5660300002)(476003)(71200400001)(2906002)(71190400001)(53936002)(8936002)(25786009)(186003)(26005)(66066001)(105586002)(6116002)(3846002)(99286004)(106356001)(486006)(33656002)(6916009)(316002)(55016002)(6246003)(6436002)(11346002)(86362001)(446003)(52536013)(14454004)(4744005)(229853002)(7736002)(9686003)(6506007)(8676002)(55236004)(97736004)(256004)(74316002)(102836004)(478600001)(81166006)(81156014);DIR:OUT;SFP:1102;SCL:1;SRVR:TY2PR01MB2843;H:TY2PR01MB4812.jpnprd01.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: renesas.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: E2T3VHwxUQYATau63VTlhkhNsWvMb4kaxYY1EvnS+O0oRD5R82BamjgCZVMEf2oWJYLOs6sS97xDA2zs/ayDBLHQ3tn+T7VeuY+OjcvP4UXQUOPpPhY8KvRpFIIPwh3cLoNQBWhDHFvThKqIg4IrpPQ9m1dxpg7sC4ZndWcTCWKw6dQ6w6Akr1Uz3hvyE8HZbSY87Fh0KDR/wuGYjkRsHcKYeKeUhA48HMLA7iohys6S00ad9nPPKQkJCnp7it76nhx2rbBV6CUqvI+odEUGddDIAkDaJllheu8TnXNlheVyoj/WuHwssiJM1/X5OzWdAx5Nlj+JSh/Msdi2x0uqwAizuFFf5zbyZUFgKrHChWGpOpAmkqbwLekvEdrO+oVE/EI0EgAoBmi6bOC1PCKIgvZ1vIsocfq5OduaLM3Vo8c= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ed22f04a-a458-427d-05f8-08d69bc80032 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Feb 2019 08:54:21.6655 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR01MB2843 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >=20 > Hello, >=20 > I was wondering whether phy-rcar-gen2.c would use dynamically allocated > device nodes? I'm sorry, but what is "dynamically allocated device nodes"? 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: >=20 > for_each_child_of_node(dev->of_node, np) { > struct rcar_gen2_channel *channel =3D drv->channels + i; > u32 channel_num; > int error, n; >=20 > channel->of_node =3D np; > ... > } >=20 > 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. >=20 > thanks, > julia