Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1668658imm; Fri, 7 Sep 2018 04:20:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYwSkSYKSKJUhqgNwSyQE9Gx5MLxo09YlGHFK7UwGr6C8jmdib8Gj6TxKCliLSdjOmD2vuJ X-Received: by 2002:a63:6949:: with SMTP id e70-v6mr7656256pgc.119.1536319208486; Fri, 07 Sep 2018 04:20:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536319208; cv=none; d=google.com; s=arc-20160816; b=V0M5ohbDiZJPOww2JHnAxLwc4Wnz698gWTTwoPy5FTpclN+zi/SNNzNEs2xbzi3GI2 6zijRdb9LBR+oRWPaBAPIK2OCJZ4tIC9fWZvwwpgpBpzEtGCxse8yoFdjxAKPGNEjPKN Wt/8X4+c8I75rWDwkFzLdA5pZIfA2IX48sHgjaDBRq+D79oxZSUYwv8VgYoFFzuZBIll w39qeXnb8FLiYHB4l8bFd066qOh82m/pzASrdKX8wCUbGkrF1UP0ISBbUtXbPOhM77kB HFlxjv4QR/tG8+v8BbjH2Mxa9Efh3IHX4HEI+3KxcPg0Kyqfs/XLA2i3eZHsTd0fkfPN plTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=uSppJxZDLiYI5JwlJetfIps7a66u7/JgXK30mXlpI5s=; b=GbEkFLEL1o71FVTdczxGk822bMKkCIEWiASUf4JPHi3FjFBhC7LnlQC2+OJw0yyt0V JlhcXicaOwVJbptABZfX2i0AWw6uItQ/1awqphPMpxQj03T8jk1vHMlaIqPS5jfBa1Fq 4l9eQLGrWG3aoDvQbw0KV6QDYxdie6ticupnrtcET98ACnolDmVIHn5SKfu1GKKKLcXc jGxRmO1mAFjoa8eVwAaZREviu01JHH2HO8C2CgYWGVfJc5hhJoewekySHck9EjQVQzZJ 1jbeuNoiX3DcADQN5r2WQV4d59ts1YJSRa8prNkHXsV0Yaozb7RA3a0z1gs+UTHwtj0x hNWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b="rs/RHvn3"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j24-v6si7962573pfn.363.2018.09.07.04.19.52; Fri, 07 Sep 2018 04:20:08 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b="rs/RHvn3"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727827AbeIGM2D (ORCPT + 99 others); Fri, 7 Sep 2018 08:28:03 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:42946 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbeIGM2D (ORCPT ); Fri, 7 Sep 2018 08:28:03 -0400 Received: by mail-lj1-f193.google.com with SMTP id f1-v6so11484063ljc.9; Fri, 07 Sep 2018 00:48:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=uSppJxZDLiYI5JwlJetfIps7a66u7/JgXK30mXlpI5s=; b=rs/RHvn32V0EpAE0CC1OkwtJVDegMIRIgN3TwFOCNCYSmp7jyU6hhTTn/HSR6bJrNG 1CJ1gNhvWHj7fxOPIGQro/VtehuZxRU+wi0EduYyubbTAfQsrpmINy1C6iQijYilrazk a1c8ldZs2VVfnRV9bCwoZN4Js53uUXYFlqRSilV3rET9Qtx7u3xAVHrkspuPOlWMdYHo oyI1fxuLNHE01GtudKeFoNrp7J0PYVbXuK5XopkR4T4aleyvOAGsk5DZIAFE3xu1iKmu OgprE/RB/KqHrk2chH+LP0pXyG/txDY6Sx6FD1EgCSIcLZSu5qrtwOh9o8kLcjPDD0tT dF3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=uSppJxZDLiYI5JwlJetfIps7a66u7/JgXK30mXlpI5s=; b=HsS6qgWg0/a/DCOwABUxX8fyjBww8T+DYSvIZXmDuk1/FAuyqO2v7VOkREiI7BweOT gxO9LRGCLIZgl/FRXeQvwGzKXCZZy0wfpE+B6PJ18YpTQ0Gh7JZQ28Z8foWWubX+PxpJ I+E43SKb9nEsm3l54M3uM4GFTwOAwI0KUr5wvl7ZVQZoCtUdBb/HZBtX878HPc2uGBqA dBOMbYSLZKNRWbpQFowEzwZWA681Jecx9GSIzfI8OP2dswmhGUGT/eZpY6fZ5kHTJmQj QmlAX5zR9eBDnarzDXzI/WEL/VeUt1G0xndX3TGjBiJA597KHaIb6dCxh9L8/a7spdQm qU6w== X-Gm-Message-State: APzg51DHGEgEFVk+QNcBCHiHsKulhktWH5Aik+u8OVYN9m5M+dXKoBrh 98m0+SW3J/1t3Nslx9khHcI= X-Received: by 2002:a2e:29da:: with SMTP id p87-v6mr3862644ljp.12.1536306499939; Fri, 07 Sep 2018 00:48:19 -0700 (PDT) Received: from xi.terra (c-74bee655.07-184-6d6c6d4.bbcust.telenor.se. [85.230.190.116]) by smtp.gmail.com with ESMTPSA id v14-v6sm1160631lji.80.2018.09.07.00.48.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Sep 2018 00:48:19 -0700 (PDT) Received: from johan by xi.terra with local (Exim 4.91) (envelope-from ) id 1fyBVG-0004AP-O4; Fri, 07 Sep 2018 09:48:30 +0200 Date: Fri, 7 Sep 2018 09:48:30 +0200 From: Johan Hovold To: Corentin Labbe Cc: Johan Hovold , Rob Herring , Greg Kroah-Hartman , Frank Rowand , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andrew Lunn , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" Subject: Re: [PATCH v2 7/9] net: stmmac: dwmac-sun8i: fix OF child-node lookup Message-ID: <20180907074830.GF1089@localhost> References: <20180827082153.22537-1-johan@kernel.org> <20180827082153.22537-8-johan@kernel.org> <20180906200337.GA15390@Red> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180906200337.GA15390@Red> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 06, 2018 at 10:03:37PM +0200, Corentin Labbe wrote: > On Mon, Aug 27, 2018 at 10:21:51AM +0200, Johan Hovold wrote: > > Use the new of_get_compatible_child() helper to lookup the mdio-internal > > child node instead of using of_find_compatible_node(), which searches > > the entire tree from a given start node and thus can return an unrelated > > (i.e. non-child) node. > > > > This also addresses a potential use-after-free (e.g. after probe > > deferral) as the tree-wide helper drops a reference to its first > > argument (i.e. the mdio-mux node). Fortunately, this was inadvertently > > balanced by a failure to drop the mdio-mux reference after lookup. > > > > While at it, also fix the related mdio-internal- and phy-node reference > > leaks. > > > > Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs") > > Cc: Corentin Labbe > > Cc: Andrew Lunn > > Cc: Giuseppe Cavallaro > > Cc: Alexandre Torgue > > Cc: Jose Abreu > > Cc: David S. Miller > > Signed-off-by: Johan Hovold > Tested-by: Corentin Labbe Thanks for testing. Johan