linux/drivers
Jindong Yue 2b223f9af1 UPSTREAM: remoteproc: core: Remove casting to rproc_handle_resource_t
There are four different callback functions that are used for the
rproc_handle_resource_t callback that all have different second
parameter types.

rproc_handle_vdev -> struct fw_rsc_vdev
rproc_handle_trace -> struct fw_rsc_trace
rproc_handle_devmem -> struct fw_rsc_devmem
rproc_handle_carveout -> struct fw_rsc_carveout

These callbacks are cast to rproc_handle_resource_t so that there is no
error about incompatible pointer types. Unfortunately, this is a Clang's
Control-Flow Integrity checking violation, which verifies that the
callback function's types match the prototypes exactly before jumping.

[    7.275750] Kernel panic - not syncing: CFI failure (target: rproc_handle_vdev+0x0/0x4)
[    7.283763] CPU: 2 PID: 1 Comm: init Tainted: G         C O      5.4.70-03301-g527af2c96672 #17
[    7.292463] Hardware name: NXP i.MX8MPlus EVK board (DT)
[    7.297779] Call trace:
[    7.300232]  dump_backtrace.cfi_jt+0x0/0x4
[    7.304337]  show_stack+0x18/0x24
[    7.307660]  dump_stack+0xb8/0x114
[    7.311069]  panic+0x164/0x3d4
[    7.314130]  __ubsan_handle_cfi_check_fail_abort+0x0/0x14
[    7.319533]  perf_proc_update_handler+0x0/0xcc
[    7.323983]  __cfi_check+0x63278/0x6a290
[    7.327913]  rproc_boot+0x3f8/0x738
[    7.331404]  rproc_add+0x68/0x110
[    7.334738]  imx_rproc_probe+0x5e4/0x708 [imx_rproc]
[    7.339711]  platform_drv_probe+0xac/0xf0
[    7.343726]  really_probe+0x260/0x65c
[    7.347393]  driver_probe_device+0x64/0x100
[    7.351580]  device_driver_attach+0x6c/0xac
[    7.355766]  __driver_attach+0xdc/0x184
[    7.359609]  bus_for_each_dev+0x98/0x104
[    7.363537]  driver_attach+0x24/0x30
[    7.367117]  bus_add_driver+0x100/0x1e0
[    7.370958]  driver_register+0x78/0x114
[    7.374800]  __platform_driver_register+0x44/0x50
[    7.379514]  init_module+0x20/0xfe8 [imx_rproc]
[    7.384049]  do_one_initcall+0x190/0x348
[    7.387979]  do_init_module+0x5c/0x210
[    7.391731]  load_module+0x2fbc/0x3590
[    7.395485]  __arm64_sys_finit_module+0xb8/0xec
[    7.400025]  el0_svc_common+0xb4/0x19c
[    7.403777]  el0_svc_handler+0x74/0x98
[    7.407531]  el0_svc+0x8/0xc
[    7.410419] SMP: stopping secondary CPUs
[    7.414648] Kernel Offset: disabled
[    7.418142] CPU features: 0x00010002,2000200c
[    7.422501] Memory Limit: none

To fix this, change the second parameter of all functions to void * and
use a local variable with the correct type so that everything works
properly. With this, we can remove casting to rproc_handle_resource_t
for these functions.

Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20210224055825.7417-1-jindong.yue@nxp.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

