提交 4ee86bab 编写于 作者: H Hannes Reinecke 提交者: Jens Axboe

blk-mq: add bounds check on tag-to-rq conversion

We need to check for a valid index before accessing the array
element to avoid accessing invalid memory regions.
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NJeff Moyer <jmoyer@redhat.com>

Modified by Jens to drop the unlikely(), and make the fall through
path be having a valid tag.
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 2b885517
......@@ -544,7 +544,10 @@ EXPORT_SYMBOL(blk_mq_abort_requeue_list);
struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag)
{
return tags->rqs[tag];
if (tag < tags->nr_tags)
return tags->rqs[tag];
return NULL;
}
EXPORT_SYMBOL(blk_mq_tag_to_rq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册