Commit graph

8 commits

Author SHA1 Message Date
Linux Build Service Account cad6f8bde0 Merge "msm: qmi: Fix decoding of multi-level nested structures" 2013-09-23 21:31:28 -07:00
Karthikeyan Ramasubramanian 9aab5245d0 msm: qmi: Fix decoding of multi-level nested structures
As per QMI message wire format, type and length information is added
only for elements in the main/outer structure. For elements within a
nested structure, there is no type and length information.

The kernel encode/decode library skips decoding multi-level
nested structures because of the missing length information.
Calculate the maximum message length of such structures through
their element information and complete the decode operation.

Change-Id: I92ed84d7da888ea6360950c288b7b6df7a79f53b
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2013-09-23 14:14:48 -06:00
Karthikeyan Ramasubramanian 6108f078ea msm: qmi: Update the skip_to_next_elem operation
skip_to_next_elem operates based on tlv_type and all elements in
nested structures have the same tlv_type. If the length of a variable
length array element in a nested structure is zero, then this operation
skips the entire nested structure instead of moving to the next element
in the nested structure.

Fix the skip_to_next_elem operation for nested structure by moving to
next element.

Change-Id: I95fbf436598f969aae5b850264b81ff817cb5d28
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2013-09-23 11:16:31 -06:00
Karthikeyan Ramasubramanian a42644f44d msm: qmi: Add support to encode and send zero length QMI messages
Currently when the clients try to send zero length QMI requests, QMI
encode/decode library returns an invalid error code.

Update the encode/decode library to check if a minimum message length
of a QMI message can be zero and enable sending such zero length QMI
messages.

Change-Id: Ifa0241107b67cc316d7ef4ba8e45bca21feb87da
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2013-09-04 17:22:11 -07:00
Karthikeyan Ramasubramanian 5554a12b7b lib: qmi: Add api to verify maximum length of a QMI message
The new API is added to verify the maximum length of a QMI message
embedded inside the message descriptor matches the expected maximum
length of the concerned QMI message. The expected maximum length of
the QMI message is calculated using the message descriptor which
describes all the elements in the structure.

Change-Id: I09602df410d9891d60f1502245ad055653f8f0f7
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2013-09-04 15:48:52 -07:00
Karthikeyan Ramasubramanian f9ad170878 lib: qmi: Add check to avoid out of bound memory access
If QMI clients pass an invalid maximum message length parameter, the
QMI message encode operation may perform an out of bound encode buffer
access.

Add a check in the QMI message encode operation to avoid out of bound
buffer access.

CRs-Fixed: 437329
Change-Id: I9d16078fade8160f327a8a77aea6c2a8e66b3127
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2013-09-04 15:48:18 -07:00
Karthikeyan Ramasubramanian 2b75c37b3c lib: qmi: Add logging to debug QMI Encode/Decode Library
Add logging macros to QMI Encode/Decode Library to enable debugging.
Add a kernel config to enable/disable the logging.

Change-Id: I9d8b44b2e75f281067161618f2a02a660c4d6812
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2013-09-04 15:37:41 -07:00
Karthikeyan Ramasubramanian 3c3d165990 lib: qmi: Introduce QMI Encode/Decode library
Introduce Encode/Decode Library to perform QMI message marshaling.
The QMI Encode/Decode Library encodes the kernel C data structures into
QMI wire format and decodes the messages in QMI wire format into kernel
C structures.

Change-Id: Ib443e697dafedeac8a790de9a3a8ed4a8444082f
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@codeaurora.org>
2013-09-04 15:34:45 -07:00