Commit Graph

10650 Commits

Author SHA1 Message Date
Soumya Managoli 2fe8f6d7b5 soc: msm-pcm: Add missing mutex lock to protect prvt data
Add mutex lock to protect private data in _put() and
get() calls.

Change-Id: I776ba5739fec4f1ff6542ef48de79ad3873f1161
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2019-11-26 00:06:53 +01:00
Soumya Managoli 8af369dae9 soc: msm-pcm: Add mutex lock to protect prvt data
Add mutex lock to protect private data in _put() and
get() calls.

Change-Id: I92f5a6515b6d1c4ad650a7dcf22a0a231a84dd30
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2019-11-26 00:06:16 +01:00
Soumya Managoli 1fd85fc4b7 asoc: msm-pcm: Added lock in controls _put() and _get() callback
There is race condition around private data used in put() and get()
of few mixer ctls with close() callback.Add global mutex lock and
code changes to protect such critical section by accessing such lock.

Change-Id: I276c2a234cfcbef88b4272b945e5c3f121e8eb32
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2019-11-26 00:05:34 +01:00
Xiaojun Sang 4a0058421a dsp: asm: validate payload size before access
Payload size is not checked before payload access. Check it
to avoid out-of-boundary memory access.

Change-Id: I913e37ba8eaa3451934b88de1e6b14a5e83f493b
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2019-07-27 22:11:31 +02:00
Soumya Managoli 2e7be3d027 asoc : msm: Fix zero size pointer issue
APPS crashes randomly due to invalid memory allocation
in q6asm_audio_client_buf_free_contiguous.
Added check to return error if memory allocation size is 0.

Change-Id: I40f49aa147d513b29b56224a5ee77ccbb2dcc110
CRs-Fixed: 2285272
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2019-07-27 22:11:30 +02:00
Aditya Bavanari c3e982548c asoc: Ratelimit error logs to avoid excessive logging
Ratelimit error logs of boundary check conditions
in audio effects driver to avoid excessive logging.

CRs-Fixed: 2426159
Change-Id: Iaf10eee281389773a21340997e3ffbe88c6e79f6
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2019-07-27 22:11:28 +02:00
Mark Brown cd6f5b0e8d ASoC: compress: Use power efficient workqueue
There is no need for the power down work to be done on a per CPU workqueue
especially considering the fairly long delay before powerdown.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Vinod Koul <vinod.koul@intel.com>
2019-07-27 22:11:04 +02:00
Mark Brown e85240ca74 ASoC: pcm: Use the power efficient workqueue for delayed powerdown
There is no need to use a normal per-CPU workqueue for delayed power downs
as they're not timing or performance critical and waking up a core for them
would defeat some of the point.

Signed-off-by: Mark Brown <broonie@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
2019-07-27 22:11:03 +02:00
Mark Brown 53f4614f5d ASoC: jack: Use power efficient workqueue
The accessory detect debounce work is not performance sensitive so let
the scheduler run it wherever is most efficient rather than in a per CPU
workqueue by using the system power efficient workqueue.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
2019-07-27 22:11:03 +02:00
Soumya Managoli 7f45834835 ASoC: msm: Modify buf size check to prevent OOB error
Expected buffer size to read is 2 bytes.
Corrected the size check to return error
when count is not 2.

Change-Id: I43b572d191f6f98a8a790b5ae77b43fabcd7329a
Signed-off-by: Soumya Managoli <smanag@codeaurora.org>
2019-07-27 22:10:59 +02:00
Xiaojun Sang e02c7a7eed dsp: asm: validate payload size before access
Payload size is not checked before payload access. Check size
to avoid out-of-boundary memory access.

Change-Id: Iaa39ee4ea5489bb5579e7b7d5dfada12d88c5809
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2019-07-27 22:10:59 +02:00
Karthikeyan Mani 8dc3bb6ce4 dsp: afe: check for payload size before payload access
Check if payload data is big enough before accessing
the data in it.

Change-Id: I939f205a8cebf6ef4859f81fae5429bca013d540
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2019-07-27 22:10:58 +02:00
Vatsal Bucha a72aa003e4 dsp: asm: Add check for num_channels before calling q6asm_map_channels
Channel_mapping array size varies for different commands.
Add check for num_channels before calling q6asm_map_channels.

Change-Id: Iccbcfe82f716fc0ffe0a26b1779dcaa1c3cb805b
Signed-off-by: Rohit kumar <rohitkr@codeaurora.org>
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2019-07-27 22:10:58 +02:00
Xiaojun Sang 9be69e398a dsp: validate token before usage as array index
Token from DSP might be invalid for array index. Validate
the token before being used as array index.

Change-Id: I9f47e1328d75d9f9acf7e85ddb452019b6eced0a
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2019-07-27 22:10:57 +02:00
Vignesh Kulothungan dbb4420cbd msm: asm: validate ADSP data before access
Validate buffer index obtained from ADSP token before using it.

CRs-Fixed: 2372302
Change-Id: I5c3b1634bd08b516844638dd67f726a882edfc17
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2019-07-27 22:10:56 +02:00
kunleiz 358da63eb1 lsm: check payload size validity before using it as array index
Payload size validity is not checked before using it in array index.
Check payload size to avoid out-of-boundary memory.

Change-Id: Ic0b06bb331fc1753ff7543bb218ab12d6a4a3ca8
Signed-off-by: Kunlei Zhang <kunleiz@codeaurora.org>
2019-07-27 22:10:55 +02:00
Vignesh Kulothungan 41ec0b6adb msm: adm: validate ADSP payload size before access
Check the size of ADSP payload before accessing it.

CRs-Fixed: 2380694
Change-Id: I52e74e5a86499ea61f8426f767948ce940d4d59c
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2019-07-27 22:10:54 +02:00
Vatsal Bucha c2a162f30b dsp: q6voice: Check size of shared memory buffer before access
Check buffer size in qdsp_cvs_callback before access in
ul_pkt.

Change-Id: Ic19994b46086709231656ec747d2df988b7a512f
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2019-07-27 22:10:53 +02:00
Aun-Ali Zaidi 2fe8a0c519 ANDROID: ASoC: msm: qdsp6v2: Fix memset argument order.
With commit f6896ad1b5966405e87ef668922cadddad52f2eb, an incorrectly ordered
memset() command was present. This causes compilation to fail on GCC 5+.

Fix the order of the passed parameters to properly set requested memory.

BUG=38500815
TEST= Kernel compiles and boots bullhead.

Change-Id: Ic7cc759bb19385ad6839d2003358c7ead6df94be
Tested-by: Aun-Ali Zaidi <admin@kodeit.net>
Signed-off-by: Aun-Ali Zaidi <admin@kodeit.net>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-07-27 22:10:15 +02:00
Wei Wang bb454f3bae ANDROID: fix uninitilized variable
Currently we set CONFIG_CC_OPTIMIZE_FOR_SIZE which suppressed the compiler
warning of unused variables which can lead undefined behavior e.g. memory
corruption and panic. See https://lkml.org/lkml/2013/3/25/347.

This patch fixes all the uninitilized variables in kernel

Bug: 33353384
Test: On device
Signed-off-by: Wei Wang <wvw@google.com>
Change-Id: I0ae1082f447b435d71156d471878ba71aa16c378
2019-07-27 22:10:15 +02:00
Eric Laurent dce0df919e soc: msm: Fix offload may be no sound when user resumes music
Send compress data by q6asm_run callback when user resumes music,
if the write_done event has been callback at offload pause state.

Bug: 30101878
Signed-off-by: Eric Laurent <elaurent@google.com>
2019-07-27 22:10:14 +02:00
Min Chong 75b8cbf0c3 ASoC: msm: audio-effects: misc fixes in h/w effects (update)
Change INT_MAX to UNIT_MAX.

Bug: 28470967
Change-Id: I8737632fe8f05b73dfa29931e2688c299b8fc22b
CRs-Fixed: 1006609
Signed-off-by: Weiyin Jiang <wjiang@codeaurora.org>
Signed-off-by: vivek mehta <mvivek@codeaurora.org>
2019-07-27 22:10:14 +02:00
Karthik Reddy Katta 1b377a2e0a ASoC: msm: qdsp6v2: Fix unmap memory command failure
Add pointer validation checks to prevent sending
invalid handles to ADSP as part of unmap memory
regions command.

CRs-Fixed: 1018367
Change-Id: I0dfb2fccb4414ed82ee10d73576fda66a273043d
Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>
2019-07-27 22:10:13 +02:00
Eric Laurent 1f64cd2458 ASoC: msm: qdsp6v2: Fix offload gapless transition
Use smaller fragment sizes at DSP interface than at
user space interface.
This allows to write earlier to the DSP without waiting for
a full user space fragement in case of underrun or gapless
transition.

Bug: 28545177

