Ye Bin
d72c254889
PM: hibernate: Get block device exclusively in swsusp_check()
[ Upstream commit 39fbef4b0f ]
The following kernel crash can be triggered:
[ 89.266592] ------------[ cut here ]------------
[ 89.267427] kernel BUG at fs/buffer.c:3020!
[ 89.268264] invalid opcode: 0000 [#1] SMP KASAN PTI
[ 89.269116] CPU: 7 PID: 1750 Comm: kmmpd-loop0 Not tainted 5.10.0-862.14.0.6.x86_64-08610-gc932cda3cef4-dirty #20
[ 89.273169] RIP: 0010:submit_bh_wbc.isra.0+0x538/0x6d0
[ 89.277157] RSP: 0018:ffff888105ddfd08 EFLAGS: 00010246
[ 89.278093] RAX: 0000000000000005 RBX: ffff888124231498 RCX: ffffffffb2772612
[ 89.279332] RDX: 1ffff11024846293 RSI: 0000000000000008 RDI: ffff888124231498
[ 89.280591] RBP: ffff8881248cc000 R08: 0000000000000001 R09: ffffed1024846294
[ 89.281851] R10: ffff88812423149f R11: ffffed1024846293 R12: 0000000000003800
[ 89.283095] R13: 0000000000000001 R14: 0000000000000000 R15: ffff8881161f7000
[ 89.284342] FS: 0000000000000000(0000) GS:ffff88839b5c0000(0000) knlGS:0000000000000000
[ 89.285711] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 89.286701] CR2: 00007f166ebc01a0 CR3: 0000000435c0e000 CR4: 00000000000006e0
[ 89.287919] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 89.289138] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 89.290368] Call Trace:
[ 89.290842] write_mmp_block+0x2ca/0x510
[ 89.292218] kmmpd+0x433/0x9a0
[ 89.294902] kthread+0x2dd/0x3e0
[ 89.296268] ret_from_fork+0x22/0x30
[ 89.296906] Modules linked in:
by running the following commands:
1. mkfs.ext4 -O mmp /dev/sda -b 1024
2. mount /dev/sda /home/test
3. echo "/dev/sda" > /sys/power/resume
That happens because swsusp_check() calls set_blocksize() on the
target partition which confuses the file system:
Thread1 Thread2
mount /dev/sda /home/test
get s_mmp_bh --> has mapped flag
start kmmpd thread
echo "/dev/sda" > /sys/power/resume
resume_store
software_resume
swsusp_check
set_blocksize
truncate_inode_pages_range
truncate_cleanup_page
block_invalidatepage
discard_buffer --> clean mapped flag
write_mmp_block
submit_bh
submit_bh_wbc
BUG_ON(!buffer_mapped(bh))
To address this issue, modify swsusp_check() to open the target block
device with exclusive access.
Signed-off-by: Ye Bin <yebin10@huawei.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-26 11:36:06 +01:00
..
2021-11-26 11:35:59 +01:00
2021-06-16 11:54:59 +02:00
2018-06-15 07:15:28 +09:00
2021-03-04 09:39:31 +01:00
2021-10-27 09:53:12 +02:00
2021-09-22 11:48:11 +02:00
2020-09-17 13:45:31 +02:00
2021-08-26 08:36:40 -04:00
2019-10-07 18:57:10 +02:00
2021-11-26 11:36:04 +01:00
2021-11-26 11:36:06 +01:00
2021-11-12 14:40:50 +01:00
2021-09-26 13:39:46 +02:00
2021-10-06 15:31:20 +02:00
2021-09-22 11:47:49 +02:00
2021-11-26 11:36:06 +01:00
2019-05-31 06:46:05 -07:00
2018-02-06 18:32:44 -08:00
2018-05-18 14:58:22 +02:00
2019-12-13 08:51:11 +01:00
2020-10-01 13:14:33 +02:00
2020-06-22 09:05:13 +02:00
2020-06-22 09:05:13 +02:00
2020-06-22 09:05:13 +02:00
2019-12-01 09:17:17 +01:00
2018-11-13 11:08:47 -08:00
2020-01-23 08:21:29 +01:00
2020-06-22 09:04:58 +02:00
2016-12-24 11:46:01 -08:00
2015-11-24 09:56:43 +01:00
2020-06-22 09:05:28 +02:00
2021-07-20 16:16:04 +02:00
2018-08-22 10:52:47 -07:00
2020-01-09 10:19:00 +01:00
2018-04-27 14:34:51 +02:00
2018-05-16 07:23:35 +02:00
2018-05-16 07:23:35 +02:00
2021-01-30 13:32:11 +01:00
2018-02-21 16:54:06 +01:00
2020-11-24 13:27:23 +01:00
2021-09-22 11:48:09 +02:00
2018-08-06 12:35:20 +02:00
2021-07-11 12:49:30 +02:00
2017-12-14 16:00:49 -08:00
2019-04-20 09:16:02 +02:00
2018-05-15 23:08:33 -07:00
2019-05-31 06:46:19 -07:00
2021-03-04 09:39:30 +01:00
2020-07-16 08:17:26 +02:00
2017-11-02 11:10:55 +01:00
2016-10-25 11:31:51 +02:00
2018-08-02 08:06:54 +09:00
2019-02-12 19:47:20 +01:00
2021-02-03 23:23:23 +01:00
2021-05-22 10:59:44 +02:00
2017-11-02 11:10:55 +01:00
2018-07-16 12:31:57 -07:00
2020-04-17 10:48:52 +02:00
2021-02-13 13:51:13 +01:00
2017-07-12 16:25:59 -07:00
2021-07-11 12:49:31 +02:00
2017-03-02 08:42:39 +01:00
2021-02-10 09:21:06 +01:00
2020-01-29 16:43:27 +01:00
2018-07-02 11:36:17 +02:00
2018-07-02 11:36:17 +02:00
2021-06-30 08:48:28 -04:00
2020-03-25 08:06:13 +01:00
2017-03-13 15:57:41 -03:00
2021-08-08 08:54:30 +02:00
2019-12-01 09:17:10 +01:00
2018-04-11 10:28:37 -07:00
2021-09-22 11:48:09 +02:00
2019-01-13 09:51:06 +01:00
2021-09-26 13:39:48 +02:00
2021-05-26 11:48:32 +02:00
2017-11-02 11:10:55 +01:00
2020-11-18 19:18:52 +01:00
2020-08-26 10:30:59 +02:00
2019-09-16 08:22:20 +02:00
2018-07-10 22:18:52 +02:00
2021-03-04 09:39:54 +01:00
2021-11-26 11:36:02 +01:00
2021-05-22 10:59:39 +02:00
2021-02-07 14:48:38 +01:00
2017-11-02 11:10:55 +01:00
2018-08-03 15:52:10 +02:00
2017-03-08 09:18:02 +01:00
2018-08-13 11:25:07 -07:00
2018-06-10 10:17:09 -07:00
2021-09-26 13:39:47 +02:00
2018-04-16 11:26:49 +02:00
2021-02-07 14:48:37 +01:00
2017-12-17 13:57:15 +01:00
2020-01-09 10:18:59 +01:00
2018-06-21 12:33:05 +02:00
2018-06-25 11:30:10 -07:00
2021-07-20 16:15:42 +02:00
2017-03-02 08:42:39 +01:00
2018-04-05 21:36:27 -07:00
2018-04-02 20:15:59 +02:00
2018-04-02 20:15:30 +02:00
2020-10-14 10:31:21 +02:00
2021-05-22 10:59:39 +02:00
2018-11-13 11:09:00 -08:00
2018-08-22 10:52:47 -07:00
2018-08-11 02:05:53 -05:00
2018-04-11 10:28:35 -07:00
2018-08-30 12:56:40 +02:00
2020-02-24 08:34:49 +01:00
2018-05-18 08:47:13 -07:00
2021-11-26 11:36:06 +01:00