linux/drivers/media
Hsin-Yi Wang e6599adfad media: mtk-vpu: avoid unaligned access to DTCM buffer.
Previously, vpu->recv_buf and send_buf are forced cast from
void __iomem *tcm. vpu->recv_buf->share_buf is passed to
vpu_ipi_desc.handler(). It's not able to do unaligned access. Otherwise
kernel would crash due to unable to handle kernel paging request.

struct vpu_run {
	u32 signaled;
	char fw_ver[VPU_FW_VER_LEN];
	unsigned int	dec_capability;
	unsigned int	enc_capability;
	wait_queue_head_t wq;
};

fw_ver starts at 4 byte boundary. If system enables
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS, strscpy() will do
read_word_at_a_time(), which tries to read 8-byte: *(unsigned long *)addr

vpu_init_ipi_handler() calls strscpy(), which would lead to crash.

vpu_init_ipi_handler() and several other handlers (eg.
vpu_dec_ipi_handler) only do read access to this data, so they can be
const, and we can use memcpy_fromio() to copy the buf to another non iomem
buffer then pass to handler.

Fixes: 85709cbf15 ("media: replace strncpy() by strscpy()")
Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2020-03-12 16:25:33 +01:00
..
cec media: cec: remove unused functions 2020-01-08 14:38:06 +01:00
common media: videobuf2-dma-contig.c: remove spurious 'b' in message 2020-03-02 15:23:39 +01:00
dvb-core media: dvb-core: dvbdev: convert to use i2c_new_client_device() 2020-01-09 15:57:46 +01:00
dvb-frontends media: tda10071: fix unsigned sign extension overflow 2020-03-12 09:46:45 +01:00
firewire media: firewire: Make structure fdtv_ca constant 2019-08-21 18:39:55 -03:00
i2c media: smiapp: Move definitions under driver directory 2020-02-27 17:49:04 -03:00
mc media: mc-entity.c: use WARN_ON, validate link pads 2020-02-24 17:21:58 +01:00
mmc treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pci media: media/pci: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:53:50 +01:00
platform media: mtk-vpu: avoid unaligned access to DTCM buffer. 2020-03-12 16:25:33 +01:00
radio media: Fix Kconfig indentation 2020-02-24 15:19:38 +01:00
rc media: rc: make scancodes 64 bit 2020-03-12 09:20:46 +01:00
spi media: spi: gs1662: Use new structure for SPI transfer delays 2020-03-05 22:46:25 +01:00
tuners media: tuners: Use the correct style for SPDX License Identifier 2019-10-24 18:57:55 -03:00
usb media: lmedm04: remove redundant assignment to variable gate 2020-03-12 09:47:33 +01:00
v4l2-core media: v4l2-mem2mem: handle draining, stopped and next-buf-is-last states 2020-03-05 22:54:49 +01:00
Kconfig media: Fix Kconfig indentation 2020-02-24 15:19:38 +01:00
Makefile media: move drivers/media/media-* to drivers/media/mc/mc-* 2019-05-28 12:15:46 -04:00