Commit graph

602479 commits

Author SHA1 Message Date
Xiaojun Sang
1b75396524 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: Iaa39ee4ea5489bb5579e7b7d5dfada12d88c5809
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2019-04-10 15:36:09 +08:00
Deepak Kumar Singh
4fedfe5c4d soc: qcom: qmi_encdec: Restrict string length in decode
The QMI TLV value for strings in a lot of qmi element info structures
account for null terminated strings with MAX_LEN + 1. If a string is
actually MAX_LEN + 1 length, this will cause an out of bounds access
when the NULL character is appended in decoding.

CR-Fixed: 2359244
Change-Id: I4d789bc6017ff58458f77fe875ca4e175a4f1357
Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2019-04-09 01:59:13 -07:00
Rajesh Kemisetti
a1b80321ae msm: kgsl: Limit log frequency in case of context count maxed out
kgsl_context_init() prints error message continuously if a process
tries to create more number of contexts that KGSL supports.

This hogs CPU and might lead to watchdog timeout.

Reduce this log frequency by using KGSL_DRV_ERR_RATELIMIT().

Change-Id: I7e3a5d3db41ab0c60d1b6b620cbcdef96d5c21a9
Signed-off-by: Rajesh Kemisetti <rajeshk@codeaurora.org>
2019-04-08 03:16:25 -07:00
Vatsal Bucha
279b0b023c qdsp6v2: q6usm: Check size of payload before access
Check size of payload before access in q6usm_mmapcallback.

Change-Id: Iff0672532c2ea40e7129237a92d8365d6b554cf2
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2019-04-04 23:47:19 -07:00
Linux Build Service Account
6dfb4b756b Merge "qdsp6v2: q6usm: Check size of payload before access" 2019-04-03 09:11:35 -07:00
Linux Build Service Account
281de5809e Merge "perf: Cancel the mux hrtimer during CPU hotplug to avoid migration" 2019-04-03 00:25:13 -07:00
Linux Build Service Account
dd45e2fcea Merge "msm: asm: validate ADSP data before access" 2019-04-02 14:00:26 -07:00
Linux Build Service Account
5d45bd7a1e Merge "drivers: soc: qcom: Added check to avoid opening multiple instance" 2019-04-02 14:00:24 -07:00
Linux Build Service Account
1dc6edb0ef Merge "dsp: q6voice: Check size of shared memory buffer before access" into msm-4.4.c10 2019-04-02 13:42:06 -07:00
Ajit Pandey
9d3ba87f26 drivers: soc: qcom: Added check to avoid opening multiple instance
Opening of multiple instance of voice_svc user space from app will
lead to pointer deference of private data within apr callback. As
multi-instance not supported added check to deny open() from user
space if previous instance hasn't been closed.

Change-Id: Ia5ef16c69a517760fc9d45530a8a41a333fa2a21
Signed-off-by: Ajit Pandey <ajitp@codeaurora.org>
2019-04-02 04:53:53 -07:00
Vatsal Bucha
f0cc7ca310 qdsp6v2: q6usm: Check size of payload before access
Check size of payload array before access in q6usm_callback.

Change-Id: Id0c85209a053f9dfdb53133aeb6b2510ecf18eb8
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2019-04-02 14:50:46 +05:30
Raghavendra Rao Ananta
ea2ee83c92 perf: Cancel the mux hrtimer during CPU hotplug to avoid migration
The current design of hrtimers migrates the pinned timers to a
different CPU upon its hotplug. However, perf-core needs to
maintain the mux-hrtimers on a per CPU basis. That is, each
hrtimer carries the context for that particular CPU and would
lose this context if it gets migrated to a different CPU. As a
result, cancel the hrtimer for the CPU that's about to go down
and restart it (if required) when the perf-events are being created.

Change-Id: I7a1d0456208855e3a99a7d49e59c6dae811d146e
Signed-off-by: Raghavendra Rao Ananta <rananta@codeaurora.org>
[mojha@codeaurora.org: Resolved merge conflict and added missing
 `cpuctx` variable to avoid build failure]
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
2019-04-01 21:07:20 -07:00
Xiaojun Sang
950b66256c asoc: check payload length against structure size
Payload length must exceed structure size. Otherwise, it may
lead to out-of-boundary memory access.

