Merge tag 'LA.UM.9.15.r1-07500-KAMORTA.QSSI13.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel into android13-4.19-kona

"LA.UM.9.15.r1-07500-KAMORTA.QSSI13.0"

* tag 'LA.UM.9.15.r1-07500-KAMORTA.QSSI13.0' of https://git.codelinaro.org/clo/la/platform/vendor/opensource/audio-kernel:
  dsp: Added fix to resolve compilation error
  dsp: q6voice: added fix to resolve Lookahead error
  ASoC: msm-pcm-host-voice: Handle OOB access in hpcm_start
  dsp: q6core: Avoid OOB access in q6core
  dsp: q6voice: Add buf size check for cvs cal data
  dsp: afe: Add check for num_channels
  dsp: afe: Add check for sidetone iir config copy size
  ASoC: msm-pcm-host-voice: Address buffer overflow in hpcm copy
  ASoC: msm-pcm-voip: Avoid interger underflow
  dsp: asm: validate payload size before access
  dsp: q6core: validate payload size before access for AVCS
  dsp:  afe: check for param size before copying
  asoc: Compilation fix for SDLLVM toolchain 16.0
  asoc: routing: add PRI_TDM path as echo reference data
  dsp: add lock in ion free to avoid use after free

 Conflicts:
	techpack/audio/dsp/q6afe.c
	techpack/audio/dsp/q6asm.c
	techpack/audio/dsp/q6core.c
	techpack/audio/dsp/q6voice.c

Change-Id: I3aab264a7be180846833043a3c3a8ce889b85d12
This commit is contained in:
Michael Bestas
2023-08-25 12:03:18 +03:00
5 changed files with 33 additions and 11 deletions

View File

