aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJozsef Kadlecsik <kadlec@blackhole.kfki.hu>2012-05-06 22:35:44 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2012-05-16 18:56:41 -0400
commit127f559127f5175e4bec3dab725a34845d956591 (patch)
tree1fe965b02a8c54835caca7e88b0d8e28f9286127 /include
parent1a4ac9870fb82eed56623d0f69ec59aa5bef85fe (diff)
netfilter: ipset: fix timeout value overflow bug
Large timeout parameters could result wrong timeout values due to an overflow at msec to jiffies conversion (reported by Andreas Herz) [ This patch was mangled by Pablo Neira Ayuso since David Laight and Eric Dumazet noticed that we were using hardcoded 1000 instead of MSEC_PER_SEC to calculate the timeout ] Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netfilter/ipset/ip_set_timeout.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/netfilter/ipset/ip_set_timeout.h b/include/linux/netfilter/ipset/ip_set_timeout.h
index 47923205a4ad..41d9cfa08167 100644
--- a/include/linux/netfilter/ipset/ip_set_timeout.h
+++ b/include/linux/netfilter/ipset/ip_set_timeout.h
@@ -30,6 +30,10 @@ ip_set_timeout_uget(struct nlattr *tb)
30{ 30{
31 unsigned int timeout = ip_set_get_h32(tb); 31 unsigned int timeout = ip_set_get_h32(tb);
32 32
33 /* Normalize to fit into jiffies */
34 if (timeout > UINT_MAX/MSEC_PER_SEC)
35 timeout = UINT_MAX/MSEC_PER_SEC;
36
33 /* Userspace supplied TIMEOUT parameter: adjust crazy size */ 37 /* Userspace supplied TIMEOUT parameter: adjust crazy size */
34 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout; 38 return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
35} 39}