Change-Id: I090de5116ab04a4ca2b9c485e17617fe9e861ad5
Signed-off-by: Xiaojun Sang <xsang@codeaurora.org>
2019-04-01 19:56:53 -07:00
Vatsal Bucha
920b58ced9 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-04-01 04:42:20 -07:00
Vignesh Kulothungan
ed93ca6232 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-03-28 18:29:01 -07:00
Neeraj Soni
b55c37ac6f msm: ice: check for crypto engine availability
There can be many ice instances present in dtsi file but
not all of them will be initialized by storage driver.
Check if crypto instance is initialized before setting
it up for data encryption/decryption usage.

Change-Id: I7c9227007474052513b277dec5963a973781c524
Signed-off-by: Neeraj Soni <neersoni@codeaurora.org>
2019-03-28 00:45:19 -07:00
Linux Build Service Account
cbdb77b292 Merge "icnss: Add Api to Block/Unblock modem shutdown" 2019-03-27 08:14:51 -07:00
Sandeep Singh
ab8f63420c icnss: Add Api to Block/Unblock modem shutdown
Add API to Block/Unblock modem graceful shutdown.

Change-Id: I69b061fc7d25762b2c36d9590802addfc170f91f
Signed-off-by: Sandeep Singh <sandsing@codeaurora.org>
2019-03-27 18:10:38 +05:30
Sandeep Singh
0fe53af862 icnss: Defer modem graceful shutdown until probe complete
In case WLAN driver probe is in progress and modem graceful
shutdown occurs and if modem shutdown request is sent just
before the mode on request sent to firmware, firmware may end up
in illegal memory access.
To address this issue, modem notifier needs to be blocked needs for
probe to complete or max 5 seconds timeout.

CRs-Fixed: 2381846
Change-Id: I9e13a11c56059cb29e161c34df11de484f87ac5e
Signed-off-by: Sandeep Singh <sandsing@codeaurora.org>
2019-03-27 17:08:56 +05:30
Xiaojun Sang
7289a6a51e 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-03-26 05:23:32 -07:00
Shadab Naseem
8bc8a30bdb scripts: gcc-wrapper: Route the GCC errors to stderr
The GCC wrapper writes any error message from GCC to stdout
along with the messages from the wrapper itself. This is okay
for most case, but when GCC is used with -print-xxx flags,
the stdout output is supposed to be taken as input to some
other build command, so putting error messages in there is
pretty bad. Fix this by writing error messages to stderr.

Change-Id: I4656033f11ba5212fdcc884cc588f8b9d2c23419
Signed-off-by: Shadab Naseem <snaseem@codeaurora.org>
2019-03-24 22:29:49 -07:00
Sandeep Singh
14961ab5bb icnss: Add support for graceful shutdown
Add a QMI command to indicate graceful shutdown to the FW
and updating the QMI file.

Change-Id: I0360f6f5b49bc19ea4a7acbbd0e192e1596463d6
Signed-off-by: Sandeep Singh <sandsing@codeaurora.org>
2019-03-20 03:52:07 -07:00
Manoj Prabhu B
d7807eff3a diag: dci: Validate dci client entries prior read
Validate the dci entries and its task structure before
accessing structure members to prevent copying dci data to
invalid entries.

Change-Id: I07c59ef0705bc52a8268b0dc984ebfa9d26d178e
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2019-03-14 23:23:10 -07:00
Linux Build Service Account
841cf03d93 Merge "diag: Add protection while accessing usb_info's buffer table" 2019-03-12 00:10:55 -07:00
Hardik Arya
6f1987e5d8 diag: Add protection while accessing usb_info's buffer table
Currently there a possibility of NULL pointer dereference while
accessing usb_info's buffer table due to missing proper protection.
The patch adds protection for the same.

Change-Id: I974a70a48e7ac47b42bc237aac4db1b9e47be6be
Signed-off-by: Hardik Arya <harya@codeaurora.org>
2019-03-11 22:34:10 -07:00
Hardik Arya
168a91f810 diag: Free usb buffer's entry after removing from list
Currently, there is possibility of memory leak due to not
freeing allocated memory for usb buffer's entry after
removing it from list. The patch handle this by freeing
the entry.

Change-Id: Idb08ecad859749e6ab1b09184362de38de4a9836
Signed-off-by: Hardik Arya <harya@codeaurora.org>
2019-03-11 22:31:22 -07:00
Linux Build Service Account
0bc8b59292 Merge "dsp: codecs: fix range check for audio buffer copying" 2019-03-11 05:47:58 -07:00
Linux Build Service Account
f71bb6b5bd Merge "msm: ipa: Fix to validate the buffer size" 2019-03-11 05:47:57 -07:00
Xiaoyu Ye
f46f0d774d dsp: codecs: fix range check for audio buffer copying
The range checking for audio buffer copying in function
"audio_in_write" is using the incorrect buffer size.
Change it to the actual allocated audio buffer size.

