Commit 2d35526d authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Vinod Koul

soundwire: cadence_master: check the number of bidir PDIs

There is an assumption that the first two PDIs are reserved for Bulk,
so we need to make sure the number of bidir PDIs is indeed larger than
two. If the configuration provided is incorrect, this could lead to
allocating a huge amount of memory.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent a78b32d9
...@@ -718,6 +718,8 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns, ...@@ -718,6 +718,8 @@ int sdw_cdns_pdi_init(struct sdw_cdns *cdns,
stream = &cdns->pcm; stream = &cdns->pcm;
/* First two PDIs are reserved for bulk transfers */ /* First two PDIs are reserved for bulk transfers */
if (stream->num_bd < CDNS_PCM_PDI_OFFSET)
return -EINVAL;
stream->num_bd -= CDNS_PCM_PDI_OFFSET; stream->num_bd -= CDNS_PCM_PDI_OFFSET;
offset = CDNS_PCM_PDI_OFFSET; offset = CDNS_PCM_PDI_OFFSET;
......
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