Commit e1d6f7ff authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jiri Slaby

ASoC: sigmadsp: Refuse to load firmware files with a non-supported version

commit 50c0f21b upstream.

Make sure to check the version field of the firmware header to make sure to
not accidentally try to parse a firmware file with a different layout.
Trying to do so can result in loading invalid firmware code to the device.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 939c0896
......@@ -176,6 +176,13 @@ static int _process_sigma_firmware(struct device *dev,
goto done;
}
if (ssfw_head->version != 1) {
dev_err(dev,
"Failed to load firmware: Invalid version %d. Supported firmware versions: 1\n",
ssfw_head->version);
goto done;
}
crc = crc32(0, fw->data + sizeof(*ssfw_head),
fw->size - sizeof(*ssfw_head));
pr_debug("%s: crc=%x\n", __func__, crc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment