diag: Fix Buffer Overflow in Diag Driver

At certain areas in the Diag driver, there is a possibility of
out of array buffer writes thereby overflowing the buffer.
This change fixes the buffer overflow issues.

Change-Id: I761b0e6cf71ed404b69bb73e88196bc30711b0f0
CRs-Fixed: 416755
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
diag: Fix Buffer Overflow during HDLC Encoding

Diag driver performs HDLC encoding on the input when an user space
program writes to the Diag node. This fix addresses a potential
buffer overflow during the encoding process.

Change-Id: I6b342027aff924ca7d9afcabda7ba147be9b4411
CRs-Fixed: 416757
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
diag: Add safeguards to prevent Integer Underflow and Memory Leak

At certain areas in the Diag driver, Integer overflow can occur.
Also, there is a possible memory leak in when a user space
program makes a ioctl call. This change fixes these issues.

Change-Id: I37e2b2d1f02983011a1db5f163354af4090f76f0
CRs-Fixed: 416995
CRs-Fixed: 416758
CRs-Fixed: 416953
Signed-off-by: Ravi Aravamudhan <aravamud@codeaurora.org>
diag: Fix race condition in diagchar driver

diag driver maintains socket logging process in global driver
structure which is manipulated in switch_logging and in close
file_operation.
There is a possibility of race while clearing the socket logging
process in close operation and sending signal in switch_logging
operation. Adding lock to serialize the two operations.

CRs-Fixed: 495063
Change-Id: I0064509c9ace18a8ff40c5a744363546a9021612
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
Merge "diag: Fix Buffer Overflow in Diag Driver"
Merge "diag: Fix Buffer Overflow during HDLC Encoding"
Merge "diag: Add safeguards to prevent Integer Underflow and Memory Leak"
Merge "diag: Fix race condition in diagchar driver"
diag: Fix possible underflow/overflow issues

Add check in order to fix possible integer underflow
during HDLC encoding which may lead to buffer
overflow. Also added check for packet length to
avoid buffer overflow.

Change-Id: I72858e7625764652571aee3154e3c2eb61655168
CRs-Fixed: 483400
CRs-Fixed: 483408
Signed-off-by: Mohit Aggarwal <maggarwa@codeaurora.org>
Merge "diag: Fix possible underflow/overflow issues"
Merge branch 'b2g/ics_strawberry' of git://codeaurora.org/kernel/msm into b2g/ics_strawberry