17 Commits

Author SHA1 Message Date
Michael Bestas
7af616af00 dsp: q6voice: Switch to __builtin_add_overflow
As seen on newer kernels

Change-Id: I87f0a408c211f956ebe8acaf23cbdd8c89fef9e5
2024-11-07 12:27:10 +02:00
Ramireddy KrishnaKanth Reddy
872164ebc4 dsp: q6voice: Adds checks for an integer overflow
there is no check for cvs_voc_pkt[2],when receives
0xffffffff from ADSP which results in an integer overflow
Fix is to address this.

Change-Id: Ie935dd8823981ec260d77f5117f4ef0b0fc08f60
Signed-off-by: Ramireddy KrishnaKanth Reddy <quic_ramikris@quicinc.com>
2024-11-07 12:26:55 +02:00
Soumya Managoli
ac69ab9caf BACKPORT: ASoC: msm-pcm-q6-v2: Add dsp buf check
Current logic copies user buf size of data
from the avail dsp buf at a given offset.
If this offset returned from DSP in READ_DONE event
goes out of bounds or is corrupted, then it can lead to
out of bounds DSP buffer access, resulting in memory fault.
Fix is to add check for this buf offset, if it is within
the buf size range.

Original-Change-Id: I7753cc6db394704dbb959477150141d42b836bef
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>

(cherry-picked from 28658bc2a0a290fdfcab61bed67e89874e99ca47)
[ Re-picking to adapt 1ee23bd8c37d for dsp buf check ]
Change-Id: Ie028d928492e5d113285416226abbeee8e6bfc20
Signed-off-by: Han Sol Jin <hansol@hansol.ca>
2024-08-19 10:21:47 +03:00
Laxminath Kasam
4d2730a95a asoc: Update copy_to_user to requested buffer size
Avoid copy to user more than requested buffer size
to avoid memory corruption.

Change-Id: Ibf1607f777a358ebd16fd8b8728809afda34eba7
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2024-08-19 10:21:43 +03:00
Laxminath Kasam
c09c224cd5 asoc: msm-pcm-q6-v2: Update memset for period size
tinycap test can attempt with different size to
read from driver and need to avoid access more
than period size.

Change-Id: Ifa4ddfb086bd83aa981da62e88da3a9395f5aabc
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2024-08-19 10:21:38 +03:00
Laxminath Kasam
68b53cde13 asoc: Reset the buffer if size is partial or zero
Sometimes during device switch in recording,
observe size 0 is return from DSP due to EOS
handling. For ALSA pcm_read to unblock, buffer
appl_ptr is elapsed without actually updating
the buffer. And userspace copies the stale
data(old buffer) causing issue sometimes.
Reset the buffer for that period_size in
such cases instead of transfer stale data.

Change-Id: I0d3ac133a8d95fad0710586e3e947410a41c9c5a
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2024-08-19 10:21:34 +03:00
Soumya Managoli
87b7744d0f dsp: q6lsm: Address use after free for mmap handle
The global declared mmap_handle can be left dangling
for case when the handle is freed by the calling function.
Fix is to address this. Also add a check to make sure
the mmap_handle is accessed legally.

Change-Id: I367f8a41339aa0025b545b125ee820220efedeee
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
2024-01-07 17:12:57 +02:00
Soumya Managoli
518e20003e ASoC: msm-pcm-host-voice: Check validity of session idx
Added check for voice session index.

Change-Id: Ifff36add5d62f2fdc3395de1447075d297f2c2df
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
2024-01-07 17:11:50 +02:00
Soumya Managoli
7fdab8ea22 ASoC: msm-pcm-voip: Avoid interger underflow
There is no check for voip pkt pkt_len,if it contains the
minimum required data. This can lead to integer underflow.
Add check for the same.

Change-Id: I91d4f2ad8dfb060cdb2ab9e36dc9f886ea40908a
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
2023-11-07 01:16:53 +02:00
Soumya Managoli
821c87b80d ASoC: msm-pcm-host-voice: Address buffer overflow in hpcm copy
Add check for the max hpcm_buf_node size before copy to avoid
buffer out of bounds issue.

