https://github.com/torvalds/linux
Revision 877f919e192a09e77962a13d7165783027dee5fd authored by Chunyu Hu on 09 June 2018, 19:51:24 UTC, committed by Al Viro on 28 June 2018, 00:44:38 UTC
kmemleak reported some memory leak on reading proc files. After adding
some debug lines, find that proc_seq_fops is using seq_release as
release handler, which won't handle the free of 'private' field of
seq_file, while in fact the open handler proc_seq_open could create
the private data with __seq_open_private when state_size is greater
than zero. So after reading files created with proc_create_seq_private,
such as /proc/timer_list and /proc/vmallocinfo, the private mem of a
seq_file is not freed. Fix it by adding the paired proc_seq_release
as the default release handler of proc_seq_ops instead of seq_release.

Fixes: 44414d82cfe0 ("proc: introduce proc_create_seq_private")
Reviewed-by: Christoph Hellwig <hch@lst.de>
CC: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chunyu Hu <chuhu@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent ce397d2
History
Tip revision: 877f919e192a09e77962a13d7165783027dee5fd authored by Chunyu Hu on 09 June 2018, 19:51:24 UTC
proc: add proc_seq_release
Tip revision: 877f919
File Mode Size
powercap
regulator
00-INDEX -rw-r--r-- 1.4 KB
apm-acpi.txt -rw-r--r-- 1.5 KB
basic-pm-debugging.txt -rw-r--r-- 11.9 KB
charger-manager.txt -rw-r--r-- 9.2 KB
drivers-testing.txt -rw-r--r-- 2.1 KB
freezing-of-tasks.txt -rw-r--r-- 12.0 KB
interface.txt -rw-r--r-- 3.5 KB
opp.txt -rw-r--r-- 13.5 KB
pci.txt -rw-r--r-- 56.3 KB
pm_qos_interface.txt -rw-r--r-- 9.7 KB
power_supply_class.txt -rw-r--r-- 9.9 KB
runtime_pm.txt -rw-r--r-- 44.5 KB
s2ram.txt -rw-r--r-- 3.3 KB
suspend-and-cpuhotplug.txt -rw-r--r-- 12.4 KB
suspend-and-interrupts.txt -rw-r--r-- 7.0 KB
swsusp-and-swap-files.txt -rw-r--r-- 2.7 KB
swsusp-dmcrypt.txt -rw-r--r-- 4.7 KB
swsusp.txt -rw-r--r-- 17.5 KB
tricks.txt -rw-r--r-- 753 bytes
userland-swsusp.txt -rw-r--r-- 8.4 KB
video.txt -rw-r--r-- 8.3 KB

back to top