https://github.com/torvalds/linux
Revision 29acfb65598f91671413869e0d0a1ec4e74ac705 authored by Frank Rowand on 16 April 2020, 21:42:50 UTC, committed by Rob Herring on 17 April 2020, 13:31:34 UTC
kmemleak reports several memory leaks from devicetree unittest.
This is the fix for problem 5 of 5.

When overlay 'overlay_bad_add_dup_prop' is applied, the apply code
properly detects that a memory leak will occur if the overlay is removed
since the duplicate property is located in a base devicetree node and
reports via printk():

  OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail
  OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail

The overlay is removed when the apply code detects multiple changesets
modifying the same property.  This is reported via printk():

  OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail

As a result of this error, the overlay is removed resulting in the
expected memory leak.

Add another device node level to the overlay so that the duplicate
property is located in a node added by the overlay, thus no memory
leak will occur when the overlay is removed.

Thus users of kmemleak will not have to debug this leak in the future.

Fixes: 2fe0e8769df9 ("of: overlay: check prevents multiple fragments touching same property")
Reported-by: Erhard F. <erhard_f@mailbox.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
Signed-off-by: Rob Herring <robh@kernel.org>
1 parent 478ff64
History
Tip revision: 29acfb65598f91671413869e0d0a1ec4e74ac705 authored by Frank Rowand on 16 April 2020, 21:42:50 UTC
of: unittest: kmemleak in duplicate property update
Tip revision: 29acfb6
File Mode Size
ABI
PCI
RCU
accounting
admin-guide
arm
arm64
block
bpf
cdrom
core-api
cpu-freq
crypto
dev-tools
devicetree
doc-guide
driver-api
fault-injection
fb
features
filesystems
firmware-guide
firmware_class
fpga
gpu
hid
hwmon
i2c
ia64
ide
iio
infiniband
input
isdn
kbuild
kernel-hacking
leds
livepatch
locking
m68k
maintainer
media
mhi
mips
misc-devices
netlabel
networking
nios2
nvdimm
openrisc
parisc
pcmcia
power
powerpc
process
riscv
s390
scheduler
scsi
security
sh
sound
sparc
sphinx
sphinx-static
spi
target
timers
trace
translations
usb
userspace-api
virt
vm
w1
watchdog
x86
xtensa
.gitignore -rw-r--r-- 53 bytes
COPYING-logo -rw-r--r-- 563 bytes
Changes l--------- 19 bytes
CodingStyle -rw-r--r-- 48 bytes
DMA-API-HOWTO.txt -rw-r--r-- 32.8 KB
DMA-API.txt -rw-r--r-- 27.3 KB
DMA-ISA-LPC.txt -rw-r--r-- 5.1 KB
DMA-attributes.txt -rw-r--r-- 6.0 KB
IPMI.txt -rw-r--r-- 29.7 KB
IRQ-affinity.txt -rw-r--r-- 2.5 KB
IRQ-domain.txt -rw-r--r-- 10.9 KB
IRQ.txt -rw-r--r-- 994 bytes
Kconfig -rw-r--r-- 360 bytes
Makefile -rw-r--r-- 5.3 KB
SubmittingPatches -rw-r--r-- 54 bytes
asm-annotations.rst -rw-r--r-- 9.2 KB
atomic_bitops.txt -rw-r--r-- 1.5 KB
atomic_t.txt -rw-r--r-- 6.9 KB
bus-virt-phys-mapping.txt -rw-r--r-- 8.0 KB
conf.py -rw-r--r-- 20.5 KB
crc32.txt -rw-r--r-- 8.6 KB
debugging-via-ohci1394.txt -rw-r--r-- 7.5 KB
digsig.txt -rw-r--r-- 3.0 KB
docutils.conf -rw-r--r-- 159 bytes
dontdiff -rw-r--r-- 2.6 KB
futex-requeue-pi.txt -rw-r--r-- 5.1 KB
hwspinlock.txt -rw-r--r-- 15.1 KB
index.rst -rw-r--r-- 4.1 KB
irqflags-tracing.txt -rw-r--r-- 2.3 KB
kprobes.txt -rw-r--r-- 30.3 KB
kref.txt -rw-r--r-- 9.1 KB
logo.gif -rw-r--r-- 16.0 KB
lzo.txt -rw-r--r-- 9.1 KB
mailbox.txt -rw-r--r-- 4.4 KB
memory-barriers.txt -rw-r--r-- 114.4 KB
nommu-mmap.txt -rw-r--r-- 12.4 KB
percpu-rw-semaphore.txt -rw-r--r-- 1.1 KB
pi-futex.txt -rw-r--r-- 5.7 KB
preempt-locking.txt -rw-r--r-- 5.5 KB
rbtree.txt -rw-r--r-- 14.8 KB
remoteproc.txt -rw-r--r-- 12.8 KB
robust-futex-ABI.txt -rw-r--r-- 8.6 KB
robust-futexes.txt -rw-r--r-- 9.5 KB
rpmsg.txt -rw-r--r-- 13.1 KB
speculation.txt -rw-r--r-- 2.8 KB
static-keys.txt -rw-r--r-- 13.0 KB
tee.txt -rw-r--r-- 9.2 KB
this_cpu_ops.txt -rw-r--r-- 11.2 KB
unaligned-memory-access.txt -rw-r--r-- 10.4 KB
xz.txt -rw-r--r-- 5.5 KB

back to top