netfilter: ipset: Limit the maximal range of consecutive elements to add/delete

The range size of consecutive elements were not limited. Thus one could
define a huge range which may result soft lockup errors due to the long
execution time. Now the range size is limited to 2^20 entries.

Reported-by: Brad Spengler <spender@grsecurity.net>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
Jozsef Kadlecsik
2021-07-28 17:01:15 +02:00
committed by Pablo Neira Ayuso
parent c7d1022326
commit 5f7b51bf09
11 changed files with 88 additions and 7 deletions
+3
View File
@@ -196,6 +196,9 @@ struct ip_set_region {
u32 elements; /* Number of elements vs timeout */
};
/* Max range where every element is added/deleted in one step */
#define IPSET_MAX_RANGE (1<<20)
/* The max revision number supported by any set type + 1 */
#define IPSET_REVISION_MAX 9