Skip to contentSkip to conversation

netfilter: nft_inner: fix IS_ERR() vs NULL check

PATCH New Dan Carpenter 1 participant 1 message Nov 15, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: nft_inner: fix IS_ERR() vs NULL check

The __nft_expr_type_get() function returns NULL on error. It never returns error pointers.

Fixes 3a07327d10a0 ("netfilter: nft_inner: support for inner tunnel header matching")

---
This applies to net-next but presumably it's going to go through the netfilter tree?

 net/netfilter/nf_tables_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nf_tables_api.c +2 -2
index 62da204eed41..6b159494c86b 100644
@@ -2873,8 +2873,8 @@ int nft_expr_inner_parse(const struct nft_ctx *ctx, const struct nlattr *nla,
 		return -EINVAL;
 
 	type = __nft_expr_type_get(ctx->family, tb[NFTA_EXPR_NAME]);
-	if (IS_ERR(type))
-		return PTR_ERR(type);
+	if (!type)
+		return -ENOENT;
 
 	if (!type->inner_ops)
 		return -EOPNOTSUPP;
Signature · 1 line
2.35.1