Commit a9a9ed42 authored by Yu Kuai's avatar Yu Kuai Committed by Zheng Zengkai
Browse files

block: fix crash on cmpxchg for request_wrapper

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I65K8D


CVE: NA

--------------------------------

Now that address of request_wrapper is caculated by address of request
plus cmd_size, if cmd_size is not aligned to 8 bytes, request_wrapper
will end up not aligned to 8 bytes as well, which will crash in arm64
because assembly instruction casal requires that operand address is
aligned to 8 bytes:

Internal error: Oops: 96000021 [#1] SMP
pc : blk_account_io_latency+0x54/0x134
Call trace:
 blk_account_io_latency+0x54/0x134
 blk_account_io_done+0x3c/0x4c
 __blk_mq_end_request+0x78/0x134
 scsi_end_request+0xcc/0x1f0
 scsi_io_completion+0x88/0x240
 scsi_finish_command+0x104/0x140
 scsi_softirq_done+0x90/0x180
 blk_mq_complete_request+0x5c/0x70
 scsi_mq_done+0x4c/0x100

Fix the problem by declaring request_wrapper as aligned to cachline, and
placing it before request.

Fixes: 9981c33d ("blk-mq: don't access request_wrapper if request is not allocated from block layer")
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Reviewed-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent e68ee72b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment