SoC: msm: qdsp6v2: return DEFER code when probe is not done

Probe may not be done when first alloc api is called. Need to return
DEFER error so that client can try later.

Change-Id: I4aa8da928aa2b9f6d22ad9aaae9a8cb27b93d424
Signed-off-by: Fred Oh <fred@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
Soc: msm: qdsp6v2: Fix invalid params handling

Alloc and free apis should sanity check all input params.
If allocation fails set client and ion handle to NULL.

Change-Id: Ide3bd782eb90ee8b033e39de232929a1ca7174b7
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: audio: qdsp6v2: Change acdb_mmap size variable to unsigned

The acdb_mmap fuction does a size calculation but
stores the result in an int which makes negitive
numbers possible. Changing the variable to unsigned
ensures that the size used is never out of bounds.

Change-Id: Iffd9c1440d2f28b703a77993fdbb3ccd18f30694
CRs-fixed: 548145
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: audio: qdsp6v2: Zero the cfg stack var

Write zeroes into the stack variable cfg to ensure
no previously written stack data is sent to
user-space.

Change-Id: Ie571949e3613c9e5a916b23e1dc19605496d9dbf
CRs-Fixed: 551574
Signed-off-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: audio: qdsp6v2: memeset msm_audio_stats to zero

memeset msm_audio_stats to zero before copying to user space.

Change-Id: I5f47bf85e36d46f726dddae68962a3d1cd06213b
CRs-fixed: 549307
Signed-off-by: Kiran Kandi <kkandi@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASOC: qdsp6: Add pause/resume support for AAC encoder

-  If session is stopped, AUDIO_START should
   trigger session to be started again. This way
   pause/resume becomes stop/start for AAC encoder.

Change-Id: Id44a5342bb90b049d9c617ede60bf41a5289c581
Signed-off-by: Sharad Sangle <assangle@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: qdsp6v2: memset stack buffer allocation.

This is needed to avoid garbage data in uninitialized variables.

Change-Id: Ia8e6148eef2cafe6931c6fdc35d7aafeb0c0bd97
CRs-Fixed: 556792
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: soundrecorder: Add support for pause/resume in HW AAC mode

- Use "stopped" notification to indicate pause/resume. This avoids
  null pointer exception while playing a recently recorded file

Change-Id: Ie5782381e816f76c34677e5863c9849609089eba
Signed-off-by: quic_mqiu <quic_mqiu@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: qdsp6v2: memset stack buffer allocation.

This is needed to avoid garbage data in uninitialized variables.

Change-Id: I20e56ee32d3b9d1eecc4fa7761ff164a210fbbde
CRs-Fixed: 561611
CRs-Fixed: 561615
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: qdsp6v2: Deleting kernel driver from arch/arm/mach-msm

Drivers are registering under misc driver but exists under arch/arm/mach

Change-Id: I6210ed2ffbc38608914fb765b8e50ac6d97950ff
CRs-Fixed: 554492
Signed-off-by: Asish Bhattacharya <asishb@codeaurora.org>
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoc: msm: qdsp6v2: add vm page offset validation

Lack of range validation can lead wrong mapping or expose arbitrary
memory page to userspace

Change-Id: I8c6eb1b7255d444bffd9d3748ca4815b11bdf16a
Signed-off-by: Fred Oh <fred@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
Soc: msm: qdsp6v2: Fix invalid params handling

when ion_import_legacy api fails then we should not
call ion_free as the handle returned is not proper to
dereference so instead just destroy the ion client and
bail out.Sanity checks for all the input params is also
added.

Change-Id: I6c51986bf2ce334ff7405e38a12c1c1db50e2417
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Anish Kumar <kanish@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: qdsp6v2: Deleting kernel driver from arch/arm/mach-msm/qdsp6v2

Driver is registering under misc driver but exists under arch/arm/mach

