Commit graph

4 commits

Author SHA1 Message Date
Tommaso Fonda
c00c013f19
sm6225-common: amplifier: Add amplifier usecase to head of usecase list
When a call is received, if the ringtone is played through the speaker,
the audio HAL will freeze and restart when the call is answered,
leading to a few seconds of silence at the beginning of the call. This
happens because of a NULL pointer dereference, which is in turn caused
by a UAF in the check_usecases_codec_backend() function, in the audio
HAL.

The UAF occurs because the amplifier HAL appends its usecase at the
wrong end of the usecases list - tail instead of head. When the second
list_for_each() loop in the aforementioned function iterates through
the list, it first finds the regular low-latency-playback usecase,
and calls disable_snd_device() for the speaker output device. This
causes the amplifier HAL to execute aw882xx_stop_feedback(), which
frees its usecase in the list, but the internal pointer of the
list_for_each() macro already points to it, thus the following
iteration effectively operates on a free'd object.

To fix this issue, have the amplifier HAL append its usecase to the
head of the list: this way, it will be iterated on before the
low-latency-playback usecase, i.e. before it gets free'd.

Change-Id: Ia8dcb11b3ed320836a6602798ff5c390e7afa9d2
2023-11-29 17:03:46 +02:00
Rohit
41ac68de1e
sm6225-common: amplifier: Rebrand to AW882xx
* AW882xx logic was the same as the TFA one anyways

Change-Id: I87cd6aecd88e2a906d6cc7a293510d0a463cb3f8
2023-04-16 13:37:58 +03:00
Pig
6e093e6109
sm6225-common: amplifier: Fix device list initializations
Update missing device list initializations.

Reported-by: Signed-off-by: SayanAcharya <rowdysayan99@gmail.com>
Co-authored-by: Signed-off-by: SayanAcharya <rowdysayan99@gmail.com>
Change-Id: Iaa44429e7a2514f882828089355fca1634b79200
2023-04-16 13:37:58 +03:00
PIPIPIG233666
635e13c2cb
sm6225-common: Add custom audio amplifier for TFA amp feedback
* Based on observing reverse engineering from davinci stock audio HAL.
 * Fixes speaker distortion on high volume.

 * Same logic with Smosia, rewritten by me.

Co-authored-by: Smosia <stasenko_nv@nrcki.ru>
Change-Id: I369555a9fcb06065177636b436d2e006c7a0b07d
2023-04-16 13:37:58 +03:00