Commit Graph

196 Commits

Author SHA1 Message Date
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
Manoj Prabhu B 75b11c7f00 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>
2017-12-19 21:34:38 -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
Mohit Aggarwal 4f6f564042 diag: Fix possible usage of freed resource issue
Currently, there is a possibility of using already
freed memory while client reads from diag driver.
The patch adds proper protection to fix the issue.

CRs-Fixed: 2076623
Change-Id: Ic946865ac79f2684c06176be64fd2f3abc6048f7
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2017-11-12 23:21:49 -08:00
Mohit Aggarwal 07aaca4edb diag: Add protection while de-initializing clients
Currently, while de-initializing clients, there is
a possibility of using already freed memory. The
patch adds proper protection to fix the issue.

CRs-Fixed: 2068569
Change-Id: I4b397a82e03fa2f1c84cfa8ca912cdb6a51ba08b
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2017-11-08 05:22:05 -08: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
Mohit Aggarwal 415aaeffad diag: dci: Add protection while querying event status
Currently, protection is missing when querying event
status due to which already removed dci client entry
might be accessed. This patch takes care of issue by
taking proper locking.

CRs-Fixed: 2015892
Change-Id: I4195c4c6198d85e96559f1728d74419527a76bc5
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2017-08-21 03:12:44 -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
Linux Build Service Account 603f4b87cd Merge "diag: Add proper checks to fix possible out-of-bound issue" 2017-07-26 13:13:44 -07:00
Hardik Arya f202e4a9a5 diag: Add proper checks to fix possible out-of-bound issue
Currently, there is a possibility of out-of-bound access while
processing data received from user space. The patch adds proper
checks for valid address.

CRs-Fixed: 2048536
Change-Id: I1e0fc7a9d69e69f3326429d5d9540dd3bb1a59b0
Signed-off-by: Hardik Arya <harya@codeaurora.org>
2017-07-25 22:55:10 -07:00
Hardik Arya 54d9ba2b86 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-07-25 22:55:07 -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
Gopikrishna Mogasati c4de80bf39 diag: Add proper synchronization checks to msg mask table
This fix removes dependency between real time message mask
table and build time message mask table. Also this fix
synchronizes retrieval and modification of real time message
mask table.

CRs-Fixed: 2015227
Change-Id: Id0a0964337ec4645d7061fc35120dfa061a990ff
Signed-off-by: Gopikrishna Mogasati <gmogas@codeaurora.org>
2017-05-31 21:20:06 +05:30
LuK1337 fc9499e55a Import latest Samsung release
* Package version: T713XXU2BQCO

Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
2017-04-18 03:43:52 +02:00
Manoj Prabhu B bc3507bbb8 diag: Fix race condition while closing SMD
This patch initializes the control channel workqueues
before registering with SMD, close the SMD control channel
on receiving the feature mask from peripheral on socket channel
if the sockets are supported and reset the in_busy variable
for the buffer that reads the data from socket channel
when diag socket state is closed.
This patch also adds add mutex protection on receiving feature mask while closing
SMD and start reading from socket channel

CRs-Fixed: 1059771
Change-Id: Icdf27dce5b3eb7cfc4a7686f044195db13a81a58
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2016-10-21 15:34:15 +05:30
Manoj Prabhu B d77eb46756 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-06-16 02:50:29 -07:00
Manoj Prabhu B 2d9a2b9b0c diag: Fix for possible dci stale entries
This patch provides the protection to dci client
entries from corruption.

CRs-Fixed: 984942 992683
Change-Id: Ifcd9f14dc03d9e42a31b3e126839489881e98303
Signed-off-by: Manoj Prabhu B <bmanoj@codeaurora.org>
2016-04-12 20:43:08 -07:00
Mohit Aggarwal 75e07a5b89 diag: dci: Add protection while de-initializing clients
Currently, while de-initializing dci clients, there is
a possibility to access stale entries. This patch fixes
this issue by adding proper protection mechanism.

CRs-Fixed: 960958 968445
Change-Id: I829c9497eeb356662a6531592c66108e615ce6e4
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2016-04-11 02:53:44 -07:00
Katish Paran 21032abc7c diag: Rate limit the error logs
This patch rate limit few of the error logs to avoid flooding
of kernel logs.

Change-Id: I11843becf1d3ae97d5e433198ae27afd0237ed82
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-10-27 00:49:09 -07:00
Mohit Aggarwal 9130551c93 diag: Increase max client limit
Currently, diag allows maximum 30 clients which is
exhausted and new clients are not able to open handle
with diag. This patch fixes this issue.

Change-Id: I1d016b1ed21c51b9282abc032d55bd87c94c0d8c
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2015-09-21 10:21:19 -07:00
Katish Paran ded3822f90 diag: Mutex protect the deinitialization for diag clients
This patch mutex protect the deinitialization steps for diag
clients.

