On Sat, Sep 18, 2021 at 10:31:05AM +0800, Jeffle Xu wrote:
From: Ye Bin yebin10@huawei.com
Hi Greg,
Ye Bin had ever fixed a use-after-free of dm-thin in v5.9, and the complete patchset contains three patches:
[1/3] d16ff19e69ab dm cache metadata: Avoid returning cmd->bm wild pointer on error [2/3] 219403d7e56f dm thin metadata: Avoid returning cmd->bm wild pointer on error [3/3] 3a653b205f29 dm thin metadata: Fix use-after-free in dm_bm_set_read_only
However, 4.19.y stable only picks the former two patches [1]: [1/3] 67f03c3d6829 dm cache metadata: Avoid returning cmd->bm wild pointer on error [2/3] 2c00ee626ed4 dm thin metadata: Avoid returning cmd->bm wild pointer on error
We encountered a NULL crash and xiejingfeng found that the omitted patch 3 can fix that. I'm not sure why patch 3 is not picked then, and we need this patch to fix this issue.
[32402.449200] BUG: unable to handle kernel NULL pointer dereference at 0000000000000008 [32402.459553] Oops: 0002 [#1] SMP NOPTI [32402.483982] RIP: 0010:dm_bm_set_read_only+0x5/0x10 [dm_persistent_data] [32402.588073] Call Trace: [32402.590522] dm_pool_metadata_read_only+0x22/0x30 [dm_thin_pool] [32402.596526] set_pool_mode+0x209/0x2e0 [dm_thin_pool] [32402.601579] metadata_operation_failed+0xd5/0xf0 [dm_thin_pool] [32402.607499] commit+0x91/0xf0 [dm_thin_pool] [32402.611771] pool_status+0x28a/0x700 [dm_thin_pool] [32402.616652] retrieve_status+0xa1/0x1c0 [dm_mod] [32402.627794] table_status+0x61/0xa0 [dm_mod] [32402.632068] ctl_ioctl+0x1b3/0x480 [dm_mod] [32402.636253] dm_ctl_ioctl+0xa/0x10 [dm_mod] [32402.640440] do_vfs_ioctl+0x9f/0x610 [32402.653081] ksys_ioctl+0x70/0x80 [32402.656393] __x64_sys_ioctl+0x16/0x20 [32402.660145] do_syscall_64+0x7b/0x200 [32402.663813] entry_SYSCALL_64_after_hwframe+0x44/0xa9
[1] https://lore.kernel.org/lkml/20200908152225.086536876@linuxfoundation.org/
commit 3a653b205f29b3f9827a01a0c88bfbcb0d169494 upstream.
The following error ocurred when testing disk online/offline:
Now queued up, thanks.
greg k-h