This is a note to let you know that I've just added the patch titled

    netfilter: ipset: fix timeout value overflow bug

to the 3.4-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     netfilter-ipset-fix-timeout-value-overflow-bug.patch
and it can be found in the queue-3.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 127f559127f5175e4bec3dab725a34845d956591 Mon Sep 17 00:00:00 2001
From: Jozsef Kadlecsik <[email protected]>
Date: Mon, 7 May 2012 02:35:44 +0000
Subject: netfilter: ipset: fix timeout value overflow bug

From: Jozsef Kadlecsik <[email protected]>

commit 127f559127f5175e4bec3dab725a34845d956591 upstream.

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 <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Acked-by: David Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 include/linux/netfilter/ipset/ip_set_timeout.h |    4 ++++
 net/netfilter/xt_set.c                         |   15 +++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

--- 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)
 {
        unsigned int timeout = ip_set_get_h32(tb);
 
+       /* Normalize to fit into jiffies */
+       if (timeout > UINT_MAX/MSEC_PER_SEC)
+               timeout = UINT_MAX/MSEC_PER_SEC;
+
        /* Userspace supplied TIMEOUT parameter: adjust crazy size */
        return timeout == IPSET_NO_TIMEOUT ? IPSET_NO_TIMEOUT - 1 : timeout;
 }
--- a/net/netfilter/xt_set.c
+++ b/net/netfilter/xt_set.c
@@ -44,6 +44,14 @@ const struct ip_set_adt_opt n = {    \
        .cmdflags = cfs,                \
        .timeout = t,                   \
 }
+#define ADT_MOPT(n, f, d, fs, cfs, t)  \
+struct ip_set_adt_opt n = {            \
+       .family = f,                    \
+       .dim = d,                       \
+       .flags = fs,                    \
+       .cmdflags = cfs,                \
+       .timeout = t,                   \
+}
 
 /* Revision 0 interface: backward compatible with netfilter/iptables */
 
@@ -296,11 +304,14 @@ static unsigned int
 set_target_v2(struct sk_buff *skb, const struct xt_action_param *par)
 {
        const struct xt_set_info_target_v2 *info = par->targinfo;
-       ADT_OPT(add_opt, par->family, info->add_set.dim,
-               info->add_set.flags, info->flags, info->timeout);
+       ADT_MOPT(add_opt, par->family, info->add_set.dim,
+                info->add_set.flags, info->flags, info->timeout);
        ADT_OPT(del_opt, par->family, info->del_set.dim,
                info->del_set.flags, 0, UINT_MAX);
 
+       /* Normalize to fit into jiffies */
+       if (add_opt.timeout > UINT_MAX/MSEC_PER_SEC)
+               add_opt.timeout = UINT_MAX/MSEC_PER_SEC;
        if (info->add_set.index != IPSET_INVALID_ID)
                ip_set_add(info->add_set.index, skb, par, &add_opt);
        if (info->del_set.index != IPSET_INVALID_ID)


Patches currently in stable-queue which might be from [email protected] 
are

queue-3.4/netfilter-ipset-fix-timeout-value-overflow-bug.patch
queue-3.4/netfilter-ipset-timeout-fixing-bug-broke-set-target-special-timeout-value.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to