linux/sound/soc/sof
Dan Carpenter fa9b878ff8
ASoC: SOF: ipc-msg-injector: fix copy in sof_msg_inject_ipc4_dfs_write()
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>
2022-07-14 13:26:37 +01:00
..
amd ASoC: SOF: Compile and runtime IPC version selection 2022-06-14 11:22:12 +01:00
imx ASoC: SOF: Compile and runtime IPC version selection 2022-06-14 11:22:12 +01:00
intel ASoC: SOF: Intel: add trigger callback into sdw_callback 2022-07-13 14:26:14 +01:00
mediatek ASoC: SOF: mediatek: Align mt8186 clock names with dt-bindings 2022-06-22 13:39:32 +01: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: compress: Prevent current kernel running with older FW 2022-07-12 15:22:08 +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: Add ops_free 2022-06-10 13:32:05 +01:00
debug.c ASoC: SOF: debug: Clarify the IPC timeout handling path 2022-06-10 13:32:21 +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
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: remove use of __func__ in dev_dbg 2022-06-17 10:46:41 +01:00
ipc3-loader.c ASoC: SOF: ipc3-loader: remove use of __func__ in dev_dbg 2022-06-17 10:46:42 +01:00
ipc3-pcm.c ASoC: SOF: topology: add code to parse config params for ACPDMIC dai 2022-06-14 11:22:10 +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-07-12 17:39:25 +01:00
ipc3.c ASoC: SOF: remove warning on ABI checks 2022-07-11 16:16:13 +01:00
ipc4-control.c ASoC: SOF: ipc4-topology: Fix error code in sof_ipc4_volume_put() 2022-06-16 09:31:17 +01:00
ipc4-loader.c ASoC: SOF: IPC4: Add FW loader ops 2022-05-12 11:41:28 +01:00
ipc4-pcm.c ASoC: SOF: ipc4-pcm: Expose sof_ipc4_set_pipeline_state() 2022-06-10 13:32:03 +01:00
ipc4-priv.h ASoC: SOF: Intel: hda: init NHLT for IPC4 2022-06-10 13:32:06 +01:00
ipc4-topology.c ASoC: SOF: ipc4-topology: free memories allocated in sof_ipc4_get_audio_fmt 2022-07-08 21:30:31 +01:00
ipc4-topology.h ASoC: SOF: ipc4-topology: add SoundWire/ALH aggregation support 2022-06-14 11:33:49 +01:00
ipc4.c ASoC: SOF: ipc4: remove use of __func__ in dev_dbg 2022-06-17 10:46:47 +01:00
ipc.c ASoC: SOF: Compile and runtime IPC version selection 2022-06-14 11:22:12 +01:00
Kconfig ASoC: SOF: Compile and runtime IPC version selection 2022-06-14 11:22:12 +01: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: Compile and runtime IPC version selection 2022-06-14 11:22:12 +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: Add ops_free 2022-06-10 13:32:05 +01:00
pcm.c ASoC: sof: Migrate to new style legacy DAI naming flag 2022-06-27 13:16:40 +01:00
pm.c ASoC: SOF: pm: add definitions for S4 and S5 states 2022-06-17 10:46:13 +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: topology: add code to parse config params for ACPDMIC dai 2022-06-14 11:22:10 +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-07-14 13:26:37 +01:00
sof-client-probes.c ASoC: SOF: sof-client-probes: Only load the driver if IPC3 is used 2022-07-12 17:39:24 +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: remove use of __func__ in dev_dbg 2022-06-17 10:46:46 +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: Merge fixes 2022-06-22 12:14:20 +01: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: remove unused variable 2022-07-12 13:45:08 +01:00
trace.c ASoC: SOF: Switch to IPC generic firmware tracing 2022-05-19 16:44:15 +01:00