Commit Graph

3036 Commits

Author SHA1 Message Date
Ajit Pandey adbb23f73a dsp: avtimer: validate payload size before memory copy
Check payload size to avoid out-of-boundary memory
access before attemptimg memory read.

Change-Id: I94723b526449aacfe7b2fe30990fb77cdd15c5da
Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
2020-06-06 20:32:11 +02:00
Jishnu Prakash 8345bca8c7 msm: sps: Update debug message format specifier
Restrict printing of kernel virtual addresses in SPS driver.

In debug prints, handles to bam device structures may be printed
as integers. As these handles are obtained by casting pointer
to bam device structures to integer, they can reveal addresses
of the structures to attackers.

Cast the handles in debug prints to pointers, printed with with %pK,
which hides these values if kptr_restrict is set (default on Android).

Change-Id: Idd28c7d11a06113605f7428a4cfc2505c1ae0073
Signed-off-by: Jishnu Prakash <jprakash@codeaurora.org>
2019-07-27 22:11:32 +02:00
Mohammed Javid 7cdfc46fca msm:ipa:Prevent rt rule deletion if rt rule id is invalid
Currently RT is deleted even if rt rule or header proc ctx
is invalid. Add check to prevent it.

Change-Id: Ic37ff9a33fab2b3c0d6393e43452e4b62a91d932
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 22:10:28 +02:00
David Dai dfc2fac0fb msm: msm_bus: Fix error handling in msm_bus_device_init
Correctly free pointers allocated by kzalloc. Remove devm_kfree
in error handling as device associated memory is automatically
freed upon destruction of device. Always use put_device instead
of kfree on initialized device.

Change-Id: Icbd88e9ccd42fedb4fbce5eff69248c3fceffc02
Signed-off-by: David Dai <daidavid1@codeaurora.org>
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
2019-07-27 22:08:45 +02:00
Manoj Prabhu B c2671b3b4c SSM: Remove support for SSM driver
SSM driver is not enabled and hence needs deprecation.
Remove all the SSM driver references.

CRs-Fixed: 2268386
Change-Id: I02f82817023d2fcc6d05a2f0d7eb3aec8f60a7d5
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2019-07-27 22:08:41 +02:00
Mohammed Javid 23c490f683 msm: ipa: Protect ipa default routing table
Protect ipa default routing table from
addition, deletion and modification once after
default rule added by ipa-driver.

Bug: 119052051
Change-Id: I045d9c29fed23edf796d826e440b81124e1f666a
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 22:05:55 +02:00
Mohammed Javid 6cf9b4ec53 msm: ipa3: Fix to validate the user inputs
Adding code changes to validate user inputs.
Before allocating the NAT entry verifying the
NAT entry size in range or not.

Bug: 109741776
Change-Id: I21147f20a12243af5d21aebdc206703964db2be4
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 22:05:55 +02:00
Siva Kumar Akkireddi f283dd5336 msm: sps: Suppress bind/unbind attributes
SPS driver does not support manual bind/unbind operations
through sysfs. Suppress the bind/unbind nodes. Do not free
SPS struct in sps_device_de_init since it is being done in
sps_exit, and also to avoid use-after-free.

Bug: 114042002
Change-Id: If6da6c5fb9d1a44d0420c6151f7f9d0a33cb2d04
Signed-off-by: Siva Kumar Akkireddi <sivaa@codeaurora.org>
2019-07-27 21:53:07 +02:00
Mohammed Javid 04b1b0185e msm: ipa: Fix to handle NULL pointer dereference
Header entry deleted but same entry pointer using in
routing table not updated. Added checks to confirm
header entry present or not before using it to avoid
null pointer dereference.

Change-Id: Id1d844c60b2dcb0cc7cf18352b78d62fe5a89347
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 21:51:22 +02:00
Mohammed Javid 834a002042 msm: ipa: rmnet: Make code changes with respect to CR#2046006
Check for CAP_NET_ADMIN capability of the user
space application who tries to access rmnet driver IOCTL.

Bug: 36367253
Change-Id: If6bb4b54659306c5103b5e34bf02c7234c851e0a
CRs-Fixed: 2226355
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 21:51:20 +02:00
sunil paidimarri a78f95743c msm: ipa: clear uC interrupt only before processing
Clearing Non uC interrupts before processing will
result in clearing interrupt data.

