mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
net: qrtr: 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 transport should return immediately and print a warning. Change-Id: Ibb20ddbebcffbdff904fc7041fd452b09e0c96af Signed-off-by: Sarannya S <quic_sarannya@quicinc.com>
This commit is contained in:
parent
875a0589dd
commit
c7bf3d5d15
@ -90,6 +90,9 @@ static void fifo_rx_peak(struct fifo_pipe *pipe,
|
||||
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…
x
Reference in New Issue
Block a user