Change-Id: Id647888430ce302359a857ef54d321bee99889bf
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
2023-11-07 01:16:52 +02:00
Tan Nayir
a9780a4558 techpack: audio: Update SOC_SINGLE_SX_TLV to SOC_SINGLE_S8_TLV
ASoC CTLs with negative minimum values were changed to use S8_TLV
controls on the upstream audio-kernel.
This is a backport of the upstream change [1] as it didn't land
into any sdm845 tag.

[1] 30fad2dc20

Change-Id: Id4b3038eb5d79a027f063869136ecebc83ee873d
2023-06-08 01:57:12 -05:00
Soumya Managoli
85c597dafc ASoC: msm-pcm-q6-v2: Add dsp buf check
Current logic copies user buf size of data
from the avail dsp buf at a given offset.
If this offset returned from DSP in READ_DONE event
goes out of bounds or is corrupted, then it can lead to
out of bounds DSP buffer access, resulting in memory fault.
Fix is to add check for this buf offset, if it is within
the buf size range.

Change-Id: I7753cc6db394704dbb959477150141d42b836bef
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
2023-06-06 18:10:57 +03:00
Michael Bestas
b82ed89445 treewide: Add .gitupstream
Change-Id: I41c0280e8d023a5242f2659eb3da0af02ee35789
2022-06-09 19:32:00 +03:00
Rashed Abdel-Tawab
3f50617df9 Unignore techpack directories
Change-Id: I4de6d6aa40f9de384b3d6e5ab11ffa7ec76423a2
2022-03-27 13:51:34 +03:00
Michael Bestas
12573767f8 Add 'techpack/audio/' from tag 'android-12.1.0_r0.1'
git-subtree-dir: techpack/audio
git-subtree-mainline: 5f518a30d1
git-subtree-split: e329f4955d
Change-Id: Ibd70ee040c9f97f0d30cdc0209f69e1a070068b1
2022-03-27 13:49:55 +03:00
Neeraj Upadhyay
8cd4682934 techpack: Gitignore all subdirs except stub
Gitignore all subdirs except stub under techpack.

Change-Id: Ic3e8910865aec83424b989286cc461f757d8522d
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
2017-12-04 17:12:35 +05:30
Bryan Huntsman
5df1dce16d techpack: add tech package support
Enable tech packages to have kernel drivers that are physically
located in the kernel source tree but not present in the kernel
repository. This is done via a manifest line item to fetch a
techpackage-module into $KERNEL/techpack/$techpackage-module.
$KERNEL/techpack/Kbuild will automatically detect any
subdirectories and link them to the kernel's kbuild system.

The resulting layout of techpack within kernel source would be as
follows :-

    kernel/
    ├── techpack/
        ├── Kbuild
        └── stub
        │    ├── Makefile
        │    ├── include
        │    │   └── uapi
        │    │       └── Kbuild
             └── stub.c
        ├── techpackage-module
            ├── Makefile
            ├── include
            │   └── uapi
            │       ├── Kbuild


$KERNEL/techpack only contains Kbuild (no Makefile) at the
toplevel and this Kbuild takes care of both compiling the
subdirectories and of exporting the needed header files therein.
The reason for having only Kbuild at the top is that Kbuild
and Makefile cannot exist together in same directory and Makefile
doesn't cater to uapi header installation.

stub is an empty techpackage-module which serves both as a sample
layout and satisfies the requirement of kernel build system, by
providing necessary buit-in.o, when no other techpackage-module has
been pulled under techpack/.

$KERNEL/techpack/techpackage-module should have a Makefile at the
top and Kbuild under $KERNEL/techpack/techpackage-module/include/uapi
directory. The uapi headers pertaining to a techpackage-module
should reside under $KERNEL/techpack/techpackage-module/include/uapi
and associated Kbuild should have necessary rules to export it.

Change-Id: I0d0ced38566907d2074831edde0934833f666eff
Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
Signed-off-by: Imran Khan <kimran@codeaurora.org>
2017-07-26 16:31:52 +05:30