(cherry picked from commit 2bf2346159)
Bug: 187234877
Reported-by: Joy-mi Huang <joy-mi.huang@mediatek.com>
Signed-off-by: Lecopzer Chen <lecopzer.chen@mediatek.com>
Change-Id: Icc7adeaf98f779fc46a979ff7e9f2ab5f963f636
2021-05-05 14:57:25 +00:00
..
accessibility speakup: fix uninitialized flush_lock 2020-12-30 11:53:44 +01:00
acpi Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
amba Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
android ANDROID: sched: Add vendor hooks for update_topology 2021-05-05 09:06:55 +00:00
ata ata: ahci_brcm: Add back regulators management 2021-03-04 11:37:45 +01:00
atm atm: idt77252: fix null-ptr-dereference 2021-03-30 14:31:50 +02:00
auxdisplay auxdisplay: ht16k33: Fix refresh rate handling 2021-03-04 11:38:00 +01:00
base ANDROID: sched: Add vendor hooks for update_topology 2021-05-05 09:06:55 +00:00
bcma
block Merge 5.10.31 into android12-5.10 2021-04-16 16:01:44 +02:00
bluetooth Merge 5.10.23 into android12-5.10 2021-03-11 19:36:03 +01:00
bus bus: ti-sysc: Fix warning on unbind if reset is not deasserted 2021-04-10 13:36:07 +02:00
cdrom
char Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
clk Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
clocksource ANDROID: GKI: enable CONFIG_MTK_TIMER 2021-05-05 12:14:32 +00:00
connector
counter counter: stm32-timer-cnt: fix ceiling miss-alignment with reload register 2021-03-25 09:04:16 +01:00
cpufreq Merge 5.10.27 into android12-5.10 2021-04-02 15:25:50 +02:00
cpuidle ANDROID: cpuidle: Move vendor hook to enter proper state 2021-03-25 19:14:33 +00:00
crypto crypto: sun4i-ss - initialize need_fallback 2021-03-04 11:38:32 +01:00
dax device-dax: Fix default return code of range_parse() 2021-03-04 11:38:15 +01:00
dca
devfreq
dio
dma Merge 5.10.33 into android12-5.10 2021-04-29 13:57:47 +02:00
dma-buf ANDROID: dma-buf: Make DMA-BUF sysfs stats kobjects not send uevents 2021-04-29 22:11:05 +00:00
edac EDAC/amd64: Do not load on family 0x15, model 0x13 2021-03-07 12:34:08 +01:00
eisa
extcon extcon: Fix error handling in extcon_dev_register 2021-04-07 15:00:11 +02:00
firewire firewire: nosy: Fix a use-after-free bug in nosy_ioctl() 2021-04-07 15:00:11 +02:00
firmware Merge 5.10.26 into android12-5.10-lts 2021-03-25 17:15:27 +01:00
fpga fpga: Specify HAS_IOMEM dependency for FPGA_DFL 2020-12-01 18:46:24 +01:00
fsi fsi: Aspeed: Add mutex to protect HW access 2020-12-30 11:53:46 +01:00
gnss
gpio Merge 5.10.33 into android12-5.10 2021-04-29 13:57:47 +02:00
gpu This is the 5.10.32 stable release 2021-04-22 11:12:08 +02:00
greybus
hid Merge 5.10.33 into android12-5.10 2021-04-29 13:57:47 +02:00
hsi HSI: Fix PM usage counter unbalance in ssi_hw_init 2021-03-04 11:37:52 +01:00
hv Drivers: hv: vmbus: Avoid use-after-free in vmbus_onoffer_rescind() 2021-03-04 11:37:46 +01:00
hwmon FROMLIST: hwmon: (scmi) port driver to the new scmi_sensor_proto_ops interface 2021-03-02 17:34:33 -08:00
hwspinlock
hwtracing ANDROID: arm64: coresight: Fix a sparse warning 2021-04-09 18:38:38 +00:00
i2c Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
i3c i3c master: fix missing destroy_workqueue() on error in i3c_master_register 2021-01-06 14:56:53 +01:00
ide ide/falconide: Fix module unload 2021-03-04 11:38:21 +01:00
idle intel_idle: Build fix 2020-12-03 10:00:23 +01:00
iio iio: hid-sensor-temperature: Fix issues of timestamp channel 2021-03-25 09:04:16 +01:00
infiniband RDMA/addr: Be strict with gid size 2021-04-14 08:42:12 +02:00
input This is the 5.10.32 stable release 2021-04-22 11:12:08 +02:00
interconnect interconnect: core: fix error return code of icc_link_destroy() 2021-04-16 11:43:19 +02:00
iommu ANDROID: Fix compilation warning in __iommu_map_pages() 2021-04-13 11:27:32 +00:00
ipack
irqchip Merge 5.10.27 into android12-5.10 2021-04-02 15:25:50 +02:00
isdn mISDN: fix crash in fritzpci 2021-04-10 13:36:08 +02:00
leds leds: trigger: fix potential deadlock with libata 2021-02-03 23:28:41 +01:00
lightnvm lightnvm: fix memory leak when submit fails 2021-01-27 11:55:22 +01:00
macintosh macintosh/adb-iop: Use big-endian autopoll mask 2021-03-04 11:37:42 +01:00
mailbox mailbox: sprd: correct definition of SPRD_OUTBOX_FIFO_FULL 2021-03-04 11:38:15 +01:00
mcb
md dm verity fec: fix misaligned RS roots IO 2021-04-21 13:00:54 +02:00
media FROMGIT: media: v4l: Add new Colorimetry Class 2021-04-15 15:34:36 -07:00
memory UPSTREAM: memory: mtk-smi: Allow building as module 2021-03-24 12:45:16 -07:00
memstick memstick: r592: Fix error return in r592_probe() 2020-12-30 11:53:34 +01:00
message
mfd mfd: gateworks-gsc: Fix interrupt type 2021-03-04 11:38:40 +01:00
misc Merge 5.10.34 into android12-5.10 2021-05-03 10:27:39 +02:00
mmc FROMGIT: mmc: sdhci: Check for reset prior to DMA address unmap 2021-04-30 21:19:40 +00:00
most
mtd mtd: rawnand: mtk: Fix WAITRDY break condition and timeout 2021-04-21 13:00:50 +02:00
mux
net Merge 5.10.34 into android12-5.10 2021-05-03 10:27:39 +02:00
nfc nfc: s3fwrn5: Release the nfc firmware 2020-12-30 11:53:53 +01:00
ntb
nubus
nvdimm libnvdimm/region: Fix nvdimm_has_flush() to handle ND_REGION_ASYNC 2021-04-21 13:00:55 +02:00
nvme nvmet-tcp: fix kmap leak when data digest in use 2021-04-07 15:00:06 +02:00
nvmem nvmem: qcom-spmi-sdam: Fix uninitialized pdev pointer 2021-03-04 11:38:39 +01:00
of Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
opp Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
oprofile
parisc
parport
pci ANDROID: PCI: dwc: Export symbols for ep driver 2021-04-16 08:47:09 +00:00
pcmcia
perf perf/arm-cmn: Move IRQs when migrating context 2021-03-04 11:37:44 +01:00
phy phy: lantiq: rcu-usb2: wait after clock enable 2021-03-04 11:38:24 +01:00
pinctrl Merge 5.10.33 into android12-5.10 2021-04-29 13:57:47 +02:00
platform Merge 5.10.29 into android12-5.10 2021-04-11 09:11:53 +02:00
pnp
power Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
powercap UPSTREAM: powercap/drivers/dtpm: Add the experimental label to the option description 2021-03-22 15:24:47 +00:00
pps
ps3 powerpc/ps3: use dma_mapping_error() 2020-12-30 11:53:53 +01:00
ptp ptp_qoriq: fix overflow in ptp_qoriq_adjfine() u64 calcalation 2021-04-10 13:36:09 +02:00
pwm Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
rapidio
ras RAS/CEC: Correct ce_add_elem()'s returned values 2021-04-14 08:42:12 +02:00
regulator Merge 5.10.30 into android12-5.10 2021-04-15 14:23:41 +02:00
remoteproc UPSTREAM: remoteproc: core: Remove casting to rproc_handle_resource_t 2021-05-05 14:57:25 +00:00
reset FROMLIST: reset: reset-scmi: port driver to the new scmi_reset_proto_ops interface 2021-03-02 17:34:33 -08:00
rpmsg
rtc Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
s390 Merge 5.10.26 into android12-5.10-lts 2021-03-25 17:15:27 +01:00
sbus
scsi This is the 5.10.32 stable release 2021-04-22 11:12:08 +02:00
sfi
sh
siox
slimbus slimbus: qcom: fix potential NULL dereference in qcom_slim_prg_slew() 2020-12-30 11:53:47 +01:00
soc Merge 5.10.33 into android12-5.10 2021-04-29 13:57:47 +02:00
soundwire soundwire: intel: fix possible crash when no device is detected 2021-03-04 11:38:22 +01:00
spi Merge 5.10.26 into android12-5.10-lts 2021-03-25 17:15:27 +01:00
spmi spmi: spmi-pmic-arb: Fix hw_irq overflow 2021-03-04 11:38:40 +01:00
ssb
staging ANDROID: kernel: clear debug_kinfo precisely 2021-04-21 23:23:56 +00:00
target scsi: target: iscsi: Fix zero tag inside a trace event 2021-04-14 08:42:03 +02:00
tc
tee optee: simplify i2c access 2021-03-04 11:37:28 +01:00
thermal thermal/core: Add NULL pointer check before using cooling device stats 2021-04-07 15:00:06 +02:00
thunderbolt thunderbolt: Fix off by one in tb_port_find_retimer() 2021-04-14 08:42:03 +02:00
tty Merge 5.10.28 into android12-5.10 2021-04-09 09:29:17 +02:00
uio
usb Merge 5.10.33 into android12-5.10 2021-04-29 13:57:47 +02:00
vdpa vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails 2021-04-28 13:39:59 +02:00
vfio This is the 5.10.32 stable release 2021-04-22 11:12:08 +02:00
vhost vhost-vdpa: protect concurrent access to vhost device iotlb 2021-04-28 13:39:59 +02:00
video Merge 5.10.28 into android12-5.10 2021-04-09 09:29:17 +02:00
virt virt: vbox: Do not use wait_event_interruptible when called from kernel context 2021-03-04 11:37:18 +01:00
virtio FROMGIT: mm, page_poison: remove CONFIG_PAGE_POISONING_NO_SANITY 2021-03-24 15:09:17 -07:00
visorbus
vlynq
vme
w1 w1: w1_therm: Fix conversion result for negative temperatures 2021-03-04 11:37:18 +01:00
watchdog Merge 5.10.20 into android12-5.10 2021-03-07 12:33:33 +01:00
xen xen/events: fix setting irq affinity 2021-04-16 11:43:22 +02:00
zorro
Kconfig
Makefile vdpa: mlx5: fix vdpa/vhost dependencies 2020-12-02 04:09:56 -05:00
OWNERS ANDROID: Add OWNERS files referring to the respective android-mainline OWNERS 2021-04-03 14:11:30 +00:00