Reading TCP stats when using TCP Illinois congestion control algorithm
can cause a divide by zero kernel oops.
The division by zero occur in tcp_illinois_info() at:
do_div(t, ca->cnt_rtt);
where ca->cnt_rtt can become zero (when rtt_reset is called)
Steps to Reproduce:
1. Register tcp_illinois:
# sysctl -w net.ipv4.tcp_congestion_control=illinois
2. Monitor internal TCP information via command "ss -i"
# watch -d ss -i
3. Establish new TCP conn to machine
Either it fails at the initial conn, or else it needs to wait
for a loss or a reset.
This is only related to reading stats. The function avg_delay() also
performs the same divide, but is guarded with a (ca->cnt_rtt > 0) at its
calling point in update_params(). Thus, simply fix tcp_illinois_info().
Function tcp_illinois_info() / get_info() is called without
socket lock. Thus, eliminate any race condition on ca->cnt_rtt
by using a local stack variable. Simply reuse info.tcpv_rttcnt,
as its already set to ca->cnt_rtt.
Function avg_delay() is not affected by this race condition, as
its called with the socket lock.
Cc: Petr Matousek <email address hidden>
Signed-off-by: Jesper Dangaard Brouer <email address hidden>
Acked-by: Eric Dumazet <email address hidden>
Acked-by: Stephen Hemminger <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit 8f363b77ee4fbf7c3bbcf5ec2c5ca482d396d664)
CVE-2012-4565
Signed-off-by: Luis Henriques <email address hidden>
Signed-off-by: Andy Whitcroft <email address hidden>
We need to validate the number of pages consumed by data_len, otherwise frags
array could be overflowed by userspace. So this patch validate data_len and
return -EMSGSIZE when data_len may occupies more frags than MAX_SKB_FRAGS.
Signed-off-by: Jason Wang <email address hidden>
Signed-off-by: David S. Miller <email address hidden>
(cherry picked from commit cc9b17ad29ecaa20bfe426a8d4dbfb94b13ff1cc)
Xen applied cleanly, but openvz required some back porting.
Signed-off-by: Tim Gardner <email address hidden>
Acked-by: Colin King <email address hidden>
Acked-by: Herton Krzesinski <email address hidden>