Song Liu
0f9650bd83
md: fix NULL pointer deref with nowait but no mddev->queue
...
Leon reported NULL pointer deref with nowait support:
[ 15.123761] device-mapper: raid: Loading target version 1.15.1
[ 15.124185] device-mapper: raid: Ignoring chunk size parameter for RAID 1
[ 15.124192] device-mapper: raid: Choosing default region size of 4MiB
[ 15.129524] BUG: kernel NULL pointer dereference, address: 0000000000000060
[ 15.129530] #PF: supervisor write access in kernel mode
[ 15.129533] #PF: error_code(0x0002) - not-present page
[ 15.129535] PGD 0 P4D 0
[ 15.129538] Oops: 0002 [#1 ] PREEMPT SMP NOPTI
[ 15.129541] CPU: 5 PID: 494 Comm: ldmtool Not tainted 5.17.0-rc2-1-mainline #1 9fe89d43dfcb215d2731e6f8851740520778615e
[ 15.129546] Hardware name: Gigabyte Technology Co., Ltd. X570 AORUS ELITE/X570 AORUS ELITE, BIOS F36e 10/14/2021
[ 15.129549] RIP: 0010:blk_queue_flag_set+0x7/0x20
[ 15.129555] Code: 00 00 00 0f 1f 44 00 00 48 8b 35 e4 e0 04 02 48 8d 57 28 bf 40 01 \
00 00 e9 16 c1 be ff 66 0f 1f 44 00 00 0f 1f 44 00 00 89 ff <f0> 48 0f ab 7e 60 \
31 f6 89 f7 c3 66 66 2e 0f 1f 84 00 00 00 00 00
[ 15.129559] RSP: 0018:ffff966b81987a88 EFLAGS: 00010202
[ 15.129562] RAX: ffff8b11c363a0d0 RBX: ffff8b11e294b070 RCX: 0000000000000000
[ 15.129564] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000000000001d
[ 15.129566] RBP: ffff8b11e294b058 R08: 0000000000000000 R09: 0000000000000000
[ 15.129568] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8b11e294b070
[ 15.129570] R13: 0000000000000000 R14: ffff8b11e294b000 R15: 0000000000000001
[ 15.129572] FS: 00007fa96e826780(0000) GS:ffff8b18deb40000(0000) knlGS:0000000000000000
[ 15.129575] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 15.129577] CR2: 0000000000000060 CR3: 000000010b8ce000 CR4: 00000000003506e0
[ 15.129580] Call Trace:
[ 15.129582] <TASK>
[ 15.129584] md_run+0x67c/0xc70 [md_mod 1e470c1b6bcf1114198109f42682f5a2740e9531]
[ 15.129597] raid_ctr+0x134a/0x28ea [dm_raid 6a645dd7519e72834bd7e98c23497eeade14cd63]
[ 15.129604] ? dm_split_args+0x63/0x150 [dm_mod 0d7b0bc3414340a79c4553bae5ca97294b78336e]
[ 15.129615] dm_table_add_target+0x188/0x380 [dm_mod 0d7b0bc3414340a79c4553bae5ca97294b78336e]
[ 15.129625] table_load+0x13b/0x370 [dm_mod 0d7b0bc3414340a79c4553bae5ca97294b78336e]
[ 15.129635] ? dev_suspend+0x2d0/0x2d0 [dm_mod 0d7b0bc3414340a79c4553bae5ca97294b78336e]
[ 15.129644] ctl_ioctl+0x1bd/0x460 [dm_mod 0d7b0bc3414340a79c4553bae5ca97294b78336e]
[ 15.129655] dm_ctl_ioctl+0xa/0x20 [dm_mod 0d7b0bc3414340a79c4553bae5ca97294b78336e]
[ 15.129663] __x64_sys_ioctl+0x8e/0xd0
[ 15.129667] do_syscall_64+0x5c/0x90
[ 15.129672] ? syscall_exit_to_user_mode+0x23/0x50
[ 15.129675] ? do_syscall_64+0x69/0x90
[ 15.129677] ? do_syscall_64+0x69/0x90
[ 15.129679] ? syscall_exit_to_user_mode+0x23/0x50
[ 15.129682] ? do_syscall_64+0x69/0x90
[ 15.129684] ? do_syscall_64+0x69/0x90
[ 15.129686] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 15.129689] RIP: 0033:0x7fa96ecd559b
[ 15.129692] Code: ff ff ff 85 c0 79 9b 49 c7 c4 ff ff ff ff 5b 5d 4c 89 e0 41 5c \
c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff \
ff 73 01 c3 48 8b 0d a5 a8 0c 00 f7 d8 64 89 01 48
[ 15.129696] RSP: 002b:00007ffcaf85c258 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
[ 15.129699] RAX: ffffffffffffffda RBX: 00007fa96f1b48f0 RCX: 00007fa96ecd559b
[ 15.129701] RDX: 00007fa97017e610 RSI: 00000000c138fd09 RDI: 0000000000000003
[ 15.129702] RBP: 00007fa96ebab583 R08: 00007fa97017c9e0 R09: 00007ffcaf85bf27
[ 15.129704] R10: 0000000000000001 R11: 0000000000000206 R12: 00007fa97017e610
[ 15.129706] R13: 00007fa97017e640 R14: 00007fa97017e6c0 R15: 00007fa97017e530
[ 15.129709] </TASK>
This is caused by missing mddev->queue check for setting QUEUE_FLAG_NOWAIT
Fix this by moving the QUEUE_FLAG_NOWAIT logic to under mddev->queue check.
Fixes: f51d46d0e7cb ("md: add support for REQ_NOWAIT")
Reported-by: Leon Möller <jkhsjdhjs@totally.rip>
Tested-by: Leon Möller <jkhsjdhjs@totally.rip>
Cc: Vishal Verma <vverma@digitalocean.com>
Signed-off-by: Song Liu <song@kernel.org>
2022-02-02 10:14:07 -08:00
..
2021-12-14 20:32:54 -07:00
2022-01-04 13:58:19 -05:00
2021-10-27 16:53:47 -04:00
2021-10-27 16:53:47 -04:00
2019-11-05 14:53:03 -05:00
2020-01-07 12:07:08 -05:00
2021-10-18 06:17:02 -06:00
2021-11-09 11:02:04 -08:00
2021-10-18 14:43:22 -06:00
2021-10-18 14:43:22 -06:00
2021-04-19 13:20:31 -04:00
2020-03-27 14:42:51 -04:00
2021-10-18 14:43:22 -06:00
2021-10-21 10:49:32 -06:00
2021-11-09 11:02:04 -08:00
2021-08-10 13:34:23 -04:00
2021-10-18 14:43:22 -06:00
2021-10-18 14:43:22 -06:00
2021-10-18 14:43:22 -06:00
2021-10-18 14:43:22 -06:00
2021-10-18 14:43:22 -06:00
2021-10-18 06:17:01 -06:00
2021-08-20 15:59:47 -04:00
2020-08-04 15:51:28 -04:00
2022-01-06 09:48:33 -05:00
2021-06-28 16:30:13 -04:00
2021-02-26 15:49:51 -07:00
2021-08-10 13:34:23 -04:00
2021-06-15 15:42:03 -04:00
2021-12-18 08:04:53 -08:00
2021-08-10 13:34:23 -04:00
2021-12-18 08:04:53 -08:00
2021-10-18 14:43:22 -06:00
2021-11-29 06:41:29 -07:00
2020-05-15 10:29:36 -04:00
2021-10-18 06:17:01 -06:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-10-18 14:43:22 -06:00
2021-10-18 06:17:01 -06:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2021-08-10 13:34:23 -04:00
2020-05-20 17:09:44 -04:00
2021-12-18 08:04:53 -08:00
2021-10-18 14:43:22 -06:00
2022-01-06 09:48:55 -05:00
2021-12-04 08:58:51 -08:00
2019-04-25 15:38:52 -04:00
2021-10-18 14:43:22 -06:00
2019-12-05 17:05:24 -05:00
2021-10-18 14:43:22 -06:00
2019-05-30 11:26:35 -07:00
2019-05-30 11:26:35 -07:00
2021-08-10 13:34:23 -04:00
2021-04-14 14:28:29 -04:00
2021-04-14 14:28:29 -04:00
2021-11-09 11:02:04 -08:00
2021-05-25 16:14:05 -04:00
2020-08-04 15:48:13 -04:00
2020-07-13 11:47:33 -04:00
2021-12-04 08:58:50 -08:00
2020-12-04 18:04:35 -05:00
2021-06-25 15:25:23 -04:00
2021-06-04 12:07:28 -04:00
2021-06-04 12:07:24 -04:00
2021-11-09 11:02:04 -08:00
2020-06-05 14:59:53 -04:00
2022-01-28 12:28:15 -07:00
2021-12-04 08:58:51 -08:00
2021-10-27 16:54:36 -04:00
2021-10-27 16:53:47 -04:00
2020-08-23 17:36:59 -05:00
2021-11-02 11:41:44 -07:00
2022-01-06 08:37:03 -08:00
2021-06-14 22:32:07 -07:00
2021-06-14 22:32:07 -07:00
2020-05-13 12:02:23 -07:00
2021-06-14 22:32:07 -07:00
2022-02-02 10:14:07 -08:00
2022-01-06 08:37:03 -08:00
2022-01-06 08:37:03 -08:00
2019-09-13 13:10:05 -07:00
2022-01-06 08:37:02 -08:00
2022-01-12 10:35:23 -08:00
2021-06-14 22:32:07 -07:00
2021-03-11 07:47:48 -07:00
2021-11-02 11:41:45 -07:00
2022-01-06 08:37:03 -08:00
2022-01-06 08:37:02 -08:00
2022-01-06 08:37:02 -08:00
2021-06-14 22:32:07 -07:00