Signed-off-by: Eric Laurent <elaurent@google.com>
2019-07-27 22:10:13 +02:00
Ben Romberger 6008e9cf77 ASoC: msm: qdsp6v2: Modify HW delay debug print
Change the HW delay debug print so it does not
seem like an error. Adds comments in the code
describing the HW delay feature.

Change-Id: I0955623a7bdb0f4180c908ba079cf6f900e496a5
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
2019-07-27 22:10:12 +02:00
Haynes Mathew George d656e215a5 ASoC: msm: qdsp6v2: Enable DSP gapless by default
Enable DSP gapless mode by default

Bug: 23221273
Change-Id: I8b35a62a5e10493e605851b4499d4604a5525c09
Signed-off-by: Haynes Mathew George <hgeorge@codeaurora.org>
2019-07-27 22:10:12 +02:00
Xiaoyu Ye a219fb4db3 ASoC: msm: qdsp6v2: add range check for audio port index
Add range check to make sure the received audio port index
from ADSP is within the valid range.

Change-Id: Ief647df1659f7f349a843f666d8f92f34a9a43be
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
2019-07-27 22:08:49 +02:00
Vignesh Kulothungan 902c42ddab ASoC: msm: qdspv2: initialize variables before use
Initialize 'flags' variables before use in spinlocks.

Bug: 77528410
Change-Id: Ifeba2c103790147fd80a387345ecff6beaff1311
CRs-Fixed: 2257317
Signed-off-by: Vignesh Kulothungan <vigneshk@codeaurora.org>
2019-07-27 21:51:25 +02:00
Meng Wang 309e66d753 ASoC: msm: qdspv2: add spin lock to protect ac
ac could get freed during the execution of q6asm_callback.
And kernel panic happens. Add spinlock to protect ac to avoid
kernel panic.

Change-Id: Ie49c8a3979231552ba7d5f207aab0d95ffdc2a72
Signed-off-by: Meng Wang <mwang@codeaurora.org>
2019-07-27 21:50:46 +02:00
Xiaoyu Ye 60cf32f480 ASoC: wcd_cpe_core: add size check for WDSP ELF files
Add size check to make sure the data sizes from WDSP
ELF metadata and the split firmware ELF are the same.

Change-Id: Ic2f7dc04dfc95608302cba23461c519378619db0
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
2019-07-27 21:50:46 +02:00
Karthikeyan Mani 078d3912e5 ASoC: msm: qdsp6v2: check for buffer size before read
Check for debugfs ops buf size passed before reading
to eliminate the possibility of reading out of bounds.

Bug: 77528653
Change-Id: I28fd60ce93256b6b0bad62b449092a891cc15463
Signed-off-by: Karthikeyan Mani <kmani@codeaurora.org>
2019-07-27 21:50:02 +02:00
Vaishnavi Kommaraju 4d261ae9ac ASoC: wcd_cpe_core: Add mutex lock for CPE session
Add mutex lock to ensure atomic access to core handle
in CPE alloc and dealloc sessions.

CRs-Fixed: 2169403
Bug: 62536960
Signed-off-by: Vaishnavi Kommaraju <vkommara@codeaurora.org>
Change-Id: Ic0bb7e1646cbeafe507680c39bb8de56086df47a
2019-07-27 21:49:29 +02:00
syphyr 947238c194 sound: soc: msm8952_rt5659: Handle defer while probing
Change-Id: I67926b65799357f4a4b58d52f92bb5c486628c88
2019-07-27 21:45:58 +02:00
Takashi Iwai 652ea8e9d4 ASoC: Fix use-after-free at card unregistration
commit 4efda5f2130da033aeedc5b3205569893b910de2 upstream.

soc_cleanup_card_resources() call snd_card_free() at the last of its
procedure.  This turned out to lead to a use-after-free.
PCM runtimes have been already removed via soc_remove_pcm_runtimes(),
while it's dereferenced later in soc_pcm_free() called via
snd_card_free().

The fix is simple: just move the snd_card_free() call to the beginning
of the whole procedure.  This also gives another benefit: it
guarantees that all operations have been shut down before actually
releasing the resources, which was racy until now.

Reported-and-tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2019-07-27 21:44:52 +02:00
LuK1337 39a771baad Merge tag 'LA.BR.1.3.6-05410-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-05410-8976.0"
2018-02-06 13:11:45 +01:00
Aditya Bavanari 976dce7632 ASoC: msm: qdsp6v2: Set freed pointers to NULL
Set freed pointers to NULL to avoid double free
in msm_compr_playback_open and msm_compr_playback_free
functions of the compress driver.

