]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: simple-card-utils: Propagate errors on too many links
authorThierry Reding <treding@nvidia.com>
Fri, 16 Apr 2021 07:11:46 +0000 (09:11 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 16 Apr 2021 15:54:08 +0000 (16:54 +0100)
commita6dec8031c407eedf624690dff4885e19af43cdc
treeb9381d1f457f60c24daeb8f79121bef22fe53869
parent13fdfe5b52960823bd445231af04a62c11453913
ASoC: simple-card-utils: Propagate errors on too many links

The DAI counting code doesn't propagate errors when the number of
maximum links is exceeded, which causes subsequent initialization code
to continue to run and that eventually leads to memory corruption with
the code trying to access memory that is out of bounds.

Fix this by propagating errors when the maximum number of links is
reached, which ensures that the driver fails to load and prevents the
memory corruption.

Fixes: d207d3b42e0c ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210416071147.2149109-1-thierry.reding@gmail.com
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/generic/audio-graph-card.c
sound/soc/generic/simple-card.c