Commit graph

28 commits

Author SHA1 Message Date
Linux Build Service Account
0e545f94b2 Merge "diag: Check buffer size against command structure size" 2019-05-10 01:53:18 -07:00
Manoj Prabhu B
60e2d8fafa diag: Check buffer size against command structure size
Validate the buffer size against the parsing command structure size
before parsing to prevent possible out of bound error case.

CRs-Fixed: 2437341
Change-Id: I31c9a556539fce403691294a76160ae4936e7065
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2019-05-09 03:06:02 -07:00
Manoj Prabhu B
e2220d73ad diag: Validate command length against size of command structure
While processing a packet containing command request, buffer size
need to be checked against size of the command structures that is
being parsed to prevent possible out of bound access.

CRs-Fixed: 2432633
Change-Id: I048bdbd0c096a6d03501bdd5b1d2d4bb50d45dd6
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2019-05-08 23:30:06 -07:00
Manoj Prabhu B
cb6de0c08b diag: Set new context for peripheral error response
The patch sets new error context with TYPE_CMD for buf_num
context to add peripheral error responses on apps response
path to respective logging session and prevent buffer corruption.

Change-Id: I02c246d9a68a4f8e912d8693b3e4844c0e0b6885
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2018-06-22 21:40:44 +05:30
Manoj Prabhu B
43f15aca94 diag: Remove hdlc status dependeny on session_info
The patch removes the hdlc status dependency on session_info
protected by md_session_lock inserting delay in processing data
off peripheral.

CRs-Fixed: 2193991
Change-Id: Ia79c0efe82803c15ccae42b00d95258f52242eee
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2018-03-20 21:35:06 -07:00
Manoj Prabhu B
a2ad16a353 diag: Proper update of logging mode
The patch properly updates the logging mode after an user PD
on-device logging session is killed preventing a mutex deadlock
and thereby safe ODL session clearing.

CRs-Fixed: 2154183
Change-Id: I8451ed3869f5b75860684d5ef4119befd0cb2723
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2018-03-07 12:21:21 +05:30
Manoj Prabhu B
26f01d728e diag: Prevent unnecessary data ready counter update
The patch fixes unnecessary data ready counter update by
adding proper checks.

CRs-Fixed: 2180045
Change-Id: Iff34a9c6203324cd07964d69a1f525325b3a011b
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2018-02-15 13:32:53 +05:30
Sreelakshmi Gownipalli
29ab15b994 diag: Increment data ready only if it is first update
Increment data ready only if it is not incremented earlier.

Change-Id: Ia61e638bcf18e17dfe4bef15fc8ed4168b4c1891
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2018-02-14 23:18:40 -08:00
Hardik Arya
808955b188 diag: Fix possible use-after-free issue for mdlog session info
Currently there is a possibility of accessing freed mdlog
session info and it's attributes after closing the session.
The patch adds protection while accessing mdlog session info
for preventing use-after-free issue.

CRs-Fixed: 2133028
Change-Id: Iba603bc2d75f84a604df2627e8fcb2a18acf4637
Signed-off-by: Hardik Arya <harya@codeaurora.org>
2018-02-02 14:39:22 +05:30
Mohit Aggarwal
54129310d8 diag: Handle data ready notification properly
Currently, there is a possibility of nested sleep
during handling of data ready notification to diag
clients. The patch fixes the issue by properly
handling data ready notifications.

Change-Id: Ib30455b41d1b05bff33cc0a627c1fc7e9a1b7568
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2017-10-13 15:45:01 +05:30
Hardik Arya
7f2bebe85e diag: Flush mdlog table entries while reallocation of data buffer
Currently there is a possibility of accessing freed up buffer
address after reallocation due to availability of old address
in mdlog entry table. The patch flushes table entries before
reallocating data buffer. Additional case of entries cleanup
during erroneous buffer free avoiding further buffer corruption.

CRs-Fixed: 2063721
Change-Id: I8424598ad34b809414518a1f7f5b1737ebe51e53
Signed-off-by: Hardik Arya <harya@codeaurora.org>
2017-10-09 13:18:13 +05:30
Hardik Arya
c36e61af0f diag: Add protection while processing non-hdlc packets
Currently, there is possibility of out-of-bound accesses during
handling of data in non-hdlc path. The patch adds proper protection
when processing non-hdlc packet information to fix the issue.

CRs-Fixed: 2029216
Change-Id: I07c466f85bd8ac08226948fea86b1d8567e68431
Signed-off-by: Hardik Arya <harya@codeaurora.org>
2017-06-30 16:06:26 +05:30
Manoj Prabhu B
d8c5876fd7 diag: Add PD buffering mode configuration support
This patch extends support to configure buffering
modes for PD buffers by defining new control packets.

CRs-Fixed: 2019180
Change-Id: I5a72ff3ec7e5ab80a7461c3c3130e3b699e75522
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2017-05-10 11:36:21 +05:30
Manoj Prabhu B
dc5e63d935 diag: Split data stream for User PDs on LPASS
This patch segregates different PD data onto separate buffers
and then onto its own data stream.