CRs-Fixed: 2142216
Change-Id: Ifd011dd85dd9f610c7b69dd460f73d26e006cd66
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2018-01-21 21:26:53 -08:00
LuK1337 b2213f5c42 Merge tag 'LA.BR.1.3.6-05010-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into cm-14.1-merge
"LA.BR.1.3.6-05010-8976.0"
2017-11-22 00:26:48 +01:00
kunleiz 4993bedca5 rtac: add size check when reading cal data kvaddr buffer
Add size check to ensure cal data bytes size fits inside
the cal date when copying to user space buffer.

CRs-Fixed: 2110256
Change-Id: I511999984684a9db4aaf1cf2c65eb1495c36980f
Signed-off-by: kunleiz <kunleiz@codeaurora.org>
2017-11-08 05:25:40 -08:00
LuK1337 4cce184099 Merge tag 'LA.BR.1.3.6-04910-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-04910-8976.0"
2017-10-14 19:29:50 +02:00
Aditya Bavanari 500cc6740d ASoC: msm: qdsp6v2: Fix dangling pointer access
Fix access of a dangling pointer by assigning it to NULL.

CRs-Fixed: 2096407
Change-Id: I22c1d55ea611ac59cdca51924787f6831bad8c2b
Signed-off-by: Aditya Bavanari <abavanar@codeaurora.org>
2017-10-05 03:05:07 -07:00
LuK1337 97104ad488 Merge tag 'LA.BR.1.3.6-04710-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-04710-8976.0"
2017-09-15 11:27:24 +02:00
Vinod Koul fec807795d ASoC: dont call dapm_sync while reporting jack always
While reporting the jack status snd_soc_jack_report() invokes snd_soc_dapm_sync()
always. This should be required when we have pins associated with jack and
reporting enables or disables these.
So add a check for this case

Change-Id: I02a8663f0e42e6bdf7454f760dbba08b59410a40
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: smanag <smanag@codeaurora.org>
Git-commit: 30a765d6433413c0eba90c969eecf12dfa2d111a
Git-repo: https://source.codeaurora.org/quic/la/kernel/msm-3.10
2017-09-11 04:50:57 -07:00
Siena Richard 3face8d88b ASoC: msm: qdsp6v2: return error when copy from userspace fails
A copy_from_user is not always expected to succeed. Therefore, check
for an error before operating on the buffer post copy.

CRs-Fixed: 1116070
Change-Id: I21032719e6e85f280ca0cda875c84ac8dee8916b
Signed-off-by: Siena Richard <sienar@codeaurora.org>
2017-08-07 16:08:55 +00:00
Weiyin Jiang fac72253f4 SoC: msm: audio-effects: return directly to avoid integer overflow
Return error code directly to avoid further integer overflow leading
to buffer overflow.

Change-Id: I8b74efda227726494724f4387c45b5b6fa04637b
CRs-Fixed: 2077909
Signed-off-by: Weiyin Jiang <wjiang@codeaurora.org>
2017-08-07 00:33:32 -07:00
LuK1337 f77b254b9f Merge tag 'LA.BR.1.3.6-04510-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-04510-8976.0"
2017-08-06 13:38:06 +02:00
Vidyakumar Athota befd353b41 ASoC: msm: qdsp6v2: add size check to fix out of bounds issue
Before calling audio calibration ioctl functions, compare the
allocated buffer size to the size of the header and cal type header
to ensure the buffer is big enough.

Change-Id: I601bb37ddcc34d459c207cf579f29744fe912d7b
Signed-off-by: Vidyakumar Athota <vathota@codeaurora.org>
2017-07-24 13:46:17 -07:00
LuK1337 62829e8978 Merge tag 'LA.BR.1.3.6-04010-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-04010-8976.0"

Change-Id: If446d01e5305f2e7b268b761d214305e35e2ce18
2017-06-09 23:21:11 +02:00
LuK1337 18aceede84 Merge tag 'LA.BR.1.3.6-03910-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-03910-8976.0"

Change-Id: I16643fc055aa2965fe5903396a8e5158c42cf1bc
2017-05-26 13:28:48 +02:00
Xiaojun Sang ebc0c18555 ASoC: msm: remove unused msm-compr-q6-v2
msm-compr-q6-v2.c and msm-compr-q6-v2.h are no longer used.

CRs-Fixed: 2022953
Change-Id: I856d90a212a3e123a2c8b80092aff003f7c608c7
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2017-05-24 10:33:25 +05:30
Linux Build Service Account c0323439c3 Merge "ASoC: msm-cpe: Fix range checking in function fw_name_store" 2017-05-22 20:26:47 -07:00