1. 30 Nov, 2018 2 commits
  2. 29 Nov, 2018 1 commit
    • Rob Herring's avatar
      scripts/dtc: Update to upstream version v1.4.7-57-gf267e674d145 · c2e7075c
      Rob Herring authored
      This adds the following commits from upstream:
      
      f267e674d145 checks: Fix crash with multiple source annotations
      3616b9a811b6 checks: Use source position information for check failures
      2bdbd07a1223 checks: Make each message output atomic
      a1eff70c02cf util: Add xa{v}sprintf_append functions
      82a52ce4573b libfdt: Add a test for fdt_getprop_by_offset()
      607b8586b383 PEP8 / Flake8 cleanups for setup.py
      f9c0a425b648 Remove broken objdir / srcdir support
      5182b5e6f28c pylibfdt: Use common PREFIX variable
      d45bf1f5f2a6 Refine make tests_clean target
      99284c4db9cb Refine pylibfdt_clean target
      a4629cfaedfb Refine libfdt_clean target
      08380fc43aa2 tests: Use modern octal literals for Python
      8113c00b99d3 pylibfdt: Allow switch to Python 3 via environment variable PYTHON
      11738cf01f15 libfdt: Don't use memcpy to handle unaligned reads on ARM
      86a288a73670 checks: Restructure check_msg to decrease indentation
      5667e7ef9a9a annotations: add the annotation functionality
      8e20ccf52f90 annotations: add positions
      ca930e20bb54 tests: Don't lose errors from make checkm
      43366bb4eeee tests: Property count valgrind errors in wrapped tests
      5062516fb8cb srcpos: Remove srcpos_empty
      a3143fafbf83 Revert "annotations: add positions"
      403cc79f06a1 checks: Update SPI bus check for 'spi-slave'
      baa1d2cf7894 annotations: add positions
      ff2ad38f6a5a Merge remote-tracking branch 'origin/pr/18'
      aa7254d9cb17 libfdt: return correct value if #size-cells property is not present
      49903aed7783 use ptrdiff_t modifier for printing pointer differences
      da2b691ccf68 treesource: Fix dts output for phandles in middle of a sequence of ints
      8f8b77a0d62d tests: Wrap check_align() calls with base_run_test()
      522d81d572f2 Fix dts output with a REF_PATH marker
      e45198c98359 Added test cases for target references
      0fcffda15e9f Merge nodes with local target label references
      1e4a0928f3b3 pylibfdt: Don't have setup.py depend on where it's invoked from
      ca399b14956f pylibfdt: Eliminate run_setup make function
      98972f1b3e33 pylibfdt: Improved version extraction
      7ba2be6cda5f pylibfdt: Don't silence setup.py when V=1
      7691f9d39301 pylibfdt: Make SETUP make variable
      855b9963def9 pylibfdt: Simpler CFLAGS handling
      47cafbeeb977 pylibfdt: Link extension module with libfdt rather than rebuilding
      dd695d6afb19 pylibfdt: Correctly set build output directory
      59327523d0d8 pylibfdt: We don't need include files from the base directory
      e84742aa7b93 checks: fix simple-bus compatible matching
      8c59a97ce096 Fix missing labels when emitting dts format
      d448f9a5fd94 Revert dts output formatting changes of spaces around brackets
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      c2e7075c
  3. 27 Nov, 2018 6 commits
  4. 26 Nov, 2018 6 commits
  5. 16 Nov, 2018 2 commits
  6. 09 Nov, 2018 19 commits
    • Rob Herring's avatar
      Merge tag 'kfree_validate_v7-for-4.20' of... · f8274f14
      Rob Herring authored
      Merge tag 'kfree_validate_v7-for-4.20' of git://git.kernel.org/pub/scm/linux/kernel/git/frowand/linux into dt/next
      
      Pull overlay validation checks from Frank Rowand:
      
      "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."
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      f8274f14
    • Rob Herring's avatar
      of/pdt: Remove unused of_pdt_build_more function ptr · 1ae367a2
      Rob Herring authored
      There are no users of of_pdt_build_more since 2012, so remove it.
      
      Cc: Frank Rowand <frowand.list@gmail.com>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      1ae367a2
    • Frank Rowand's avatar
      of: unittest: initialize args before calling of_*parse_*() · eeb07c57
      Frank Rowand authored
      Callers of of_irq_parse_one() blindly use the pointer args.np
      without checking whether of_irq_parse_one() had an error and
      thus did not set the value of args.np.  Initialize args to
      zero so that using the format "%pOF" to show the value of
      args.np will show "(null)" when of_irq_parse_one() has an
      error.  This prevents the dereference of a random value.
      
      Make the same fix for callers of of_parse_phandle_with_args()
      and of_parse_phandle_with_args_map().
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      eeb07c57
    • Frank Rowand's avatar
      of: unittest: find overlays[] entry by name instead of index · 160b1d4e
      Frank Rowand authored
      One accessor of overlays[] was using a hard coded index value to
      find the correct array entry instead of searching for the entry
      containing the correct name.
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      160b1d4e
    • Frank Rowand's avatar
      of: unittest: allow base devicetree to have symbol metadata · 5babefb7
      Frank Rowand authored
      The overlay metadata nodes in the FDT created from testcases.dts
      are not handled properly.
      
      The __fixups__ and __local_fixups__ node were added to the live
      devicetree, but should not be.
      
      Only the first property in the /__symbols__ node was added to the
      live devicetree if the live devicetree already contained a
      /__symbols node.  All of the node's properties must be added.
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      5babefb7
    • Frank Rowand's avatar
      of: overlay: set node fields from properties when add new overlay node · f9627881
      Frank Rowand authored
      Overlay nodes added by add_changeset_node() do not have the node
      fields name, phandle, and type set.
      
      The node passed to __of_attach_node() when the add node changeset
      entry is processed does not contain any properties.  The node's
      properties are located in add property changeset entries that will
      be processed after the add node changeset is applied.
      
      Set the node's fields in the node contained in the add node
      changeset entry and do not set them to incorrect values in
      add_changeset_node().
      
      A visible symptom that is fixed by this patch is the names of nodes
      added by overlays that have an entry in /sys/bus/platform/drivers/*/
      will contain the unit-address but the node-name will be <NULL>,  for
      example, "fc4ab000.<NULL>".  After applying the patch the name, in
      this example, for node restart@fc4ab000 is "fc4ab000.restart".
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      f9627881
    • Frank Rowand's avatar
      of: unittest: remove unused of_unittest_apply_overlay() argument · 8c329655
      Frank Rowand authored
      Argument unittest_nr is not used in of_unittest_apply_overlay(),
      remove it.
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      8c329655
    • Frank Rowand's avatar
      of: overlay: check prevents multiple fragments touching same property · 2fe0e876
      Frank Rowand authored
      Add test case of two fragments updating the same property.  After
      adding the test case, the system hangs at end of boot, after
      after slub stack dumps from kfree() in crypto modprobe code.
      
      Multiple overlay fragments adding, modifying, or deleting the same
      property is not supported.  Add check to detect the attempt and fail
      the overlay apply.
      
      Before this patch, the first fragment error would terminate
      processing.  Allow fragment checking to proceed and report all
      of the fragment errors before terminating the overlay apply. This
      is not a hot path, thus not a performance issue (the error is not
      transient and requires fixing the overlay before attempting to
      apply it again).
      
      After applying this patch, the devicetree unittest messages will
      include:
      
         OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail
      
         ...
      
         ### dt-test ### end of unittest - 212 passed, 0 failed
      
      The check to detect two fragments updating the same property is
      folded into the patch that created the test case to maintain
      bisectability.
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      2fe0e876
    • Frank Rowand's avatar
      of: overlay: check prevents multiple fragments add or delete same node · c168263b
      Frank Rowand authored
      Multiple overlay fragments adding or deleting the same node is not
      supported.  Replace code comment of such, with check to detect the
      attempt and fail the overlay apply.
      
      Devicetree unittest where multiple fragments added the same node was
      added in the previous patch in the series.  After applying this patch
      the unittest messages will no longer include:
      
         Duplicate name in motor-1, renamed to "controller#1"
         OF: overlay: of_overlay_apply() err=0
         ### dt-test ### of_overlay_fdt_apply() expected -22, ret=0, overlay_bad_add_dup_node
         ### dt-test ### FAIL of_unittest_overlay_high_level():2419 Adding overlay 'overlay_bad_add_dup_node' failed
      
         ...
      
         ### dt-test ### end of unittest - 210 passed, 1 failed
      
      but will instead include:
      
         OF: overlay: ERROR: multiple overlay fragments add and/or delete node /testcase-data-2/substation@100/motor-1/controller
      
         ...
      
         ### dt-test ### end of unittest - 211 passed, 0 failed
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      c168263b
    • Frank Rowand's avatar
      of: overlay: test case of two fragments adding same node · a68238a1
      Frank Rowand authored
      Multiple overlay fragments adding or deleting the same node is not
      supported.  An attempt to do so results in an incorrect devicetree.
      The node name will be munged for the second add.
      
      After adding this patch, the unittest messages will show:
      
         Duplicate name in motor-1, renamed to "controller#1"
         OF: overlay: of_overlay_apply() err=0
         ### dt-test ### of_overlay_fdt_apply() expected -22, ret=0, overlay_bad_add_dup_node
         ### dt-test ### FAIL of_unittest_overlay_high_level():2419 Adding overlay 'overlay_bad_add_dup_node' failed
      
         ...
      
         ### dt-test ### end of unittest - 210 passed, 1 failed
      
      The incorrect (munged) node name "controller#1" can be seen in the
      /proc filesystem:
      
         $ pwd
         /proc/device-tree/testcase-data-2/substation@100/motor-1
         $ ls
         compatible    controller    controller#1  name          phandle       spin
         $ ls controller
         power_bus
         $ ls controller#1
         power_bus_emergency
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      a68238a1
    • Frank Rowand's avatar
      of: overlay: make all pr_debug() and pr_err() messages unique · a15e824f
      Frank Rowand authored
      Make overlay.c debug and error messages unique so that they can be
      unambiguously found by grep.
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      a15e824f
    • Frank Rowand's avatar
      of: overlay: validate overlay properties #address-cells and #size-cells · 6f751188
      Frank Rowand authored
      If overlay properties #address-cells or #size-cells are already in
      the live devicetree for any given node, then the values in the
      overlay must match the values in the live tree.
      
      If the properties are already in the live tree then there is no
      need to create a changeset entry to add them since they must
      have the same value.  This reduces the memory used by the
      changeset and eliminates a possible memory leak.
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      6f751188
    • Frank Rowand's avatar
      of: overlay: reorder fields in struct fragment · 81225ea6
      Frank Rowand authored
      Order the fields of struct fragment in the same order as
      struct of_overlay_notify_data.  The order in struct fragment is
      not significant.  If both structs are ordered the same then when
      examining the data in a debugger or dump the human involved does
      not have to remember which context they are examining.
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      81225ea6
    • Frank Rowand's avatar
      of: overlay: do not duplicate properties from overlay for new nodes · 8814dc46
      Frank Rowand authored
      When allocating a new node, add_changeset_node() was duplicating the
      properties from the respective node in the overlay instead of
      allocating a node with no properties.
      
      When this patch is applied the errors reported by the devictree
      unittest from patch "of: overlay: add tests to validate kfrees from
      overlay removal" will no longer occur.  These error messages are of
      the form:
      
         "OF: ERROR: ..."
      
      and the unittest results will change from:
      
         ### dt-test ### end of unittest - 203 passed, 7 failed
      
      to
      
         ### dt-test ### end of unittest - 210 passed, 0 failed
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      8814dc46
    • Frank Rowand's avatar
      of: overlay: use prop add changeset entry for property in new nodes · 6b4955ba
      Frank Rowand authored
      The changeset entry 'update property' was used for new properties in
      an overlay instead of 'add property'.
      
      The decision of whether to use 'update property' was based on whether
      the property already exists in the subtree where the node is being
      spliced into.  At the top level of creating a changeset describing the
      overlay, the target node is in the live devicetree, so checking whether
      the property exists in the target node returns the correct result.
      As soon as the changeset creation algorithm recurses into a new node,
      the target is no longer in the live devicetree, but is instead in the
      detached overlay tree, thus all properties are incorrectly found to
      already exist in the target.
      
      This fix will expose another devicetree bug that will be fixed
      in the following patch in the series.
      
      When this patch is applied the errors reported by the devictree
      unittest will change, and the unittest results will change from:
      
         ### dt-test ### end of unittest - 210 passed, 0 failed
      
      to
      
         ### dt-test ### end of unittest - 203 passed, 7 failed
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      6b4955ba
    • Frank Rowand's avatar
      powerpc/pseries: add of_node_put() in dlpar_detach_node() · 5b3f5c40
      Frank Rowand authored
      The previous commit, "of: overlay: add missing of_node_get() in
      __of_attach_node_sysfs" added a missing of_node_get() to
      __of_attach_node_sysfs().  This results in a refcount imbalance
      for nodes attached with dlpar_attach_node().  The calling sequence
      from dlpar_attach_node() to __of_attach_node_sysfs() is:
      
         dlpar_attach_node()
            of_attach_node()
               __of_attach_node_sysfs()
      
      For more detailed description of the node refcount, see
      commit 68baf692 ("powerpc/pseries: Fix of_node_put() underflow
      during DLPAR remove").
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Acked-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      5b3f5c40
    • Frank Rowand's avatar
      of: overlay: add missing of_node_get() in __of_attach_node_sysfs · 5b2c2f5a
      Frank Rowand authored
      There is a matching of_node_put() in __of_detach_node_sysfs()
      
      Remove misleading comment from function header comment for
      of_detach_node().
      
      This patch may result in memory leaks from code that directly calls
      the dynamic node add and delete functions directly instead of
      using changesets.
      
      This commit should result in powerpc systems that dynamically
      allocate a node, then later deallocate the node to have a
      memory leak when the node is deallocated.
      
      The next commit will fix the leak.
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      5b2c2f5a
    • Frank Rowand's avatar
      of: overlay: add missing of_node_put() after add new node to changeset · 7c528e45
      Frank Rowand authored
      The refcount of a newly added overlay node decrements to one
      (instead of zero) when the overlay changeset is destroyed.  This
      change will cause the final decrement be to zero.
      
      After applying this patch, new validation warnings will be
      reported from the devicetree unittest during boot due to
      a pre-existing devicetree bug.  The warnings will be similar to:
      
        OF: ERROR: memory leak before free overlay changeset,  /testcase-data/overlay-node/test-bus/test-unittest4
      
      This pre-existing devicetree bug will also trigger a WARN_ONCE() from
      refcount_sub_and_test_checked() when an overlay changeset is
      destroyed without having first been applied.  This scenario occurs
      when an error in the overlay is detected during the overlay changeset
      creation:
      
        WARNING: CPU: 0 PID: 1 at lib/refcount.c:187 refcount_sub_and_test_checked+0xa8/0xbc
        refcount_t: underflow; use-after-free.
      
        (unwind_backtrace) from (show_stack+0x10/0x14)
        (show_stack) from (dump_stack+0x6c/0x8c)
        (dump_stack) from (__warn+0xdc/0x104)
        (__warn) from (warn_slowpath_fmt+0x44/0x6c)
        (warn_slowpath_fmt) from (refcount_sub_and_test_checked+0xa8/0xbc)
        (refcount_sub_and_test_checked) from (kobject_put+0x24/0x208)
        (kobject_put) from (of_changeset_destroy+0x2c/0xb4)
        (of_changeset_destroy) from (free_overlay_changeset+0x1c/0x9c)
        (free_overlay_changeset) from (of_overlay_remove+0x284/0x2cc)
        (of_overlay_remove) from (of_unittest_apply_revert_overlay_check.constprop.4+0xf8/0x1e8)
        (of_unittest_apply_revert_overlay_check.constprop.4) from (of_unittest_overlay+0x960/0xed8)
        (of_unittest_overlay) from (of_unittest+0x1cc4/0x2138)
        (of_unittest) from (do_one_initcall+0x4c/0x28c)
        (do_one_initcall) from (kernel_init_freeable+0x29c/0x378)
        (kernel_init_freeable) from (kernel_init+0x8/0x110)
        (kernel_init) from (ret_from_fork+0x14/0x2c)
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      7c528e45
    • Frank Rowand's avatar
      of: overlay: add tests to validate kfrees from overlay removal · 144552c7
      Frank Rowand authored
      Add checks:
        - attempted kfree due to refcount reaching zero before overlay
          is removed
        - properties linked to an overlay node when the node is removed
        - node refcount > one during node removal in a changeset destroy,
          if the node was created by the changeset
      
      After applying this patch, several validation warnings will be
      reported from the devicetree unittest during boot due to
      pre-existing devicetree bugs. The warnings will be similar to:
      
        OF: ERROR: of_node_release(), unexpected properties in /testcase-data/overlay-node/test-bus/test-unittest11
        OF: ERROR: memory leak, expected refcount 1 instead of 2, of_node_get()/of_node_put() unbalanced - destroy cset entry: attach overlay node /testcase-data-2/substation@100/
        hvac-medium-2
      Tested-by: default avatarAlan Tull <atull@kernel.org>
      Signed-off-by: default avatarFrank Rowand <frank.rowand@sony.com>
      144552c7
  7. 05 Nov, 2018 1 commit
  8. 04 Nov, 2018 3 commits
    • Linus Torvalds's avatar
      Linux 4.20-rc1 · 65102238
      Linus Torvalds authored
      65102238
    • Linus Torvalds's avatar
      Merge tag 'tags/upstream-4.20-rc1' of git://git.infradead.org/linux-ubifs · 42bd06e9
      Linus Torvalds authored
      Pull UBIFS updates from Richard Weinberger:
      
       - Full filesystem authentication feature, UBIFS is now able to have the
         whole filesystem structure authenticated plus user data encrypted and
         authenticated.
      
       - Minor cleanups
      
      * tag 'tags/upstream-4.20-rc1' of git://git.infradead.org/linux-ubifs: (26 commits)
        ubifs: Remove unneeded semicolon
        Documentation: ubifs: Add authentication whitepaper
        ubifs: Enable authentication support
        ubifs: Do not update inode size in-place in authenticated mode
        ubifs: Add hashes and HMACs to default filesystem
        ubifs: authentication: Authenticate super block node
        ubifs: Create hash for default LPT
        ubfis: authentication: Authenticate master node
        ubifs: authentication: Authenticate LPT
        ubifs: Authenticate replayed journal
        ubifs: Add auth nodes to garbage collector journal head
        ubifs: Add authentication nodes to journal
        ubifs: authentication: Add hashes to index nodes
        ubifs: Add hashes to the tree node cache
        ubifs: Create functions to embed a HMAC in a node
        ubifs: Add helper functions for authentication support
        ubifs: Add separate functions to init/crc a node
        ubifs: Format changes for authentication support
        ubifs: Store read superblock node
        ubifs: Drop write_node
        ...
      42bd06e9
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-4.20-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 4710e789
      Linus Torvalds authored
      Pull NFS client bugfixes from Trond Myklebust:
       "Highlights include:
      
        Bugfix:
         - Fix build issues on architectures that don't provide 64-bit cmpxchg
      
        Cleanups:
         - Fix a spelling mistake"
      
      * tag 'nfs-for-4.20-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
        NFS: fix spelling mistake, EACCESS -> EACCES
        SUNRPC: Use atomic(64)_t for seq_send(64)
      4710e789