linux-stable/drivers/misc
Sherry Sun cc1a267986 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>
2020-10-02 15:57:29 +02:00
..
altera-stapl altera-stapl: altera_get_note: prevent write beyond end of 'key' 2020-03-03 08:02:57 +01:00
c2port misc: c2port: core: Ensure source size does not equal destination size in strncpy() 2020-06-29 18:45:52 +02:00
cardreader misc: rtsx: Add power saving functions and fix driving parameter 2020-09-16 17:30:37 +02:00
cb710 misc: cb710: sgbuf2: Add missing documentation for cb710_sg_dwiter_write_next_block()'s 'data' arg 2020-06-29 18:45:53 +02:00
cxl cxl: Change PCIBIOS_SUCCESSFUL to 0 2020-07-13 15:39:52 +02:00
echo char: Replace HTTP links with HTTPS ones 2020-07-23 09:44:15 +02:00
eeprom eeprom: ee1004: use module_i2c_driver to simplify the code 2020-10-02 11:36:37 +02:00
genwqe pci-v5.9-changes 2020-08-07 18:48:15 -07:00
habanalabs habanalabs/gaudi: use correct define for qman init 2020-09-30 08:38:18 +02:00
ibmasm misc: ibmasm: dot_command: Demote function headers from kerneldoc 2020-07-01 15:08:03 +02:00
lis3lv02d
lkdtm misc: lkdtm: bugs: At least try to use popuated variable 2020-06-29 18:45:52 +02:00
mei Merge 5.9-rc3 into char-misc-next 2020-08-31 07:17:17 +02:00
mic misc: vop: add round_up(x,4) for vring_size to avoid kernel panic 2020-10-02 15:57:29 +02:00
ocxl ocxl: simplify the return expression of free_function_dev() 2020-10-02 11:35:46 +02:00
sgi-gru treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
sgi-xp treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
ti-st misc: ti-st: st_kim: Tidy-up bespoke commentry 2020-06-29 18:45:52 +02:00
uacce uacce: Use kobj_to_dev() instead of container_of() 2020-09-07 14:30:35 +02:00
vmw_vmci VMCI: check return value of get_user_pages_fast() for errors 2020-08-28 12:31:39 +02:00
ad525x_dpot-i2c.c
ad525x_dpot-spi.c
ad525x_dpot.c docs: misc-devices/pci-endpoint-test.txt: convert to ReST 2020-06-19 14:05:49 -06:00
ad525x_dpot.h
apds990x.c
apds9802als.c
atmel-ssc.c misc: atmel-ssc: lock with mutex instead of spinlock 2020-06-29 19:10:51 +02:00
atmel_tclib.c
bh1770glc.c
cs5535-mfgpt.c
ds1682.c
dummy-irq.c
enclosure.c misc: enclosure: Update enclosure_remove_device() documentation to match reality 2020-07-01 15:05:37 +02:00
fastrpc.c misc: fastrpc: add ioctl for attaching to sensors pd 2020-09-16 17:30:37 +02:00
hisi_hikey_usb.c misc: hisi_hikey_usb: delete a stray tab 2020-09-22 18:54:00 +02:00
hmc6352.c
hpilo.c misc: hpilo: avoid a useless memset 2020-07-23 12:56:49 +02:00
hpilo.h hpilo: Replace one-element array with flexible-array member 2020-07-14 18:21:25 +02:00
ibmvmc.c mm, treewide: rename kzfree() to kfree_sensitive() 2020-08-07 11:33:22 -07:00
ibmvmc.h
ics932s401.c
isl29003.c
isl29020.c misc: isl29020: add missed pm_runtime_disable 2020-01-14 15:06:07 +01:00
Kconfig misc: hisi_hikey_usb: add support for Hikey 970 2020-09-10 18:56:41 +02:00
kgdbts.c maccess: rename probe_kernel_{read,write} to copy_{from,to}_kernel_nofault 2020-06-17 10:57:41 -07:00
lattice-ecp3-config.c misc: lattice-ecp3-config: Remove set but clearly unused variable 'ret' 2020-07-01 15:05:37 +02:00
Makefile misc: hisi_hikey_usb: Driver to support onboard USB gpio hub on Hikey960 2020-09-10 18:56:38 +02:00
pch_phub.c misc: pch_phub: Remove superfluous descriptions to non-existent args 'offset_address' 2020-07-01 15:05:37 +02:00
pci_endpoint_test.c misc: pci_endpoint_test: Add J721E in pci_device_id table 2020-08-03 14:50:08 +01:00
phantom.c misc/phantom.c: use generic power management 2020-06-29 18:43:42 +02:00
pti.c misc: pti: Remove unparsable empty line in function header 2020-07-01 15:05:36 +02:00
pvpanic.c misc: pvpanic: Use devm_platform_ioremap_resource() 2020-09-22 18:53:30 +02:00
qcom-coincell.c
sram-exec.c char: Replace HTTP links with HTTPS ones 2020-07-23 09:44:15 +02:00
sram.c misc: sram: use devm_platform_ioremap_resource_wc() 2019-11-05 18:32:47 +01:00
sram.h
tifm_7xx1.c misc/tifm_7xx1.c: use generic power management 2020-06-29 18:43:42 +02:00
tifm_core.c
tsl2550.c misc: tsl2550: remove redundant initialization to variable r 2020-01-14 15:16:51 +01:00
vmw_balloon.c vmw_balloon: Explicitly include linux/io.h for virt_to_phys() 2019-12-10 10:15:48 +01:00
xilinx_sdfec.c misc: xilinx-sdfec: convert get_user_pages() --> pin_user_pages() 2020-05-27 11:09:26 +02:00