Change-Id: I13410b0b1382de7b026726a3736f397dee1092fa
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-08-27 08:16:02 -07:00
Sreelakshmi Gownipalli fa6505e5b1 diag: Cleanup client information on deinit Ioctl
Clean up the client pid information from the client table on
lsm_deinit Ioctl call.

Change-Id: Ia40a481b1be909c46371c0bb295db7baa30bdbc8
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2015-08-17 18:42:35 -07:00
Katish Paran 8a59a28abd diag: dci: Use ipc logging to log the messages
This patch uses ipc logging to log the error messages.

Change-Id: I386569f8b42ea905a940a7d1c04fb5a573f09604
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-08-08 01:07:22 -07:00
Sreelakshmi Gownipalli 6e146a91ae diag: Donot drop the data in memory device mode
Copy the data from buf table in diag_md_copy_to_user() if the
userspace buffer has space. If the data copy fails then drain
the data once the userpace buf is available instead of dropping
the data.

Change-Id: I6a24b13837ce7a07ea0d6bd2954b40a776c6ae0b
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2015-08-01 18:38:38 -07:00
Mohit Aggarwal b6c079c722 diag: Handle mode change commands properly
Currently, if APPS master table is having mode reset command
registration followed by other mode change commands then
APPS driver will not be able to forward mode change commands
to Modem. This patch fixes this issue.

Change-Id: I502e0a9a222d954c16b36df275585df39a84f970
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2015-07-31 02:51:02 -07:00
Katish Paran 23608b862c diag: Add padding to buffers while writing over to usb
Add padding to the buffers to avoid apf prefetch overrun.

Change-Id: I73df5f5d6b1924ea6dfabc3eaba233ef0f70d6cd
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-07-22 12:52:20 -07:00
Linux Build Service Account b99fe33af6 Merge "diag: Enable ipc logging for debugging" 2015-07-07 07:21:17 -07:00
Linux Build Service Account bec6c0a277 Merge "diag: Consider delayed responses while recording packet statistics" 2015-07-04 12:31:50 -07:00
Ravi Aravamudhan 9247fca7ae diag: Consider delayed responses while recording packet statistics
Diag driver was ignoring delayed response type packets while
recording packet allocation and drop statistics which results in
erroneous prints. This patch solves this issue.

Change-Id: I299f341a91c027c7cc5ee185b854ca5ad1bcc114
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-07-02 00:22:54 -07:00
Katish Paran 40d6da266c diag: Enable ipc logging for debugging
This patch enables ipc logging for diag.

Change-Id: Ia0c40e6938603ab4da7b44bc2dfb20757c52386a
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-07-01 14:25:09 +05:30
Ravi Aravamudhan efe1dadd32 diag: Make fixes in memory device mode
When there are multiple clients voting for memory device mode, diag
driver is incorrectly picking the client for draining data. Also,
memory device client that is currently receiving data won't receive
data when a new memory device client comes up. This patch addresses
these issues.

Change-Id: I6c2b3f46a1ade60c58db9c35b551f490268cfbee
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-06-30 10:38:42 -07:00
Katish Paran dda5bb4090 diag: Safeguard for bound checks and integer overflow
Bound checks are placed to avoid integer overflow.

Change-Id: I2b1a2a73d25cfe002493da3989243a8c544a9bc0
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-06-29 12:21:29 +05:30
Mohit Aggarwal 11d6e2860b diag: Add support for time sync command
This patch adds support for time sync command.
Also forwards the time sync control packet to all
the peripherals on receiving time sync switch command.

Change-Id: I5c42203bcf3cd830dbf937879b01d002c73c0c31
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2015-06-22 17:45:29 +05:30
Ravi Aravamudhan 7a00cbc0d3 diag: Handle command registration mutex correctly
On removing command registration entries from the registration table
diag driver was not handling the mutexes properly.

Change-Id: I2a15ac736fd665eafb50d40bcb255b911ac216b5
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-06-14 00:24:35 -07:00
Linux Build Service Account ed49e7e6c5 Merge "diag: Fix issues when memory-device mode closes" 2015-06-13 19:50:51 -07:00
Ravi Aravamudhan 52b12ebd3e diag: Fix issues when memory-device mode closes
Diag driver is not cleaning up the buffers properly when the logging
mode is switched from memory-device mode to USB mode. Changing the
clean up sequence solves this issue.

Change-Id: I3523748a79e37489c378393f578f54d0a44bd0b9
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-06-11 13:49:24 -07:00
Ravi Aravamudhan f5c5247f16 diag: Ratelimit error message on failure to write to remote processor
Diag driver is printing an error dmesg on failure to write to diagfwd
bridge. Change pr_err to pr_err_ratelimited to avoid flooding kernel
dmesg.

