Yu Kuai
4eeb6535cd
md/bitmap: factor out a helper to set timeout
...
Register/unregister 'mddev->thread' are both under 'reconfig_mutex',
however, some context didn't hold the mutex to access mddev->thread,
which can cause null-ptr-deference:
1) md_bitmap_daemon_work() can be called from md_check_recovery() where
'reconfig_mutex' is not held, deference 'mddev->thread' might cause
null-ptr-deference, because md_unregister_thread() reset the pointer
before stopping the thread.
2) timeout_store() access 'mddev->thread' multiple times,
null-ptr-deference can be triggered if 'mddev->thread' is reset in the
middle.
This patch factor out a helper to set timeout, the new helper always
check if 'mddev->thread' is null first, so that problem 1 can be fixed.
Now that this helper only access 'mddev->thread' once, but it's possible
that 'mddev->thread' can be freed while this helper is still in progress,
hence the problem is not fixed yet. Follow up patches will fix this by
protecting md_thread with rcu.
Signed-off-by: Yu Kuai <yukuai3@huawei.com >
Signed-off-by: Song Liu <song@kernel.org >
Link: https://lore.kernel.org/r/20230523021017.3048783-5-yukuai1@huaweicloud.com
2023-06-13 15:25:13 -07:00
..
2023-06-12 08:04:05 -06:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2021-10-27 16:53:47 -04:00
2023-03-30 15:57:51 -04:00
2023-03-30 15:57:51 -04:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-04-27 19:42:02 -07:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-03-28 16:20:17 -07:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-06-12 08:04:05 -06:00
2021-04-19 13:20:31 -04:00
2020-03-27 14:42:51 -04:00
2023-06-12 08:04:05 -06:00
2023-06-12 08:04:05 -06:00
2023-06-01 09:13:31 -06:00
2023-04-11 12:09:08 -04:00
2023-04-11 12:09:08 -04:00
2023-04-11 12:09:08 -04:00
2023-06-12 08:04:05 -06:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-04-19 11:13:43 -04:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:07 -05:00
2023-06-05 10:57:40 -06:00
2023-04-11 12:01:01 -04:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:01:01 -04:00
2023-06-12 08:04:05 -06:00
2023-04-11 12:01:01 -04:00
2023-04-11 12:01:01 -04:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:09:08 -04:00
2023-04-11 12:01:01 -04:00
2023-04-11 12:01:01 -04:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:01:01 -04:00
2023-06-13 15:25:13 -07:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:01:01 -04:00
2023-02-14 14:23:07 -05:00
2023-06-12 08:04:05 -06:00
2023-03-16 13:37:06 -04:00
2023-03-16 13:37:06 -04:00
2023-04-11 12:01:01 -04:00
2023-04-11 12:09:08 -04:00
2023-02-14 14:23:08 -05:00
2023-06-12 08:04:05 -06:00
2023-04-11 12:01:01 -04:00
2023-03-28 16:20:17 -07:00
2023-02-14 14:23:06 -05:00
2023-06-12 08:04:05 -06:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:09:08 -04:00
2023-06-12 08:04:05 -06:00
2023-02-14 14:23:06 -05:00
2022-09-07 16:37:27 -07:00
2023-06-12 08:04:05 -06:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-02-14 14:23:06 -05:00
2023-04-11 12:09:08 -04:00
2023-04-11 12:09:08 -04:00
2023-02-14 14:23:06 -05:00
2023-05-31 09:50:02 -06:00
2021-06-04 12:07:24 -04:00
2023-04-11 12:09:08 -04:00
2022-07-14 12:14:31 -06:00
2023-06-12 08:04:05 -06:00
2023-06-12 08:04:05 -06:00
2023-03-15 12:18:07 -06:00
2022-08-02 14:38:59 -07:00
2023-06-05 10:56:46 -06:00
2023-06-13 15:25:13 -07:00
2018-08-01 15:49:39 -07:00
2022-08-23 14:54:54 -05:00
2018-10-18 09:36:35 -07:00
2022-02-04 07:43:18 -07:00
2023-04-13 22:20:24 -07:00
2020-05-13 12:02:23 -07:00
2022-05-22 23:07:21 -07:00
2018-05-30 15:33:32 -06:00
2023-06-13 15:25:11 -07:00
2023-06-13 15:24:14 -07:00
2023-04-13 22:20:24 -07:00
2019-09-13 13:10:05 -07:00
2023-06-01 09:13:31 -06:00
2023-06-01 09:13:31 -06:00
2022-03-08 15:16:54 -08:00
2023-05-31 09:50:02 -06:00
2022-08-02 17:14:31 -06:00
2023-05-31 09:50:02 -06:00
2023-06-13 15:13:21 -07:00
2022-09-22 00:05:04 -07:00
2023-06-01 09:13:31 -06:00
2022-09-22 00:05:05 -07:00