linux/sound/soc/sof
Dan Carpenter 27e070151c ASoC: SOF: ipc-msg-injector: fix copy in sof_msg_inject_ipc4_dfs_write()
[ Upstream commit fa9b878ff8 ]

There are two bugs that have to do with when we copy the payload:

	size = simple_write_to_buffer(ipc4_msg->data_ptr,
			      priv->max_msg_size, ppos, buffer,
			      count);

The value of "*ppos" was supposed to be zero but it is
sizeof(ipc4_msg->header_u64) so it will copy the data into the middle of
the "ipc4_msg->data_ptr" buffer instead of to the start.  The second
problem is "buffer" should be "buffer + sizeof(ipc4_msg->header_u64)".

This function is used for fuzz testing so the data is normally random
and this bug likely does not affect anyone very much.

In this context, it's simpler and more appropriate to use copy_from_user()
instead of simple_write_to_buffer() so I have re-written the function.

Fixes: 066c67624d ("ASoC: SOF: ipc-msg-injector: Add support for IPC4 messages")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/Ysg1tB2FKLnRMsel@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2022-08-17 15:15:52 +02:00
..
amd ASoC: SOF: Modify the host trace_init parameter list to include dmab 2022-05-19 16:44:17 +01:00
imx ASoC: SOF: imx: Do not set the load_module ops 2022-04-29 13:06:13 +01:00
intel ASoC: SOF: Intel: disable IMR boot when resuming from ACPI S4 and S5 states 2022-06-24 16:21:51 +01:00
mediatek ASoC: SOF: mediatek: fix mt8195 StatvectorSel wrong setting 2022-08-17 15:15:51 +02:00
xtensa ASoC: SOF: dsp_arch_ops: add kernel log level parameter for oops and stack 2021-12-23 13:38:25 +00:00
compress.c ASoC: SOF: Drop 'header' parameter from tx_message() API 2022-04-04 08:39:09 +01:00
control.c ASoC: SOF: control: use pm_runtime_resume_and_get() 2022-04-27 14:15:24 +01:00
core.c ASoC: SOF: Switch to IPC generic firmware tracing 2022-05-19 16:44:15 +01:00
debug.c ASoC: SOF: Switch to IPC generic firmware tracing 2022-05-19 16:44:15 +01:00
iomem-utils.c ASoC: SOF: Split up utils.c into sof-utils and iomem-utils 2022-02-10 15:19:04 +00:00
ipc.c ASoC: SOF: Switch to IPC generic firmware tracing 2022-05-19 16:44:15 +01:00
ipc3-control.c ASoC: SOF: ipc3: Remove the ipc3-ops.h header file 2022-05-04 15:31:18 +01:00
ipc3-dtrace.c ASoC: SOF: ipc3-dtrace: Move dtrace related variables local from sof_dev 2022-05-19 16:44:19 +01:00
ipc3-loader.c ASoC: SOF: ipc3: Remove the ipc3-ops.h header file 2022-05-04 15:31:18 +01:00
ipc3-pcm.c ASoC: SOF: ipc3: Remove the ipc3-ops.h header file 2022-05-04 15:31:18 +01:00
ipc3-priv.h ASoC: SOF: Modify the host trace_init parameter list to include dmab 2022-05-19 16:44:17 +01:00
ipc3-topology.c ASoC: SOF: ipc3-topology: Prevent double freeing of ipc_control_data via load_bytes 2022-08-17 15:15:52 +02:00
ipc3.c ASoC: SOF: Switch to IPC generic firmware tracing 2022-05-19 16:44:15 +01:00
ipc4-loader.c ASoC: SOF: IPC4: Add FW loader ops 2022-05-12 11:41:28 +01:00
ipc4-priv.h ASoC: SOF: IPC4: Add FW loader ops 2022-05-12 11:41:28 +01:00
ipc4.c ASoC: SOF: IPC4: Add FW loader ops 2022-05-12 11:41:28 +01:00
Kconfig ASoC: SOF: Convert the generic probe support to SOF client 2022-02-10 15:19:12 +00:00
loader.c ASoC: SOF: loader: Call optional query_fw_configuration on first boot 2022-04-29 13:06:17 +01:00
Makefile ASoC: SOF: Clone the trace code to ipc3-dtrace as fw_tracing implementation 2022-05-19 16:44:14 +01:00
nocodec.c ASOC: SOF: simplify nocodec mode 2021-04-12 17:05:55 +01:00
ops.c ASoC: SOF: Switch to IPC generic firmware tracing 2022-05-19 16:44:15 +01:00
ops.h ASoC: SOF: ipc3-dtrace: Move host ops wrappers from generic header to private 2022-05-19 16:44:16 +01:00
pcm.c ASoC: SOF: Add a prepare op to IPC topology widget ops 2022-04-29 13:06:05 +01:00
pm.c ASoC: SOF: pm: add definitions for S4 and S5 states 2022-06-24 16:21:50 +01:00
sof-acpi-dev.c ASoC: SOF: add IPC-dependent file names 2022-04-19 12:03:34 +01:00
sof-acpi-dev.h ASoC: SOF: ACPI: avoid reverse module dependency 2021-03-02 15:31:40 +01:00
sof-audio.c ASoC: SOF: Fix potential NULL pointer dereference 2022-06-06 12:31:21 +01:00
sof-audio.h ASoC: SOF: Add a prepare op to IPC topology widget ops 2022-04-29 13:06:05 +01:00
sof-client-ipc-flood-test.c ASoC: SOF: sof-client-ipc-flood-test: use pm_runtime_resume_and_get() 2022-05-19 16:44:29 +01:00
sof-client-ipc-msg-injector.c ASoC: SOF: ipc-msg-injector: fix copy in sof_msg_inject_ipc4_dfs_write() 2022-08-17 15:15:52 +02:00
sof-client-probes.c ASoC: SOF: sof-client-probes: Query the maximum IPC payload size 2022-05-09 18:17:57 +01:00
sof-client-probes.h ASoC: SOF: Convert the generic probe support to SOF client 2022-02-10 15:19:12 +00:00
sof-client.c ASoC: SOF: sof-client: IPC flood test can only work with SOF_IPC 2022-05-09 18:18:03 +01:00
sof-client.h ASoC: SOF: sof-client: Add API to get the ipc_type 2022-05-09 18:17:58 +01:00
sof-of-dev.c ASoC: SOF: add IPC-dependent file names 2022-04-19 12:03:34 +01:00
sof-of-dev.h ASoC: SOF: OF: Add shutdown callback for SOF OF device 2022-04-07 18:29:44 +01:00
sof-pci-dev.c ASoC: Pull in fixes 2022-05-04 15:30:32 +01:00
sof-pci-dev.h ASoC: SOF: pci: split PCI into different drivers 2021-03-02 15:32:00 +01:00
sof-priv.h ASoC: SOF: make ctx_store and ctx_restore as optional 2022-08-17 15:15:45 +02:00
sof-utils.c ASoC: SOF: Split up utils.c into sof-utils and iomem-utils 2022-02-10 15:19:04 +00:00
sof-utils.h ASoC: SOF: Split up utils.c into sof-utils and iomem-utils 2022-02-10 15:19:04 +00:00
stream-ipc.c ASoC: SOF: Remove ipc_pcm_params() ops 2022-03-11 13:41:09 +00:00
topology.c ASoC: SOF: topology: Skip parsing DAI link tokens if not needed 2022-04-29 13:06:03 +01:00
trace.c ASoC: SOF: Switch to IPC generic firmware tracing 2022-05-19 16:44:15 +01:00