Skip to content

Commit

Permalink
ASoC: sigmadsp: Refuse to load firmware files with a non-supported ve…
Browse files Browse the repository at this point in the history
…rsion

commit 50c0f21 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 <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
larsclausen authored and gregkh committed Jan 16, 2015
1 parent d4527a1 commit bc87f9e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sound/soc/codecs/sigmadsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit bc87f9e

Please sign in to comment.