linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings
@ 2025-08-25 10:12 Srinivas Kandagatla
  2025-08-25 10:12 ` [PATCH 1/3] ASoC: qcom: audioreach: fix potential null pointer dereference Srinivas Kandagatla
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2025-08-25 10:12 UTC (permalink / raw)
  To: broonie
  Cc: perex, tiwai, srini, lgirdwood, linux-sound, linux-kernel,
	linux-arm-msm, krzysztof.kozlowski, Srinivas Kandagatla

Recent static calibration support patches have excersised new code path
exposing some missing checks and also accessing some variables which are 
of LE type that are accessed directly without converting it to CPU type.

Thanks to Dan Carpenter and kernel test robot for reporting this.

--srini

Srinivas Kandagatla (3):
  ASoC: qcom: audioreach: fix potential null pointer dereference
  ASoC: qcom: topology: convert to cpu endainess type before accessing
  ASoC: qcom: audioreach: convert to cpu endainess type before accessing

 sound/soc/qcom/qdsp6/audioreach.c | 2 +-
 sound/soc/qcom/qdsp6/topology.c   | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

-- 
2.50.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] ASoC: qcom: audioreach: fix potential null pointer dereference
  2025-08-25 10:12 [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings Srinivas Kandagatla
@ 2025-08-25 10:12 ` Srinivas Kandagatla
  2025-08-25 10:12 ` [PATCH 2/3] ASoC: qcom: topology: convert to cpu endainess type before accessing Srinivas Kandagatla
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2025-08-25 10:12 UTC (permalink / raw)
  To: broonie
  Cc: perex, tiwai, srini, lgirdwood, linux-sound, linux-kernel,
	linux-arm-msm, krzysztof.kozlowski, Srinivas Kandagatla,
	Dan Carpenter, Stable

It is possible that the topology parsing function
audioreach_widget_load_module_common() could return NULL or an error
pointer. Add missing NULL check so that we do not dereference it.

Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Cc: <Stable@vger.kernel.org>
Fixes: 36ad9bf1d93d ("ASoC: qdsp6: audioreach: add topology support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
 sound/soc/qcom/qdsp6/topology.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
index ec51fabd98cb..c2226ed5164f 100644
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -607,8 +607,8 @@ static int audioreach_widget_load_module_common(struct snd_soc_component *compon
 		return PTR_ERR(cont);
 
 	mod = audioreach_parse_common_tokens(apm, cont, &tplg_w->priv, w);
-	if (IS_ERR(mod))
-		return PTR_ERR(mod);
+	if (IS_ERR_OR_NULL(mod))
+		return mod ? PTR_ERR(mod) : -ENODEV;
 
 	mod->data = audioreach_get_module_priv_data(&tplg_w->priv);
 
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/3] ASoC: qcom: topology: convert to cpu endainess type before accessing
  2025-08-25 10:12 [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings Srinivas Kandagatla
  2025-08-25 10:12 ` [PATCH 1/3] ASoC: qcom: audioreach: fix potential null pointer dereference Srinivas Kandagatla
