diff options
author | Cezary Rojewski <cezary.rojewski@intel.com> | 2022-07-07 14:41:46 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2022-07-08 18:53:21 +0100 |
commit | 00566ad4ce9d394c6ebaacde12eda06eef4e5279 (patch) | |
tree | e4a59561481bc8b159f863f3da289142ea394d9d /sound/soc/intel/avs/messages.c | |
parent | 3c1923a119a61534f8ce221766041ddf470c9307 (diff) | |
download | linux-00566ad4ce9d394c6ebaacde12eda06eef4e5279.tar.gz |
ASoC: Intel: avs: Shield LARGE_CONFIG_GETs against zero payload_size
Some LARGE_CONFIG_GETs are never expected to return payload of size 0.
Check for such situation and collapse if met.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220707124153.1858249-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/avs/messages.c')
-rw-r--r-- | sound/soc/intel/avs/messages.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/soc/intel/avs/messages.c b/sound/soc/intel/avs/messages.c index 3559fb496e0b..9cf621eaec5a 100644 --- a/sound/soc/intel/avs/messages.c +++ b/sound/soc/intel/avs/messages.c @@ -474,6 +474,9 @@ int avs_ipc_get_fw_config(struct avs_dev *adev, struct avs_fw_cfg *cfg) &payload, &payload_size); if (ret) return ret; + /* Non-zero payload expected for FIRMWARE_CONFIG. */ + if (!payload_size) + return -EREMOTEIO; while (offset < payload_size) { tlv = (struct avs_tlv *)(payload + offset); @@ -587,6 +590,9 @@ int avs_ipc_get_hw_config(struct avs_dev *adev, struct avs_hw_cfg *cfg) &payload, &payload_size); if (ret) return ret; + /* Non-zero payload expected for HARDWARE_CONFIG. */ + if (!payload_size) + return -EREMOTEIO; while (offset < payload_size) { tlv = (struct avs_tlv *)(payload + offset); @@ -670,6 +676,9 @@ int avs_ipc_get_modules_info(struct avs_dev *adev, struct avs_mods_info **info) &payload, &payload_size); if (ret) return ret; + /* Non-zero payload expected for MODULES_INFO. */ + if (!payload_size) + return -EREMOTEIO; *info = (struct avs_mods_info *)payload; return 0; |