Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp84426imm; Thu, 30 Aug 2018 08:52:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbZK/qh8uQDykh5qWKgrftrpoR8wECo07z7oZES13SO+PS2hVSuTBr7aI0Z8gwgcyCY+/he X-Received: by 2002:a62:9f85:: with SMTP id v5-v6mr11029528pfk.27.1535644358170; Thu, 30 Aug 2018 08:52:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535644358; cv=none; d=google.com; s=arc-20160816; b=W1rrO1MITHxbpBIXTFoF3CKY4SvKm2bhAfZlu531ue0gW3Hhayv5qsQ49Yf2ciAokN 7cv6dcfZwIjTqmzZg54emXsSNy1wJHbpw7m5JVkm4wfylwgFcNiU+sou9gVrY6E5+EVt RVQF5R5Ef1ScUVyVTNcZrQBGUSLpRyDV949PEIG0Qx6TSA+kuuAQyZ8+Jz0Y6BIld/BL jq6H7lBXUgdsSgX/j/5Ip86Pw5b38FrqtVWh/HyJgUHVpMbKKKNvMIyudarAruU/hl6z ksLu2qt2mv00xYayzXIEB+KNbntYWkDkXHFBl69EEHd5pAzdElB4kBbumSjzphtD06Wx woug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=2Kuc0W7y65zawk3ZsOwcIgCUdcwn8dkSa8odyiMtyGY=; b=0LeKRDh0rQjt3Z38FgMhmqVnZUySYhh37F5NclfZ3IcmSDGmgHcVqLN8Jo62BVuE/9 14g1AuUlUY/6GQIci0SM7dknv6dDzVt9VMxgF/5ksItbb/1jSRwdVp11iECL4E+SBl/w 5GdxweeFJbyyNdbpl0V176c/hp8riOSOW8Gep0Kr/fImTzsoFTnDKaWfkAkj8rVKSnCw 0XHq/KqkPzxTaZRqsbIT42SrHsnbBotF+SIDj6KdSnjSgSmSi17xZQwAJkdcVPPEM8Nx 2UTsFIyNIAq/YubciqFCQgUkXx0cP4IcmGWG7ak6cfyM9tHgE7zHC8cctKU/4rPp5KOu S9zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=cV+8521l; 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=pass (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 x19-v6si6212539pgf.477.2018.08.30.08.52.23; Thu, 30 Aug 2018 08:52:38 -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=pass header.i=@kernel.org header.s=default header.b=cV+8521l; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727544AbeH3TyK (ORCPT + 99 others); Thu, 30 Aug 2018 15:54:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:36616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727229AbeH3TyK (ORCPT ); Thu, 30 Aug 2018 15:54:10 -0400 Received: from mail-qt0-f172.google.com (mail-qt0-f172.google.com [209.85.216.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5B9E620834; Thu, 30 Aug 2018 15:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1535644282; bh=Ge7u50KM178hS1srxJrueZTFvb1rDyK4EtOX9N20+hU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=cV+8521lOC7KBfvk1xCqQqIC+I/AADvUOV0zDByqbdu4JpkzmnAMwm8VlF/7UDZjE h5WNnD+GXfWe1JPgezfyKZdOLejoHXtE6A9eAc+aJEX1FksZ5FV3/JGrC1/i6/hT6+ P8fvEBVMkgTGchv9nwJgLvJIMcQqdnKMw4vJIok8= Received: by mail-qt0-f172.google.com with SMTP id z8-v6so10630571qto.9; Thu, 30 Aug 2018 08:51:22 -0700 (PDT) X-Gm-Message-State: APzg51B4bFWQ1ozQWF5iY8qbjqHCtGY5jQ00Z7ABtbue3mpcqa6grp5r yL0SzYfyKrVTEVQqTHIPG5uYiFntacMfLOx0sg== X-Received: by 2002:aed:2aa1:: with SMTP id t30-v6mr12532768qtd.101.1535644281600; Thu, 30 Aug 2018 08:51:21 -0700 (PDT) MIME-Version: 1.0 References: <20180827082153.22537-1-johan@kernel.org> <20180827082153.22537-2-johan@kernel.org> In-Reply-To: <20180827082153.22537-2-johan@kernel.org> From: Rob Herring Date: Thu, 30 Aug 2018 10:51:09 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/9] of: add helper to lookup compatible child node To: Johan Hovold Cc: Greg Kroah-Hartman , Frank Rowand , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 27, 2018 at 3:22 AM Johan Hovold wrote: > > Add of_get_compatible_child() helper that can be used to lookup > compatible child nodes. > > Several drivers currently use of_find_compatible_node() to lookup child > nodes while failing to notice that the of_find_ functions search the > entire tree depth-first (from a given start node) and therefore can > match unrelated nodes. The fact that these functions also drop a > reference to the node they start searching from (e.g. the parent node) > is typically also overlooked, something which can lead to use-after-free > bugs. > > Signed-off-by: Johan Hovold > --- > drivers/of/base.c | 25 +++++++++++++++++++++++++ > include/linux/of.h | 8 ++++++++ > 2 files changed, 33 insertions(+) I've applied this one and plan to send to Linus tomorrow. Rob