Johannes Thumshirn
bfcea1c661
btrfs: free checksum hash on in close_ctree
fs_info::csum_hash gets initialized in btrfs_init_csum_hash() which is
called by open_ctree().
But it only gets freed if open_ctree() fails, not on normal operation.
This leads to a memory leak like the following found by kmemleak:
unreferenced object 0xffff888132cb8720 (size 96):
comm "mount", pid 450, jiffies 4294912436 (age 17.584s)
hex dump (first 32 bytes):
04 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:
[<000000000c9643d4>] crypto_create_tfm+0x2d/0xd0
[<00000000ae577f68>] crypto_alloc_tfm+0x4b/0xb0
[<000000002b5cdf30>] open_ctree+0xb84/0x2060 [btrfs]
[<0000000043204297>] btrfs_mount_root+0x552/0x640 [btrfs]
[<00000000c99b10ea>] legacy_get_tree+0x22/0x40
[<0000000071a6495f>] vfs_get_tree+0x1f/0xc0
[<00000000f180080e>] fc_mount+0x9/0x30
[<000000009e36cebd>] vfs_kern_mount.part.11+0x6a/0x80
[<0000000004594c05>] btrfs_mount+0x174/0x910 [btrfs]
[<00000000c99b10ea>] legacy_get_tree+0x22/0x40
[<0000000071a6495f>] vfs_get_tree+0x1f/0xc0
[<00000000b86e92c5>] do_mount+0x6b0/0x940
[<0000000097464494>] ksys_mount+0x7b/0xd0
[<0000000057213c80>] __x64_sys_mount+0x1c/0x20
[<00000000cb689b5e>] do_syscall_64+0x43/0x130
[<000000002194e289>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Free fs_info::csum_hash in close_ctree() to avoid the memory leak.
Fixes: 6d97c6e31b
("btrfs: add boilerplate code for directly including the crypto framework")
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2019-07-17 17:03:33 +02:00
..
2019-07-04 17:26:17 +02:00
2019-04-29 19:02:44 +02:00
2019-02-25 14:13:24 +01:00
2018-04-12 16:29:46 +02:00
2019-07-01 13:34:53 +02:00
2019-07-01 13:34:53 +02:00
2019-07-02 12:30:55 +02:00
2019-07-02 12:30:55 +02:00
2019-07-01 13:35:02 +02:00
2019-07-01 13:35:02 +02:00
2018-04-12 16:29:46 +02:00
2019-07-02 12:30:51 +02:00
2019-07-02 12:30:48 +02:00
2019-04-29 19:02:52 +02:00
2019-07-04 17:26:17 +02:00
2018-04-12 16:29:46 +02:00
2019-07-04 17:26:17 +02:00
2019-07-04 17:26:17 +02:00
2019-04-29 19:02:30 +02:00
2018-10-15 17:23:33 +02:00
2019-07-04 17:26:17 +02:00
2019-07-04 17:26:17 +02:00
2019-07-01 13:34:56 +02:00
2019-04-29 19:02:43 +02:00
2019-04-29 19:02:50 +02:00
2019-07-17 17:03:33 +02:00
2019-07-01 13:35:02 +02:00
2018-10-15 17:23:25 +02:00
2018-04-12 16:29:46 +02:00
2019-07-05 18:47:57 +02:00
2019-07-04 17:26:17 +02:00
2019-04-29 19:02:38 +02:00
2019-02-25 14:13:21 +01:00
2019-07-04 17:26:18 +02:00
2019-07-01 13:35:02 +02:00
2019-07-04 17:26:17 +02:00
2019-07-04 17:26:17 +02:00
2019-04-29 19:02:46 +02:00
2019-04-29 19:02:46 +02:00
2019-04-29 19:02:46 +02:00
2019-04-29 19:02:50 +02:00
2019-07-04 17:26:17 +02:00
2018-04-12 16:29:46 +02:00
2019-07-17 17:03:28 +02:00
2019-07-04 17:26:17 +02:00
2019-07-17 17:03:30 +02:00
2019-07-02 12:30:47 +02:00
2019-02-25 14:13:28 +01:00
2019-02-25 14:13:32 +01:00
2019-07-04 17:26:17 +02:00
2018-04-12 16:29:46 +02:00
2019-07-04 17:26:17 +02:00
2019-07-01 13:35:00 +02:00
2018-04-12 16:29:51 +02:00
2019-07-02 12:30:47 +02:00
2018-04-20 19:18:16 +02:00
2019-07-02 12:30:49 +02:00
2019-04-29 19:02:54 +02:00
2019-07-02 12:30:48 +02:00
2019-02-25 14:13:39 +01:00
2019-04-30 09:26:13 -06:00
2019-07-01 13:34:58 +02:00
2018-04-12 16:29:46 +02:00
2019-06-14 17:33:46 +02:00
2019-05-07 12:48:10 -07:00
2019-04-29 19:02:49 +02:00
2019-07-04 17:26:17 +02:00
2019-07-04 17:26:18 +02:00
2019-07-02 12:30:48 +02:00
2019-07-02 12:30:49 +02:00
2018-04-12 16:29:46 +02:00
2019-07-02 12:30:53 +02:00
2019-07-02 12:30:53 +02:00
2018-08-06 13:12:43 +02:00
2019-07-02 12:30:51 +02:00
2019-07-02 12:30:51 +02:00
2018-12-17 14:51:43 +01:00
2019-07-04 17:26:17 +02:00
2019-07-04 17:26:17 +02:00
2019-07-01 13:34:55 +02:00
2019-04-29 19:02:39 +02:00
2019-02-25 14:13:27 +01:00
2019-07-02 12:30:50 +02:00
2019-04-29 19:02:41 +02:00
2018-04-12 16:29:51 +02:00
2018-04-12 16:29:46 +02:00
2019-04-29 19:02:50 +02:00
2019-07-02 12:30:51 +02:00
2019-07-02 12:30:50 +02:00
2019-06-17 16:37:17 +02:00
2019-04-29 19:02:44 +02:00
2019-02-25 14:13:32 +01:00
2019-05-28 18:54:09 +02:00