Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp3805863ima; Tue, 23 Oct 2018 11:33:58 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Z43nEU+g0JkOT6oQwaoXpfF+fM9q8KsdxZzthQgRtTrE3Xi3U5o46IX2fSOKjcVpdFa33 X-Received: by 2002:a63:a309:: with SMTP id s9-v6mr47911938pge.106.1540319637948; Tue, 23 Oct 2018 11:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540319637; cv=none; d=google.com; s=arc-20160816; b=zrd0OQYQ5D4S+3lredD+mGvQVS/uX3E7ToEK9XxWELwgqxiBmN6JcNtprKO1ydwX/F ZpeDsRGElWeqQBiCHgLkwUDQGLl4v9RttkSiPh7LX+poFS9HMCUswfwBGm1E5LcP06Bd CWDltFkjQzz+vGcpyRCpN9CMY/duvBUrRvC7k6YZVD4qBQWQ+yryN1Z8H1f/feXPQ04G OSUcxVaoMQ5Zyi7hcRflFOIKDwlZtMOAFXQNBxGLZ5cXZOiyZRWSnBejhLCVFzQuvfd1 NcncgzI0X4kZuEXUxG7LOX8kZLKlRNJOCeIZpqvJKl6OCT3jV2nBzUXucLoIFsVf5nJ6 HOcQ== 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; bh=1Pba+42o/HXDd2M4xjxdVxOTeJ0oV4Zhebdo/RytTnA=; b=gVSX1IOSc18BSp2SqDdeeUmzjk3K6infGyUqEZcTnjhXFL7TZC3t0/ewDi//E7QfmJ J4ofMAwaLGTnISD9T8/4AF9JNjlWtZ9ISgYo3jtVYVGxh2K677zrmVzajXztvIKMAahT AJnrNo5GGI3d/2PKhcSUZj9Jd3AED/Lj6bakGzaKCVdXS8qXhyuwB3fX7zyznrutEmsN GxiJD1zw9kVmVGpJmc/1rk7Fqmda1t1mMYhkqmggmxeWnpnvLS6Q46arMjWQgPfk6iSG ca4nuordtnrFy5v9r93JeoKge86Mybf49JJ/dfvzJ+mbh/a6lVUaGmUefCZpX00+bo+G CohA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=hD5l0apg; 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 w185-v6si84306pfb.21.2018.10.23.11.33.41; Tue, 23 Oct 2018 11:33:57 -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=hD5l0apg; 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 S1728609AbeJXC5m (ORCPT + 99 others); Tue, 23 Oct 2018 22:57:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:39164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728052AbeJXC5m (ORCPT ); Tue, 23 Oct 2018 22:57:42 -0400 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 D346220831; Tue, 23 Oct 2018 18:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540319589; bh=vQwS10vd0zr83qVSpClYGcvnr7q8sZo2AZtAFLobAIU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=hD5l0apgV/cDPkg1mx7SJPwR8gldcVvBXPxPY175ggH5JXnhSluvB8MS1QsqUmBJx nHZuyDoRRqf3aAI+YwgHfdqsK8/4i8dTNzSQNkIjuGpg10dExNyHPGXc1dH4et3g7L aZNhYPAd3h2biy4/NEvGhCCYnujyWhhbzb+GK0ZA= Received: by mail-qk1-f179.google.com with SMTP id x8-v6so1497523qka.4; Tue, 23 Oct 2018 11:33:08 -0700 (PDT) X-Gm-Message-State: ABuFfogSmI8lwMG2FbRTW79zRirJUAeqopAxrpJfSN1V7GKrpfU0YyrB kBmVzsT3Q3cC3FdY406o7I6COzpp6/9/Nk3E/w== X-Received: by 2002:a37:ddcf:: with SMTP id u76-v6mr46675895qku.184.1540319587953; Tue, 23 Oct 2018 11:33:07 -0700 (PDT) MIME-Version: 1.0 References: <20180827082153.22537-1-johan@kernel.org> <20180904130557.GT28861@localhost> <20181023091951.GC20058@localhost> In-Reply-To: <20181023091951.GC20058@localhost> From: Rob Herring Date: Tue, 23 Oct 2018 13:32:56 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 0/9] of: fix compatible-child-node lookups To: Johan Hovold Cc: Greg Kroah-Hartman , Frank Rowand , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , CK Hu , Philipp Zabel , Rob Clark , David Airlie , Ulf Hansson , Josh Wu , Boris Brezillon , Doug Berger , Florian Fainelli , David Miller , Giuseppe CAVALLARO , Alexandre Torgue , joabreu@synopsys.com, Samuel Ortiz , Sebastian Reichel , Martin Blumenstingl 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 Tue, Oct 23, 2018 at 4:21 AM Johan Hovold wrote: > > Hi Rob, > > On Tue, Sep 04, 2018 at 03:05:57PM +0200, Johan Hovold wrote: > > Hi all, > > > > On Mon, Aug 27, 2018 at 10:21:44AM +0200, Johan Hovold wrote: > > > 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 (e.g. after > > > probe deferrals). > > > > > > This series adds a new helper, similar to of_get_child_by_name(), > > > that can be used to lookup compatible child nodes, and uses the new > > > helper to fix child-node lookups throughout the tree. > > > > > > This is related to the fixes I posted about a year ago, which addressed > > > a similar anti-pattern when looking up child nodes by name. Since it > > > took me more than a year to get all those fixes into Linus' tree (one > > > fix is still pending), and as these fixes depend on the new helper, I'm > > > suggesting that these all go in through Rob's or Greg's trees. > > > > > > Alternatively, the helper could go into to -rc2, and I'll be pinging > > > submaintainers for the coming year as well. ;) > > > > Rob has gotten the helper into -rc2 now: > > > > 36156f9241cb of: add helper to lookup compatible child node > > > > so feel free to pick these fixes up directly for 4.19-rc or -next, > > whichever you prefer. I've been able to trigger crashes after probe > > deferrals due to the use-after-free, but this seems unlikely to be > > exploitable. > > > > I think Rob will be picking up any patches that remain by the end of the > > release cycle for 4.20. > > So far only Ulf has picked up the mmc patch below directly, so if you > could take the rest through your tree for -rc1 that would be great. Thanks for the reminder, though before the merge window opened would have been better. I've applied all but the mtd patch. Rob