David Disseldorp
1addb798e9
null_blk: fix dev->badblocks leak
null_alloc_dev() allocates memory for dev->badblocks, but cleanup
currently only occurs in the configfs release codepath, missing a number
of other places.
This bug was found running the blktests block/010 test, alongside
kmemleak:
rapido1:/blktests# ./check block/010
...
rapido1:/blktests# echo scan > /sys/kernel/debug/kmemleak
[ 306.966708] kmemleak: 32 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
rapido1:/blktests# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff88001f86d000 (size 4096):
comm "modprobe", pid 231, jiffies 4294892415 (age 318.252s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff814b0379>] kmemleak_alloc+0x49/0xa0
[<ffffffff810f180f>] kmem_cache_alloc+0x9f/0xe0
[<ffffffff8124e45f>] badblocks_init+0x2f/0x60
[<ffffffffa0019fae>] 0xffffffffa0019fae
[<ffffffffa0021273>] nullb_device_badblocks_store+0x63/0x130 [null_blk]
[<ffffffff810004cd>] do_one_initcall+0x3d/0x170
[<ffffffff8109fe0d>] do_init_module+0x56/0x1e9
[<ffffffff8109ebd7>] load_module+0x1c47/0x26a0
[<ffffffff8109f819>] SyS_finit_module+0xa9/0xd0
[<ffffffff814b4f60>] entry_SYSCALL_64_fastpath+0x13/0x94
Fixes: 2f54a613c9 ("nullb: badbblocks support")
Reviewed-by: Shaohua Li <shli@fb.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2017-11-22 08:43:11 -07:00
..
2017-11-14 20:11:57 -07:00
2017-11-13 17:56:58 -08:00
2017-11-14 15:32:19 -08:00
2017-11-14 15:32:19 -08:00
2017-08-09 13:09:16 -06:00
2017-09-07 11:59:42 -07:00
2017-11-15 18:21:05 -08:00
2017-11-14 20:11:57 -07:00
2017-10-05 15:01:20 +02:00
2017-11-17 09:51:57 -08:00
2017-09-26 07:41:22 -06:00
2017-07-29 09:00:03 -06:00
2017-11-14 20:10:35 -07:00
2017-11-17 09:51:57 -08:00
2017-09-26 12:07:24 -06:00
2017-09-26 07:41:22 -06:00
2017-11-02 11:10:55 +01:00
2017-11-14 15:32:19 -08:00
2017-11-22 08:43:11 -07:00
2017-08-23 12:49:55 -06:00
2017-08-17 23:03:44 +10:00
2017-11-09 09:32:53 +01:00
2017-11-14 15:32:19 -08:00
2017-08-18 08:45:29 -06:00
2017-08-09 22:22:32 -07:00
2017-11-14 20:11:57 -07:00
2017-06-27 12:13:45 -06:00
2017-10-27 08:23:21 -06:00
2017-09-07 11:59:42 -07:00
2017-06-27 12:13:45 -06:00