If set resize requested try to remove expired entries on timeout enabled set first and retry adding element. Try this only once, of adding element fails again perform actual set resize. Fix expected behaviour by setting retried variable after resize routine is called, as setting this to true before calling resize will always ignore attempt to remove expired entries from the set. Signed-off-by: Sergey Popovich <popovich_sergei@xxxxxxx> --- net/netfilter/ipset/ip_set_core.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c index fb1f2b4..96e4f2f 100644 --- a/net/netfilter/ipset/ip_set_core.c +++ b/net/netfilter/ipset/ip_set_core.c @@ -1410,10 +1410,16 @@ call_ad(struct sock *ctnl, struct sk_buff *skb, struct ip_set *set, write_lock_bh(&set->lock); ret = set->variant->uadt(set, tb, adt, &lineno, flags, retried); write_unlock_bh(&set->lock); + + if (ret != -EAGAIN || !set->variant->resize) + break; + + ret = set->variant->resize(set, retried); + if (ret) + break; + retried = true; - } while (ret == -EAGAIN && - set->variant->resize && - (ret = set->variant->resize(set, retried)) == 0); + } while (1); if (!ret || (ret == -IPSET_ERR_EXIST && eexist)) return 0; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html