Change-Id: I47ea7c22250264da206e1fb8691e77224c825ab0
CRs-Fixed: 1008549
Acked-by: Mohammed Javid <mjavid@qti.qualcomm.com>
Signed-off-by: sunil paidimarri <hisunil@codeaurora.org>
2019-07-27 21:50:54 +02:00
Sridhar Ancha f290807c52 msm: ipa: Remove usage of stack memory
When stack memory is provided to HW as part of descriptor
it can lead to cache alignment issues. Make changes to
use heap memory whereever applicable.

Change-Id: I666f98cf2ec45a4743db0ab7bc6d2df821cce84a
Acked-by: Chaitanya Pratapa <cpratapa@qti.qualcomm.com>
Signed-off-by: Sridhar Ancha <sancha@codeaurora.org>
2019-07-27 21:50:54 +02:00
Mohammed Javid 8c36693b68 msm:ipa: Return mux id only for valid interface
Currently value of MAX_NUM_OF_MUX_CHANNEL is 10
but number of valid interfaces is 8. So empty interface
is also getting mux id. Return mux id only for valid
interfaces.

Change-Id: I7852df0aa0ccee781c1bf6857a4183b99194f3ee
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 21:50:53 +02:00
Mohammed Javid 26955f56d6 msm:ipa: Fix to IPA static analysis constant null deferenced
Adding code changes to reslove IPA static analysis
issue Constant NULL dereferenced by passing
to other function.

Change-Id: I07bd7ac42929576429fc4548cfce7d202d77364f
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 21:50:52 +02:00
Mohammed Javid c3cb559284 msm: ipa: Change error value for set quota
Currently IPA send common error -EFAULT to user space
in case of IOCTL fails. Change error value for set quota
based on error received from modem.

Change-Id: Ib6ba487a186245ddf752cd08de12293af1ea1bb9
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 21:50:52 +02:00
Skylar Chang 987c28ae62 msm: ipa: add ioctl to get ipa hw version
Add ioctl for user space to get ipa hw version

Change-Id: Iba207623126f641324fbcf174bddd46552f489de
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
2019-07-27 21:50:52 +02:00
Skylar Chang e37099ac8a msm: ipa: support aggregated ipa stats query
add support on wan-driver to query modem or
wlan-fw to get the total data usage for all
tethered clients.

Change-Id: I56f40f1c0f6b2ec4279e78b3aeb81c687d08bf2e
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
2019-07-27 21:50:51 +02:00
Ghanim Fodi e7e4de5505 msm: ipa: Prevent deletion of the default route rule
The first APPS default routing table rule is installed
at the IPA driver initialization. To prevent routing
exception, this rule cannot be deleted by user application.
This change prevents deleting this rule.

Change-Id: Ia27434fd24a15fea5956018a1271b11bbe227df7
CRs-fixed: 2165859
Signed-off-by: Ghanim Fodi <gfodi@codeaurora.org>
2019-07-27 21:50:41 +02:00
Mohammed Javid 3f213e0cd9 msm: ipa: Fix to add string NULL terminator
Missing null terminator to userspcae provided
string leads to strlen buffer overflow in strlcpy function.
Added code changes to fix string NULL terminator issue.

Change-Id: I3f9d5f22fbb26f68de12370bc5e07a4e6bc2ced9
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2019-07-27 21:50:40 +02:00
Michael Adisumarta a0e231ee10 msm: ipa: dynamic memory leak fix
This is a fix for dynamic memory leak seen with incorrectly
allocating memory of a different size than with intended
size.

Change-Id: I821442ee6728ea90ceab7644e194f4e06369333a
Acked-by: Jyothi Jayanthi <jyothij@qti.qualcomm.com>
Signed-off-by: Michael Adisumarta <madisuma@codeaurora.org>
2019-07-27 21:50:40 +02:00
Jonathan Solnit e1715e23ed msm: ipa: Fix to unsigned integer underflow
Added code changes to fix the unsigned integer underflow
leads to accessing unmapped memory.

Bug: 70242505

