Yang Shi
f4dbba5919
locktorture: Fix potential memory leak with rw lock test
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>
2017-01-14 21:36:06 -08:00
..
2016-12-17 21:27:44 -05:00
2016-10-11 15:06:32 -07:00
2016-12-14 16:04:08 -08:00
2016-12-23 16:49:12 -08:00
2016-07-15 14:54:27 +09:00
2016-12-15 12:32:35 +01:00
2016-08-26 14:42:08 +02:00
2017-01-14 21:36:06 -08:00
2016-12-24 11:46:01 -08:00
2016-12-24 11:46:01 -08:00
2017-01-14 21:23:48 -08:00
2016-12-25 17:21:22 +01:00
2016-12-25 17:21:22 +01:00
2016-12-25 11:04:12 +01:00
2016-12-17 18:44:00 -08:00
2017-01-05 23:06:06 -08:00
2016-12-17 18:44:00 -08:00
2016-12-17 18:44:00 -08:00
2016-12-05 19:00:38 -05:00
2016-11-29 15:10:12 -05:00
2016-12-14 14:06:40 -08:00
2016-12-24 11:46:01 -08:00
2016-06-21 15:03:36 -04:00
2016-11-25 16:25:52 -05:00
2016-12-24 11:46:01 -08:00
2016-12-24 11:46:01 -08:00
2016-12-26 17:30:24 -08:00
2016-12-24 11:46:01 -08:00
2016-06-30 18:05:09 -05:00
2016-12-24 11:46:01 -08:00
2016-12-24 11:46:01 -08:00
2016-12-24 11:46:01 -08:00
2016-07-28 16:07:41 -07:00
2016-12-24 11:46:01 -08:00
2016-12-25 17:21:22 +01:00
2016-12-24 11:46:01 -08:00
2016-12-12 18:55:09 -08:00
2016-08-05 09:00:54 -04:00
2016-10-25 11:31:51 +02:00
2016-12-20 09:48:47 -08:00
2016-12-14 16:04:07 -08:00
2016-12-20 09:48:44 -08:00
2016-11-30 23:14:57 +11:00
2016-08-02 19:35:27 -04:00
2016-12-24 11:46:01 -08:00
2016-12-24 11:46:01 -08:00
2016-08-02 19:35:30 -04:00
2016-12-12 18:55:06 -08:00
2016-12-14 17:25:18 -08:00
2016-09-09 17:34:46 -07:00
2016-12-24 11:46:01 -08:00
2016-10-25 11:08:10 +08:00
2016-11-26 11:18:01 -08:00
2016-09-22 20:00:36 -05:00
2016-05-27 15:26:11 -07:00
2016-12-24 11:46:01 -08:00
2016-11-22 12:57:38 -06:00
2016-12-14 16:04:08 -08:00
2016-04-14 12:56:09 -07:00
2016-12-14 13:57:44 -08:00
2016-12-25 17:21:22 +01:00
2016-10-26 12:02:35 +02:00
2016-10-11 15:06:33 -07:00
2016-10-21 15:45:47 -06:00
2016-11-16 10:15:09 +01:00
2016-12-22 22:58:37 -05:00
2016-12-24 11:46:01 -08:00
2016-12-14 16:04:07 -08:00
2016-12-24 11:46:01 -08:00
2016-08-02 19:35:02 -04:00
2016-11-15 10:54:36 -05:00
2016-08-22 10:01:49 -07:00
2016-12-09 09:13:30 -05:00
2016-08-31 07:28:35 -05:00
2016-12-24 11:46:01 -08:00
2016-09-05 13:52:39 +02:00
2016-09-22 20:00:36 -05:00
2016-09-22 20:00:36 -05:00
2016-12-14 16:04:08 -08:00
2016-12-14 16:04:08 -08:00
2016-10-19 12:12:40 -04:00