mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-08 21:22:09 -04:00
net: qrtr: haven: Add bounds check in rx path
Validate the values read from shared memory in the receive path. In the case where a VM is misbehaving, the qrtr haven transport should return immediately and print a warning. Change-Id: Ieccd3f99ec0cf321f136600760e7f66e125f765a Signed-off-by: Sarannya S <quic_sarannya@quicinc.com>
This commit is contained in:
parent
245ad69b23
commit
a97331a732
1 changed files with 3 additions and 0 deletions
|
|
@ -148,6 +148,9 @@ static void haven_rx_peak(struct haven_pipe *pipe, void *data,
|
|||
if (tail >= pipe->length)
|
||||
tail -= pipe->length;
|
||||
|
||||
if (WARN_ON_ONCE(tail > pipe->length))
|
||||
return;
|
||||
|
||||
len = min_t(size_t, count, pipe->length - tail);
|
||||
if (len)
|
||||
memcpy_fromio(data, pipe->fifo + tail, len);
|
||||
|
|
|
|||
Loading…
Reference in a new issue