summaryrefslogtreecommitdiffstats
path: root/kernel/ip_set_bitmap_port.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/ip_set_bitmap_port.c')
-rw-r--r--kernel/ip_set_bitmap_port.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/kernel/ip_set_bitmap_port.c b/kernel/ip_set_bitmap_port.c
index fbd0aaf..3fb7c92 100644
--- a/kernel/ip_set_bitmap_port.c
+++ b/kernel/ip_set_bitmap_port.c
@@ -197,7 +197,7 @@ bitmap_port_head(struct ip_set *set, struct sk_buff *skb)
return 0;
nla_put_failure:
- return -EFAULT;
+ return -EMSGSIZE;
}
static int
@@ -211,7 +211,7 @@ bitmap_port_list(const struct ip_set *set,
atd = ipset_nest_start(skb, IPSET_ATTR_ADT);
if (!atd)
- return -EFAULT;
+ return -EMSGSIZE;
for (; cb->args[2] <= last; cb->args[2]++) {
id = cb->args[2];
if (!test_bit(id, map->members))
@@ -220,7 +220,7 @@ bitmap_port_list(const struct ip_set *set,
if (!nested) {
if (id == first) {
nla_nest_cancel(skb, atd);
- return -EFAULT;
+ return -EMSGSIZE;
} else
goto nla_put_failure;
}
@@ -237,6 +237,10 @@ bitmap_port_list(const struct ip_set *set,
nla_put_failure:
nla_nest_cancel(skb, nested);
ipset_nest_end(skb, atd);
+ if (unlikely(id == first)) {
+ cb->args[2] = 0;
+ return -EMSGSIZE;
+ }
return 0;
}
@@ -432,7 +436,7 @@ bitmap_port_timeout_head(struct ip_set *set, struct sk_buff *skb)
return 0;
nla_put_failure:
- return -EFAULT;
+ return -EMSGSIZE;
}
static int
@@ -447,7 +451,7 @@ bitmap_port_timeout_list(const struct ip_set *set,
adt = ipset_nest_start(skb, IPSET_ATTR_ADT);
if (!adt)
- return -EFAULT;
+ return -EMSGSIZE;
for (; cb->args[2] <= last; cb->args[2]++) {
id = cb->args[2];
if (!bitmap_port_timeout_test(map, id))
@@ -456,7 +460,7 @@ bitmap_port_timeout_list(const struct ip_set *set,
if (!nested) {
if (id == first) {
nla_nest_cancel(skb, adt);
- return -EFAULT;
+ return -EMSGSIZE;
} else
goto nla_put_failure;
}
@@ -476,6 +480,10 @@ bitmap_port_timeout_list(const struct ip_set *set,
nla_put_failure:
nla_nest_cancel(skb, nested);
ipset_nest_end(skb, adt);
+ if (unlikely(id == first)) {
+ cb->args[2] = 0;
+ return -EMSGSIZE;
+ }
return 0;
}