From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org,
pabeni@redhat.com, edumazet@google.com
Subject: [PATCH net-next 1/6] netfilter: nf_tables: NULL pointer dereference in nf_tables_updobj()
Date: Fri, 17 Feb 2023 13:29:52 +0100 [thread overview]
Message-ID: <20230217122957.799277-2-pablo@netfilter.org> (raw)
In-Reply-To: <20230217122957.799277-1-pablo@netfilter.org>
From: Alok Tiwari <alok.a.tiwari@oracle.com>
static analyzer detect null pointer dereference case for 'type'
function __nft_obj_type_get() can return NULL value which require to handle
if type is NULL pointer return -ENOENT.
This is a theoretical issue, since an existing object has a type, but
better add this failsafe check.
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
net/netfilter/nf_tables_api.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 974b95dece1d..2abf473c8f67 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -7023,6 +7023,9 @@ static int nf_tables_newobj(struct sk_buff *skb, const struct nfnl_info *info,
return -EOPNOTSUPP;
type = __nft_obj_type_get(objtype);
+ if (WARN_ON_ONCE(!type))
+ return -ENOENT;
+
nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla);
return nf_tables_updobj(&ctx, type, nla[NFTA_OBJ_DATA], obj);
--
2.30.2
next prev parent reply other threads:[~2023-02-17 12:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 12:29 [PATCH net-next 0/6] Netfilter/IPVS updates for net-next Pablo Neira Ayuso
2023-02-17 12:29 ` Pablo Neira Ayuso [this message]
2023-02-20 11:00 ` [PATCH net-next 1/6] netfilter: nf_tables: NULL pointer dereference in nf_tables_updobj() patchwork-bot+netdevbpf
2023-02-17 12:29 ` [PATCH net-next 2/6] netfilter: nf_tables: fix wrong pointer passed to PTR_ERR() Pablo Neira Ayuso
2023-02-17 12:29 ` [PATCH net-next 3/6] netfilter: conntrack: udp: fix seen-reply test Pablo Neira Ayuso
2023-02-17 12:29 ` [PATCH net-next 4/6] netfilter: conntrack: remote a return value of the 'seq_print_acct' function Pablo Neira Ayuso
2023-02-17 12:29 ` [PATCH net-next 5/6] ipvs: avoid kfree_rcu without 2nd arg Pablo Neira Ayuso
2023-02-17 12:29 ` [PATCH net-next 6/6] netfilter: let reset rules clean out conntrack entries Pablo Neira Ayuso
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=20230217122957.799277-2-pablo@netfilter.org \
--to=pablo@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).