]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nftables: fix incorrect increment of loop counter
authorColin Ian King <colin.king@canonical.com>
Mon, 14 Dec 2020 23:40:15 +0000 (23:40 +0000)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 16 Dec 2020 10:02:10 +0000 (11:02 +0100)
commitde59852498f9e4c8d3cf94df703ee2f9afee8505
tree25822c88c579457de7dab4678a2cf8f0ae620e42
parentfc09518e8213357ea07d8523c6bb59b397c201a6
netfilter: nftables: fix incorrect increment of loop counter

The intention of the err_expr cleanup path is to iterate over the
allocated expr_array objects and free them, starting from i - 1 and
working down to the start of the array. Currently the loop counter
is being incremented instead of decremented and also the index i is
being used instead of k, repeatedly destroying the same expr_array
element.  Fix this by decrementing k and using k as the index into
expr_array.

Addresses-Coverity: ("Infinite loop")
Fixes: 5652d97caa02 ("netfilter: nftables: generalize set expressions support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c