Change-Id: I8148aebd3597ec6ae8c184199afe816f3d80636e
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
Signed-off-by: Jonathan Solnit <jsolnit@google.com>
2019-07-27 21:50:23 +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
Linux Build Service Account 0c7c2e7461 Merge "msm: ipa: Fix the handling of default IPA header" 2018-01-22 19:30:07 -08:00
Ghanim Fodi e216179f9a msm: ipa: Fix the handling of default IPA header
Default IPA header is added or deleted from the driver
directly and not by user space application. This change
prevents adding/deleting it from user application which
may cause inconsistencies in the driver. Also the change
fixes the header reset function to skip on the correct
default header.

Change-Id: Ic813433655411f1447db8b0c15efdf64038d8c26
CRs-fixed: 2151146
Signed-off-by: Ghanim Fodi <gfodi@codeaurora.org>
2018-01-21 21:34:48 -08:00
Odelu Kukatla 26020077ec msm: msm_bus: Add mutex lock for floor vote data
Floor vote data needs to be protected with mutex lock to
avoid double free of memory due to race condtion.

Change-Id: Ifaa01a14d273ccba6b9463aff3a41c0038b05f06
Signed-off-by: Odelu Kukatla <okukatla@codeaurora.org>
2018-01-21 21:13:01 -08:00
Jishnu Prakash fee040aaa1 msm: sps: Update debug message format specifier
Restrict printing of kernel virtual addresses in SPS driver.
In debug code, %p is used to print virtual addresses of
kernel objects, which can be exploited by attackers. It is
replaced with %pK, which hides these values if kptr_restrict
is set (default on Android).

Change-Id: I57585fa655abc01b2e8d694c8f31b7617bbf4ec7
Signed-off-by: Jishnu Prakash <jprakash@codeaurora.org>
2017-12-14 22:08:39 -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
Mohammed Javid 6ed8e2e849 msm: ipa: Fix to use after free issue
Added code changes to avoid use after free
if header already table already freed
during ipa ioctl test.

Change-Id: Idc5c57a5aa896d4af0c76cc49fd964f236229711
Acked-by: Pooja Kumari <kumarip@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2017-11-14 18:18:25 -08:00
Shihuan Liu c1d93f8b66 msm: ipa: add null terminator
Add null terminator at the end of string
extend_ioctl_data.u.rmnet_mux_val.vchannel_name
to avoid potential security issue.

Change-Id: I57fe3a9f7e3ad6a499b62a9cfc49bc6b2f3b42e0
Acked-by: Shihuan Liu <shihuanl@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
2017-11-11 03:18:52 -08:00
Mohammed Javid e51f6cadca msm: ipa: Fix to use after free issue
Added to code changes to ref_cnt variable will decrement only
when add_ref_hdr variable is true.

Change-Id: I0bcc3909669f4843c43135e5f047ac28fa62bb63
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2017-11-08 05:26:29 -08:00
Skylar Chang 2eaf14b921 msm: ipa3: add lock for num_q6_rule
There is a race condition be observed
on global variable num_q6_rule used in
ipa wan-driver. The fix is to add lock
to prevent different threads are accessing
it at the same time.

Change-Id: Ia9190c60361cb5605b61963309beca3acdeac89d
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
2017-11-02 04:52:58 -07: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
Utkarsh Saxena a7412da2f9 msm:ipa: using rate limit api for ioctl calls
ipav2/ipav3 ioctl calls input arguments validation failed cases,
replacing IPAERR() with IPAERR_RL() marco for controlling logs
printing on the console.

Change-Id: I0d1aabb9b500228e5fd5d94cf17657bf29bdf175
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Utkarsh Saxena <usaxena@codeaurora.org>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2017-10-05 19:51:20 -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
Utkarsh Saxena 68243eb550 msm: ipa: Fix for missing int overflow check in the refcount library
Overflow of reference counter can lead to memory leak.

Before incrementing the reference count, check with
U32_MAX and return for error check.

Bug: 35467471
Change-Id: Ib96d36574ee086ec73c9836110cb2c98e8ae3d66
Acked-by: Mohammed Javid <mjavid@qti.qualcomm.com>
Signed-off-by: Utkarsh Saxena <usaxena@codeaurora.org>
2017-09-08 18:48:51 +00:00
Mohammed Javid a89b05e8af msm:ipa: Fix to incorrect structure access
Accessing of incorrect structure pointer is causing
memory out of bound access, fixed issue by accessing
the correct structure pointer.

