linux-sg2042/drivers/media/platform/mtk-vcodec
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
..
vdec media: mtk-vcodec: reset segment data then trig decoder 2020-03-02 15:22:30 +01:00
venc media: mtk-vcodec: remove unneeded proxy functions 2019-06-21 17:10:20 -04:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mtk_vcodec_dec.c media: mtk-vcodec: use v4l2_m2m_buffer where appropriate 2020-01-09 14:46:41 +01:00
mtk_vcodec_dec.h media: mtk-vcodec: use v4l2_m2m_buffer where appropriate 2020-01-09 14:46:41 +01:00
mtk_vcodec_dec_drv.c media: media/platform: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:54:14 +01:00
mtk_vcodec_dec_pm.c Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
mtk_vcodec_dec_pm.h Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
mtk_vcodec_drv.h media: mtk-vcodec: flag OUTPUT formats with V4L2_FMT_FLAG_DYN_RESOLUTION 2019-08-19 14:57:40 -03:00
mtk_vcodec_enc.c media: mtk-vcodec: use v4l2_m2m_buffer where appropriate 2020-01-09 14:46:41 +01:00
mtk_vcodec_enc.h media: mtk-vcodec: use v4l2_m2m_buffer where appropriate 2020-01-09 14:46:41 +01:00
mtk_vcodec_enc_drv.c media: media/platform: rename VFL_TYPE_GRABBER to _VIDEO 2020-02-24 16:54:14 +01:00
mtk_vcodec_enc_pm.c Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
mtk_vcodec_enc_pm.h Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
mtk_vcodec_intr.c Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
mtk_vcodec_intr.h Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
mtk_vcodec_util.c Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
mtk_vcodec_util.h Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
vdec_drv_base.h media: mtk-vcodec: avoid unneeded pointer-to-long conversions 2019-06-21 17:09:30 -04:00
vdec_drv_if.c media: mtk-vcodec: remove unneeded proxy functions 2019-06-21 17:10:20 -04:00
vdec_drv_if.h media: mtk-vcodec: remove unneeded proxy functions 2019-06-21 17:10:20 -04:00
vdec_ipi_msg.h Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
vdec_vpu_if.c media: mtk-vpu: avoid unaligned access to DTCM buffer. 2020-03-12 16:25:33 +01:00
vdec_vpu_if.h media: mtk-vcodec: vdec: set VPI IPI handler in one place 2019-10-01 16:45:25 -03:00
venc_drv_base.h media: mtk-vcodec: avoid unneeded pointer-to-long conversions 2019-06-21 17:09:30 -04:00
venc_drv_if.c media: mtk-vcodec: remove unneeded proxy functions 2019-06-21 17:10:20 -04:00
venc_drv_if.h media: mtk-vcodec: remove unneeded proxy functions 2019-06-21 17:10:20 -04:00
venc_ipi_msg.h Linux 5.2-rc4 2019-06-11 12:09:28 -04:00
venc_vpu_if.c media: mtk-vpu: avoid unaligned access to DTCM buffer. 2020-03-12 16:25:33 +01:00
venc_vpu_if.h Linux 5.2-rc4 2019-06-11 12:09:28 -04:00