diff mbox series

[nf] netfilter: nf_tables: fix unexpected EOPNOTSUPP error

Message ID 20191102205944.22253-1-ffmancera@riseup.net
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nf] netfilter: nf_tables: fix unexpected EOPNOTSUPP error | expand

Commit Message

Fernando F. Mancera Nov. 2, 2019, 8:59 p.m. UTC
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>
---
 net/netfilter/nf_tables_api.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Pablo Neira Ayuso Nov. 4, 2019, 7:20 p.m. UTC | #1
On Sat, Nov 02, 2019 at 09:59:44PM +0100, Fernando Fernandez Mancera wrote:
> If the object type doesn't implement an update operation and the user tries to
> update it will silently ignore the update operation.

Applied, thanks.
diff mbox series

Patch

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,
 	struct nft_trans *trans;
 	int err;
 
-	if (!obj->ops->update)
-		return -EOPNOTSUPP;
-
 	trans = nft_trans_alloc(ctx, NFT_MSG_NEWOBJ,
 				sizeof(struct nft_trans_obj));
 	if (!trans)
@@ -6499,7 +6496,8 @@  static void nft_obj_commit_update(struct nft_trans *trans)
 	obj = nft_trans_obj(trans);
 	newobj = nft_trans_obj_newobj(trans);
 
-	obj->ops->update(obj, newobj);
+	if (obj->ops->update)
+		obj->ops->update(obj, newobj);
 
 	kfree(newobj);
 }