1. 10 8月, 2016 1 次提交
  2. 20 7月, 2016 1 次提交
  3. 19 7月, 2016 1 次提交
  4. 25 6月, 2016 1 次提交
    • F
      of: fix memory leak related to safe_name() · d9fc8807
      Frank Rowand 提交于
      Fix a memory leak resulting from memory allocation in safe_name().
      This patch fixes all call sites of safe_name().
      
      Mathieu Malaterre reported the memory leak on boot:
      
      On my PowerMac device-tree would generate a duplicate name:
      
      [    0.023043] device-tree: Duplicate name in PowerPC,G4@0, renamed to "l2-cache#1"
      
      in this case a newly allocated name is generated by `safe_name`. However
      in this case it is never deallocated.
      
      The bug was found using kmemleak reported as:
      
      unreferenced object 0xdf532e60 (size 32):
        comm "swapper", pid 1, jiffies 4294892300 (age 1993.532s)
        hex dump (first 32 bytes):
          6c 32 2d 63 61 63 68 65 23 31 00 dd e4 dd 1e c2  l2-cache#1......
          ec d4 ba ce 04 ec cc de 8e 85 e9 ca c4 ec cc 9e  ................
        backtrace:
          [<c02d3350>] kvasprintf+0x64/0xc8
          [<c02d3400>] kasprintf+0x4c/0x5c
          [<c0453814>] safe_name.isra.1+0x80/0xc4
          [<c04545d8>] __of_attach_node_sysfs+0x6c/0x11c
          [<c075f21c>] of_core_init+0x8c/0xf8
          [<c0729594>] kernel_init_freeable+0xd4/0x208
          [<c00047e8>] kernel_init+0x24/0x11c
          [<c00158ec>] ret_from_kernel_thread+0x5c/0x64
      
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=120331Signed-off-by: NFrank Rowand <frank.rowand@am.sony.com>
      Reported-by: mathieu.malaterre@gmail.com
      Tested-by: NMathieu Malaterre <mathieu.malaterre@gmail.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NRob Herring <robh@kernel.org>
      d9fc8807
  5. 11 5月, 2016 1 次提交
    • S
      drivers/of: Add check for null property in of_remove_property() · 201b3fe5
      Suraj Jitindar Singh 提交于
      The validity of the property input argument to of_remove_property() is
      never checked within the function and thus it is possible to pass a null
      value. It happens that this will be picked up in __of_remove_property()
      as no matching property of the device node will be found and thus an
      error will be returned, however once again there is no explicit check
      for a null value. By the time this is detected 2 locks have already been
      acquired which is completely unnecessary if the property to remove is
      null.
      
      Add an explicit check in the function of_remove_property() for a null
      property value and return -ENODEV in this case, this is consistent with
      what the previous return value would have been when the null value was
      not detected and passed to __of_remove_property().
      
      By moving an explicit check for the property paramenter into the
      of_remove_property() function, this will remove the need to perform this
      check in calling code before invocation of the of_remove_property()
      function.
      Signed-off-by: NSuraj Jitindar Singh <sjitindarsingh@gmail.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NMichael Ellerman <mpe@ellerman.id.au>
      201b3fe5
  6. 25 4月, 2016 1 次提交
  7. 20 4月, 2016 5 次提交
  8. 04 3月, 2016 1 次提交
  9. 31 10月, 2015 1 次提交
  10. 23 6月, 2015 1 次提交
  11. 22 6月, 2015 1 次提交
  12. 04 6月, 2015 1 次提交
  13. 27 5月, 2015 1 次提交
  14. 25 5月, 2015 1 次提交
  15. 17 4月, 2015 1 次提交
  16. 15 4月, 2015 1 次提交
    • K
      of: Add helper function to check MMIO register endianness · 37786c7f
      Kevin Cernekee 提交于
      SoC peripherals can come in several different flavors:
      
       - little-endian: registers always need to be accessed in LE mode (so the
         kernel should perform a swap if the CPU is running BE)
      
       - big-endian: registers always need to be accessed in BE mode (so the
         kernel should perform a swap if the CPU is running LE)
      
       - native-endian: the bus will automatically swap accesses, so the kernel
         should never swap
      
      Introduce a function that checks an OF device node to see whether it
      contains a "big-endian" or "native-endian" property.  For the former case,
      always return true.  For the latter case, return true iff the kernel was
      built for BE (implying that the BE MMIO accessors do not perform a swap).
      Otherwise return false, assuming LE registers.
      
      LE registers are assumed by default because most existing drivers (libahci,
      serial8250, usb) always use readl/writel in the absence of instructions
      to the contrary, so that will be our fallback.
      Signed-off-by: NKevin Cernekee <cernekee@gmail.com>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NRob Herring <robh@kernel.org>
      37786c7f
  17. 19 3月, 2015 2 次提交
  18. 18 3月, 2015 1 次提交
  19. 10 3月, 2015 2 次提交
  20. 23 2月, 2015 2 次提交
  21. 04 2月, 2015 1 次提交
  22. 04 12月, 2014 2 次提交
  23. 28 11月, 2014 1 次提交
  24. 19 11月, 2014 2 次提交
  25. 05 11月, 2014 5 次提交
  26. 04 11月, 2014 2 次提交
    • G
      of: Eliminate of_allnodes list · 5063e25a
      Grant Likely 提交于
      The device tree structure is composed of two lists; the 'allnodes' list
      which is a singly linked list containing every node in the tree, and the
      child->parent structure where each parent node has a singly linked list
      of children. All of the data in the allnodes list can be easily
      reproduced with the parent-child lists, so of_allnodes is actually
      unnecessary. Remove it entirely which saves a bit of memory and
      simplifies the data structure quite a lot.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Gaurav Minocha <gaurav.minocha.os@gmail.com>
      Cc: Pantelis Antoniou <pantelis@pantelis.antoniou@konsulko.com>
      5063e25a
    • G
      of: Fix overflow bug in string property parsing functions · a87fa1d8
      Grant Likely 提交于
      The string property read helpers will run off the end of the buffer if
      it is handed a malformed string property. Rework the parsers to make
      sure that doesn't happen. At the same time add new test cases to make
      sure the functions behave themselves.
      
      The original implementations of of_property_read_string_index() and
      of_property_count_strings() both open-coded the same block of parsing
      code, each with it's own subtly different bugs. The fix here merges
      functions into a single helper and makes the original functions static
      inline wrappers around the helper.
      
      One non-bugfix aspect of this patch is the addition of a new wrapper,
      of_property_read_string_array(). The new wrapper is needed by the
      device_properties feature that Rafael is working on and planning to
      merge for v3.19. The implementation is identical both with and without
      the new static inline wrapper, so it just got left in to reduce the
      churn on the header file.
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Darren Hart <darren.hart@intel.com>
      Cc: <stable@vger.kernel.org>  # v3.3+: Drop selftest hunks that don't apply
      a87fa1d8