From: santosh.shilimkar@oracle.com Date: Fri, 6 Jan 2017 18:44:15 +0000 (-0800) Subject: RDS: validate the requested traces user input against max supported X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=780e982905bef61d13496d9af5310bf4af3a64d3;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git RDS: validate the requested traces user input against max supported Larger than supported value can lead to array read/write overflow. Reported-by: Colin Ian King Signed-off-by: Santosh Shilimkar Signed-off-by: David S. Miller --- diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c index fd8217404162..b405f77d664c 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) {