Change-Id: Ib7aaa2163c0d99161369eb85d09dc2d23d8c787b
Signed-off-by: Xiaoyu Ye <benyxy@codeaurora.org>
2019-03-11 00:47:25 -07:00
Deepak Kumar
b0a3e87996 msm: kgsl: Correctly limit max number of contexts per process
Read and increment context count atomic variable under a lock
to avoid race condition between read and increment. This is
necessary to make sure no process goes beyond the specified
context limit.

Change-Id: I483e2ac169beaff49e19b8ef1b46541f6eb740b0
Signed-off-by: Deepak Kumar <dkumar@codeaurora.org>
2019-03-06 23:32:09 -08:00
Praveen Kurapati
a411b9ceed msm: ipa: Fix to validate the buffer size
Adding code changes to validate buffer size.
While calling ipa_read verifying the kernel buffer
size in range or not.

Change-Id: Idc608c2cf0587a00f19ece38a4eb646f7fde68e3
Signed-off-by: Praveen Kurapati <pkurapat@codeaurora.org>
2019-03-06 21:35:38 +05:30
Laxminath Kasam
5557ce5cc8 asoc: codecs: Fix out of bound register access
For TX5 MUX registers, offset is not followed
in TXn order. Update driver to read/write correct
register offset when TX5 MUX registers access.

CRs-Fixed: 2218938
Change-Id: I8958b6cd1847967cbd37e7145c9f3909b0b8853b
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
2019-03-05 01:10:35 -08:00
Linux Build Service Account
a2faea1692 Merge "dsp: asm: Add check for num_channels before calling q6asm_map_channels" 2019-03-04 13:09:48 -08:00
Vatsal Bucha
e8629a0959 qdsp6v2: apr: check for packet size to header size comparison
Check if packet size is large enough to hold the header.

Change-Id: I7261f8111d8b5f4f7c181e469de248a732242d64
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
2019-03-03 22:36:36 -08:00
Rohit kumar
8c12285cf3 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>
2019-03-01 03:42:08 -08:00
Linux Build Service Account
7f8a8ced82 Merge "ion: fix system secure force alloc" 2019-02-18 23:49:18 -08:00
Linux Build Service Account
2c57e25f25 Merge "iommu: iommu-debug: don't pass null character to copy_to_user" 2019-02-18 05:12:49 -08:00
Vijayanand Jitta
42a7efc865 iommu: iommu-debug: don't pass null character to copy_to_user
Doing a cat on pte,test_virt_addr from adb shell prints a null
character as well which is at the end of the string this is not
required so, don't pass this null character to copy_to_user.

Change-Id: I8d9120f64d1df84a704379eb00bd239fc7059e9e
Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
2019-02-17 21:50:33 -08:00
Deepak Kumar Singh
3f49920e67 soc: qcom: Validate read and write index before calculating ptr
Currently we are not validating read and write index of
tx and rx fifo's before calculating ptr, this can lead to
out-of-bound access. The patch adds proper check for the same.

CR-Fixed: 2355425
Change-Id: I7b158e94ae743a90ac364783fe31914ca0fa582b
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2019-02-17 21:25:32 -08:00
Vikash Garodia
e18e27735c msm: vidc: Ensure validity of shared Q indices
Video driver and firmware communicates over shared queue.
The queue header has the indices which synchronizes the read
and write between the driver and firmware modules.
This change ensures that the indices are within the valid
range before accessing them.

CRs-fixed: 2345481
Change-Id: I8da6bb4218a5b8ec0e2e2c7b87f6cc9eec21bd16
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: Paras Nagda <pnagda@codeaurora.org>
Signed-off-by: Vasantha Balla <vballa@codeaurora.org>
2019-02-15 03:27:21 -08:00
Vinayak Menon
979cdd6f6e ion: fix system secure force alloc
Even when ION_FLAG_POOL_FORCE_ALLOC is set for secure alloc,
alloc_from_pool_preferred tries to get the pages from pool
first. In case if it enters split_page_from_secure_pool,
free_buffer_page can end up calling __free_pages on the page
from pool which is hyp assigned, resulting in issues for e.g.
a fault if page poisoning is enabled.

