From patchwork Tue Jun 20 22:02:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Rowand X-Patchwork-Id: 778522 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wshs54CT7z9s0m for ; Wed, 21 Jun 2017 08:11:53 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uvXGR0Sz"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wshs535jrzDqjv for ; Wed, 21 Jun 2017 08:11:53 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uvXGR0Sz"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3wshgX45PLzDqhp for ; Wed, 21 Jun 2017 08:03:36 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uvXGR0Sz"; dkim-atps=neutral Received: by mail-pf0-x241.google.com with SMTP id y7so26163571pfd.3 for ; Tue, 20 Jun 2017 15:03:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=/nEVhJkF31LxdHju9BBDXy2IwCbeOFEFHFXeON0pQyY=; b=uvXGR0Szvl7cLQozXTDeQvQWPOGuFYUiujqyfURBWIvW339C+L8YBVp8/lCa73SdcX iYYIn3wGrIV0knVZtdlfyprNDQep12oP07g8pB8YAhZaHv3CgTaQu/WbsA5XC1COe6L9 btfdZqMgylJdL6mPlb04ASY5wWNOY8Bk+ptqG0plNF03zTjCZk8RpumwCW7ci3ZXT6yQ HMXoOpZNPybfaKa0goFmDiG4dBsHm+dq3L7zGXHVJvIFf9CFo1Wf3KwAYrt4vDBpQ6sq ZR28yShCujEAIbc+176lc/Q4kH8wShsisiCEtNFl2YYysC+Yvb//vqVIkWmaT+0h8aAr CXkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=/nEVhJkF31LxdHju9BBDXy2IwCbeOFEFHFXeON0pQyY=; b=f4He881AmmlPzccEj8037kvMA37zngLiYnBl9LNF/ybRgIwxYKGZSkopR8tg30WC9D KJAc1uIfQx4YxlQCKK0svd5UPSXiwNPUfERnYPpJf7tiY6Bd+G4J8kFSY432PYqxGF5w FJOTtWx0/27m2oTunw2tv03i3mA7Bfj9MkRlHrggkNgpY5ccxQhMR1a+vS9q2vOB+a7N ztSfH5nCp69RPoyjvTTvvwhc7vJRNj4A3+HvfkZUI9IDZ2gTHjy9/zDth+4XvWL0KGP+ dgBOr0/tYhNmBYWvk/GWe/yFPed9uPET250/pA5xCmPH5HKkUUnu9GIWfDtiS/U/1AyK TVLw== X-Gm-Message-State: AKS2vOzB1xVvNHhVNttyO0sGHkizawrqoaoeGTW1LgPiggciMfYhVCoW HJQbTPd2QYQ0DA== X-Received: by 10.98.13.9 with SMTP id v9mr9471568pfi.176.1497996214977; Tue, 20 Jun 2017 15:03:34 -0700 (PDT) Received: from localhost.localdomain (c-73-93-215-6.hsd1.ca.comcast.net. [73.93.215.6]) by smtp.gmail.com with ESMTPSA id c66sm25979462pfl.81.2017.06.20.15.03.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Jun 2017 15:03:34 -0700 (PDT) From: frowand.list@gmail.com To: Rob Herring Subject: [PATCH v6 4/4] of: detect invalid phandle in overlay Date: Tue, 20 Jun 2017 15:02:52 -0700 Message-Id: <1497996172-821-5-git-send-email-frowand.list@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1497996172-821-1-git-send-email-frowand.list@gmail.com> References: <1497996172-821-1-git-send-email-frowand.list@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Frank Rowand Overlays are not allowed to modify phandle values of previously existing nodes because there is no information available to allow fixup up properties that use the previously existing phandle. Signed-off-by: Frank Rowand --- drivers/of/overlay.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c index ca0b85f5deb1..20ab49d2f7a4 100644 --- a/drivers/of/overlay.c +++ b/drivers/of/overlay.c @@ -130,6 +130,10 @@ static int of_overlay_apply_single_device_node(struct of_overlay *ov, /* NOTE: Multiple mods of created nodes not supported */ tchild = of_get_child_by_name(target, cname); if (tchild != NULL) { + /* new overlay phandle value conflicts with existing value */ + if (child->phandle) + return -EINVAL; + /* apply overlay recursively */ ret = of_overlay_apply_one(ov, tchild, child); of_node_put(tchild);