Su Yue
e240c1b363
bcachefs: fix memleak in bch2_split_devs
...
The pointer dev_name can be modified by strseq(),
then causes the memleak:
unreferenced object 0xffff9d08a2916c80 (size 32):
comm "mount.bcachefs", pid 9090, jiffies 4295856224 (age 17.564s)
hex dump (first 32 bytes):
2f 64 65 76 2f 6d 61 70 70 65 72 2f 74 65 73 74 /dev/mapper/test
2d 30 00 00 00 00 00 00 00 00 00 00 00 00 00 00 -0..............
backtrace:
[<00000000c5d3be7d>] __kmem_cache_alloc_node+0x1f3/0x2c0
[<0000000052215d26>] __kmalloc_node_track_caller+0x51/0x150
[<0000000069fea956>] kstrdup+0x32/0x60
[<000000000877fcf1>] bch2_split_devs+0x3f/0x150 [bcachefs]
[<000000007ee93204>] bch2_mount+0xcb/0x640 [bcachefs]
[<000000002dd1e04b>] legacy_get_tree+0x30/0x60
[<000000006afc31d3>] vfs_get_tree+0x28/0xf0
[<000000007b0c538e>] path_mount+0x475/0xb60
[<0000000092de5882>] __x64_sys_mount+0x105/0x140
[<0000000054fc05d8>] do_syscall_64+0x42/0xf0
[<00000000df584910>] entry_SYSCALL_64_after_hwframe+0x6e/0x76
Fix it by copy pointer dev_name at beginning and free the copied
pointer at end.
Signed-off-by: Su Yue <glass.su@suse.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-21 06:01:45 -05:00
..
2024-01-01 11:47:07 -05:00
2024-01-05 23:24:21 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:43 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:38 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:41 -05:00
2024-01-05 23:24:20 -05:00
2023-11-04 22:19:13 -04:00
2024-01-05 23:24:20 -05:00
2023-11-05 13:12:18 -05:00
2023-11-05 13:12:18 -05:00
2024-01-05 23:24:21 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:40 -05:00
2024-01-05 23:24:20 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:40 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:44 -05:00
2024-01-05 23:24:19 -05:00
2023-11-24 02:43:12 -05:00
2023-11-13 21:45:01 -05:00
2024-01-01 11:47:43 -05:00
2024-01-01 11:47:41 -05:00
2024-01-05 23:24:21 -05:00
2024-01-05 23:24:19 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:44 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:44 -05:00
2024-01-05 23:24:19 -05:00
2024-01-01 11:47:44 -05:00
2024-01-01 11:47:41 -05:00
2024-01-05 23:24:19 -05:00
2024-01-05 23:24:19 -05:00
2024-01-01 11:47:38 -05:00
2024-01-05 23:24:46 -05:00
2024-01-05 23:24:20 -05:00
2024-01-05 23:24:20 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:40 -05:00
2024-01-01 11:46:52 -05:00
2024-01-01 11:47:43 -05:00
2024-01-01 11:47:43 -05:00
2023-11-25 21:48:42 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:44 -05:00
2024-01-01 11:47:44 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:38 -05:00
2024-01-05 23:24:20 -05:00
2024-01-05 23:24:20 -05:00
2024-01-05 23:24:19 -05:00
2024-01-05 23:24:20 -05:00
2023-12-19 19:01:52 -05:00
2024-01-01 11:47:44 -05:00
2024-01-01 11:47:43 -05:00
2024-01-05 23:24:20 -05:00
2024-01-05 23:24:46 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:43 -05:00
2024-01-01 11:47:42 -05:00
2023-11-13 21:42:21 -05:00
2023-11-13 21:42:21 -05:00
2024-01-01 11:47:40 -05:00
2024-01-01 11:47:40 -05:00
2023-11-05 13:12:18 -05:00
2024-01-05 23:24:19 -05:00
2024-01-01 11:47:36 -05:00
2024-01-05 23:24:21 -05:00
2024-01-05 23:24:19 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:43 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:43 -05:00
2023-11-24 00:29:58 -05:00
2024-01-05 23:24:21 -05:00
2023-11-24 00:29:58 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:41 -05:00
2024-01-01 11:47:38 -05:00
2024-01-01 11:47:41 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:44 -05:00
2024-01-01 11:47:43 -05:00
2024-01-01 11:47:43 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:42 -05:00
2024-01-05 23:24:19 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:43 -05:00
2024-01-01 11:47:39 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:40 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:07 -05:00
2024-01-01 11:47:07 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:41 -05:00
2024-01-01 11:47:44 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:40 -05:00
2024-01-05 23:24:46 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:39 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:38 -05:00
2024-01-01 11:47:42 -05:00
2024-01-05 23:24:21 -05:00
2024-01-05 23:24:20 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:07 -05:00
2024-01-01 11:47:07 -05:00
2024-01-05 23:24:19 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:38 -05:00
2024-01-01 11:47:40 -05:00
2024-01-05 23:24:21 -05:00
2024-01-05 23:24:20 -05:00
2024-01-01 11:47:37 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:07 -05:00
2024-01-01 11:47:42 -05:00
2024-01-05 23:24:21 -05:00
2024-01-05 23:24:21 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:38 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:42 -05:00
2024-01-05 23:24:19 -05:00
2024-01-05 23:24:20 -05:00
2024-01-05 23:24:19 -05:00
2024-01-05 23:24:21 -05:00
2024-01-21 06:01:45 -05:00
2024-01-05 23:24:21 -05:00
2024-01-01 11:47:42 -05:00
2024-01-01 11:47:07 -05:00