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

Commit 780e9829 authored by santosh.shilimkar@oracle.com's avatar santosh.shilimkar@oracle.com Committed by David S. Miller
Browse files

RDS: validate the requested traces user input against max supported



Larger than supported value can lead to array read/write overflow.

Reported-by: default avatarColin Ian King <colin.king@canonical.com>
Signed-off-by: default avatarSantosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1c966c5d
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -310,6 +310,9 @@ static int rds_recv_track_latency(struct rds_sock *rs, char __user *optval,
	if (copy_from_user(&trace, optval, sizeof(trace)))
		return -EFAULT;

	if (trace.rx_traces > RDS_MSG_RX_DGRAM_TRACE_MAX)
		return -EFAULT;

	rs->rs_rx_traces = trace.rx_traces;
	for (i = 0; i < rs->rs_rx_traces; i++) {
		if (trace.rx_trace_pos[i] > RDS_MSG_RX_DGRAM_TRACE_MAX) {