lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 20 Sep 2014 11:01:11 -0700 From: Joe Perches <joe@...ches.com> To: Eric Dumazet <eric.dumazet@...il.com> Cc: David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>, Neal Cardwell <ncardwell@...gle.com>, Yuchung Cheng <ycheng@...gle.com> Subject: Re: [PATCH net-next] tcp: avoid possible arithmetic overflows On Sat, 2014-09-20 at 10:19 -0700, Eric Dumazet wrote: > From: Eric Dumazet <edumazet@...gle.com> > > icsk_rto is an 32bit field, and icsk_backoff can reach 15 by default, > or more if some sysctl (eg tcp_retries2) are changed. > > Better use 64bit to perform icsk_rto << icsk_backoff operations Maybe better to use a helper function for this? something like: static inline u64 icsk_rto_backoff(const struct inet_connection_sock *icsk) { u64 when = (u64)icsk->icsk_rto; return when << icsk->icsk_backoff; } > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c [] > @@ -3208,9 +3208,12 @@ static void tcp_ack_probe(struct sock *sk) > * This function is not for random using! > */ > } else { > + unsigned long when; > + > + when = min((u64)icsk->icsk_rto << icsk->icsk_backoff, > + (u64)TCP_RTO_MAX); Maybe: u32 when = (u32)min_t(u64, icsk_rto_backoff(icsk), TCP_RTO_MAX); -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists