diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-03-14 10:50:20 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-02 09:58:51 +0200 |
commit | ffc1d85e8c5f79d54597f3be294a287f5ceaa7a4 (patch) | |
tree | 95b6938b12401f584e82a57c45ecc400c5578e95 /net | |
parent | e313d5da057b2335b6f60aa70e9873a4f0f59d45 (diff) | |
download | linux-stable-ffc1d85e8c5f79d54597f3be294a287f5ceaa7a4.tar.gz linux-stable-ffc1d85e8c5f79d54597f3be294a287f5ceaa7a4.tar.bz2 linux-stable-ffc1d85e8c5f79d54597f3be294a287f5ceaa7a4.zip |
netfilter: nf_tables: bogus EBUSY in helper removal from transaction
[ Upstream commit 8ffcd32f64633926163cdd07a7d295c500a947d1 ]
Proper use counter updates when activating and deactivating the object,
otherwise, this hits bogus EBUSY error.
Fixes: cd5125d8f518 ("netfilter: nf_tables: split set destruction in deactivate and destroy phase")
Reported-by: Laura Garcia <nevola@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nft_objref.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/net/netfilter/nft_objref.c b/net/netfilter/nft_objref.c index d8737c115257..bf92a40dd1b2 100644 --- a/net/netfilter/nft_objref.c +++ b/net/netfilter/nft_objref.c @@ -64,21 +64,34 @@ nla_put_failure: return -1; } -static void nft_objref_destroy(const struct nft_ctx *ctx, - const struct nft_expr *expr) +static void nft_objref_deactivate(const struct nft_ctx *ctx, + const struct nft_expr *expr, + enum nft_trans_phase phase) { struct nft_object *obj = nft_objref_priv(expr); + if (phase == NFT_TRANS_COMMIT) + return; + obj->use--; } +static void nft_objref_activate(const struct nft_ctx *ctx, + const struct nft_expr *expr) +{ + struct nft_object *obj = nft_objref_priv(expr); + + obj->use++; +} + static struct nft_expr_type nft_objref_type; static const struct nft_expr_ops nft_objref_ops = { .type = &nft_objref_type, .size = NFT_EXPR_SIZE(sizeof(struct nft_object *)), .eval = nft_objref_eval, .init = nft_objref_init, - .destroy = nft_objref_destroy, + .activate = nft_objref_activate, + .deactivate = nft_objref_deactivate, .dump = nft_objref_dump, }; |