Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] ASoC: sigmadsp: Refuse to load firmware files with a non-supported version
@ 2014-11-19 17:29 Lars-Peter Clausen
  2014-11-19 17:29 ` [PATCH 2/6] ASoC: adau17x1: Mark DSP parameter memory as readable and precious Lars-Peter Clausen
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Lars-Peter Clausen @ 2014-11-19 17:29 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, Lars-Peter Clausen, stable

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>
Cc: stable@vger.kernel.org
---
 sound/soc/codecs/sigmadsp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
index f2de7e0..81a38dd 100644
--- a/sound/soc/codecs/sigmadsp.c
+++ b/sound/soc/codecs/sigmadsp.c
@@ -159,6 +159,13 @@ 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);
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-11-21 16:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-19 17:29 [PATCH 1/6] ASoC: sigmadsp: Refuse to load firmware files with a non-supported version Lars-Peter Clausen
2014-11-19 17:29 ` [PATCH 2/6] ASoC: adau17x1: Mark DSP parameter memory as readable and precious Lars-Peter Clausen
2014-11-21 16:30   ` Lars-Peter Clausen
2014-11-21 16:38     ` Mark Brown
2014-11-19 17:29 ` [PATCH 3/6] ASoC: sigmadsp: Drop support support SIGMA_ACTION_DELAY Lars-Peter Clausen
2014-11-19 17:29 ` [PATCH 4/6] ASoC: sigmadsp: Restructure in preparation for fw v2 support Lars-Peter Clausen
2014-11-19 17:29 ` [PATCH 5/6] ASoC: sigmadsp: Add support for fw v2 Lars-Peter Clausen
2014-11-19 17:29 ` [PATCH 6/6] ASoC: adau1701: Implement sigmadsp safeload Lars-Peter Clausen
2014-11-20  9:56 ` [PATCH 1/6] ASoC: sigmadsp: Refuse to load firmware files with a non-supported version Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox