未验证 提交 941d3f0d 编写于 作者: R Ranjani Sridharan 提交者: Mark Brown

ASoC: SOF: topology: Prevent NULL pointer dereference with no TLV

When there is no TLV data in topology, extracting the TLV data
could result in a NULL pointer exception. Prevent this by making
sure that the TLV data exists before extracting it.
Signed-off-by: NRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: NGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: NPaul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: NBard Liao <bard.liao@intel.com>
Signed-off-by: NKai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210201093128.1226603-1-kai.vehmanen@linux.intel.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 0084364d
...@@ -1073,7 +1073,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp, ...@@ -1073,7 +1073,7 @@ static int sof_control_load_volume(struct snd_soc_component *scomp,
scontrol->cmd = SOF_CTRL_CMD_VOLUME; scontrol->cmd = SOF_CTRL_CMD_VOLUME;
/* extract tlv data */ /* extract tlv data */
if (get_tlv_data(kc->tlv.p, tlv) < 0) { if (!kc->tlv.p || get_tlv_data(kc->tlv.p, tlv) < 0) {
dev_err(scomp->dev, "error: invalid TLV data\n"); dev_err(scomp->dev, "error: invalid TLV data\n");
ret = -EINVAL; ret = -EINVAL;
goto out_free; goto out_free;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册