]> asedeno.scripts.mit.edu Git - linux.git/commit
of: overlay: check prevents multiple fragments touching same property
authorFrank Rowand <frank.rowand@sony.com>
Fri, 5 Oct 2018 03:36:18 +0000 (20:36 -0700)
committerFrank Rowand <frank.rowand@sony.com>
Fri, 9 Nov 2018 06:12:03 +0000 (22:12 -0800)
commit2fe0e8769df9fed5098daea7db933bc414c329d7
tree9596b2739bf643a769f1c93e124bbc6d89c62e7d
parentc168263b5a10d2434ad5051be8dda47baa34a98e
of: overlay: check prevents multiple fragments touching same property

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: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
drivers/of/overlay.c
drivers/of/unittest-data/Makefile
drivers/of/unittest-data/overlay_bad_add_dup_prop.dts [new file with mode: 0644]
drivers/of/unittest-data/overlay_base.dts
drivers/of/unittest.c