Change-Id: I68759dc17551a5705693506a5c137977d429fe36
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
2019-02-12 21:47:51 -08:00
Jann Horn
38f4fba64d mm/vmstat.c: fix outdated vmstat_text
7a9cdebdcc17 ("mm: get rid of vmacache_flush_all() entirely") removed the
VMACACHE_FULL_FLUSHES statistics, but didn't remove the corresponding
entry in vmstat_text.  This causes an out-of-bounds access in
vmstat_show().

Luckily this only affects kernels with CONFIG_DEBUG_VM_VMACACHE=y, which
is probably very rare.

Change-Id: Ia4f5f0327d58a7831aff010949fa31bfd56139dc
Link: http://lkml.kernel.org/r/20181001143138.95119-1-jannh@google.com
Fixes: 7a9cdebdcc17 ("mm: get rid of vmacache_flush_all() entirely")
Signed-off-by: Jann Horn <jannh@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Roman Gushchin <guro@fb.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Kemi Wang <kemi.wang@intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 28e2c4bb99aa40f9d5f07ac130cbc4da0ea93079
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
2019-02-10 21:55:41 -08:00
Linux Build Service Account
6fd3e4ce63 Merge "mm: get rid of vmacache_flush_all() entirely" 2019-02-08 11:43:33 -08:00
Linux Build Service Account
3e34840002 Merge "msm: vidc: fix KCFI errors" 2019-02-08 03:13:58 -08:00
Linus Torvalds
13fbdf9d9a mm: get rid of vmacache_flush_all() entirely
commit 7a9cdebdcc17e426fb5287e4a82db1dfe86339b2 upstream.

Jann Horn points out that the vmacache_flush_all() function is not only
potentially expensive, it's buggy too.  It also happens to be entirely
unnecessary, because the sequence number overflow case can be avoided by
simply making the sequence number be 64-bit.  That doesn't even grow the
data structures in question, because the other adjacent fields are
already 64-bit.

So simplify the whole thing by just making the sequence number overflow
case go away entirely, which gets rid of all the complications and makes
the code faster too.  Win-win.

[ Oleg Nesterov points out that the VMACACHE_FULL_FLUSHES statistics
  also just goes away entirely with this ]

Change-Id: Ib485c9f33638e844f2378a1ec376e64200d30fd2
Reported-by: Jann Horn <jannh@google.com>
Suggested-by: Will Deacon <will.deacon@arm.com>
Acked-by: Davidlohr Bueso <dave@stgolabs.net>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Git-commit: 84580567f1f856d2c7a610273315852e345bc3ac
Git-repo: https://android.googlesource.com/kernel/common/
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
2019-02-08 01:55:58 -08:00
Govindaraj Rajagopal
b6376f2b6d msm: vidc: fix KCFI errors
Fix errors reported after enabling Kernel Control Flow
Integrity (KCFI) on kernel code. This is a security
mechanism that disallows changes to the original
control flow of a compiled binary.

Change-Id: I1e1e901c5889d9928411dc785da88e1eac378560
Signed-off-by: Govindaraj Rajagopal <grajagop@codeaurora.org>
Signed-off-by: Sanjay Singh <sisanj@codeaurora.org>
2019-02-07 18:07:35 +05:30
Linux Build Service Account
45d0550497 Merge "msm: vidc: Add memory barrier after queue header update" 2019-02-06 23:03:58 -08:00
Sanjay Singh
2eae84f039 msm: vidc: Correct error handling for allocation failure cases
In error handling, trying to free memory which is not yet
allocated. Fix is added to correct this error handling.

Change-Id: I4e91a95f7ebd9132141d8686ae2bdfaed3a9a8c1
Signed-off-by: Sanjay Singh <sisanj@codeaurora.org>
Signed-off-by: Vasantha Balla <vballa@codeaurora.org>
2019-02-06 00:46:18 -08:00
Maheshwar Ajja
7fef9d4e2d msm: vidc: Add memory barrier after queue header update
Add memory barrier after updating queue header variables
to ensure main memory is updated so that video hardware
reads the updated header values.

CRs-Fixed: 2135048
Change-Id: I1a2778bee16c9093284c4d33980e6985c279f499
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: Sanjay Singh <sisanj@codeaurora.org>
2019-02-06 11:44:38 +05:30
Linux Build Service Account
8b4d96792a Merge "msm: vidc: ensure codec count is in supported session range" 2019-02-04 06:38:19 -08:00