All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 6/9] netfilter: nf_tables: fix unexpected EOPNOTSUPP error
Date: Wed,  6 Nov 2019 12:12:34 +0100	[thread overview]
Message-ID: <20191106111237.3183-7-pablo@netfilter.org> (raw)
In-Reply-To: <20191106111237.3183-1-pablo@netfilter.org>

From: Fernando Fernandez Mancera <ffmancera@riseup.net>

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>
---
 net/netfilter/nf_tables_api.c | 6 ++----
 1 file 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,
 	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);
 }
-- 
2.11.0


  parent reply	other threads:[~2019-11-06 11:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-06 11:12 [PATCH 0/9] Netfilter fixes for net Pablo Neira Ayuso
2019-11-06 11:12 ` [PATCH 1/9] netfilter: nf_tables_offload: check for register data length mismatches Pablo Neira Ayuso
2019-11-06 11:12 ` [PATCH 2/9] netfilter: ipset: Fix an error code in ip_set_sockfn_get() Pablo Neira Ayuso
2019-11-06 11:12 ` [PATCH 3/9] netfilter: ipset: Copy the right MAC address in hash:ip,mac IPv6 sets Pablo Neira Ayuso
2019-11-06 11:12 ` [PATCH 4/9] netfilter: ipset: Fix nla_policies to fully support NL_VALIDATE_STRICT Pablo Neira Ayuso
2019-11-06 11:12 ` [PATCH 5/9] netfilter: nf_tables: Align nft_expr private data to 64-bit Pablo Neira Ayuso
2019-11-06 11:12 ` Pablo Neira Ayuso [this message]
2019-11-06 11:12 ` [PATCH 7/9] bridge: ebtables: don't crash when using dnat target in output chains Pablo Neira Ayuso
2019-11-06 11:12 ` [PATCH 8/9] netfilter: nf_tables: bogus EOPNOTSUPP on basechain update Pablo Neira Ayuso
2019-11-06 11:12 ` [PATCH 9/9] netfilter: nf_tables_offload: skip EBUSY on chain update Pablo Neira Ayuso
2019-11-07  5:17 ` [PATCH 0/9] Netfilter fixes for net David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191106111237.3183-7-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.