projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3a7b21e
)
netfilter: ipset: list:set: fix reference counter update
author
Jozsef Kadlecsik
<
[email protected]
>
Tue, 9 Apr 2013 08:57:19 +0000
(08:57 +0000)
committer
Pablo Neira Ayuso
<
[email protected]
>
Tue, 9 Apr 2013 19:02:11 +0000
(21:02 +0200)
The last element can be replaced or pushed off and in both
cases the reference counter must be updated.
Signed-off-by: Jozsef Kadlecsik <
[email protected]
>
Signed-off-by: Pablo Neira Ayuso <
[email protected]
>
net/netfilter/ipset/ip_set_list_set.c
patch
|
blob
|
history
diff --git
a/net/netfilter/ipset/ip_set_list_set.c
b/net/netfilter/ipset/ip_set_list_set.c
index 8371c2bac2e4240eb5c4b3f6abd0faa48f6212ce..09c744aa89829cb7f99878974ef2471364135f27 100644
(file)
--- a/
net/netfilter/ipset/ip_set_list_set.c
+++ b/
net/netfilter/ipset/ip_set_list_set.c
@@
-174,9
+174,13
@@
list_set_add(struct list_set *map, u32 i, ip_set_id_t id,
{
const struct set_elem *e = list_set_elem(map, i);
- if (i == map->size - 1 && e->id != IPSET_INVALID_ID)
- /* Last element replaced: e.g. add new,before,last */
- ip_set_put_byindex(e->id);
+ if (e->id != IPSET_INVALID_ID) {
+ const struct set_elem *x = list_set_elem(map, map->size - 1);
+
+ /* Last element replaced or pushed off */
+ if (x->id != IPSET_INVALID_ID)
+ ip_set_put_byindex(x->id);
+ }
if (with_timeout(map->timeout))
list_elem_tadd(map, i, id, ip_set_timeout_set(timeout));
else