Change-Id: I3c2f5f7a97cac854093ef670184d06db4231f5e1
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2017-09-04 00:14:44 -07:00
Skylar Chang 051c346ba0 msm: ipa: fix security issues in ipa wan driver
Fix the security issue in handling add mux channel event
in ipa wan driver.

Change-Id: Ic2ffeafddad4954ec3ecba0d675646d0790eede7
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Acked-by: Shihuan Liu <shihuanl@qti.qualcomm.com>
2017-08-31 23:33:54 -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
Skylar Chang 4af7ad86b9 msm: ipa: prevent string buffer overflows
On rmnet_ipa_set_data_quota() API, add the
string terminator to prevent vulnerability
of string buffer overflows on debug prints.

Change-Id: Ie669f6606f76b9006bce4edd0c6d04aef9cfb600
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
2017-07-30 10:32:28 -07:00
Mohammed Javid 10a74f4b41 msm:ipa: Fix to kasan use-after-free issue
Added mutex lock to query rt table function also to sync
with other ioctl calls in ipa.
Change-Id: I65d46c0ef28b5e6260c92473fd15e9763de20146
Acked-by: Ashok Vuyyuru <avuyyuru@qti.qualcomm.com>
Signed-off-by: Mohammed Javid <mjavid@codeaurora.org>
2017-07-25 03:45:25 -07:00
LuK1337 ea03599937 Merge tag 'LA.BR.1.3.6-04110-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-04110-8976.0"

Change-Id: Ie9bc105eee4263ab1ec2f91556feca988522808f
2017-07-08 18:34:23 +02:00
Siva Kumar Akkireddi 3f95a82455 msm: sps: Fix race condition in SPS debugfs APIs
SPS debugfs APIs can be called concurrently which can result
in dangling pointer access. This change synchronizes access
to the SPS debugfs buffer.

Change-Id: I409b3f0618f760cb67eba47b43c81d166cdae4aa
Signed-off-by: Siva Kumar Akkireddi <sivaa@codeaurora.org>
2017-06-29 22:46:48 -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
Linux Build Service Account 251b7fcbfa Merge "msm: msm_bus: Add mutex to protect node_list" 2017-05-31 12:55:16 -07:00
Linux Build Service Account a9db53d011 Merge "soc: qcom: msm_bus: add mutex lock for cllist data" 2017-05-30 13:08:50 -07:00
David Dai 636bc7b683 msm: msm_bus: Add mutex to protect node_list
Static variable node_list list need to be protected with a mutex
to prevent race conditions and use after free cases.

Change-Id: I4790b06712b8a8b401f43418cfcc53b415fb0019
Signed-off-by: David Dai <daidavid1@codeaurora.org>
2017-05-30 07:19:24 -07:00
Maria Yu 455affe5f7 soc: qcom: msm_bus: add mutex lock for cllist data
Cldata needed to be protected by lock since crash
happened when synchronous update and free.

CRs-Fixed: 2034222
Change-Id: Ied86461b784d69d9758dc3fc793a8a0de86e7f9c
Signed-off-by: Maria Yu <aiquny@codeaurora.org>
2017-05-29 23:32:28 -07:00
Skylar Chang 569da1544d msm: ipa: do not use delay in SSR
In some rare race condition during SSR, modem might
programmed commands to IPA to lock the pipe, and AP will
enable delay on this pipe which will prevent IPA to read
unlock command. In this case IPA HW will be stalled as it
is locked forever on this pipe.

CRs-Fixed: 1040724
Change-Id: Ifc874c9e881eb1b3ccea321679bb272cd427fabb
Acked-by: Ady Abraham <adya@qti.qualcomm.com>
Acked-by: Mohammed Javid <mjavid@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Signed-off-by: Utkarsh Saxena <usaxena@codeaurora.org>
2017-05-28 04:36:30 -07: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
Skylar Chang 45e8d79d63 msm : rmnet_ipa: fix memory overflow issue
Fix the security issue where mux channel name might
not be null-terminated causing memory access overflow
in ipa wan driver.

Change-Id: I3ef440b62cf3861464fb60c1e7f65f2be5e39ed0
Acked-by: Shihuan Liu <shihuanl@qti.qualcomm.com>
Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
2017-04-28 11:51:40 +05:30