diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-11-19 18:29:02 +0100 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2015-01-26 14:38:41 +0100 |
commit | e1d6f7ff9cd65f868066d9b17833fb82760209f4 (patch) | |
tree | 7fa0b0be44f9265364c75db4e4ac92210b15ae1b /sound | |
parent | 939c0896c85b324de081975d21b77b7678fff2af (diff) |
ASoC: sigmadsp: Refuse to load firmware files with a non-supported version
commit 50c0f21b42dd4cd02b51f82274f66912d9a7fa32 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: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/sigmadsp.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c index 4068f2491232..bb3878c9625f 100644 --- a/sound/soc/codecs/sigmadsp.c +++ b/sound/soc/codecs/sigmadsp.c @@ -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); |