Yang Shi
d21f3eaa09
locktorture: Fix potential memory leak with rw lock test
commit f4dbba591945dc301c302672adefba9e2ec08dc5 upstream.
When running locktorture module with the below commands with kmemleak enabled:
$ modprobe locktorture torture_type=rw_lock_irq
$ rmmod locktorture
The below kmemleak got caught:
root@10:~# echo scan > /sys/kernel/debug/kmemleak
[ 323.197029] kmemleak: 2 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
root@10:~# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffffffc07592d500 (size 128):
comm "modprobe", pid 368, jiffies 4294924118 (age 205.824s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 c3 7b 02 00 00 00 00 00 .........{......
00 00 00 00 00 00 00 00 d7 9b 02 00 00 00 00 00 ................
backtrace:
[<ffffff80081e5a88>] create_object+0x110/0x288
[<ffffff80086c6078>] kmemleak_alloc+0x58/0xa0
[<ffffff80081d5acc>] __kmalloc+0x234/0x318
[<ffffff80006fa130>] 0xffffff80006fa130
[<ffffff8008083ae4>] do_one_initcall+0x44/0x138
[<ffffff800817e28c>] do_init_module+0x68/0x1cc
[<ffffff800811c848>] load_module+0x1a68/0x22e0
[<ffffff800811d340>] SyS_finit_module+0xe0/0xf0
[<ffffff80080836f0>] el0_svc_naked+0x24/0x28
[<ffffffffffffffff>] 0xffffffffffffffff
unreferenced object 0xffffffc07592d480 (size 128):
comm "modprobe", pid 368, jiffies 4294924118 (age 205.824s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 3b 6f 01 00 00 00 00 00 ........;o......
00 00 00 00 00 00 00 00 23 6a 01 00 00 00 00 00 ........#j......
backtrace:
[<ffffff80081e5a88>] create_object+0x110/0x288
[<ffffff80086c6078>] kmemleak_alloc+0x58/0xa0
[<ffffff80081d5acc>] __kmalloc+0x234/0x318
[<ffffff80006fa22c>] 0xffffff80006fa22c
[<ffffff8008083ae4>] do_one_initcall+0x44/0x138
[<ffffff800817e28c>] do_init_module+0x68/0x1cc
[<ffffff800811c848>] load_module+0x1a68/0x22e0
[<ffffff800811d340>] SyS_finit_module+0xe0/0xf0
[<ffffff80080836f0>] el0_svc_naked+0x24/0x28
[<ffffffffffffffff>] 0xffffffffffffffff
It is because cxt.lwsa and cxt.lrsa don't get freed in module_exit, so free
them in lock_torture_cleanup() and free writer_tasks if reader_tasks is
failed at memory allocation.
Signed-off-by: Yang Shi <yang.shi@linaro.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Cc: 石洋 <yang.s@alibaba-inc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
2017-09-13 14:13:36 -07:00 |
| .. |
|
bpf
|
bpf/verifier: fix min/max handling in BPF_SUB
|
2017-08-30 10:21:44 +02:00 |
|
configs
|
config: android: enable CONFIG_SECCOMP
|
2016-10-11 15:06:32 -07:00 |
|
debug
|
kernel/debug/debug_core.c: more properly delay for secondary CPUs
|
2017-01-06 10:40:17 +01:00 |
|
events
|
mm, uprobes: fix multiple free of ->uprobes_state.xol_area
|
2017-09-07 08:35:39 +02:00 |
|
gcov
|
gcov: support GCC 7.1
|
2017-09-02 07:07:53 +02:00 |
|
irq
|
genirq/ipi: Fixup checks against nr_cpu_ids
|
2017-08-24 17:12:21 -07:00 |
|
livepatch
|
livepatch/module: make TAINT_LIVEPATCH module-specific
|
2016-08-26 14:42:08 +02:00 |
|
locking
|
locktorture: Fix potential memory leak with rw lock test
|
2017-09-13 14:13:36 -07:00 |
|
power
|
PM / sleep: fix device reference leak in test_suspend
|
2016-11-02 05:10:04 +01:00 |
|
printk
|
printk: use rcuidle console tracepoint
|
2017-02-23 17:44:36 +01:00 |
|
rcu
|
rcu: Add memory barriers for NOCB leader wakeup
|
2017-07-21 07:42:22 +02:00 |
|
sched
|
sched/cgroup: Move sched_online_group() back into css_online() to fix crash
|
2017-08-06 18:59:42 -07:00 |
|
time
|
timers: Fix excessive granularity of new timers after a nohz idle
|
2017-08-30 10:21:51 +02:00 |
|
trace
|
ftrace: Check for null ret_stack on profile function graph entry function
|
2017-08-30 10:21:50 +02:00 |
|
.gitignore
|
|
|
|
acct.c
|
|
|
|
async.c
|
|
|
|
audit.c
|
Merge branch 'stable-4.9' of git://git.infradead.org/users/pcmoore/audit
|
2016-10-04 14:21:41 -07:00 |
|
audit.h
|
Merge branch 'stable-4.8' of git://git.infradead.org/users/pcmoore/audit
|
2016-07-29 17:54:17 -07:00 |
|
audit_fsnotify.c
|
|
|
|
audit_tree.c
|
audit: cleanup prune_tree_thread
|
2016-04-04 09:46:47 -04:00 |
|
audit_watch.c
|
audit: Fix use after free in audit_remove_watch_rule()
|
2017-08-24 17:12:18 -07:00 |
|
auditfilter.c
|
audit: add fields to exclude filter by reusing user filter
|
2016-06-27 11:01:00 -04:00 |
|
auditsc.c
|
Merge branch 'stable-4.9' of git://git.infradead.org/users/pcmoore/audit
|
2016-10-04 14:21:41 -07:00 |
|
backtracetest.c
|
|
|
|
bounds.c
|
|
|
|
capability.c
|
ptrace: Capture the ptracer's creds not PT_PTRACE_CAP
|
2017-01-06 10:40:13 +01:00 |
|
cgroup.c
|
cgroup: fix error return value from cgroup_subtree_control()
|
2017-08-11 08:49:28 -07:00 |
|
cgroup_freezer.c
|
|
|
|
cgroup_pids.c
|
cgroup/pids: remove spurious suspicious RCU usage warning
|
2017-03-26 13:05:58 +02:00 |
|
compat.c
|
|
|
|
configs.c
|
|
|
|
context_tracking.c
|
|
|
|
cpu.c
|
smp/hotplug: Replace BUG_ON and react useful
|
2017-08-06 18:59:41 -07:00 |
|
cpu_pm.c
|
|
|
|
cpuset.c
|
cpuset: Fix incorrect memory_pressure control file mapping
|
2017-09-07 08:35:40 +02:00 |
|
crash_dump.c
|
|
|
|
cred.c
|
cred: Reject inodes with invalid ids in set_create_file_as()
|
2016-06-30 18:05:09 -05:00 |
|
delayacct.c
|
|
|
|
dma.c
|
|
|
|
elfcore.c
|
|
|
|
exec_domain.c
|
|
|
|
exit.c
|
sched/autogroup: Do not use autogroup->tg in zombie threads
|
2016-11-22 12:33:43 +01:00 |
|
extable.c
|
kernel/extable.c: mark core_kernel_text notrace
|
2017-07-21 07:42:21 +02:00 |
|
fork.c
|
mm, uprobes: fix multiple free of ->uprobes_state.xol_area
|
2017-09-07 08:35:39 +02:00 |
|
freezer.c
|
freezer, oom: check TIF_MEMDIE on the correct task
|
2016-07-28 16:07:41 -07:00 |
|
futex.c
|
futex: Remove unnecessary warning from get_futex_key
|
2017-08-16 13:43:15 -07:00 |
|
futex_compat.c
|
|
|
|
groups.c
|
cred: simpler, 1D supplementary groups
|
2016-10-07 18:46:30 -07:00 |
|
hung_task.c
|
hung_task: allow hung_task_panic when hung_task_warnings is 0
|
2016-10-11 15:06:33 -07:00 |
|
irq_work.c
|
|
|
|
jump_label.c
|
jump_labels: API for flushing deferred jump label updates
|
2017-01-19 20:17:59 +01:00 |
|
kallsyms.c
|
kallsyms: add support for relative offsets in kallsyms address table
|
2016-03-15 16:55:16 -07:00 |
|
kcmp.c
|
|
|
|
Kconfig.freezer
|
|
|
|
Kconfig.hz
|
|
|
|
Kconfig.locks
|
|
|
|
Kconfig.preempt
|
|
|
|
kcov.c
|
kcov: add missing #include <linux/sched.h>
|
2016-12-07 17:10:00 -08:00 |
|
kexec.c
|
kexec: allow architectures to override boot mapping
|
2016-08-02 19:35:27 -04:00 |
|
kexec_core.c
|
kexec: add restriction on kexec_load() segment sizes
|
2016-08-02 19:35:31 -04:00 |
|
kexec_file.c
|
kexec: fix double-free when failing to relocate the purgatory
|
2016-09-01 17:52:01 -07:00 |
|
kexec_internal.h
|
|
|
|
kmod.c
|
|
|
|
kprobes.c
|
tracing/kprobes: Enforce kprobes teardown after testing
|
2017-05-25 15:44:47 +02:00 |
|
ksysfs.c
|
kexec: add a kexec_crash_loaded() function
|
2016-08-02 19:35:30 -04:00 |
|
kthread.c
|
cgroup, kthread: close race window where new kthreads can be migrated to non-root cgroups
|
2017-04-21 09:31:18 +02:00 |
|
latencytop.c
|
|
|
|
Makefile
|
kernel/watchdog.c: move hardlockup detector to separate file
|
2017-06-17 06:41:57 +02:00 |
|
membarrier.c
|
Fix: Disable sys_membarrier when nohz_full is enabled
|
2017-03-12 06:41:45 +01:00 |
|
memremap.c
|
mm, devm_memremap_pages: hold device_hotplug lock over mem_hotplug_{begin, done}
|
2017-03-12 06:41:43 +01:00 |
|
module-internal.h
|
|
|
|
module.c
|
Re-enable CONFIG_MODVERSIONS in a slightly weaker form
|
2016-11-29 16:01:30 -08:00 |
|
module_signing.c
|
KEYS: Move the point of trust determination to __key_link()
|
2016-04-11 22:43:43 +01:00 |
|
notifier.c
|
|
|
|
nsproxy.c
|
|
|
|
padata.c
|
padata: free correct variable
|
2017-05-20 14:28:40 +02:00 |
|
panic.c
|
kernel/panic.c: add missing \n
|
2017-07-05 14:40:24 +02:00 |
|
params.c
|
|
|
|
pid.c
|
pids: make task_tgid_nr_ns() safe
|
2017-08-24 17:12:21 -07:00 |
|
pid_namespace.c
|
pid_ns: Sleep in TASK_INTERRUPTIBLE in zap_pid_ns_processes
|
2017-05-25 15:44:38 +02:00 |
|
profile.c
|
profile: Convert to hotplug state machine
|
2016-07-15 10:41:42 +02:00 |
|
ptrace.c
|
ptrace: Properly initialize ptracer_cred on fork
|
2017-06-14 15:05:54 +02:00 |
|
range.c
|
|
|
|
reboot.c
|
|
|
|
relay.c
|
relay: check array offset before using it
|
2017-01-12 11:39:30 +01:00 |
|
resource.c
|
/proc/iomem: only expose physical resource addresses to privileged users
|
2016-04-14 12:56:09 -07:00 |
|
seccomp.c
|
seccomp: Fix tracer exit notifications during fatal signals
|
2016-08-30 16:12:46 -07:00 |
|
signal.c
|
signal: protect SIGNAL_UNKILLABLE from unintentional clearing.
|
2017-08-11 08:49:36 -07:00 |
|
smp.c
|
smp: Allocate smp_call_on_cpu() workqueue on stack too
|
2016-09-22 14:49:10 +02:00 |
|
smpboot.c
|
kthread/smpboot: do not park in kthread_create_on_cpu()
|
2016-10-11 15:06:33 -07:00 |
|
smpboot.h
|
|
|
|
softirq.c
|
softirq: Display IRQ_POLL for irq-poll statistics
|
2016-10-21 15:45:47 -06:00 |
|
stacktrace.c
|
stacktrace, lockdep: Fix address, newline ugliness
|
2017-02-14 15:25:42 -08:00 |
|
stop_machine.c
|
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2016-10-03 13:39:00 -07:00 |
|
sys.c
|
prctl: make PR_SET_THP_DISABLE wait for mmap_sem killable
|
2016-05-23 17:04:14 -07:00 |
|
sys_ni.c
|
x86/pkeys: Fix pkeys build breakage for some non-x86 arches
|
2016-09-13 14:41:36 +02:00 |
|
sysctl.c
|
sysctl: report EINVAL if value is larger than UINT_MAX for proc_douintvec
|
2017-07-12 15:01:04 +02:00 |
|
sysctl_binary.c
|
kernel/sysctl_binary.c: use generic UUID library
|
2016-05-20 17:58:30 -07:00 |
|
task_work.c
|
task_work: use READ_ONCE/lockless_dereference, avoid pi_lock if !task_works
|
2016-08-02 19:35:02 -04:00 |
|
taskstats.c
|
taskstats: fix the length of cgroupstats_cmd_get_policy
|
2016-11-03 16:55:58 -04:00 |
|
test_kprobes.c
|
|
|
|
torture.c
|
torture: Convert torture_shutdown() to hrtimer
|
2016-08-22 10:01:49 -07:00 |
|
tracepoint.c
|
kernel/...: convert pr_warning to pr_warn
|
2016-03-22 15:36:02 -07:00 |
|
tsacct.c
|
|
|
|
ucount.c
|
kernel/ucount.c: mark user_header with kmemleak_ignore()
|
2017-06-17 06:41:51 +02:00 |
|
uid16.c
|
cred: simpler, 1D supplementary groups
|
2016-10-07 18:46:30 -07:00 |
|
up.c
|
smp: Add function to execute a function synchronously on a CPU
|
2016-09-05 13:52:39 +02:00 |
|
user-return-notifier.c
|
|
|
|
user.c
|
|
|
|
user_namespace.c
|
Merge branch 'nsfs-ioctls' into HEAD
|
2016-09-22 20:00:36 -05:00 |
|
utsname.c
|
Merge branch 'nsfs-ioctls' into HEAD
|
2016-09-22 20:00:36 -05:00 |
|
utsname_sysctl.c
|
|
|
|
watchdog.c
|
kernel/watchdog: prevent false hardlockup on overloaded system
|
2017-06-17 06:41:57 +02:00 |
|
watchdog_hld.c
|
kernel/watchdog: prevent false hardlockup on overloaded system
|
2017-06-17 06:41:57 +02:00 |
|
workqueue.c
|
workqueue: implicit ordered attribute should be overridable
|
2017-08-11 08:49:37 -07:00 |
|
workqueue_internal.h
|
|
|