Change-Id: I0930d3f56767569edefa1af3c7d45a724a219ce3
CRs-Fixed: 548017
Signed-off-by: Mohammad Johny Shaik <mjshai@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ALSA: compress: Memset timestamp structure to zero.

snd_compr_tstamp is initialized using aggregate initialization
that does not zero out the padded bytes. Initialize timestamp
structure to zero using memset to avoid this.

CRs-Fixed: 568717
Change-Id: I7a7d188705161f06201f1a1f2945bb6acd633d5d
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ALSA: pcm: check for integer overflow during multiplication

Channel info data structure is parsed from userspace and if
user does not set the no. of channels correctly, it could lead
to security vulnerability if we don't check for overflow when the
no. of channels is multiplied with pcm bit width. Add a condition
to check for overflow during multiplication.

CRs-fixed: 537818
Change-Id: Ib9631b6e45d77b39be2c27343d4aee3e9244d8cc
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ALSA: core: Fix crash by avoiding appl_ptr crossing 32-bit boundary

Incase of A2DP usecase using proxy driver, appl_ptr has
boundary value as 0x60000000 frames in sw_params for stereo(2 channels).
When this value crosses 0x40000000, then userspace calculating
appl_ptr at bytes results in crossing 32-bit value 0x100000000,
and points to 0x0 offset which can result in crash or pop.
To avoid above scenario, set the sw_params appl_ptr boundary value
within 0x40000000. Added proper check at sw_params update
to set this value correctly within 32-bit boundary(frames).

Change-Id: I537a04156699d90549a0a468ae19539ecd552d3b
CRs-Fixed: 483203
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
msm: usbaudio: Add check for NULL before dereferencing

kzalloc() and usb_ifnum_to_if() both APIs can return NULL. Current
code is not checking return value and derefencing which may crash
device if it is set to NULL. Fix this by checking return value
against NULL and handling the same.

CRs-Fixed: 562273
Change-Id: I0d2c910f43321e94fc447b19ae3e3207727e24f3
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Saket Saurabh <ssaurabh@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC: Compress: Check and set pcm_new driver op

Check and set if pcm_new driver op is initialized by the driver.
This allows the compress offload drivers to register mixer
controls.

Change-Id: If54fa36cf19cbca7239d6e3e30455472e9a173d8
Signed-off-by: Ravi Kumar Alamanda <ralama@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>
ASoC :msm: Increase Proxy buffering

-Proxy buffering can overflow if BT playback setup takes a lot of time
-Fix this by increasing the proxy buffer size so that we will end
 up buffering the additional data that can come in during this time

Change-Id: I3b9acc848e0922bb26c87845fc6164f4266fbfa9
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>

ASoC: msm: Increase Proxy buffering

-Proxy buffering can overflow if BT playback setup takes
longer than usual.
-Fix this by increasing the proxy buffer size so that
we will end up buffering the additional data that can come
in during this time.

Change-Id: I5d091ff12036a80dbf50fd14556b13852dd0cc24
CRs-Fixed: 547254
Signed-off-by: Amit Shekhar <ashekhar@codeaurora.org>

Revert "ASoC: msm: Increase Proxy buffering"

This reverts commit c1a463e27329c0a0016ccfc38c513bb760f82337

Change-Id: I88ffb9822184d8f227799a97a7cbceaf2f80f769
Signed-off-by: flar2 <asegaert@gmail.com>
ASoc: msm: qdsp6: Add ultra low latency playback support

Using ULL further reduces continuous latency when
compared to the current low latency path.
This is achieved by having no post-processing in
the DSP along with smaller buffer sizes

Change-Id: I81cb10db575b0fd3405fe6d051ccce4f8496bb32
Signed-off-by: Aleksander Holynski <aholynsk@codeaurora.org>
Signed-off-by: Krishnankutty Kolathappilly <kkolat@codeaurora.org>
Signed-off-by: flar2 <asegaert@gmail.com>