summary refs log tree commit diff
path: root/block
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2021-11-01 06:56:09 -0600
committerJens Axboe <axboe@kernel.dk>2021-11-02 06:57:20 -0600
commita22c00be90de188d36f4772ef7b268aa48d7010d (patch)
treed3365e21de21addda6532956d4590c8816a3df1b /block
parentef1661ba6d2e9c8eecd13ee04067bdcc59f7aac6 (diff)
downloadlinux-a22c00be90de188d36f4772ef7b268aa48d7010d.tar.gz
block: assign correct tag before doing prefetch of request
Ensure that current tag is correctly assigned before attempting
to prefetch the first cacheline of the request.

Fixes: 92aff191cc5b ("block: prefetch request to be initialized")
Reported-and-tested-by: syzbot+cd20829ac44b92bf6ed0@syzkaller.appspotmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/blk-mq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 221d1b7d10d6..4787d5b74aa3 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -405,8 +405,8 @@ __blk_mq_alloc_requests_batch(struct blk_mq_alloc_data *data,
 	for (i = 0; tag_mask; i++) {
 		if (!(tag_mask & (1UL << i)))
 			continue;
-		prefetch(tags->static_rqs[tag]);
 		tag = tag_offset + i;
+		prefetch(tags->static_rqs[tag]);
 		tag_mask &= ~(1UL << i);
 		rq = blk_mq_rq_ctx_init(data, tags, tag, alloc_time_ns);
 		rq_list_add(data->cached_rq, rq);