aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/nft_bitwise.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2017-05-15 11:17:34 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2017-05-15 12:51:41 +0200
commit591054469b3eef34bc097c30fae8ededddf8d796 (patch)
tree6dfcdd522ab793a3accec95ccda1bd57d5354639 /net/netfilter/nft_bitwise.c
parent71df14b0ce094be46d105b5a3ededd83b8e779a0 (diff)
downloadlinux-591054469b3eef34bc097c30fae8ededddf8d796.tar.gz
netfilter: nf_tables: revisit chain/object refcounting from elements
Andreas reports that the following incremental update using our commit protocol doesn't work. # nft -f incremental-update.nft delete element ip filter client_to_any { 10.180.86.22 : goto CIn_1 } delete chain ip filter CIn_1 ... Error: Could not process rule: Device or resource busy The existing code is not well-integrated into the commit phase protocol, since element deletions do not result in refcount decrement from the preparation phase. This results in bogus EBUSY errors like the one above. Two new functions come with this patch: * nft_set_elem_activate() function is used from the abort path, to restore the set element refcounting on objects that occurred from the preparation phase. * nft_set_elem_deactivate() that is called from nft_del_setelem() to decrement set element refcounting on objects from the preparation phase in the commit protocol. The nft_data_uninit() has been renamed to nft_data_release() since this function does not uninitialize any data store in the data register, instead just releases the references to objects. Moreover, a new function nft_data_hold() has been introduced to be used from nft_set_elem_activate(). Reported-by: Andreas Schultz <aschultz@tpip.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nft_bitwise.c')
-rw-r--r--net/netfilter/nft_bitwise.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/netfilter/nft_bitwise.c b/net/netfilter/nft_bitwise.c
index 96bd4f325b0f50..fff8073e2a5692 100644
--- a/net/netfilter/nft_bitwise.c
+++ b/net/netfilter/nft_bitwise.c
@@ -99,9 +99,9 @@ static int nft_bitwise_init(const struct nft_ctx *ctx,
return 0;
err2:
- nft_data_uninit(&priv->xor, d2.type);
+ nft_data_release(&priv->xor, d2.type);
err1:
- nft_data_uninit(&priv->mask, d1.type);
+ nft_data_release(&priv->mask, d1.type);
return err;
}