Greg Thelen
f8e9ec1661
block: tolerate tracing of NULL bio
__get_request() can call trace_block_getrq() with bio=NULL which causes
block_get_rq::TP_fast_assign() to deref a NULL pointer and panic.
Syzkaller fuzzer panics with
linux-next (1d53d908b79d7870d89063062584eead4cf83448):
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN
Modules linked in:
CPU: 0 PID: 2983 Comm: syzkaller401111 Not tainted 4.13.0-rc7-next-20170901+ #13
task: ffff8801cf1da000 task.stack: ffff8801ce440000
RIP: 0010:perf_trace_block_get_rq+0x697/0x970 include/trace/events/block.h:384
RSP: 0018:ffff8801ce4473f0 EFLAGS: 00010246
RAX: ffff8801cf1da000 RBX: 1ffff10039c88e84 RCX: 1ffffd1ffff84d27
RDX: dffffc0000000001 RSI: 1ffff1003b643e7a RDI: ffffe8ffffc26938
RBP: ffff8801ce447530 R08: 1ffff1003b643e6c R09: ffffe8ffffc26964
R10: 0000000000000002 R11: fffff91ffff84d2d R12: ffffe8ffffc1f890
R13: ffffe8ffffc26930 R14: ffffffff85cad9e0 R15: 0000000000000000
FS: 0000000002641880(0000) GS:ffff8801db200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000043e670 CR3: 00000001d1d7a000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
trace_block_getrq include/trace/events/block.h:423 [inline]
__get_request block/blk-core.c:1283 [inline]
get_request+0x1518/0x23b0 block/blk-core.c:1355
blk_old_get_request block/blk-core.c:1402 [inline]
blk_get_request+0x1d8/0x3c0 block/blk-core.c:1427
sg_scsi_ioctl+0x117/0x750 block/scsi_ioctl.c:451
sg_ioctl+0x192d/0x2ed0 drivers/scsi/sg.c:1070
vfs_ioctl fs/ioctl.c:45 [inline]
do_vfs_ioctl+0x1b1/0x1530 fs/ioctl.c:685
SYSC_ioctl fs/ioctl.c:700 [inline]
SyS_ioctl+0x8f/0xc0 fs/ioctl.c:691
entry_SYSCALL_64_fastpath+0x1f/0xbe
block_get_rq::TP_fast_assign() has multiple redundant ->dev assignments.
Only one of them is NULL tolerant. Favor the NULL tolerant one.
Fixes: 74d46992e0 ("block: replace bi_bdev with a gendisk pointer and partitions index")
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2017-09-11 09:45:52 -06:00
..
2015-04-08 09:39:59 -04:00
2017-01-09 11:10:02 +00:00
2016-12-25 17:21:22 +01:00
2016-02-26 10:52:48 +09:00
2017-08-23 12:49:55 -06:00
2017-09-11 09:45:52 -06:00
2017-04-25 11:57:45 -04:00
2017-08-31 11:42:41 -07:00
2017-08-18 16:36:29 +02:00
2017-02-10 16:02:26 +01:00
2015-04-15 16:35:19 -07:00
2017-02-22 16:41:27 -08:00
2016-09-02 20:05:05 +02:00
2016-07-14 22:16:05 -07:00
2016-10-25 14:40:39 +02:00
2017-07-30 22:30:11 -04:00
2017-08-23 12:49:55 -06:00
2016-03-20 13:44:34 -04:00
2015-09-01 14:32:44 -07:00
2016-01-08 11:38:13 -05:00
2017-07-06 07:02:25 -04:00
2017-09-06 17:27:24 -07:00
2017-06-09 11:52:09 +02:00
2017-06-09 11:52:08 +02:00
2015-10-20 21:56:10 -04:00
2016-07-26 16:19:19 -07:00
2017-05-31 21:01:03 +02:00
2016-08-17 11:13:07 +02:00
2017-04-29 00:20:49 +02:00
2016-09-29 10:03:38 +02:00
2016-03-24 10:52:25 -07:00
2016-07-14 09:03:57 +02:00
2016-07-15 08:08:13 -04:00
2016-09-13 15:23:12 +02:00
2016-11-24 11:55:43 -05:00
2015-04-08 09:40:01 -04:00
2017-08-30 14:02:01 +02:00
2017-09-06 17:27:30 -07:00
2016-07-15 15:55:01 -07:00
2015-11-06 17:50:42 -08:00
2017-07-10 16:32:32 -07:00
2016-04-01 17:03:37 -05:00
2016-03-17 15:09:34 -07:00
2017-06-20 15:31:43 -04:00
2016-09-16 23:55:30 +02:00
2016-07-15 15:52:41 -04:00
2017-08-16 14:10:10 -07:00
2017-07-24 16:04:12 -07:00
2017-06-05 14:30:49 +01:00
2017-04-04 11:44:06 +02:00
2016-04-11 16:57:09 -04:00
2017-05-31 21:01:03 +02:00
2017-06-13 18:51:11 +01:00
2015-08-05 12:27:09 -07:00
2016-07-13 15:53:43 -04:00
2016-02-07 14:13:05 -05:00
2016-12-19 09:05:20 -05:00
2017-03-03 09:45:01 -05:00
2015-06-02 08:03:25 -07:00
2015-08-31 10:47:14 -04:00
2015-08-03 23:15:50 +08:00
2017-05-05 15:54:45 +08:00
2017-02-27 13:26:17 -08:00
2016-03-08 11:19:28 -05:00
2017-01-05 18:10:04 -05:00
2017-04-14 22:37:02 -03:00
2015-12-18 13:53:31 -02:00
2017-02-22 16:41:29 -08:00
2016-08-02 02:57:29 +03:00
2016-11-10 13:53:32 -07:00
2017-07-29 09:00:03 -06:00
2017-08-29 10:51:29 -07:00
2017-08-31 09:45:55 -04:00