netfilter: xt_recent: check for unsupported user space flags
authorTim Gardner <tim.gardner@canonical.com>
Wed, 17 Mar 2010 15:18:56 +0000 (16:18 +0100)
committerPatrick McHardy <kaber@trash.net>
Wed, 17 Mar 2010 15:18:56 +0000 (16:18 +0100)
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
include/linux/netfilter/xt_recent.h
net/netfilter/xt_recent.c

index bba990ecb0188ab735e4fae17797a586eb16d6f5..83318e01425e74494f5c48fb25f83d015e522d01 100644 (file)
@@ -20,6 +20,9 @@ enum {
 /* Only allowed with --rcheck and --update */
 #define XT_RECENT_MODIFIERS (XT_RECENT_TTL|XT_RECENT_REAP)
 
+#define XT_RECENT_VALID_FLAGS (XT_RECENT_CHECK|XT_RECENT_SET|XT_RECENT_UPDATE|\
+                              XT_RECENT_REMOVE|XT_RECENT_TTL|XT_RECENT_REAP)
+
 struct xt_recent_mtinfo {
        __u32 seconds;
        __u32 hit_count;
index b65eca9e13a31ba08293be6f92c9fae620c78745..d2e7c80cd3c36ab8a939ada49ca873f9be61eefa 100644 (file)
@@ -319,6 +319,11 @@ static bool recent_mt_check(const struct xt_mtchk_param *par)
                get_random_bytes(&hash_rnd, sizeof(hash_rnd));
                hash_rnd_inited = true;
        }
+       if (info->check_set & ~XT_RECENT_VALID_FLAGS) {
+               pr_info(KBUILD_MODNAME ": Unsupported user space flags "
+                       "(%08x)\n", info->check_set);
+               return false;
+       }
        if (hweight8(info->check_set &
                     (XT_RECENT_SET | XT_RECENT_REMOVE |
                      XT_RECENT_CHECK | XT_RECENT_UPDATE)) != 1)