diff options
author | Alok Tiwari <alok.a.tiwari@oracle.com> | 2023-01-17 07:45:49 -0800 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-02-01 12:18:48 +0100 |
commit | dac7f50a45216d652887fb92d6cd3b7ca7f006ea (patch) | |
tree | ece611746850a7ba772efa5dc4bc386f74fc4b8c /net/netfilter | |
parent | dd25cfab16e6bff1bbd75b42b8334c4419c90a4f (diff) | |
download | linux-dac7f50a45216d652887fb92d6cd3b7ca7f006ea.tar.gz linux-dac7f50a45216d652887fb92d6cd3b7ca7f006ea.tar.bz2 linux-dac7f50a45216d652887fb92d6cd3b7ca7f006ea.zip |
netfilter: nf_tables: NULL pointer dereference in nf_tables_updobj()
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>
Diffstat (limited to 'net/netfilter')
-rw-r--r-- | net/netfilter/nf_tables_api.c | 3 |
1 files changed, 3 insertions, 0 deletions
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); |