@ 2025-08-25 10:12 ` Srinivas Kandagatla
  2025-08-25 10:12 ` [PATCH 3/3] ASoC: qcom: audioreach: " Srinivas Kandagatla
  2025-09-02 10:57 ` [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2025-08-25 10:12 UTC (permalink / raw)
  To: broonie
  Cc: perex, tiwai, srini, lgirdwood, linux-sound, linux-kernel,
	linux-arm-msm, krzysztof.kozlowski, Srinivas Kandagatla,
	kernel test robot

Looks like some of the members of module config are accessed directly
without converting their endainess to cpu type.

Fix this by using le32_to_cpu() where required.

Fixes: c7ed4c2debfd ("ASoC: qcom: audioreach: add support for static calibration")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508230741.heXmHeDC-lkp@intel.com
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
 sound/soc/qcom/qdsp6/topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/qdsp6/topology.c b/sound/soc/qcom/qdsp6/topology.c
index c2226ed5164f..f61285e7dcf2 100644
--- a/sound/soc/qcom/qdsp6/topology.c
+++ b/sound/soc/qcom/qdsp6/topology.c
@@ -314,7 +314,7 @@ static struct audioreach_module_priv_data *audioreach_get_module_priv_data(
 		struct snd_soc_tplg_vendor_array *mod_array;
 
 		mod_array = (struct snd_soc_tplg_vendor_array *)((u8 *)private->array + sz);
-		if (mod_array->type == SND_SOC_AR_TPLG_MODULE_CFG_TYPE) {
+		if (le32_to_cpu(mod_array->type) == SND_SOC_AR_TPLG_MODULE_CFG_TYPE) {
 			struct audioreach_module_priv_data *pdata;
 
 			pdata = kzalloc(struct_size(pdata, data, le32_to_cpu(mod_array->size)),
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 3/3] ASoC: qcom: audioreach: convert to cpu endainess type before accessing
  2025-08-25 10:12 [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings Srinivas Kandagatla
  2025-08-25 10:12 ` [PATCH 1/3] ASoC: qcom: audioreach: fix potential null pointer dereference Srinivas Kandagatla
  2025-08-25 10:12 ` [PATCH 2/3] ASoC: qcom: topology: convert to cpu endainess type before accessing Srinivas Kandagatla
@ 2025-08-25 10:12 ` Srinivas Kandagatla
  2025-09-02 10:57 ` [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Srinivas Kandagatla @ 2025-08-25 10:12 UTC (permalink / raw)
  To: broonie
  Cc: perex, tiwai, srini, lgirdwood, linux-sound, linux-kernel,
	linux-arm-msm, krzysztof.kozlowski, Srinivas Kandagatla,
	kernel test robot

Looks like some of the members of module config are accessed directly
without converting their endainess to cpu type.

Fix this by using le32_to_cpu() where required.

Fixes: da9881d00153 ("ASoC: qcom: audioreach: add support for SMECNS module")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202508230830.Rkp7HHbG-lkp@intel.com
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
---
 sound/soc/qcom/qdsp6/audioreach.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/qcom/qdsp6/audioreach.c b/sound/soc/qcom/qdsp6/audioreach.c
index f4c53e84b4dc..bbfd51db8797 100644
--- a/sound/soc/qcom/qdsp6/audioreach.c
+++ b/sound/soc/qcom/qdsp6/audioreach.c
@@ -815,7 +815,7 @@ static int audioreach_set_module_config(struct q6apm_graph *graph,
 					struct audioreach_module *module,
 					struct audioreach_module_config *cfg)
 {
-	int payload_size = module->data->size;
+	int payload_size = le32_to_cpu(module->data->size);
 	struct gpr_pkt *pkt;
 	int rc;
 	void *p;
-- 
2.50.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings
  2025-08-25 10:12 [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings Srinivas Kandagatla
                   ` (2 preceding siblings ...)
  2025-08-25 10:12 ` [PATCH 3/3] ASoC: qcom: audioreach: " Srinivas Kandagatla
@ 2025-09-02 10:57 ` Mark Brown
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2025-09-02 10:57 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: perex, tiwai, srini, lgirdwood, linux-sound, linux-kernel,
	linux-arm-msm, krzysztof.kozlowski

On Mon, 25 Aug 2025 11:12:44 +0100, Srinivas Kandagatla wrote:
> Recent static calibration support patches have excersised new code path
> exposing some missing checks and also accessing some variables which are
> of LE type that are accessed directly without converting it to CPU type.
> 
> Thanks to Dan Carpenter and kernel test robot for reporting this.
> 
> --srini
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] ASoC: qcom: audioreach: fix potential null pointer dereference
      commit: 8318e04ab2526b155773313b66a1542476ce1106
[2/3] ASoC: qcom: topology: convert to cpu endainess type before accessing
      commit: 7e67e1c99efa6ecd003d51a42dbe7bd5bad329eb
[3/3] ASoC: qcom: audioreach: convert to cpu endainess type before accessing
      commit: 8f57dcf39fd0864f5f3e6701fe885e55f45d0d3a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-09-02 10:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-25 10:12 [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings Srinivas Kandagatla
2025-08-25 10:12 ` [PATCH 1/3] ASoC: qcom: audioreach: fix potential null pointer dereference Srinivas Kandagatla
2025-08-25 10:12 ` [PATCH 2/3] ASoC: qcom: topology: convert to cpu endainess type before accessing Srinivas Kandagatla
2025-08-25 10:12 ` [PATCH 3/3] ASoC: qcom: audioreach: " Srinivas Kandagatla
2025-09-02 10:57 ` [PATCH 0/3] ASoC: qcom: audioreach: fix sparse warnings Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).