summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorFernando Fernandez Mancera <ffmancera@riseup.net>2019-11-02 16:59:44 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2019-11-04 14:58:33 -0500
commit9fedd894b4e1c7ad5e5f711899f6a0a1da01d996 (patch)
treef7110b7271b6fb6a809ac0a3ebc75399db579af5 /net
parent250367c59e6ba0d79d702a059712d66edacd4a1a (diff)
netfilter: nf_tables: fix unexpected EOPNOTSUPP error
If the object type doesn't implement an update operation and the user tries to update it will silently ignore the update operation. Fixes: aa4095a156b5 ("netfilter: nf_tables: fix possible null-pointer dereference in object update") Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r--net/netfilter/nf_tables_api.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index d481f9baca2f..aa26841ad9a1 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -5143,9 +5143,6 @@ static int nf_tables_updobj(const struct nft_ctx *ctx,
5143 struct nft_trans *trans; 5143 struct nft_trans *trans;
5144 int err; 5144 int err;
5145 5145
5146 if (!obj->ops->update)
5147 return -EOPNOTSUPP;
5148
5149 trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ, 5146 trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ,
5150 sizeof(struct nft_trans_obj)); 5147 sizeof(struct nft_trans_obj));
5151 if (!trans) 5148 if (!trans)
@@ -6499,7 +6496,8 @@ static void nft_obj_commit_update(struct nft_trans *trans)
6499 obj = nft_trans_obj(trans); 6496 obj = nft_trans_obj(trans);
6500 newobj = nft_trans_obj_newobj(trans); 6497 newobj = nft_trans_obj_newobj(trans);
6501 6498
6502 obj->ops->update(obj, newobj); 6499 if (obj->ops->update)
6500 obj->ops->update(obj, newobj);
6503 6501
6504 kfree(newobj); 6502 kfree(newobj);
6505} 6503}