@@ -220,6 +220,7 @@ CDEFINES += -DANI_LITTLE_BYTE_ENDIAN \
-DPTT_SOCK_SVC_ENABLE \
-Wall\
-Werror\
-Wno-enum-conversion \
-D__linux__
KBUILD_CPPFLAGS += $(CDEFINES)

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/init.h>
@@ -5566,6 +5566,14 @@ static int get_ec_ref_port_id(int value, int *index)
*index = 40;
port_id = AFE_PORT_ID_QUINARY_TDM_TX;
break;
case 41:
*index = 41;
port_id = AFE_PORT_ID_PRIMARY_TDM_RX;
break;
case 42:
*index = 42;
port_id = AFE_PORT_ID_PRIMARY_TDM_TX;
break;
default:
*index = 0; /* NONE */
pr_err("%s: Invalid value %d\n", __func__, value);
@@ -5624,6 +5632,7 @@ static const char *const ec_ref_rx[] = { "None", "SLIM_RX", "I2S_RX",
"SLIM_7_RX", "RX_CDC_DMA_RX_0", "RX_CDC_DMA_RX_1", "RX_CDC_DMA_RX_2",
"RX_CDC_DMA_RX_3", "TX_CDC_DMA_TX_0", "TERT_TDM_RX_2", "SEC_TDM_TX_0",
"DISPLAY_PORT1", "SEN_MI2S_RX", "SENARY_MI2S_TX", "QUIN_TDM_TX_0",
"PRI_TDM_RX_0", "PRI_TDM_TX_0",
};
static const struct soc_enum msm_route_ec_ref_rx_enum[] = {
@@ -29694,6 +29703,8 @@ static const struct snd_soc_dapm_route intercon_tdm[] = {
{"AUDIO_REF_EC_UL1 MUX", "TERT_TDM_RX_2", "TERT_TDM_RX_2"},
{"AUDIO_REF_EC_UL1 MUX", "SEC_TDM_TX_0", "SEC_TDM_TX_0"},
{"AUDIO_REF_EC_UL1 MUX", "QUIN_TDM_TX_0", "QUIN_TDM_TX_0"},
{"AUDIO_REF_EC_UL1 MUX", "PRI_TDM_RX_0", "PRI_TDM_RX_0"},
{"AUDIO_REF_EC_UL1 MUX", "PRI_TDM_TX_0", "PRI_TDM_TX_0"},
{"AUDIO_REF_EC_UL10 MUX", "QUAT_TDM_TX_1", "QUAT_TDM_TX_1"},
{"AUDIO_REF_EC_UL10 MUX", "QUAT_TDM_RX_0", "QUAT_TDM_RX_0"},
@@ -29702,6 +29713,8 @@ static const struct snd_soc_dapm_route intercon_tdm[] = {
{"AUDIO_REF_EC_UL10 MUX", "TERT_TDM_TX_0", "TERT_TDM_TX_0"},
{"AUDIO_REF_EC_UL10 MUX", "TERT_TDM_RX_2", "TERT_TDM_RX_2"},
{"AUDIO_REF_EC_UL10 MUX", "SEC_TDM_TX_0", "SEC_TDM_TX_0"},
{"AUDIO_REF_EC_UL10 MUX", "PRI_TDM_RX_0", "PRI_TDM_RX_0"},
{"AUDIO_REF_EC_UL10 MUX", "PRI_TDM_TX_0", "PRI_TDM_TX_0"},
{"LSM1 Mixer", "QUIN_TDM_TX_0", "QUIN_TDM_TX_0"},
{"LSM1 Mixer", "TERT_TDM_TX_0", "TERT_TDM_TX_0"},

View File

@@ -1,6 +1,8 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2023, Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/init.h>
@@ -63,6 +65,7 @@ static void msm_audio_ion_add_allocation(
mutex_unlock(&(msm_audio_ion_data->list_mutex));
}
/* This function is called with ion_data list mutex lock */
static int msm_audio_dma_buf_map(struct dma_buf *dma_buf,
dma_addr_t *addr, size_t *len)
{
@@ -151,7 +154,6 @@ static int msm_audio_dma_buf_unmap(struct dma_buf *dma_buf)
* should be explicitly acquired to avoid race condition
* on adding elements to the list.
*/
mutex_lock(&(msm_audio_ion_data.list_mutex));
list_for_each_safe(ptr, next,
&(msm_audio_ion_data.alloc_list)) {
@@ -175,7 +177,6 @@ static int msm_audio_dma_buf_unmap(struct dma_buf *dma_buf)
break;
}
}
mutex_unlock(&(msm_audio_ion_data.list_mutex));
if (!found) {
dev_err(cb_dev,
@@ -230,6 +231,7 @@ int msm_audio_ion_get_smmu_info(struct device **cb_dev,
return 0;
}
/* This function is called with ion_data list mutex lock */
static void *msm_audio_ion_map_kernel(struct dma_buf *dma_buf)
{
int rc = 0;
@@ -278,7 +280,6 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
* TBD: remove the below section once new API
* for unmapping kernel virtual address is available.
*/
mutex_lock(&(msm_audio_ion_data.list_mutex));
list_for_each_entry(alloc_data, &(msm_audio_ion_data.alloc_list),
list) {
if (alloc_data->dma_buf == dma_buf) {
@@ -286,7 +287,6 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
break;
}
}
mutex_unlock(&(msm_audio_ion_data.list_mutex));
if (!vaddr) {
dev_err(cb_dev,
@@ -309,7 +309,8 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf)
return rc;
}
static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
/* This function is called with ion_data list mutex lock */
static int msm_audio_ion_buf_map(struct dma_buf *dma_buf, dma_addr_t *paddr,
size_t *plen, void **vaddr)
{
int rc = 0;
@@ -331,7 +332,9 @@ static int msm_audio_ion_map_buf(struct dma_buf *dma_buf, dma_addr_t *paddr,
if (IS_ERR_OR_NULL(*vaddr)) {
pr_err("%s: ION memory mapping for AUDIO failed\n", __func__);
rc = -ENOMEM;
mutex_lock(&(msm_audio_ion_data.list_mutex));
msm_audio_dma_buf_unmap(dma_buf);
mutex_unlock(&(msm_audio_ion_data.list_mutex));
goto err;
}
@@ -390,7 +393,7 @@ int msm_audio_ion_alloc(struct dma_buf **dma_buf, size_t bufsz,
goto err;
}
rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, vaddr);
rc = msm_audio_ion_buf_map(*dma_buf, paddr, plen, vaddr);
if (rc) {
pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
goto err;
@@ -490,7 +493,7 @@ int msm_audio_ion_import(struct dma_buf **dma_buf, int fd,
}
}
rc = msm_audio_ion_map_buf(*dma_buf, paddr, plen, vaddr);
rc = msm_audio_ion_buf_map(*dma_buf, paddr, plen, vaddr);
if (rc) {
pr_err("%s: failed to map ION buf, rc = %d\n", __func__, rc);
goto err;
@@ -516,6 +519,7 @@ EXPORT_SYMBOL(msm_audio_ion_import);
*
* Returns 0 on success or error on failure
*/
/* This funtion is called with ion_data list mutex lock */
int msm_audio_ion_free(struct dma_buf *dma_buf)
{
int ret = 0;
@@ -525,11 +529,15 @@ int msm_audio_ion_free(struct dma_buf *dma_buf)
return -EINVAL;
}
mutex_lock(&(msm_audio_ion_data.list_mutex));
ret = msm_audio_ion_unmap_kernel(dma_buf);
if (ret)
if (ret) {
mutex_unlock(&(msm_audio_ion_data.list_mutex));
return ret;
}
msm_audio_dma_buf_unmap(dma_buf);
mutex_unlock(&(msm_audio_ion_data.list_mutex));
return 0;
}

View File

@@ -2291,7 +2291,7 @@ static int32_t q6asm_callback(struct apr_client_data *data, void *priv)
config_debug_fs_read_cb();
if (data->payload_size != (READDONE_IDX_SEQ_ID + 1) * sizeof(uint32_t)) {
pr_err("%s: payload size of %d is less than expected %d.\n",
pr_err("%s: payload size of %d is less than expected %ld.\n",
__func__, data->payload_size,
((READDONE_IDX_SEQ_ID + 1) * sizeof(uint32_t)));
spin_unlock_irqrestore(

View File

@@ -2760,7 +2760,7 @@ static int voice_send_cvs_register_cal_cmd(struct voice_data *v)
}
if (col_data->cal_data.size >= MAX_COL_INFO_SIZE) {
pr_err("%s: Invalid cal data size %d!\n",
pr_err("%s: Invalid cal data size %ld!\n",
__func__, col_data->cal_data.size);
ret = -EINVAL;
goto unlock;