Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27eb9f4b authored by Sarannya S's avatar Sarannya S
Browse files

net: qrtr: fifo: 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: I088f6cc77433dfcd099e5c117b9ca6408c40f09e
Signed-off-by: default avatarSarannya S <quic_sarannya@quicinc.com>
parent ed7a20b6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -82,6 +82,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);