Skip to contentSkip to conversation

ASoC: SOF: ipc4-loader: Verify ext manifest magic number

PATCH In review Peter Ujfalusi 2 participants 2 messages Aug 23, 2022 – Aug 24, 2022

Subsystems (3)
lore
Share & tools
lore

Peter Ujfalusi

author maintainer
#0 lore raw

PATCH 1/1 ASoC: SOF: ipc4-loader: Verify ext manifest magic number

Firmware image must start with an extended manifest. Add a check to make sure that the image does contain it.

The magic number (the first u32 of a firmware image if manifest is present) for an IPC4 image must be 0x31454124 (ASCI "$AE1").

---
 sound/soc/sof/ipc4-loader.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
sound/soc/sof/ipc4-loader.c +11 -0
index 9fadae8fd011..8bd2132b4f41 100644
@@ -40,6 +40,17 @@ static size_t sof_ipc4_fw_parse_ext_man(struct snd_sof_dev *sdev)
 
 	ext_man_hdr = (struct sof_ext_manifest4_hdr *)fw->data;
 
+	/*
+	 * At the start of the firmware image we must have an extended manifest.
+	 * Verify that the magic number is correct.
+	 */
+	if (ext_man_hdr->id != SOF_EXT_MAN4_MAGIC_NUMBER) {
+		dev_err(sdev->dev,
+			"Unexpected extended manifest magic number: %#x\n",
+			ext_man_hdr->id);
+		return -EINVAL;
+	}
+
 	fw_hdr_offset = ipc4_data->manifest_fw_hdr_offset;
 	if (!fw_hdr_offset)
 		return -EINVAL;
Signature · 1 line
2.37.2
maintainer
#1 lore raw
Quoted 8 lines · Peter Ujfalusi

Firmware image must start with an extended manifest. Add a check to make sure that the image does contain it.

The magic number (the first u32 of a firmware image if manifest is present) for an IPC4 image must be 0x31454124 (ASCI "$AE1").

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: ipc4-loader: Verify ext manifest magic number

      commit: a337c2012774d588fcab318c42edc2601d90e549

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark