mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 17:41:50 +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
|
@ -256,8 +256,7 @@ static void tcp_westwood_event(struct sock *sk, enum tcp_ca_event event)
|
|||
}
|
||||
|
||||
/* Extract info for Tcp socket info provided via netlink. */
|
||||
static void tcp_westwood_info(struct sock *sk, u32 ext,
|
||||
struct sk_buff *skb)
|
||||
static int tcp_westwood_info(struct sock *sk, u32 ext, struct sk_buff *skb)
|
||||
{
|
||||
const struct westwood *ca = inet_csk_ca(sk);
|
||||
|
||||
|
@ -268,8 +267,9 @@ static void tcp_westwood_info(struct sock *sk, u32 ext,
|
|||
.tcpv_minrtt = jiffies_to_usecs(ca->rtt_min),
|
||||
};
|
||||
|
||||
nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
|
||||
return nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct tcp_congestion_ops tcp_westwood __read_mostly = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue