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: 6d97c6e31b55 ("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-05-30 11:29:21 -07:00
2019-06-19 17:09:55 +02:00
2019-05-21 10:50:46 +02:00
2019-06-28 08:34:12 +08:00
2019-05-24 17:37:52 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-07-17 17:03:33 +02:00
2019-05-24 17:27:11 +02:00
2019-06-27 18:27:36 +02:00
2019-06-21 09:58:42 -07:00
2019-05-30 11:26:32 -07:00
2019-05-31 08:34:32 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-24 17:37:52 +02:00
2019-06-05 17:37:12 +02:00
2019-06-05 17:37:06 +02:00
2019-06-19 17:09:55 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-25 15:03:12 -07:00
2019-05-21 10:50:46 +02:00
2019-06-05 17:36:37 +02:00
2019-05-21 10:50:46 +02:00
2019-05-30 11:26:32 -07:00
2019-06-11 13:35:22 +02:00
2019-06-14 17:27:12 -10:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-12 17:52:13 -04:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-30 11:25:17 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-30 11:26:35 -07:00
2019-06-05 17:37:16 +02:00
2019-05-31 09:43:26 -04:00
2019-05-21 10:50:46 +02:00
2019-06-28 11:48:52 -04:00
2019-05-21 10:50:46 +02:00
2019-05-21 11:28:39 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-06-19 15:53:58 +02:00
2019-05-24 17:37:53 +02:00
2019-06-13 17:34:56 -10:00
2019-05-30 11:29:53 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-06-21 09:58:42 -07:00
2019-06-29 16:43:44 +08:00
2019-06-08 12:52:42 -07:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-06-19 15:25:41 +02:00
2019-05-30 11:26:32 -07:00
2019-05-21 10:50:46 +02:00
2019-05-30 11:26:32 -07:00
2019-06-19 17:09:53 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-06-19 17:09:55 +02:00
2019-06-05 17:37:07 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-06-05 17:36:38 +02:00
2019-06-17 09:33:02 -06:00
2019-06-29 16:43:45 +08:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-30 11:26:32 -07:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-06-29 16:43:45 +08:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-27 07:35:02 -06:00
2019-05-21 10:50:45 +02:00
2019-04-02 17:49:58 +02:00
2019-05-30 11:29:21 -07:00
2019-06-19 17:09:55 +02:00
2019-06-05 17:36:37 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-02-01 15:46:24 -08:00
2019-05-21 10:50:45 +02:00
2019-06-29 16:43:45 +08:00
2019-05-21 10:50:45 +02:00
2019-04-08 18:21:02 -05:00
2019-05-21 10:50:45 +02:00
2019-03-08 14:48:40 -08:00
2019-02-28 03:29:26 -05:00
2019-05-24 17:27:11 +02:00
2019-05-24 17:27:11 +02:00
2019-05-21 10:50:45 +02:00
2019-01-21 17:48:13 +01:00
2019-05-21 10:50:45 +02:00
2019-05-24 17:27:11 +02:00
2019-05-31 13:52:41 -04:00
2019-05-30 11:26:32 -07:00
2019-06-29 17:11:01 +08:00
2019-01-03 18:57:57 -08:00
2019-06-17 09:33:02 -06:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:46 +02:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-05-07 21:12:44 -07:00
2019-05-21 10:50:45 +02:00
2019-01-30 17:44:07 -05:00
2019-04-30 09:26:13 -06:00
2019-05-07 21:28:04 -07:00
2019-06-17 17:36:09 -04:00
2019-05-30 11:26:32 -07:00
2019-04-09 19:20:57 -04:00
2019-05-21 10:50:45 +02:00
2019-04-14 15:09:40 -07:00
2019-06-17 17:36:09 -04:00
2019-05-30 11:29:53 -07:00
2019-05-21 10:50:45 +02:00
2019-05-06 17:46:52 +03:00
2019-01-03 18:57:57 -08:00
2019-06-29 16:43:45 +08:00
2019-04-08 18:21:02 -05:00
2019-04-08 18:21:02 -05:00
2019-05-21 10:50:45 +02:00
2019-05-21 10:50:45 +02:00
2019-02-01 01:55:45 -05:00
2019-02-07 16:38:35 +01:00
2019-04-28 21:34:21 -04:00
2019-05-14 09:47:50 -07:00
2019-02-07 00:13:27 +01:00
2019-06-19 17:09:53 +02:00
2019-02-07 00:13:27 +01:00
2019-05-21 10:50:45 +02:00