[net-next][PATCH] RDS: validate the requested traces user input against max supported

Subsystems: networking [general], rds - reliable datagram sockets, the rest

2 messages, 2 authors, 2017-01-07 · open the first message on its own page

[net-next][PATCH] RDS: validate the requested traces user input against max supported

From: Santosh Shilimkar <hidden>
Date: 2017-01-06 18:44:33

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

Reported-by: Colin Ian King <redacted>
Signed-off-by: Santosh Shilimkar <redacted>
---
 net/rds/af_rds.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c
index fd821740..b405f77 100644
--- a/net/rds/af_rds.c
+++ b/net/rds/af_rds.c
@@ -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) {
-- 
1.9.1

Re: [net-next][PATCH] RDS: validate the requested traces user input against max supported

From: David Miller <davem@davemloft.net>
Date: 2017-01-07 03:14:57

From: Santosh Shilimkar <redacted>
Date: Fri,  6 Jan 2017 10:44:15 -0800
Larger than supported value can lead to array read/write overflow.

Reported-by: Colin Ian King <redacted>
Signed-off-by: Santosh Shilimkar <redacted>
Applied, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help