History

Merge branch 'master' of git://blackhole.kfki.hu/nf

Jozsef Kadlecsik says: ==================== ipset patches for nf Please apply the next patches for ipset in your nf branch. Both patches should go into the stable kernel branches as well, because these are important bugfixes: * Sometimes valid entries in hash:* types of sets were evicted due to a typo in an index. The wrong evictions happen when entries are deleted from the set and the bucket is shrinked. Bug was reported by Eric Ewanco and the patch fixes netfilter bugzilla id #1119. * Fixing of a null pointer exception when someone wants to add an entry to an empty list type of set and specifies an add before/after option. The fix is from Vishwanath Pai. ====================

Pablo Neira Ayuso committed 9 years ago

Commit 3ef767e2 parents 4eba8b7 40b446a2 files · +7 −4Browse files

Unified · Split

2 files
  1. net/netfilter/ipset/ip_set_hash_gen.h +1 −1
  2. net/netfilter/ipset/ip_set_list_set.c +6 −3
net/netfilter/ipset/ip_set_hash_gen.h+1−1
@@ -897,7 +897,7 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext, · 896 unmodified lines
897897 continue;
898898 data = ahash_data(n, j, dsize);
899899 memcpy(tmp->value + k * dsize, data, dsize);
900− set_bit(j, tmp->used);
900+ set_bit(k, tmp->used);
901901 k++;
902902 }
903903 tmp->pos = k;
net/netfilter/ipset/ip_set_list_set.c+6−3
@@ -260,11 +260,14 @@ list_set_uadd(struct ip_set *set, void *value, const struct ip_set_ext *ext, · 259 unmodified lines
260260 else
261261 prev = e;
262262 }
263+
264+ /* If before/after is used on an empty set */
265+ if ((d->before > 0 && !next) ||
266+ (d->before < 0 && !prev))
267+ return -IPSET_ERR_REF_EXIST;
268+
263269 /* Re-add already existing element */
264270 if (n) {
265− if ((d->before > 0 && !next) ||
266− (d->before < 0 && !prev))
267− return -IPSET_ERR_REF_EXIST;
268271 if (!flag_exist)
269272 return -IPSET_ERR_EXIST;
270273 /* Update extensions */