Change-Id: Iafe6e8270367ac27011b4e3935f67c2f97556e3f
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-06-10 17:37:25 -07:00
Linux Build Service Account 162f250eb6 Merge "diag: Add control packet support to indicate pd status" 2015-06-06 07:06:47 -07:00
Sreelakshmi Gownipalli f207dbeaba diag: Add control packet support to indicate pd status
Add control packet support to signal MEMORY_DEVICE application
when a pd comes up.

Change-Id: I7182dfbe60ee07d0ab2f7c87eb981816ba764e25
Signed-off-by: Sreelakshmi Gownipalli <sgownipa@codeaurora.org>
2015-06-04 12:53:28 -07:00
Katish Paran 5b3f5e71ab diag: Remove spinlock protection while releasing wake source
Currently, apps diag is holding a spinlock while releasing
wake source. This may lead to spinlock contention in case
multiple zero size packets are received over smd thus leading
to lockout. This patch removes the spinlock protection while
releasing wake source.

Change-Id: I73f2b6f584bfbc259cd534c59aedbacd4cc59381
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-06-04 17:41:54 +05:30
Katish Paran 1f744a2241 diag: Do not overwrite the earlier responses
If hdlc is disabled on apps, the buffer length is not being
properly increased. Thus the overwrite is happening with the new
responses. This patch fixes the issue.

Change-Id: I1dcbd666bdaab70eabf72547acf77c056cf345b1
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-05-27 19:31:38 -07:00
Katish Paran e67a17dbb5 diag: dci: Add mutex protection while accessing client details
Currently while extracting events and logs information from
the data read over peripherals, the clients details are accessed
without mutex protection. As the client access may happen from
multiple context, mutex protection is needed. This patch
resolves the same.

Change-Id: I9bd115e1cd9eebc625f4a68854d554ff874d866d
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-05-19 16:32:13 +05:30
Katish Paran 1866433583 diag: Enable hdlc encoding in case if logging mode changes
Currently hdlc encoding is not turned on by default in case if
the logging mode is changed from usb mode to memory device mode
or vice-versa. By design, the hdlc encoding must be turned on
after any logging switch. Also, stop any further reads over
peripherals until the time the mux layer is established.

Change-Id: I21f89771412e2da8ee0243f5f6bb24f917038300
Signed-off-by: Katish Paran <kparan@codeaurora.org>
2015-05-12 15:25:23 -07:00
Linux Build Service Account 2473dd7dc3 Merge "diag: Fix memory leak issue" 2015-05-06 11:37:57 -07:00
Mohit Aggarwal 49ed068d8d diag: Fix memory leak issue
Currently, diag driver is allocating memory for registration
table entries and not releasing that memory.

Change-Id: Ia4652b18ba7813d459801f4dd0a94ecc24dc40b4
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
2015-05-05 21:04:35 +05:30
Ravi Aravamudhan a78fabb8f0 diag: usb: Add support for partial writes over USB
Diag driver needs to support writing partial packets over USB to
remove any dependency on the controller properties. Make change
to write large buffers in chunks.

Change-Id: I9f70396adbe3dfb988ad65319442ede88fbc6896
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-05-04 17:58:08 -07:00
Ravi Aravamudhan 25fbececeb diag: Add support to communicate over Sockets
Diag on peripherals now support communication over IPC router
sockets. Add support on application processor to communicate with
the peripherals over sockets. This patch also maintains backwards
compatibility over SMD.

Change-Id: Id95d89e83a5532224594991c080c78747b510f74
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-05-04 17:58:02 -07:00
Ravi Aravamudhan 636ccf45ad diag: Separate SMD structures from Diag core logic
Diag SMD structures are embedded inside Diag core logic. This patch
modularizes operations performed over SMD, keeping it distinct from
other diag modules.

Change-Id: I6bd99b109da7b71d6310708312078d7334cc0f58
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-05-04 17:54:17 -07:00
Ravi Aravamudhan 135799223e diag: Generalize peripherals and channel types
Macros referring to different peripherals have the type of channel
in their name and the macros for channel types have the underlying
transport in their name. This patch renames the macros used in
Diag driver.

Change-Id: I0c98e7e4fde68716bf3491e143603618d1740dac
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-04-30 00:09:59 -07:00
Ravi Aravamudhan 42cc7b6748 diag: Separate feature mask into different structure
Peripheral features are embdedded in the diag core logic.
Refactor the code to separate the peripheral features into a
different structure.

Change-Id: I302d6523722d29e874337a032ea39df26d439d2e
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
2015-04-30 12:30:38 +05:30