mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 07:12:09 +00:00
inet_diag: fix access to tcp cc information
Two different problems are fixed here : 1) inet_sk_diag_fill() might be called without socket lock held. icsk->icsk_ca_ops can change under us and module be unloaded. -> Access to freed memory. Fix this using rcu_read_lock() to prevent module unload. 2) Some TCP Congestion Control modules provide information but again this is not safe against icsk->icsk_ca_ops change and nla_put() errors were ignored. Some sockets could not get the additional info if skb was almost full. Fix this by returning a status from get_info() handlers and using rcu protection as well. Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Daniel Borkmann <daniel@iogearbox.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
fad9dfefea
commit
521f1cf1db
7 changed files with 36 additions and 18 deletions
|
@ -277,7 +277,7 @@ static void dctcp_cwnd_event(struct sock *sk, enum tcp_ca_event ev)
|
|||
}
|
||||
}
|
||||
|
||||
static void dctcp_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
|
||||
static int dctcp_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
|
||||
{
|
||||
const struct dctcp *ca = inet_csk_ca(sk);
|
||||
|
||||
|
@ -297,8 +297,9 @@ static void dctcp_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
|
|||
info.dctcp_ab_tot = ca->acked_bytes_total;
|
||||
}
|
||||
|
||||
nla_put(skb, INET_DIAG_DCTCPINFO, sizeof(info), &info);
|
||||
return nla_put(skb, INET_DIAG_DCTCPINFO, sizeof(info), &info);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct tcp_congestion_ops dctcp __read_mostly = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue