Bart Van Assche
b425e50492
block: Avoid that blk_exit_rl() triggers a use-after-free
...
Since the introduction of .init_rq_fn() and .exit_rq_fn() it is
essential that the memory allocated for struct request_queue
stays around until all blk_exit_rl() calls have finished. Hence
make blk_init_rl() take a reference on struct request_queue.
This patch fixes the following crash:
general protection fault: 0000 [#2 ] SMP
CPU: 3 PID: 28 Comm: ksoftirqd/3 Tainted: G D 4.12.0-rc2-dbg+ #2
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.0.0-prebuilt.qemu-project.org 04/01/2014
task: ffff88013a108040 task.stack: ffffc9000071c000
RIP: 0010:free_request_size+0x1a/0x30
RSP: 0018:ffffc9000071fd38 EFLAGS: 00010202
RAX: 6b6b6b6b6b6b6b6b RBX: ffff880067362a88 RCX: 0000000000000003
RDX: ffff880067464178 RSI: ffff880067362a88 RDI: ffff880135ea4418
RBP: ffffc9000071fd40 R08: 0000000000000000 R09: 0000000100180009
R10: ffffc9000071fd38 R11: ffffffff81110800 R12: ffff88006752d3d8
R13: ffff88006752d3d8 R14: ffff88013a108040 R15: 000000000000000a
FS: 0000000000000000(0000) GS:ffff88013fd80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa8ec1edb00 CR3: 0000000138ee8000 CR4: 00000000001406e0
Call Trace:
mempool_destroy.part.10+0x21/0x40
mempool_destroy+0xe/0x10
blk_exit_rl+0x12/0x20
blkg_free+0x4d/0xa0
__blkg_release_rcu+0x59/0x170
rcu_process_callbacks+0x260/0x4e0
__do_softirq+0x116/0x250
smpboot_thread_fn+0x123/0x1e0
kthread+0x109/0x140
ret_from_fork+0x31/0x40
Fixes: commit e9c787e65c0c ("scsi: allocate scsi_cmnd structures as part of struct request")
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Acked-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Jan Kara <jack@suse.cz>
Cc: <stable@vger.kernel.org> # v4.11+
Signed-off-by: Jens Axboe <axboe@fb.com>
2017-06-01 13:07:55 -06:00
..
2017-05-23 09:16:07 -06:00
2016-10-21 15:45:47 -06:00
2017-04-19 08:48:24 -06:00
2017-05-10 07:39:43 -06:00
2017-04-20 09:39:12 -06:00
2017-05-10 07:39:43 -06:00
2016-10-28 08:45:17 -06:00
2017-05-01 14:09:21 -07:00
2017-06-01 13:07:55 -06:00
2017-06-01 13:07:55 -06:00
2017-04-20 12:16:10 -06:00
2017-04-19 10:19:47 -06:00
2017-04-23 12:59:56 -06:00
2017-03-03 10:53:35 -08:00
2017-04-08 11:25:38 -06:00
2017-03-02 08:42:36 +01:00
2017-04-08 11:25:38 -06:00
2016-11-08 17:30:00 -05:00
2017-05-04 08:25:17 -06:00
2017-05-04 08:25:17 -06:00
2017-03-29 11:09:51 -06:00
2017-05-04 08:24:40 -06:00
2017-04-20 17:28:30 -06:00
2017-05-04 08:24:13 -06:00
2017-04-14 14:06:54 -06:00
2017-03-02 08:56:04 -07:00
2017-02-27 20:54:05 +02:00
2017-05-30 12:32:37 -06:00
2017-05-04 08:23:44 -06:00
2017-04-08 11:25:38 -06:00
2017-03-02 08:42:26 +01:00
2017-05-10 07:40:18 -06:00
2017-04-21 07:56:23 -06:00
2017-06-01 13:07:55 -06:00
2017-01-17 10:04:20 -07:00
2017-05-22 14:47:12 -06:00
2017-04-20 12:16:10 -06:00
2017-04-21 07:56:23 -06:00
2017-04-19 08:49:03 -06:00
2017-01-12 07:58:32 -07:00
2017-06-01 13:07:55 -06:00
2015-09-19 18:57:09 -07:00
2017-04-20 12:16:10 -06:00
2017-05-01 14:41:04 -07:00
2017-05-31 09:25:21 -06:00
2014-01-21 20:18:26 -08:00
2017-04-08 11:25:38 -06:00
2017-02-08 13:43:06 -07:00
2017-05-10 07:40:04 -06:00
2017-05-02 10:21:17 -07:00
2017-04-08 11:25:38 -06:00
2017-04-19 17:38:36 -06:00
2017-05-12 15:43:10 -07:00
2017-04-19 08:30:26 -06:00
2017-05-04 08:25:17 -06:00
2017-04-19 08:48:24 -06:00
2017-05-04 08:25:17 -06:00
2017-01-17 10:03:33 -07:00
2017-02-17 12:41:47 -07:00
2017-05-23 08:41:59 -06:00
2017-04-20 12:16:10 -06:00
2017-04-07 14:24:16 -06:00
2017-03-24 20:34:39 -06:00