CRs-Fixed: 2019189
Change-Id: I09c4e1a7da0ccd3ba3e025e9f13da0fbcb95f103
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2017-04-20 20:52:49 +05:30
Linux Build Service Account
1f51dfcea3 Merge "diag: Fix feature mask mismatch for peripherals" 2017-04-09 23:59:28 -07:00
Manoj Prabhu B
67d53d08d8 diag: Fix feature mask mismatch for peripherals
This patch adds a way to publish APPS support
of untagging header only to selected peripherals.

CRs-Fixed: 2030651
Change-Id: I2a2a03d0a6d441d23ec093ff5de9bef5e9799d24
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2017-04-09 20:34:46 +05:30
Mohit Aggarwal
8901694f22 diag: Set context properly while sending command responses
Currently, setting of context is not proper while sending
command responses due to which modem command response
buffer is getting corrupted leading to modem qshrink4
qdb file corruption. This patch fixes the issue by
setting the context properly.

CRs-Fixed: 2026664
Change-Id: I4bd2c23feaaf8a75a5a256d28377878519b507c6
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2017-04-05 12:40:05 +05:30
Manoj Prabhu B
db3fd8b4be diag: Add support for header untagging
This patch provides the support for segregate different PD data onto
separate buffers and then onto its own data stream based on received
diag private id header from the peripheral data packets.
This patch adds a new feature mask supporting the feature and
a new IOCTL querying the support of the feature.

CRs-Fixed: 1112307
Change-Id: Id76e718f83e09defc221f9ee169d4676d8e57d8a
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2017-03-25 22:02:40 +05:30
Chris Lew
cfd24cdcd6 diag: Add mdlog session to apps pkt response path
Apps pkt cmd response defaults to APPS_DATA peripheral.
Error response for mdlogging does not go to the right md
session. Pass md session along response path to ensure
correct destination.

Change-Id: Iece75fdb580a68350085bf48df374e60c2b4adb6
Signed-off-by: Chris Lew <clew@codeaurora.org>
2017-01-25 17:15:12 -08:00
Manoj Prabhu B
db1306a708 diag: Add sysfs parameter to control diag mask clear
This patch adds syfs parameter which controls clearing
of the peripheral masks upon USB disconnect and stopping
ODL.
This patch takes proper care for handling buffers
while clearing masks.

CRs-Fixed: 1081142
Change-Id: Ibe070661618258513d683bfec13ff10f23bee5d6
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2016-12-26 19:16:16 -08:00
Manoj Prabhu B
a9a910d7d0 diag: Fix possible access to freed variable
Mdlog structure member - hdlc timer is being accessed after
mdlog session is terminated.
This patch prevents the access to freed variable
by providing session_lock protection.

Change-Id: I1701e57fb4bbb751b76a4f24dc936ac22524e26c
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2016-11-22 20:22:39 -08:00
Manoj Prabhu B
9ce38e70a0 diag: Clear masks upon logging exit
This patch clears the peripheral masks upon the mdlog exit
and USB disconnection. This enables to keep the data and
cmd channel open for read.

CRs-Fixed: 1057143
Change-Id: Ie6f19319b75f3bf389ddd5a8168fd3bcd3efbc8b
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2016-09-08 23:56:37 -07:00
Sreelakshmi Gownipalli
59a61e7cc5 diag: Add diag over glink support
Add diag over glink support to communicate to WDSP.

Change-Id: I60cce19bd82030990a1267b81ed28c25ac8601ec
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2016-08-23 21:26:50 -07:00
Chris Lew
b1e748622f diag: Add support for multi connection logging
This change adds support to route On-Device logging and
USB logging traffic per peripheral. A peripherals'
traffic can go to either endpoint but not both. The
mux layer has a peripheral state and the mode switching
logic has multi mode support.

CRs-Fixed: 1004236
Change-Id: I54fef744bdf08a346e4aef22c1280e928cdaf5d2
Signed-off-by: Chris Lew <clew@codeaurora.org>
2016-06-24 15:07:20 -07:00
Manoj Prabhu B
34ef12d7fe diag: Fix possible kernel addresses leak
This patch addresses kernel addresses leak by changing
the format specifier to adhere to the kptr_restrict system setting.

CRs-Fixed: 987013
Change-Id: I32649a26f54d96c56d80aa2a1bd5f5d9dd0dd9d3
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2016-05-19 16:10:45 -07:00
Sreelakshmi Gownipalli
bed8615856 diag: Set the diag stm status correctly
While processing the diag stm mask stm state is set
incorrectly even though the ctrl packet is sent to peripheral
successfully.

Change-Id: I594f97ab824bf161b98fd5ac722ea96b985dbf9c
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2016-03-23 21:16:38 -07:00
Mohit Aggarwal
86e3a9baf2 diag: Rectify possible double free in memory device mode
Currently, there is a possibility of double freeing the
buffer in memory device mode. This patch protects the
buffer properly and also does the required cleanup once
buffer will be freed.

Change-Id: Ia016884bff4d41f2f8c59a547bd00a862c477e01
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2016-03-23 21:16:13 -07:00
Sreelakshmi Gownipalli
fc116784df diag: Add snap shot of diag driver
Add snap shot of diag driver

Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2016-03-23 19:58:26 -07:00