From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Alok Tiwari <alok.a.tiwari@oracle.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Sasha Levin <sashal@kernel.org>,
kadlec@netfilter.org, fw@strlen.de, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.15 22/36] netfilter: nf_tables: NULL pointer dereference in nf_tables_updobj()
Date: Sun, 26 Feb 2023 09:48:30 -0500 [thread overview]
Message-ID: <20230226144845.827893-22-sashal@kernel.org> (raw)
In-Reply-To: <20230226144845.827893-1-sashal@kernel.org>
From: Alok Tiwari <alok.a.tiwari@oracle.com>
[ Upstream commit dac7f50a45216d652887fb92d6cd3b7ca7f006ea ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.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 81bd13b3d8fd4..a02a25b7eae6d 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -6794,6 +6794,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.39.0
next prev parent reply other threads:[~2023-02-26 15:58 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-26 14:48 [PATCH AUTOSEL 5.15 01/36] wifi: ath9k: Fix use-after-free in ath9k_hif_usb_disconnect() Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 02/36] wifi: brcmfmac: Fix potential stack-out-of-bounds in brcmf_c_preinit_dcmds() Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 06/36] wifi: ath11k: debugfs: fix to work with multiple PCI devices Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 10/36] wifi: brcmfmac: ensure CLM version is null-terminated to prevent stack-out-of-bounds Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 11/36] wifi: mt7601u: fix an integer underflow Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 12/36] inet: fix fast path in __inet_hash_connect() Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 13/36] ice: restrict PTP HW clock freq adjustments to 100, 000, 000 PPB Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 14/36] ice: add missing checks for PF vsi type Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 19/36] netpoll: Remove 4s sleep during carrier detection Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 20/36] net: bcmgenet: Add a check for oversized packets Sasha Levin
2023-02-26 14:48 ` Sasha Levin [this message]
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 24/36] wifi: mt76: dma: free rx_head in mt76_dma_rx_cleanup Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 26/36] net/mlx5: fw_tracer: Fix debug print Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 34/36] hv_netvsc: Check status in SEND_RNDIS_PKT completion message Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 35/36] devlink: health: Fix nla_nest_end in error flow Sasha Levin
2023-02-26 14:48 ` [PATCH AUTOSEL 5.15 36/36] scm: add user copy checks to put_cmsg() Sasha Levin
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=20230226144845.827893-22-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=alok.a.tiwari@oracle.com \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=stable@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 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).