From patchwork Fri Nov 9 06:56:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Rowand X-Patchwork-Id: 995359 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42rrZh0WFXz9s55 for ; Fri, 9 Nov 2018 17:58:04 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oe5HHdak"; 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 42rrZg68SZzF3W3 for ; Fri, 9 Nov 2018 17:58:03 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com 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="oe5HHdak"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::442; helo=mail-pf1-x442.google.com; envelope-from=frowand.list@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="oe5HHdak"; dkim-atps=neutral Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (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 42rrXd5t43zF3Gr for ; Fri, 9 Nov 2018 17:56:17 +1100 (AEDT) Received: by mail-pf1-x442.google.com with SMTP id b81-v6so3547pfe.11 for ; Thu, 08 Nov 2018 22:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:cc:from:subject:message-id:date:user-agent:mime-version :content-language:content-transfer-encoding; bh=ZfD90Hvp0FuovJUhMX05MqKYD8ZCEtw5w94uyNFI8Qo=; b=oe5HHdakLh9BH1W8MU3AFu1RzNoBlN/4tVsxRE/UQYqJI8N4qTm8fx2e0OcSlKqlP5 O23wL4TRdei2KvgdoUFmb5KNYUk/KkkQmpYzkALD2XF6565COSai4DIhcKSmY+iCX5rg cSKz+Fi3+gDqQvJsPq7rYh8NYEaY5p1FBrYa4kZKDSD1vIq8nsQe0SmMLdTeofHGmPV+ YVPgnXcJSNFDuKN04oFZ4yRoKp27EVetYuSal8ZUbmJW1imjT2+tlpnxeRRJBKJr4xxA 8rNSnpT/ZSsWe1JVbb1j4O0kynwZevYWdKt+ZigJX9h0qWpFgya5lUuY5SLH8XrJ5kP8 bfgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=ZfD90Hvp0FuovJUhMX05MqKYD8ZCEtw5w94uyNFI8Qo=; b=eyyracwEa7dZ/rLc54Xsiezd+UCAzA3IHLghwNd0CWrQ1Mi128ZGR+369REnqjBLq+ AQUhxtEmCdVCaMQSKJ4WvdzpPzAvtMWwLdDcvdstxUBWNW06h0mYbBuPMq07mOH50PJe sKhokhJlJklhtafUDFtuqp6FNVfykZLIfT9ChTGO2LbokQLwE0kUI1IYb9uw51VPC8Kv 8ZysYZt6c8tshzZnkblWQ049v/5WgwjgWXF5nDKYAAwlsOPUBQhbTC33t5Io59++Foin FptyBCDIS69yU64ZxwB0k1qAS1WWWkRfF45g4hn7P1OPKkuY4h1cNLbQv6xYPKtMmlED J5eA== X-Gm-Message-State: AGRZ1gKfwXeZPRflkVBl3r5anTRsWb3jp8S0Em9HJR8ND0RrY5p7+lYi zg5Z4HcGjw3pQMEPQZny618= X-Google-Smtp-Source: AJdET5cJP7EBKyx+ty0Uz7zyAJ2LqRX4p3tJUuzYGVqeJCbd8TVYNpQ14Vj7fd2VGQAfhDcD+tqivQ== X-Received: by 2002:a62:160c:: with SMTP id 12-v6mr7776030pfw.45.1541746575691; Thu, 08 Nov 2018 22:56:15 -0800 (PST) Received: from [192.168.1.70] (c-24-6-192-50.hsd1.ca.comcast.net. [24.6.192.50]) by smtp.gmail.com with ESMTPSA id e65-v6sm7181502pfa.90.2018.11.08.22.56.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Nov 2018 22:56:15 -0800 (PST) To: Rob Herring , Pantelis Antoniou , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Alan Tull , Moritz Fischer From: Frank Rowand Subject: [GIT PULL] of: overlay: validation checks, subsequent fixes for v20 Message-ID: <262419e9-5c9f-1193-f119-33f373d81e43@gmail.com> Date: Thu, 8 Nov 2018 22:56:13 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 Content-Language: en-US X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 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" , linux-fpga@vger.kernel.org, linuxppc-dev , "linux-kernel@vger.kernel.org" Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Hi Rob, Please pull the changes to add the overlay validation checks. This is the v7 version of the patch series. -Frank The following changes since commit 651022382c7f8da46cb4872a545ee1da6d097d2a: Linux 4.20-rc1 (2018-11-04 15:37:52 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/frowand/linux.git tags/kfree_validate_v7-for-4.20 for you to fetch changes up to eeb07c573ec307c53fe2f6ac6d8d11c261f64006: of: unittest: initialize args before calling of_*parse_*() (2018-11-08 22:12:37 -0800) ---------------------------------------------------------------- Add checks to (1) overlay apply process and (2) memory freeing triggered by overlay release. The checks are intended to detect possible memory leaks and invalid overlays. The checks revealed bugs in existing code. Fixed the bugs. While fixing bugs, noted other issues, which are fixed in separate patches. ---------------------------------------------------------------- Frank Rowand (17): of: overlay: add tests to validate kfrees from overlay removal of: overlay: add missing of_node_put() after add new node to changeset of: overlay: add missing of_node_get() in __of_attach_node_sysfs powerpc/pseries: add of_node_put() in dlpar_detach_node() of: overlay: use prop add changeset entry for property in new nodes of: overlay: do not duplicate properties from overlay for new nodes of: overlay: reorder fields in struct fragment of: overlay: validate overlay properties #address-cells and #size-cells of: overlay: make all pr_debug() and pr_err() messages unique of: overlay: test case of two fragments adding same node of: overlay: check prevents multiple fragments add or delete same node of: overlay: check prevents multiple fragments touching same property of: unittest: remove unused of_unittest_apply_overlay() argument of: overlay: set node fields from properties when add new overlay node of: unittest: allow base devicetree to have symbol metadata of: unittest: find overlays[] entry by name instead of index of: unittest: initialize args before calling of_*parse_*() arch/powerpc/platforms/pseries/dlpar.c | 2 + drivers/of/dynamic.c | 59 ++++- drivers/of/kobj.c | 4 +- drivers/of/overlay.c | 292 ++++++++++++++++----- drivers/of/unittest-data/Makefile | 2 + .../of/unittest-data/overlay_bad_add_dup_node.dts | 28 ++ .../of/unittest-data/overlay_bad_add_dup_prop.dts | 24 ++ drivers/of/unittest-data/overlay_base.dts | 1 + drivers/of/unittest.c | 96 +++++-- include/linux/of.h | 21 +- 10 files changed, 432 insertions(+), 97 deletions(-) create mode 100644 drivers/of/unittest-data/overlay_bad_add_dup_node.dts create mode 100644 drivers/of/unittest-data/overlay_bad_add_dup_prop.dts