diff options
author | Sherry Sun <sherry.sun@nxp.com> | 2020-09-29 17:11:05 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-10-02 15:57:29 +0200 |
commit | cc1a2679865a94b83804822996eed010a50a7c1d (patch) | |
tree | 76c539bee6d5e2d659e809635ae2aa57ee97f070 /Documentation/features/perf | |
parent | 8c56adc511afd1a4355f5209b8dc11a80ec32b63 (diff) | |
download | linux-stable-cc1a2679865a94b83804822996eed010a50a7c1d.tar.gz linux-stable-cc1a2679865a94b83804822996eed010a50a7c1d.tar.bz2 linux-stable-cc1a2679865a94b83804822996eed010a50a7c1d.zip |
misc: vop: add round_up(x,4) for vring_size to avoid kernel panic
Since struct _mic_vring_info and vring are allocated together and follow
vring, if the vring_size() is not four bytes aligned, which will cause
the start address of struct _mic_vring_info is not four byte aligned.
For example, when vring entries is 128, the vring_size() will be 5126
bytes. The _mic_vring_info struct layout in ddr looks like:
0x90002400: 00000000 00390000 EE010000 0000C0FF
Here 0x39 is the avail_idx member, and 0xC0FFEE01 is the magic member.
When EP use ioread32(magic) to reads the magic in RC's share memory, it
will cause kernel panic on ARM64 platform due to the cross-byte io read.
Here read magic in user space use le32toh(vr0->info->magic) will meet
the same issue.
So add round_up(x,4) for vring_size, then the struct _mic_vring_info
will store in this way:
0x90002400: 00000000 00000000 00000039 C0FFEE01
Which will avoid kernel panic when read magic in struct _mic_vring_info.
Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Signed-off-by: Joakim Zhang <qiangqing.zhang@nxp.com>
Link: https://lore.kernel.org/r/20200929091106.24624-4-sherry.sun@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'Documentation/features/perf')
0 files changed, 0 insertions, 0 deletions